Skip to content
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

Use ServiceAccount for Workload Identity clientID and tenantId #1316

Open
dkirrane opened this issue Sep 27, 2023 · 7 comments
Open

Use ServiceAccount for Workload Identity clientID and tenantId #1316

dkirrane opened this issue Sep 27, 2023 · 7 comments
Labels
enhancement New feature or request

Comments

@dkirrane
Copy link

dkirrane commented Sep 27, 2023

Feature Request
Currently for Workload Identity the SecretProviderClass requires clientID and tenantId.
However this detail is already available from the application's ServiceAccount

apiVersion: v1
kind: ServiceAccount
metadata:
  name: my-app
  namespace: default
  labels:
    azure.workload.identity/use: 'true'
  annotations:
    azure.workload.identity/client-id: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    azure.workload.identity/tenant-id: ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
apiVersion: secrets-store.csi.x-k8s.io/v1
kind: SecretProviderClass
metadata:
  name: my-app
spec:
  provider: azure
  parameters:
    usePodIdentity: "false"
    clientID: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    keyvaultName: my-kv
    tenantId: ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ

Proposal

Instead can the SecretProviderClass just use the ServiceAccount for clientID and tenantId?
for example

apiVersion: secrets-store.csi.x-k8s.io/v1
kind: SecretProviderClass
metadata:
  name: my-app
spec:
  provider: azure
  parameters:
    usePodIdentity: "false"
    serviceAccountName: my-app
    keyvaultName: my-kv
@dkirrane dkirrane added the enhancement New feature or request label Sep 27, 2023
@rbtz-openai
Copy link

@aramase Can we bump the priority for this, or should we go through Azure Support to escalate?

@wenzel-felix
Copy link

#1443 I just opened this PR trying to adjust it similarly to your request.
Currently, it only takes care of the clientID, not the tenantID as the latter one is theoretically optional for the service account. I don't see it as big of an issue as the clientID, which potentially changes for every SPC. The tenantID is rather static.

@EPinci
Copy link

EPinci commented Nov 14, 2024

We would greatly benefit from this as well: the separate clientID has already caused issues in our workload.

@mo-martin
Copy link

This functionality would have prevented an outtage experienced with the dual clientID requirement, big thumbs up from me

@halabap
Copy link

halabap commented Nov 29, 2024

This would be great, we would like to avoid specifying the client id in the SecretProviderClass as we are autogenerating SeviceAccount manifests for worload identity, but SecretProviderClass is created by development teams and the need to set the same client ID second time in SecretProviderClass leads to mistakes.

@mo-martin
Copy link

@halabap if your team is using helm, then a viable and temporary work around is to use helms 'lookup' function. It allows you to query any applied metadata in the Kubernetes resources.

It's not better than just referencing a service account, and it does add some fragility to the secret provider, but it works!

@halabap
Copy link

halabap commented Nov 29, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants