You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
expectedErrMsg: "AZURE_CLIENT_SECRET env variable is set while workload identity is enabled using AZURE_FEDERATED_TOKEN_FILE env variable, this should never happen.\nPlease consider reporting a bug: https://issues.redhat.com",
164
+
expectedErrMsg: "azure_client_secret is set while workload identity is enabled using azure_federated_token_file, this should never happen.\nPlease consider reporting a bug: https://issues.redhat.com",
165
165
},
166
166
{
167
167
name: "should fail, tenant id missing while federated token file is present",
expectedErrMsg: "AZURE_TENANT_ID env variable should be set up while workload identity is enabled using AZURE_FEDERATED_TOKEN_FILE env variable, this should never happen.\nPlease consider reporting a bug: https://issues.redhat.com",
170
+
expectedErrMsg: "azure_tenant_id should be set up while workload identity is enabled using azure_federated_token_file, this should never happen.\nPlease consider reporting a bug: https://issues.redhat.com",
171
171
},
172
172
{
173
173
name: "should fail, workload identity can't be enabled because federated token missing, expect secret provided",
Copy file name to clipboardExpand all lines: cmd/azure-config-credentials-injector/main.go
+62-10Lines changed: 62 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -37,6 +37,7 @@ var (
37
37
outputFilePathstring
38
38
enableWorkloadIdentitystring
39
39
disableIdentityExtensionAuthbool
40
+
credentialsPathstring
40
41
}
41
42
)
42
43
@@ -47,6 +48,7 @@ func init() {
47
48
injectorCmd.PersistentFlags().StringVar(&injectorOpts.outputFilePath, "output-file-path", "/tmp/merged-cloud-config/cloud.conf", "Location of the generated cloud config file with injected credentials.")
48
49
injectorCmd.PersistentFlags().BoolVar(&injectorOpts.disableIdentityExtensionAuth, "disable-identity-extension-auth", false, "Disable managed identity authentication, if it's set in cloudConfig.")
returnfmt.Errorf("failed to read azure_federated_token_file from secret: %w", err)
122
+
}
123
+
} else {
124
+
federatedTokenFileFound=true
125
+
}
83
126
84
127
// If federatedTokenFile found, workload identity should be used
85
128
iffederatedTokenFileFound {
86
129
// azureClientSecret should not be set for workload identity auth, report error when secretFound
87
130
ifsecretFound {
88
-
returnfmt.Errorf("%s env variable is set while workload identity is enabled using %s env variable, this should never happen.\nPlease consider reporting a bug: https://issues.redhat.com", clientSecretEnvKey, federatedTokenEnvKey)
131
+
returnfmt.Errorf("azure_client_secret is set while workload identity is enabled using azure_federated_token_file, this should never happen.\nPlease consider reporting a bug: https://issues.redhat.com")
89
132
}
90
133
// tenantId is required for workload identity auth, report error when !tenantIdFound
91
134
if!tenantIdFound {
92
-
returnfmt.Errorf("%s env variable should be set up while workload identity is enabled using %s env variable, this should never happen.\nPlease consider reporting a bug: https://issues.redhat.com", tenantIDEnvKey, federatedTokenEnvKey)
135
+
returnfmt.Errorf("azure_tenant_id should be set up while workload identity is enabled using azure_federated_token_file, this should never happen.\nPlease consider reporting a bug: https://issues.redhat.com")
93
136
}
94
137
} else {
95
138
// federatedTokenFile not found, secret will be required
96
139
if!secretFound {
97
-
returnfmt.Errorf("%s env variable should be set up", clientSecretEnvKey)
140
+
returnfmt.Errorf("azure_client_secret should be set up")
0 commit comments