Skip to content

Commit 4beb491

Browse files
go.mod: bump msi-dataplane to v0.4.0 (#4095)
Signed-off-by: Steve Kuznetsov <[email protected]>
1 parent 3a0f4bd commit 4beb491

File tree

8 files changed

+36
-77
lines changed

8 files changed

+36
-77
lines changed

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ require (
2323
github.com/Azure/go-autorest/autorest/to v0.4.0
2424
github.com/Azure/go-autorest/autorest/validation v0.3.1
2525
github.com/Azure/go-autorest/tracing v0.6.0
26-
github.com/Azure/msi-dataplane v0.3.0
26+
github.com/Azure/msi-dataplane v0.4.0
2727
github.com/apparentlymart/go-cidr v1.1.0
2828
github.com/codahale/etm v0.0.0-20141003032925-c00c9e6fb4c9
2929
github.com/containers/image/v5 v5.31.0

go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ github.com/Azure/go-autorest/logger v0.2.1 h1:IG7i4p/mDa2Ce4TRyAO8IHnVhAVF3RFU+Z
6666
github.com/Azure/go-autorest/logger v0.2.1/go.mod h1:T9E3cAhj2VqvPOtCYAvby9aBXkZmbF5NWuPV8+WeEW8=
6767
github.com/Azure/go-autorest/tracing v0.6.0 h1:TYi4+3m5t6K48TGI9AUdb+IzbnSxvnvUMfuitfgcfuo=
6868
github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBpUA79WCAKPPZVC2DeU=
69-
github.com/Azure/msi-dataplane v0.3.0 h1:ng54QWSDGct4crZJ0Ea7Zt/ZbaQLO2s7yXicWRPyLP4=
70-
github.com/Azure/msi-dataplane v0.3.0/go.mod h1:y+euhWbc8/wgVM1hyJLQf4DnByegnwxAcDV0OKNM9+k=
69+
github.com/Azure/msi-dataplane v0.4.0 h1:lofdhX74IgMEvIe6cw8tdwr3zfZkdk77TXetFv0/By8=
70+
github.com/Azure/msi-dataplane v0.4.0/go.mod h1:y+euhWbc8/wgVM1hyJLQf4DnByegnwxAcDV0OKNM9+k=
7171
github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1 h1:WJTmL004Abzc5wDB5VtZG2PJk5ndYDgVacGqfirKxjM=
7272
github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1/go.mod h1:tCcJZ0uHAmvjsVYzEFivsRTN00oz5BEsRgQHu5JZ9WE=
7373
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU=

pkg/cluster/clustermsi.go

+1-6
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,6 @@ func (m *manager) initializeClusterMsiClients(ctx context.Context) error {
120120
return err
121121
}
122122

123-
cloud, err := m.env.Environment().CloudNameForMsiDataplane()
124-
if err != nil {
125-
return err
126-
}
127-
128123
msiResourceId, err := m.doc.OpenShiftCluster.ClusterMsiResourceId()
129124
if err != nil {
130125
return err
@@ -134,7 +129,7 @@ func (m *manager) initializeClusterMsiClients(ctx context.Context) error {
134129
for _, identity := range kvSecret.ExplicitIdentities {
135130
if identity.ResourceID != nil && strings.EqualFold(*identity.ResourceID, msiResourceId.String()) {
136131
var err error
137-
azureCred, err = dataplane.GetCredential(cloud, identity)
132+
azureCred, err = dataplane.GetCredential(m.env.Environment().AzureClientOptions(), identity)
138133
if err != nil {
139134
return fmt.Errorf("failed to get credential for msi identity %q: %v", msiResourceId, err)
140135
}

pkg/util/azureclient/environments.go

+11-25
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import (
1313
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
1414
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
1515
"github.com/Azure/go-autorest/autorest/azure"
16-
"github.com/Azure/msi-dataplane/pkg/dataplane"
1716

1817
"github.com/Azure/ARO-RP/pkg/util/azureclient/azuresdk/common"
1918
utilgraph "github.com/Azure/ARO-RP/pkg/util/graph"
@@ -120,43 +119,39 @@ func (e *AROEnvironment) ArmClientOptions(middlewares ...policy.Policy) *arm.Cli
120119
func (e *AROEnvironment) ClientCertificateCredentialOptions(additionalTenants []string) *azidentity.ClientCertificateCredentialOptions {
121120
return &azidentity.ClientCertificateCredentialOptions{
122121
AdditionallyAllowedTenants: additionalTenants,
123-
ClientOptions: azcore.ClientOptions{
124-
Cloud: e.Cloud,
125-
},
122+
ClientOptions: e.AzureClientOptions(),
126123
// Required for Subject Name/Issuer (SNI) authentication
127124
SendCertificateChain: true,
128125
}
129126
}
130127

131128
func (e *AROEnvironment) ClientSecretCredentialOptions() *azidentity.ClientSecretCredentialOptions {
132129
return &azidentity.ClientSecretCredentialOptions{
133-
ClientOptions: azcore.ClientOptions{
134-
Cloud: e.Cloud,
135-
},
130+
ClientOptions: e.AzureClientOptions(),
136131
}
137132
}
138133

139134
func (e *AROEnvironment) DefaultAzureCredentialOptions() *azidentity.DefaultAzureCredentialOptions {
140135
return &azidentity.DefaultAzureCredentialOptions{
141-
ClientOptions: azcore.ClientOptions{
142-
Cloud: e.Cloud,
143-
},
136+
ClientOptions: e.AzureClientOptions(),
144137
}
145138
}
146139

147140
func (e *AROEnvironment) EnvironmentCredentialOptions() *azidentity.EnvironmentCredentialOptions {
148141
return &azidentity.EnvironmentCredentialOptions{
149-
ClientOptions: azcore.ClientOptions{
150-
Cloud: e.Cloud,
151-
},
142+
ClientOptions: e.AzureClientOptions(),
152143
}
153144
}
154145

155146
func (e *AROEnvironment) ManagedIdentityCredentialOptions() *azidentity.ManagedIdentityCredentialOptions {
156147
return &azidentity.ManagedIdentityCredentialOptions{
157-
ClientOptions: azcore.ClientOptions{
158-
Cloud: e.Cloud,
159-
},
148+
ClientOptions: e.AzureClientOptions(),
149+
}
150+
}
151+
152+
func (e *AROEnvironment) AzureClientOptions() azcore.ClientOptions {
153+
return azcore.ClientOptions{
154+
Cloud: e.Cloud,
160155
}
161156
}
162157

@@ -173,12 +168,3 @@ func (e *AROEnvironment) NewGraphServiceClient(tokenCredential azcore.TokenCrede
173168

174169
return client, nil
175170
}
176-
177-
// CloudNameForMsiDataplane returns the cloud name to be passed in when instantiating
178-
// an MSI dataplane client or an error if it encounters an issue getting the correct
179-
// cloud name. This function might seem a little strange, but it's necessary because
180-
// the cloud names stored in the AROEnvironments are in all-caps, whereas the ones
181-
// defined as constants in the dataplane module are in camel case.
182-
func (e *AROEnvironment) CloudNameForMsiDataplane() (dataplane.AzureCloud, error) {
183-
return dataplane.AzureCloud(e.Name), nil
184-
}

vendor/github.com/Azure/msi-dataplane/pkg/dataplane/constants.go

-9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/Azure/msi-dataplane/pkg/dataplane/identity.go

+2-21
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/Azure/msi-dataplane/pkg/dataplane/reloadCredentials.go

+18-12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/modules.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ github.com/Azure/go-autorest/logger
138138
# github.com/Azure/go-autorest/tracing v0.6.0
139139
## explicit; go 1.12
140140
github.com/Azure/go-autorest/tracing
141-
# github.com/Azure/msi-dataplane v0.3.0
141+
# github.com/Azure/msi-dataplane v0.4.0
142142
## explicit; go 1.22
143143
github.com/Azure/msi-dataplane/pkg/dataplane
144144
github.com/Azure/msi-dataplane/pkg/dataplane/internal/challenge

0 commit comments

Comments
 (0)