This is a cache of https://docs.openshift.com/container-platform/4.10/cicd/gitops/configuring-sso-on-argo-cd-using-dex.html. It is a snapshot of the page at 2024-11-27T16:56:09.849+0000.
Configuring SSO for Argo CD using Dex - GitOps | CI/CD | OpenShift Container Platform 4.10
×

After the Red Hat OpenShift GitOps Operator is installed, Argo CD automatically creates a user with admin permissions. To manage multiple users, cluster administrators can use Argo CD to configure Single Sign-On (SSO).

The spec.dex parameter in the ArgoCD CR is deprecated. In a future release of Red Hat OpenShift GitOps v1.9, configuring Dex using the spec.dex parameter in the ArgoCD CR is planned to be removed. Consider using the .spec.sso parameter instead.

Enabling the Dex OpenShift OAuth Connector

Dex uses the users and groups defined within OpenShift by checking the OAuth server provided by the platform. The following example shows the properties of Dex along with example configurations:

apiVersion: argoproj.io/v1alpha1
kind: ArgoCD
metadata:
  name: example-argocd
  labels:
    example: openshift-oauth
spec:
  dex:
    openShiftOAuth: true (1)
    groups:(2)
     - default
  rbac:(3)
    defaultPolicy: 'role:readonly'
    policy: |
      g, cluster-admins, role:admin
    scopes: '[groups]'
1 The openShiftOAuth property triggers the Operator to automatically configure the built-in OpenShift OAuth server when the value is set to true.
2 The groups property allows users of the specified group(s) to log in.
3 The RBAC policy property assigns the admin role in the Argo CD cluster to users in the OpenShift cluster-admins group.

Mapping users to specific roles

Argo CD cannot map users to specific roles if they have a direct ClusterRoleBinding role. You can manually change the role as role:admin on SSO through OpenShift.

Procedure
  1. Create a group named cluster-admins.

    $ oc adm groups new cluster-admins
  2. Add the user to the group.

    $ oc adm groups add-users cluster-admins user
  3. Apply the cluster-admin ClusterRole to the group:

    $ oc adm policy add-cluster-role-to-group cluster-admin cluster-admins

Disabling Dex

Dex is installed by default for all the Argo CD instances created by the Operator. You can configure Red Hat OpenShift GitOps to use Dex as the SSO authentication provider by setting the .spec.dex parameter.

In Red Hat OpenShift GitOps v1.6.0, DISABLE_DEX is deprecated and is planned to be removed in Red Hat OpenShift GitOps v1.9.0. Consider using the .spec.sso.dex parameter instead. See "Enabling or disabling Dex using .spec.sso".

Procedure
  • Set the environmental variable DISABLE_DEX to true in the YAML resource of the Operator:

    ...
    spec:
      config:
        env:
        - name: DISABLE_DEX
          value: "true"
    ...

Enabling or disabling Dex using .spec.sso

You can configure Red Hat OpenShift GitOps to use Dex as its SSO authentication provider by setting the .spec.sso parameter.

Procedure
  1. To enable Dex, set the .spec.sso.provider: dex parameter in the YAML resource of the Operator:

    ...
    spec:
      sso:
        provider: dex
        dex:
          openShiftOAuth: true
    ...
  2. To disable dex, either remove the spec.sso element from the Argo CD custom resource, or specify a different SSO provider.