Skip to content

Conversation

@blakepettersson
Copy link
Member

@blakepettersson blakepettersson commented Jan 29, 2026

A proposal for acquiring temporary repository credentials using the tokenrequest api (or via spiffe if applicable).

Checklist:

  • Either (a) I've created an enhancement proposal and discussed it with the community, (b) this is a bug fix, or (c) this does not need to be in the release notes.
  • The title of the PR states what changed and the related issues number (used for the release note).
  • The title of the PR conforms to the Title of the PR
  • I've included "Closes [ISSUE #]" or "Fixes [ISSUE #]" in the description to automatically close the associated issue.
  • I've updated both the CLI and UI to expose my feature, or I plan to submit a second PR with them.
  • Does this PR require documentation updates?
  • I've updated documentation as required by this PR.
  • I have signed off all my commits as required by DCO
  • I have written unit and/or e2e tests for my change. PRs without these are unlikely to be merged.
  • My build is green (troubleshooting builds).
  • My new feature complies with the feature status guidelines.
  • I have added a brief description of why this PR is necessary and/or what this PR solves.
  • Optional. My organization is added to USERS.md.
  • Optional. For bug fixes, I've indicated what older releases this fix should be cherry-picked into (this may or may not happen depending on risk/complexity).

@bunnyshell
Copy link

bunnyshell bot commented Jan 29, 2026

🔴 Preview Environment stopped on Bunnyshell

See: Environment Details | Pipeline Logs

Available commands (reply to this comment):

  • 🔵 /bns:start to start the environment
  • 🚀 /bns:deploy to redeploy the environment
  • /bns:delete to remove the environment

@blakepettersson blakepettersson force-pushed the docs/workload-identity-v2 branch from d454057 to f0cddfb Compare January 29, 2026 13:15
A proposal for acquiring temporary repository credentials using the
tokenrequest api.

Signed-off-by: Blake Pettersson <[email protected]>
@blakepettersson blakepettersson force-pushed the docs/workload-identity-v2 branch from f0cddfb to 1e8955c Compare January 29, 2026 13:32
Signed-off-by: Blake Pettersson <[email protected]>
Signed-off-by: Blake Pettersson <[email protected]>
name: argocd-project-production
annotations:
azure.workload.identity/client-id: "client-id-uuid"
azure.workload.identity/tenant-id: "tenant-id-uuid"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't read all of it yet, but this is exactly what I'm trying to fix in #26030

It's not enough to set the tenant id here, because Workload Identity can only get one Identity from Entra Id. To make this more broadly applicable, we need the feature to be able to overwrite the tenant id per repository - both for Helm/OCI (Azure Container Registry) and for Git (Azure DevOps).

Copy link
Member Author

@blakepettersson blakepettersson Jan 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @lieberlois,

In this proposal you should be able to set a custom tenant id by setting a custom token url in the repo cred.

something like

apiVersion: v1
kind: Secret
metadata:
  name: my-ecr-repo
  labels:
    argocd.argoproj.io/secret-type: repository
stringData:
  type: oci
  url: oci://your-registry.azurecr.io/myrepository
  project: production
  workloadIdentityProvider: "azure"
  workloadIdentityTokenURL: "https://login.microsoftonline.com/your-custom-tenant-id/oauth2/v2.0/token"

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But it seems AKS not expose the Token directly, the token exchanging is managed by AKS and AAD. User use label `azure.workload.identity/use=true' to let AKS to write the cred back to the pod.
ref: https://azure.github.io/azure-workload-identity/docs/topics/service-account-labels-and-annotations.html

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wondering what @ninjadq is asking here too. I think what would happen is some argo process would:

  1. Get a token for the service account/api/v1/namespaces/argocd/serviceaccounts/argocd-project-production/token
  2. Exchange K8s JWT with Azure AD https://login.microsoftonline.com/{tenant}/oauth2/token
  3. Get the ACR token (simile to here)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, it should be added to service account and be read from there for overide.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link

@ninjadq ninjadq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The proposal looks great! It’s more comprehensive and scalable than current implementation

**Upgrade:**
- The `workloadIdentityProvider` field defaults to empty, so existing repositories continue to work unchanged
- Users opt-in to workload identity by setting `workloadIdentityProvider` to their desired provider
- No migration required for existing deployments
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Azure workload identity already used for some customer. It seems need some migration to the new proposal

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, I'll amend

name: argocd-project-production
annotations:
azure.workload.identity/client-id: "client-id-uuid"
azure.workload.identity/tenant-id: "tenant-id-uuid"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But it seems AKS not expose the Token directly, the token exchanging is managed by AKS and AAD. User use label `azure.workload.identity/use=true' to let AKS to write the cred back to the pod.
ref: https://azure.github.io/azure-workload-identity/docs/topics/service-account-labels-and-annotations.html

Signed-off-by: Blake Pettersson <[email protected]>
**Azure:**
```yaml
apiVersion: v1
kind: ServiceAccount
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@blakepettersson As this service account is not used as kubenetes object we are only using it to read the configurations for workload identity, these configurations can be added in the secrets for repo conffigurations?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jagpreetstamber my concern is having to need to add a bunch of cloud-specific fields to the repository spec itself. IMO having e.g tenantId and clientId are Azure-specific options and should be kept somewhere where we have the options to have more flexibility (i.e annotations). TBF we could have this as annotations on the repository itself, but that would also mean needing to duplicate those settings for all repositories needing to make use of it.

- ArgoCD stores registry credentials (username/password, tokens) in Kubernetes secrets
- These credentials are long-lived and must be manually rotated
- Credential leakage poses significant security risks
- The existing implementation of Workload Identity is in practice scoped on the whole repo-server, meaning that there
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we document a migration path and how we would support any backwards compatibility?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment @ninjadq left below but I didn't see theirs before I left mine. Feel free to resolve.

┌─────────────────────────────────────────────────────────────────────────────┐
│ Workload Identity Resolver │
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What component would be responsible for the token exchange?

#### Example 1: AWS ECR with Multi-Project Setup

```yaml
# Service Account for production project
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request generator also needs to be added in the scope of workload identity

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes good point, will check to see if this would require any changes (I don't think so, or it shouldn't be too extensive)


```yaml
# Service Account for production project
apiVersion: v1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Single Sign On Also needs to be added in the scope

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you expand on why this would be needed?

@blakepettersson
Copy link
Member Author

Here's the current WIP

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants