Repository navigation
feat: make the credentials Secret optional for workload identity #131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4212,6 +4212,85 @@ func TestIdentityType(t *testing.T) { | |
| }, | ||
| }, | ||
| }, | ||
| "AzureWorkloadIdentityCredentialsWithoutSecret": { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This case doesn't reach the identity provider: |
||
| reason: "The Function should not require the azure-creds Secret for Workload Identity, which the pod environment can provide entirely", | ||
| args: args{ | ||
| ctx: context.Background(), | ||
| req: &fnv1.RunFunctionRequest{ | ||
| Meta: &fnv1.RequestMeta{Tag: testRequestTag}, | ||
| Input: resource.MustStructJSON(`{ | ||
| "apiVersion": "msgraph.fn.crossplane.io/v1alpha1", | ||
| "kind": "Input", | ||
| "queryType": "GroupObjectIDs", | ||
| "groupsRef": "status.groups", | ||
| "target": "status.groupObjectIDs", | ||
| "identity": { | ||
| "type": "AzureWorkloadIdentityCredentials" | ||
| } | ||
| }`), | ||
| Observed: &fnv1.State{ | ||
| Composite: &fnv1.Resource{ | ||
| Resource: resource.MustStructJSON(xr), | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| want: want{ | ||
| rsp: &fnv1.RunFunctionResponse{ | ||
| Meta: &fnv1.ResponseMeta{Tag: testRequestTag, Ttl: durationpb.New(response.DefaultTTL)}, | ||
| Results: []*fnv1.Result{ | ||
| { | ||
| Severity: fnv1.Severity_SEVERITY_FATAL, | ||
| Message: `failed to initialize workload identity provider: failed to obtain workloadidentity credentials`, | ||
| Target: fnv1.Target_TARGET_COMPOSITE.Enum(), | ||
| }, | ||
| }, | ||
| Desired: &fnv1.State{ | ||
| Composite: &fnv1.Resource{ | ||
| Resource: resource.MustStructJSON(xr), | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| "AzureServicePrincipalCredentialsWithoutSecret": { | ||
| reason: "The Function should still require the azure-creds Secret for service principal credentials", | ||
| args: args{ | ||
| ctx: context.Background(), | ||
| req: &fnv1.RunFunctionRequest{ | ||
| Meta: &fnv1.RequestMeta{Tag: testRequestTag}, | ||
| Input: resource.MustStructJSON(`{ | ||
| "apiVersion": "msgraph.fn.crossplane.io/v1alpha1", | ||
| "kind": "Input", | ||
| "queryType": "GroupObjectIDs", | ||
| "groupsRef": "status.groups", | ||
| "target": "status.groupObjectIDs" | ||
| }`), | ||
| Observed: &fnv1.State{ | ||
| Composite: &fnv1.Resource{ | ||
| Resource: resource.MustStructJSON(xr), | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| want: want{ | ||
| rsp: &fnv1.RunFunctionResponse{ | ||
| Meta: &fnv1.ResponseMeta{Tag: testRequestTag, Ttl: durationpb.New(response.DefaultTTL)}, | ||
| Results: []*fnv1.Result{ | ||
| { | ||
| Severity: fnv1.Severity_SEVERITY_FATAL, | ||
| Message: `failed to get azure-creds credentials`, | ||
| Target: fnv1.Target_TARGET_COMPOSITE.Enum(), | ||
| }, | ||
| }, | ||
| Desired: &fnv1.State{ | ||
| Composite: &fnv1.Resource{ | ||
| Resource: resource.MustStructJSON(xr), | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| "AzureWorkloadIdentityCredentials": { | ||
| reason: "The Function should use Workload Identity credentials if identity.type is AzureWorkloadIdentityCredentials", | ||
| args: args{ | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that the DRC no longer mounts
/var/run/secrets/azure/tokens, thisfederatedTokenFileonly resolves on webhook versions before v1.6.0 (which moved the token), and a set key overridesAZURE_FEDERATED_TOKEN_FILE.Please drop this line and the trailing comma on
tenantId.Optional, since it predates this PR: the
#notes make the JSON invalid, so moving them out of the block would make it copy-pasteable.