Skip to content

Commit abb7b22

Browse files
authored
[release-1.31] chore: Downgrade MSAL from v1.5.0 to v1.4.2, together with other depe… (#9608)
* chore: Downgrade MSAL from v1.5.0 to v1.4.2, together with other dependencies * fix: Consider ipv6 single stack case when checking pip name and pip prefix id
1 parent 4e9b118 commit abb7b22

File tree

9 files changed

+81
-67
lines changed

9 files changed

+81
-67
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ require (
7272
github.com/Azure/go-autorest/autorest/validation v0.3.1 // indirect
7373
github.com/Azure/go-autorest/logger v0.2.1 // indirect
7474
github.com/Azure/msi-dataplane v0.4.3 // indirect
75-
github.com/AzureAD/microsoft-authentication-library-for-go v1.5.0 // indirect
75+
github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2 // indirect
7676
github.com/NYTimes/gziphandler v1.1.1 // indirect
7777
github.com/antlr4-go/antlr/v4 v4.13.1 // indirect
7878
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ github.com/Azure/msi-dataplane v0.4.3 h1:dWPWzY4b54tLIR9T1Q014Xxd/1DxOsMIp6EjRFA
7878
github.com/Azure/msi-dataplane v0.4.3/go.mod h1:yAfxdJyvcnvSDfSyOFV9qm4fReEQDl+nZLGeH2ZWSmw=
7979
github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1 h1:WJTmL004Abzc5wDB5VtZG2PJk5ndYDgVacGqfirKxjM=
8080
github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1/go.mod h1:tCcJZ0uHAmvjsVYzEFivsRTN00oz5BEsRgQHu5JZ9WE=
81-
github.com/AzureAD/microsoft-authentication-library-for-go v1.5.0 h1:XkkQbfMyuH2jTSjQjSoihryI8GINRcs4xp8lNawg0FI=
82-
github.com/AzureAD/microsoft-authentication-library-for-go v1.5.0/go.mod h1:HKpQxkWaGLJ+D/5H8QRpyQXA1eKjxkFlOMwck5+33Jk=
81+
github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2 h1:oygO0locgZJe7PpYPXT5A29ZkwJaPqcva7BVeemZOZs=
82+
github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI=
8383
github.com/NYTimes/gziphandler v1.1.1 h1:ZUDjpQae29j0ryrS0u/B8HZfJBtBQHjqw2rQ2cqUQ3I=
8484
github.com/NYTimes/gziphandler v1.1.1/go.mod h1:n/CVRwUEOgIxrgPvAQhUUr9oeUtvrhMomdKFjzJNB0c=
8585
github.com/antlr4-go/antlr/v4 v4.13.1 h1:SqQKkuVZ+zWkMMNkjy5FZe5mr5WURWnlpmOuzYWrPrQ=

pkg/provider/azure_loadbalancer_test.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2458,6 +2458,8 @@ func TestDeterminePublicIPName(t *testing.T) {
24582458
expectedPIPName string
24592459
expectedError bool
24602460
isIPv6 bool
2461+
serviceIPv6 bool
2462+
annotations map[string]string
24612463
}{
24622464
{
24632465
desc: "determinePublicIpName shall get public IP from az.getPublicIPName if no specific " +
@@ -2486,12 +2488,22 @@ func TestDeterminePublicIPName(t *testing.T) {
24862488
expectedPIPName: "pipName",
24872489
expectedError: false,
24882490
},
2491+
{
2492+
desc: "determinePublicIpName shall use IPv6 pip annotation for IPv6 single stack service",
2493+
annotations: map[string]string{
2494+
consts.ServiceAnnotationPIPNameDualStack[true]: "service-lb-public-IP3dbe-v6",
2495+
},
2496+
expectedPIPName: "service-lb-public-IP3dbe-v6",
2497+
isIPv6: true,
2498+
serviceIPv6: true,
2499+
expectedError: false,
2500+
},
24892501
}
24902502

24912503
for _, test := range testCases {
24922504
t.Run(test.desc, func(t *testing.T) {
24932505
az := GetTestCloud(ctrl)
2494-
service := getTestService("test1", v1.ProtocolTCP, nil, false, 80)
2506+
service := getTestService("test1", v1.ProtocolTCP, test.annotations, test.serviceIPv6, 80)
24952507
setServiceLoadBalancerIP(&service, test.loadBalancerIP)
24962508

24972509
mockPIPsClient := az.PublicIPAddressesClient.(*mockpublicipclient.MockInterface)

pkg/provider/azure_utils.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,12 @@ func getServicePIPName(service *v1.Service, isIPv6 bool) string {
391391
}
392392

393393
if !isServiceDualStack(service) {
394+
v4Enabled, v6Enabled := getIPFamiliesEnabled(service)
395+
if isIPv6 && v6Enabled && !v4Enabled {
396+
if name := service.Annotations[consts.ServiceAnnotationPIPNameDualStack[true]]; name != "" {
397+
return name
398+
}
399+
}
394400
return service.Annotations[consts.ServiceAnnotationPIPNameDualStack[false]]
395401
}
396402

@@ -411,6 +417,12 @@ func getServicePIPPrefixID(service *v1.Service, isIPv6 bool) string {
411417
}
412418

413419
if !isServiceDualStack(service) {
420+
v4Enabled, v6Enabled := getIPFamiliesEnabled(service)
421+
if isIPv6 && v6Enabled && !v4Enabled {
422+
if id := service.Annotations[consts.ServiceAnnotationPIPPrefixIDDualStack[true]]; id != "" {
423+
return id
424+
}
425+
}
414426
return service.Annotations[consts.ServiceAnnotationPIPPrefixIDDualStack[false]]
415427
}
416428

pkg/provider/azure_utils_test.go

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -798,7 +798,7 @@ func TestGetServicePIPName(t *testing.T) {
798798
&v1.Service{
799799
ObjectMeta: metav1.ObjectMeta{
800800
Annotations: map[string]string{
801-
consts.ServiceAnnotationPIPNameDualStack[false]: "pip-name-ipv6",
801+
consts.ServiceAnnotationPIPNameDualStack[true]: "pip-name-ipv6",
802802
},
803803
},
804804
Spec: v1.ServiceSpec{
@@ -840,6 +840,21 @@ func TestGetServicePIPName(t *testing.T) {
840840
true,
841841
"pip-name-ipv6",
842842
},
843+
{
844+
"From ServiceAnnotationPIPName IPv6 single stack fallback",
845+
&v1.Service{
846+
ObjectMeta: metav1.ObjectMeta{
847+
Annotations: map[string]string{
848+
consts.ServiceAnnotationPIPNameDualStack[false]: "pip-name-ipv6",
849+
},
850+
},
851+
Spec: v1.ServiceSpec{
852+
IPFamilies: []v1.IPFamily{v1.IPv6Protocol},
853+
},
854+
},
855+
true,
856+
"pip-name-ipv6",
857+
},
843858
}
844859
for _, tc := range testcases {
845860
t.Run(tc.desc, func(t *testing.T) {
@@ -876,7 +891,7 @@ func TestGetServicePIPPrefixID(t *testing.T) {
876891
&v1.Service{
877892
ObjectMeta: metav1.ObjectMeta{
878893
Annotations: map[string]string{
879-
consts.ServiceAnnotationPIPPrefixIDDualStack[false]: "pip-prefix-id-ipv6",
894+
consts.ServiceAnnotationPIPPrefixIDDualStack[true]: "pip-prefix-id-ipv6",
880895
},
881896
},
882897
Spec: v1.ServiceSpec{
@@ -918,6 +933,21 @@ func TestGetServicePIPPrefixID(t *testing.T) {
918933
true,
919934
"pip-prefix-id-ipv6",
920935
},
936+
{
937+
"From ServiceAnnotationPIPPrefixIDDualStack IPv6 single stack fallback",
938+
&v1.Service{
939+
ObjectMeta: metav1.ObjectMeta{
940+
Annotations: map[string]string{
941+
consts.ServiceAnnotationPIPPrefixIDDualStack[false]: "pip-prefix-id-ipv6",
942+
},
943+
},
944+
Spec: v1.ServiceSpec{
945+
IPFamilies: []v1.IPFamily{v1.IPv6Protocol},
946+
},
947+
},
948+
true,
949+
"pip-prefix-id-ipv6",
950+
},
921951
}
922952
for _, tc := range testcases {
923953
t.Run(tc.desc, func(t *testing.T) {
@@ -927,6 +957,22 @@ func TestGetServicePIPPrefixID(t *testing.T) {
927957
}
928958
}
929959

960+
func TestGetServicePIPNames(t *testing.T) {
961+
svc := &v1.Service{
962+
ObjectMeta: metav1.ObjectMeta{
963+
Annotations: map[string]string{
964+
consts.ServiceAnnotationPIPNameDualStack[true]: "pip-name-ipv6",
965+
},
966+
},
967+
Spec: v1.ServiceSpec{
968+
IPFamilies: []v1.IPFamily{v1.IPv6Protocol},
969+
},
970+
}
971+
972+
names := getServicePIPNames(svc)
973+
assert.Equal(t, []string{"", "pip-name-ipv6"}, names)
974+
}
975+
930976
func TestGetResourceByIPFamily(t *testing.T) {
931977
testcases := []struct {
932978
desc string

vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/local/server.go

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/authority/authority.go

Lines changed: 1 addition & 40 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/resolvers.go

Lines changed: 2 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/modules.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ github.com/Azure/go-autorest/tracing
162162
github.com/Azure/msi-dataplane/pkg/dataplane
163163
github.com/Azure/msi-dataplane/pkg/dataplane/internal/challenge
164164
github.com/Azure/msi-dataplane/pkg/dataplane/internal/client
165-
# github.com/AzureAD/microsoft-authentication-library-for-go v1.5.0
165+
# github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2
166166
## explicit; go 1.18
167167
github.com/AzureAD/microsoft-authentication-library-for-go/apps/cache
168168
github.com/AzureAD/microsoft-authentication-library-for-go/apps/confidential

0 commit comments

Comments
 (0)