github.com/argoproj/argo-cd/v3@v3.2.1/docs/operator-manual/declarative-setup.md (about)

     1  # Declarative Setup
     2  
     3  Argo CD applications, projects and settings can be defined declaratively using Kubernetes manifests. These can be updated using `kubectl apply`, without needing to touch the `argocd` command-line tool.
     4  
     5  ## Quick Reference
     6  
     7  All resources, including `Application` and `AppProject` specs, have to be installed in the Argo CD namespace (by default `argocd`).
     8  
     9  ### Atomic configuration
    10  
    11  | Sample File                                                           | Resource Name                                                                      | Kind      | Description                                                                          |
    12  |-----------------------------------------------------------------------|------------------------------------------------------------------------------------|-----------|--------------------------------------------------------------------------------------|
    13  | [`argocd-cm.yaml`](argocd-cm-yaml.md)                                 | argocd-cm                                                                          | ConfigMap | General Argo CD configuration                                                        |
    14  | [`argocd-repositories.yaml`](argocd-repositories-yaml.md)             | my-private-repo / istio-helm-repo / private-helm-repo / private-repo               | Secrets   | Sample repository connection details                                                 |
    15  | [`argocd-repo-creds.yaml`](argocd-repo-creds-yaml.md)                    | argoproj-https-creds / argoproj-ssh-creds / github-creds / github-enterprise-creds | Secrets   | Sample repository credential templates                                               |
    16  | [`argocd-cmd-params-cm.yaml`](argocd-cmd-params-cm-yaml.md)           | argocd-cmd-params-cm                                                               | ConfigMap | Argo CD env variables configuration                                                  |
    17  | [`argocd-secret.yaml`](argocd-secret-yaml.md)                         | argocd-secret                                                                      | Secret    | User Passwords, Certificates (deprecated), Signing Key, Dex secrets, Webhook secrets |
    18  | [`argocd-rbac-cm.yaml`](argocd-rbac-cm-yaml.md)                       | argocd-rbac-cm                                                                     | ConfigMap | RBAC Configuration                                                                   |
    19  | [`argocd-tls-certs-cm.yaml`](argocd-tls-certs-cm-yaml.md)             | argocd-tls-certs-cm                                                                | ConfigMap | Custom TLS certificates for connecting Git repositories via HTTPS (v1.2 and later)   |
    20  | [`argocd-ssh-known-hosts-cm.yaml`](argocd-ssh-known-hosts-cm-yaml.md) | argocd-ssh-known-hosts-cm                                                          | ConfigMap | SSH known hosts data for connecting Git repositories via SSH (v1.2 and later)        |
    21  
    22  For each specific kind of ConfigMap and Secret resource, there is only a single supported resource name (as listed in the above table) - if you need to merge things you need to do it before creating them.
    23  
    24  !!!warning "A note about ConfigMap resources"
    25      Be sure to annotate your ConfigMap resources using the label `app.kubernetes.io/part-of: argocd`, otherwise Argo CD will not be able to use them.
    26  
    27  ### Multiple configuration objects
    28  
    29  | Sample File                                                      | Kind        | Description              |
    30  |------------------------------------------------------------------|-------------|--------------------------|
    31  | [`application.yaml`](../user-guide/application-specification.md) | Application | Example application spec |
    32  | [`project.yaml`](./project-specification.md)                     | AppProject  | Example project spec     |
    33  | [`argocd-repositories.yaml`](./argocd-repositories-yaml.md)                                                                | Secret      | Repository credentials   |
    34  
    35  For `Application` and `AppProject` resources, the name of the resource equals the name of the application or project within Argo CD. This also means that application and project names are unique within a given Argo CD installation - you cannot have the same application name for two different applications.
    36  
    37  ## Applications
    38  
    39  The Application CRD is the Kubernetes resource object representing a deployed application instance
    40  in an environment. It is defined by two key pieces of information:
    41  
    42  * `source` reference to the desired state in Git (repository, revision, path, environment)
    43  * `destination` reference to the target cluster and namespace. For the cluster one of server or name can be used, but not both (which will result in an error). Under the hood when the server is missing, it is calculated based on the name and used for any operations.
    44  
    45  A minimal Application spec is as follows:
    46  
    47  ```yaml
    48  apiVersion: argoproj.io/v1alpha1
    49  kind: Application
    50  metadata:
    51    name: guestbook
    52    namespace: argocd
    53  spec:
    54    project: default
    55    source:
    56      repoURL: https://github.com/argoproj/argocd-example-apps.git
    57      targetRevision: HEAD
    58      path: guestbook
    59    destination:
    60      server: https://kubernetes.default.svc
    61      namespace: guestbook
    62  ```
    63  
    64  See [application.yaml](application.yaml) for additional fields. As long as you have completed the first step of [Getting Started](../getting_started.md#1-install-argo-cd), you can apply this with `kubectl apply -n argocd -f application.yaml` and Argo CD will start deploying the guestbook application.
    65  
    66  !!! note
    67      The namespace must match the namespace of your Argo CD instance - typically this is `argocd`.
    68  
    69  !!! note
    70      When creating an application from a Helm repository, the `chart` attribute must be specified instead of the `path` attribute within `spec.source`.
    71  
    72  ```yaml
    73  spec:
    74    project: default
    75    source:
    76      repoURL: https://argoproj.github.io/argo-helm
    77      chart: argo
    78  ```
    79  
    80  !!! warning
    81      Without the `resources-finalizer.argocd.argoproj.io` finalizer, deleting an application will not delete the resources it manages. To perform a cascading delete, you must add the finalizer. See [App Deletion](../user-guide/app_deletion.md#about-the-deletion-finalizer).
    82  
    83  ```yaml
    84  metadata:
    85    finalizers:
    86      - resources-finalizer.argocd.argoproj.io
    87  ```
    88  
    89  ### App of Apps
    90  
    91  You can create an app that creates other apps, which in turn can create other apps.
    92  This allows you to declaratively manage a group of apps that can be deployed and configured in concert.
    93  
    94  See [cluster bootstrapping](cluster-bootstrapping.md).
    95  
    96  ## Projects
    97  
    98  The AppProject CRD is the Kubernetes resource object representing a logical grouping of applications.
    99  It is defined by the following key pieces of information:
   100  
   101  * `sourceRepos` reference to the repositories that applications within the project can pull manifests from.
   102  * `destinations` reference to clusters and namespaces that applications within the project can deploy into.
   103  * `roles` list of entities with definitions of their access to resources within the project.
   104  
   105  !!!warning "Projects which can deploy to the Argo CD namespace grant admin access"
   106      If a Project's `destinations` configuration allows deploying to the namespace in which Argo CD is installed, then
   107      Applications under that project have admin-level access. [RBAC access](https://argo-cd.readthedocs.io/en/stable/operator-manual/rbac/)
   108      to admin-level Projects should be carefully restricted, and push access to allowed `sourceRepos` should be limited
   109      to only admins.
   110  
   111  An example spec is as follows:
   112  
   113  ```yaml
   114  apiVersion: argoproj.io/v1alpha1
   115  kind: AppProject
   116  metadata:
   117    name: my-project
   118    namespace: argocd
   119    # Finalizer that ensures that project is not deleted until it is not referenced by any application
   120    finalizers:
   121      - resources-finalizer.argocd.argoproj.io
   122  spec:
   123    description: Example Project
   124    # Allow manifests to deploy from any Git repos
   125    sourceRepos:
   126    - '*'
   127    # Only permit applications to deploy to the guestbook namespace in the same cluster
   128    destinations:
   129    - namespace: guestbook
   130      server: https://kubernetes.default.svc
   131    # Deny all cluster-scoped resources from being created, except for Namespace
   132    clusterResourceWhitelist:
   133    - group: ''
   134      kind: Namespace
   135    # Allow all namespaced-scoped resources to be created, except for ResourceQuota, LimitRange, NetworkPolicy
   136    namespaceResourceBlacklist:
   137    - group: ''
   138      kind: ResourceQuota
   139    - group: ''
   140      kind: LimitRange
   141    - group: ''
   142      kind: NetworkPolicy
   143    # Deny all namespaced-scoped resources from being created, except for Deployment and StatefulSet
   144    namespaceResourceWhitelist:
   145    - group: 'apps'
   146      kind: Deployment
   147    - group: 'apps'
   148      kind: StatefulSet
   149    roles:
   150    # A role which provides read-only access to all applications in the project
   151    - name: read-only
   152      description: Read-only privileges to my-project
   153      policies:
   154      - p, proj:my-project:read-only, applications, get, my-project/*, allow
   155      groups:
   156      - my-oidc-group
   157    # A role which provides sync privileges to only the guestbook-dev application, e.g. to provide
   158    # sync privileges to a CI system
   159    - name: ci-role
   160      description: Sync privileges for guestbook-dev
   161      policies:
   162      - p, proj:my-project:ci-role, applications, sync, my-project/guestbook-dev, allow
   163      # NOTE: JWT tokens can only be generated by the API server and the token is not persisted
   164      # anywhere by Argo CD. It can be prematurely revoked by removing the entry from this list.
   165      jwtTokens:
   166      - iat: 1535390316
   167  ```
   168  
   169  ## Repositories
   170  
   171  !!!note
   172      Some Git hosters - notably GitLab and possibly on-premise GitLab instances as well - require you to
   173      specify the `.git` suffix in the repository URL, otherwise they will send a HTTP 301 redirect to the
   174      repository URL suffixed with `.git`. Argo CD will **not** follow these redirects, so you have to
   175      adjust your repository URL to be suffixed with `.git`.
   176  
   177  Repository details are stored in secrets. To configure a repo, create a secret which contains repository details.
   178  Consider using [bitnami-labs/sealed-secrets](https://github.com/bitnami-labs/sealed-secrets) to store an encrypted secret definition as a Kubernetes manifest.
   179  Each repository must have a `url` field and, depending on whether you connect using HTTPS, SSH, or GitHub App, `username` and `password` (for HTTPS), `sshPrivateKey` (for SSH), or `githubAppPrivateKey` (for GitHub App).
   180  Credentials can be scoped to a project using the optional `project` field. When omitted, the credential will be used as the default for all projects without a scoped credential.
   181  
   182  !!!warning
   183      When using [bitnami-labs/sealed-secrets](https://github.com/bitnami-labs/sealed-secrets) the labels will be removed and have to be readded as described here: https://github.com/bitnami-labs/sealed-secrets#sealedsecrets-as-templates-for-secrets
   184  
   185  Example for HTTPS:
   186  
   187  ```yaml
   188  apiVersion: v1
   189  kind: Secret
   190  metadata:
   191    name: private-repo
   192    namespace: argocd
   193    labels:
   194      argocd.argoproj.io/secret-type: repository
   195  stringData:
   196    type: git
   197    url: https://github.com/argoproj/private-repo
   198    password: my-password
   199    username: my-username
   200    project: my-project
   201  ```
   202  
   203  Example for SSH:
   204  
   205  ```yaml
   206  apiVersion: v1
   207  kind: Secret
   208  metadata:
   209    name: private-repo
   210    namespace: argocd
   211    labels:
   212      argocd.argoproj.io/secret-type: repository
   213  stringData:
   214    type: git
   215    url: git@github.com:argoproj/my-private-repository.git
   216    sshPrivateKey: |
   217      -----BEGIN OPENSSH PRIVATE KEY-----
   218      ...
   219      -----END OPENSSH PRIVATE KEY-----
   220  ```
   221  
   222  Example for GitHub App:
   223  
   224  ```yaml
   225  apiVersion: v1
   226  kind: Secret
   227  metadata:
   228    name: github-repo
   229    namespace: argocd
   230    labels:
   231      argocd.argoproj.io/secret-type: repository
   232  stringData:
   233    type: git
   234    url: https://github.com/argoproj/my-private-repository
   235    githubAppID: 1
   236    githubAppInstallationID: 2
   237    githubAppPrivateKey: |
   238      -----BEGIN OPENSSH PRIVATE KEY-----
   239      ...
   240      -----END OPENSSH PRIVATE KEY-----
   241  ---
   242  apiVersion: v1
   243  kind: Secret
   244  metadata:
   245    name: github-enterprise-repo
   246    namespace: argocd
   247    labels:
   248      argocd.argoproj.io/secret-type: repository
   249  stringData:
   250    type: git
   251    url: https://ghe.example.com/argoproj/my-private-repository
   252    githubAppID: 1
   253    githubAppInstallationID: 2
   254    githubAppEnterpriseBaseUrl: https://ghe.example.com/api/v3
   255    githubAppPrivateKey: |
   256      -----BEGIN OPENSSH PRIVATE KEY-----
   257      ...
   258      -----END OPENSSH PRIVATE KEY-----
   259  ```
   260  
   261  Example for Google Cloud Source repositories:
   262  
   263  ```yaml
   264  kind: Secret
   265  metadata:
   266    name: github-repo
   267    namespace: argocd
   268    labels:
   269      argocd.argoproj.io/secret-type: repository
   270  stringData:
   271    type: git
   272    url: https://source.developers.google.com/p/my-google-project/r/my-repo
   273    gcpServiceAccountKey: |
   274      {
   275        "type": "service_account",
   276        "project_id": "my-google-project",
   277        "private_key_id": "REDACTED",
   278        "private_key": "-----BEGIN PRIVATE KEY-----\nREDACTED\n-----END PRIVATE KEY-----\n",
   279        "client_email": "argocd-service-account@my-google-project.iam.gserviceaccount.com",
   280        "client_id": "REDACTED",
   281        "auth_uri": "https://accounts.google.com/o/oauth2/auth",
   282        "token_uri": "https://oauth2.googleapis.com/token",
   283        "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
   284        "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/argocd-service-account%40my-google-project.iam.gserviceaccount.com"
   285      }
   286  ```
   287  
   288  !!! tip
   289      The Kubernetes documentation has [instructions for creating a secret containing a private key](https://kubernetes.io/docs/concepts/configuration/secret/#use-case-pod-with-ssh-keys).
   290  
   291  Example for Azure Container Registry/ Azure Devops repositories using Azure workload identity:
   292  
   293  Refer to [Azure Container Registry/Azure Repos using Azure Workload Identity](../user-guide/private-repositories.md#azure-container-registryazure-repos-using-azure-workload-identity)
   294  
   295  ### Repository Credentials
   296  
   297  If you want to use the same credentials for multiple repositories, you can configure credential templates. Credential templates can carry the same credentials information as repositories.
   298  
   299  ```yaml
   300  apiVersion: v1
   301  kind: Secret
   302  metadata:
   303    name: first-repo
   304    namespace: argocd
   305    labels:
   306      argocd.argoproj.io/secret-type: repository
   307  stringData:
   308    type: git
   309    url: https://github.com/argoproj/private-repo
   310  ---
   311  apiVersion: v1
   312  kind: Secret
   313  metadata:
   314    name: second-repo
   315    namespace: argocd
   316    labels:
   317      argocd.argoproj.io/secret-type: repository
   318  stringData:
   319    type: git
   320    url: https://github.com/argoproj/other-private-repo
   321  ---
   322  apiVersion: v1
   323  kind: Secret
   324  metadata:
   325    name: private-repo-creds
   326    namespace: argocd
   327    labels:
   328      argocd.argoproj.io/secret-type: repo-creds
   329  stringData:
   330    type: git
   331    url: https://github.com/argoproj
   332    password: my-password
   333    username: my-username
   334  ```
   335  
   336  In the above example, every repository accessed via HTTPS whose URL is prefixed with `https://github.com/argoproj` would use a username stored in the key `username` and a password stored in the key `password` of the secret `private-repo-creds` for connecting to Git.
   337  
   338  In order for Argo CD to use a credential template for any given repository, the following conditions must be met:
   339  
   340  * The repository must either not be configured at all, or if configured, must not contain any credential information (i.e. contain none of `sshPrivateKey`, `username`, `password` )
   341  * The URL configured for a credential template (e.g. `https://github.com/argoproj`) must match as prefix for the repository URL (e.g. `https://github.com/argoproj/argocd-example-apps`).
   342  
   343  !!! note
   344      Matching credential template URL prefixes is done on a _best match_ effort, so the longest (best) match will take precedence. The order of definition is not important, as opposed to pre v1.4 configuration.
   345  
   346  The following keys are valid to refer to credential secrets:
   347  
   348  #### SSH repositories
   349  
   350  * `sshPrivateKey` refers to the SSH private key for accessing the repositories
   351  
   352  #### HTTPS repositories
   353  
   354  * `username` and `password` refer to the username and/or password for accessing the repositories
   355  * `tlsClientCertData` and `tlsClientCertKey` refer to secrets where a TLS client certificate (`tlsClientCertData`) and the corresponding private key `tlsClientCertKey` are stored for accessing the repositories
   356  
   357  #### GitHub App repositories
   358  
   359  * `githubAppPrivateKey` refers to the GitHub App private key for accessing the repositories
   360  * `githubAppID` refers to the GitHub Application ID for the application you created.
   361  * `githubAppInstallationID` refers to the Installation ID of the GitHub app you created and installed.
   362  * `githubAppEnterpriseBaseUrl` refers to the base api URL for GitHub Enterprise (e.g. `https://ghe.example.com/api/v3`)
   363  * `tlsClientCertData` and `tlsClientCertKey` refer to secrets where a TLS client certificate (`tlsClientCertData`) and the corresponding private key `tlsClientCertKey` are stored for accessing GitHub Enterprise if custom certificates are used.
   364  
   365  #### Helm Chart repositories
   366  
   367  See the [Helm](#helm) section for the properties that apply to Helm repositories and charts sourced from OCI registries.
   368  
   369  ### Repositories using self-signed TLS certificates (or are signed by custom CA)
   370  
   371  You can manage the TLS certificates used to verify the authenticity of your repository servers in a ConfigMap object named `argocd-tls-certs-cm`. The data section should contain a map, with the repository server's hostname part (not the complete URL) as key, and the certificate(s) in PEM format as data. So, if you connect to a repository with the URL `https://server.example.com/repos/my-repo`, you should use `server.example.com` as key. The certificate data should be either the server's certificate (in case of self-signed certificate) or the certificate of the CA that was used to sign the server's certificate. You can configure multiple certificates for each server, e.g. if you are having a certificate roll-over planned.
   372  
   373  If there are no dedicated certificates configured for a repository server, the system's default trust store is used for validating the server's repository. This should be good enough for most (if not all) public Git repository services such as GitLab, GitHub and Bitbucket as well as most privately hosted sites which use certificates from well-known CAs, including Let's Encrypt certificates.
   374  
   375  An example ConfigMap object:
   376  
   377  ```yaml
   378  apiVersion: v1
   379  kind: ConfigMap
   380  metadata:
   381    name: argocd-tls-certs-cm
   382    namespace: argocd
   383    labels:
   384      app.kubernetes.io/name: argocd-cm
   385      app.kubernetes.io/part-of: argocd
   386  data:
   387    server.example.com: |
   388      -----BEGIN CERTIFICATE-----
   389      MIIF1zCCA7+gAwIBAgIUQdTcSHY2Sxd3Tq/v1eIEZPCNbOowDQYJKoZIhvcNAQEL
   390      BQAwezELMAkGA1UEBhMCREUxFTATBgNVBAgMDExvd2VyIFNheG9ueTEQMA4GA1UE
   391      BwwHSGFub3ZlcjEVMBMGA1UECgwMVGVzdGluZyBDb3JwMRIwEAYDVQQLDAlUZXN0
   392      c3VpdGUxGDAWBgNVBAMMD2Jhci5leGFtcGxlLmNvbTAeFw0xOTA3MDgxMzU2MTda
   393      Fw0yMDA3MDcxMzU2MTdaMHsxCzAJBgNVBAYTAkRFMRUwEwYDVQQIDAxMb3dlciBT
   394      YXhvbnkxEDAOBgNVBAcMB0hhbm92ZXIxFTATBgNVBAoMDFRlc3RpbmcgQ29ycDES
   395      MBAGA1UECwwJVGVzdHN1aXRlMRgwFgYDVQQDDA9iYXIuZXhhbXBsZS5jb20wggIi
   396      MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCv4mHMdVUcafmaSHVpUM0zZWp5
   397      NFXfboxA4inuOkE8kZlbGSe7wiG9WqLirdr39Ts+WSAFA6oANvbzlu3JrEQ2CHPc
   398      CNQm6diPREFwcDPFCe/eMawbwkQAPVSHPts0UoRxnpZox5pn69ghncBR+jtvx+/u
   399      P6HdwW0qqTvfJnfAF1hBJ4oIk2AXiip5kkIznsAh9W6WRy6nTVCeetmIepDOGe0G
   400      ZJIRn/OfSz7NzKylfDCat2z3EAutyeT/5oXZoWOmGg/8T7pn/pR588GoYYKRQnp+
   401      YilqCPFX+az09EqqK/iHXnkdZ/Z2fCuU+9M/Zhrnlwlygl3RuVBI6xhm/ZsXtL2E
   402      Gxa61lNy6pyx5+hSxHEFEJshXLtioRd702VdLKxEOuYSXKeJDs1x9o6cJ75S6hko
   403      Ml1L4zCU+xEsMcvb1iQ2n7PZdacqhkFRUVVVmJ56th8aYyX7KNX6M9CD+kMpNm6J
   404      kKC1li/Iy+RI138bAvaFplajMF551kt44dSvIoJIbTr1LigudzWPqk31QaZXV/4u
   405      kD1n4p/XMc9HYU/was/CmQBFqmIZedTLTtK7clkuFN6wbwzdo1wmUNgnySQuMacO
   406      gxhHxxzRWxd24uLyk9Px+9U3BfVPaRLiOPaPoC58lyVOykjSgfpgbus7JS69fCq7
   407      bEH4Jatp/10zkco+UQIDAQABo1MwUTAdBgNVHQ4EFgQUjXH6PHi92y4C4hQpey86
   408      r6+x1ewwHwYDVR0jBBgwFoAUjXH6PHi92y4C4hQpey86r6+x1ewwDwYDVR0TAQH/
   409      BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAgEAFE4SdKsX9UsLy+Z0xuHSxhTd0jfn
   410      Iih5mtzb8CDNO5oTw4z0aMeAvpsUvjJ/XjgxnkiRACXh7K9hsG2r+ageRWGevyvx
   411      CaRXFbherV1kTnZw4Y9/pgZTYVWs9jlqFOppz5sStkfjsDQ5lmPJGDii/StENAz2
   412      XmtiPOgfG9Upb0GAJBCuKnrU9bIcT4L20gd2F4Y14ccyjlf8UiUi192IX6yM9OjT
   413      +TuXwZgqnTOq6piVgr+FTSa24qSvaXb5z/mJDLlk23npecTouLg83TNSn3R6fYQr
   414      d/Y9eXuUJ8U7/qTh2Ulz071AO9KzPOmleYPTx4Xty4xAtWi1QE5NHW9/Ajlv5OtO
   415      OnMNWIs7ssDJBsB7VFC8hcwf79jz7kC0xmQqDfw51Xhhk04kla+v+HZcFW2AO9so
   416      6ZdVHHQnIbJa7yQJKZ+hK49IOoBR6JgdB5kymoplLLiuqZSYTcwSBZ72FYTm3iAr
   417      jzvt1hxpxVDmXvRnkhRrIRhK4QgJL0jRmirBjDY+PYYd7bdRIjN7WNZLFsgplnS8
   418      9w6CwG32pRlm0c8kkiQ7FXA6BYCqOsDI8f1VGQv331OpR2Ck+FTv+L7DAmg6l37W
   419      +LB9LGh4OAp68ImTjqf6ioGKG0RBSznwME+r4nXtT1S/qLR6ASWUS4ViWRhbRlNK
   420      XWyb96wrUlv+E8I=
   421      -----END CERTIFICATE-----
   422  
   423  ```
   424  
   425  !!! note
   426      The `argocd-tls-certs-cm` ConfigMap will be mounted as a volume at the mount path `/app/config/tls` in the pods of `argocd-server` and `argocd-repo-server`. It will create files for each data key in the mount path directory, so above example would leave the file `/app/config/tls/server.example.com`, which contains the certificate data. It might take a while for changes in the ConfigMap to be reflected in your pods, depending on your Kubernetes configuration.
   427  
   428  ### SSH known host public keys
   429  
   430  If you are configuring repositories to use SSH, Argo CD will need to know their SSH public keys. In order for Argo CD to connect via SSH the public key(s) for each repository server must be pre-configured in Argo CD (unlike TLS configuration), otherwise the connections to the repository will fail.
   431  
   432  You can manage the SSH known hosts data in the `argocd-ssh-known-hosts-cm` ConfigMap. This ConfigMap contains a single entry, `ssh_known_hosts`, with the public keys of the SSH servers as its value. The value can be filled in from any existing `ssh_known_hosts` file, or from the output of the `ssh-keyscan` utility (which is part of OpenSSH's client package). The basic format is `<server_name> <keytype> <base64-encoded_key>`, one entry per line.
   433  
   434  Here is an example of running `ssh-keyscan`:
   435  ```bash
   436  $ for host in bitbucket.org github.com gitlab.com ssh.dev.azure.com vs-ssh.visualstudio.com ; do ssh-keyscan $host 2> /dev/null ; done
   437  bitbucket.org ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDQeJzhupRu0u0cdegZIa8e86EG2qOCsIsD1Xw0xSeiPDlCr7kq97NLmMbpKTX6Esc30NuoqEEHCuc7yWtwp8dI76EEEB1VqY9QJq6vk+aySyboD5QF61I/1WeTwu+deCbgKMGbUijeXhtfbxSxm6JwGrXrhBdofTsbKRUsrN1WoNgUa8uqN1Vx6WAJw1JHPhglEGGHea6QICwJOAr/6mrui/oB7pkaWKHj3z7d1IC4KWLtY47elvjbaTlkN04Kc/5LFEirorGYVbt15kAUlqGM65pk6ZBxtaO3+30LVlORZkxOh+LKL/BvbZ/iRNhItLqNyieoQj/uh/7Iv4uyH/cV/0b4WDSd3DptigWq84lJubb9t/DnZlrJazxyDCulTmKdOR7vs9gMTo+uoIrPSb8ScTtvw65+odKAlBj59dhnVp9zd7QUojOpXlL62Aw56U4oO+FALuevvMjiWeavKhJqlR7i5n9srYcrNV7ttmDw7kf/97P5zauIhxcjX+xHv4M=
   438  github.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOMqqnkVzrm0SdG6UOoqKLsabgH5C9okWi0dh2l9GKJl
   439  github.com ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCj7ndNxQowgcQnjshcLrqPEiiphnt+VTTvDP6mHBL9j1aNUkY4Ue1gvwnGLVlOhGeYrnZaMgRK6+PKCUXaDbC7qtbW8gIkhL7aGCsOr/C56SJMy/BCZfxd1nWzAOxSDPgVsmerOBYfNqltV9/hWCqBywINIR+5dIg6JTJ72pcEpEjcYgXkE2YEFXV1JHnsKgbLWNlhScqb2UmyRkQyytRLtL+38TGxkxCflmO+5Z8CSSNY7GidjMIZ7Q4zMjA2n1nGrlTDkzwDCsw+wqFPGQA179cnfGWOWRVruj16z6XyvxvjJwbz0wQZ75XK5tKSb7FNyeIEs4TT4jk+S4dhPeAUC5y+bDYirYgM4GC7uEnztnZyaVWQ7B381AK4Qdrwt51ZqExKbQpTUNn+EjqoTwvqNj4kqx5QUCI0ThS/YkOxJCXmPUWZbhjpCg56i+2aB6CmK2JGhn57K5mj0MNdBXA4/WnwH6XoPWJzK5Nyu2zB3nAZp+S5hpQs+p1vN1/wsjk=
   440  github.com ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEmKSENjQEezOmxkZMy7opKgwFB9nkt5YRrYMjNuG5N87uRgg6CLrbo5wAdT/y6v0mKV0U2w0WZ2YB/++Tpockg=
   441  gitlab.com ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBFSMqzJeV9rUzU4kWitGjeR4PWSa29SPqJ1fVkhtj3Hw9xjLVXVYrU9QlYWrOLXBpQ6KWjbjTDTdDkoohFzgbEY=
   442  gitlab.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAfuCHKVTjquxvt6CM6tdG4SLp1Btn/nOeHHE5UOzRdf
   443  gitlab.com ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCsj2bNKTBSpIYDEGk9KxsGh3mySTRgMtXL583qmBpzeQ+jqCMRgBqB98u3z++J1sKlXHWfM9dyhSevkMwSbhoR8XIq/U0tCNyokEi/ueaBMCvbcTHhO7FcwzY92WK4Yt0aGROY5qX2UKSeOvuP4D6TPqKF1onrSzH9bx9XUf2lEdWT/ia1NEKjunUqu1xOB/StKDHMoX4/OKyIzuS0q/T1zOATthvasJFoPrAjkohTyaDUz2LN5JoH839hViyEG82yB+MjcFV5MU3N1l1QL3cVUCh93xSaua1N85qivl+siMkPGbO5xR/En4iEY6K2XPASUEMaieWVNTRCtJ4S8H+9
   444  ssh.dev.azure.com ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC7Hr1oTWqNqOlzGJOfGJ4NakVyIzf1rXYd4d7wo6jBlkLvCA4odBlL0mDUyZ0/QUfTTqeu+tm22gOsv+VrVTMk6vwRU75gY/y9ut5Mb3bR5BV58dKXyq9A9UeB5Cakehn5Zgm6x1mKoVyf+FFn26iYqXJRgzIZZcZ5V6hrE0Qg39kZm4az48o0AUbf6Sp4SLdvnuMa2sVNwHBboS7EJkm57XQPVU3/QpyNLHbWDdzwtrlS+ez30S3AdYhLKEOxAG8weOnyrtLJAUen9mTkol8oII1edf7mWWbWVf0nBmly21+nZcmCTISQBtdcyPaEno7fFQMDD26/s0lfKob4Kw8H
   445  vs-ssh.visualstudio.com ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC7Hr1oTWqNqOlzGJOfGJ4NakVyIzf1rXYd4d7wo6jBlkLvCA4odBlL0mDUyZ0/QUfTTqeu+tm22gOsv+VrVTMk6vwRU75gY/y9ut5Mb3bR5BV58dKXyq9A9UeB5Cakehn5Zgm6x1mKoVyf+FFn26iYqXJRgzIZZcZ5V6hrE0Qg39kZm4az48o0AUbf6Sp4SLdvnuMa2sVNwHBboS7EJkm57XQPVU3/QpyNLHbWDdzwtrlS+ez30S3AdYhLKEOxAG8weOnyrtLJAUen9mTkol8oII1edf7mWWbWVf0nBmly21+nZcmCTISQBtdcyPaEno7fFQMDD26/s0lfKob4Kw8H
   446  ```
   447  
   448  Here is an example `ConfigMap` object using the output from `ssh-keyscan` above:
   449  
   450  ```yaml
   451  apiVersion: v1
   452  kind: ConfigMap
   453  metadata:
   454    labels:
   455      app.kubernetes.io/name: argocd-ssh-known-hosts-cm
   456      app.kubernetes.io/part-of: argocd
   457    name: argocd-ssh-known-hosts-cm
   458  data:
   459    ssh_known_hosts: |
   460      # This file was automatically generated by hack/update-ssh-known-hosts.sh. DO NOT EDIT
   461      [ssh.github.com]:443 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEmKSENjQEezOmxkZMy7opKgwFB9nkt5YRrYMjNuG5N87uRgg6CLrbo5wAdT/y6v0mKV0U2w0WZ2YB/++Tpockg=
   462      [ssh.github.com]:443 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOMqqnkVzrm0SdG6UOoqKLsabgH5C9okWi0dh2l9GKJl
   463      [ssh.github.com]:443 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCj7ndNxQowgcQnjshcLrqPEiiphnt+VTTvDP6mHBL9j1aNUkY4Ue1gvwnGLVlOhGeYrnZaMgRK6+PKCUXaDbC7qtbW8gIkhL7aGCsOr/C56SJMy/BCZfxd1nWzAOxSDPgVsmerOBYfNqltV9/hWCqBywINIR+5dIg6JTJ72pcEpEjcYgXkE2YEFXV1JHnsKgbLWNlhScqb2UmyRkQyytRLtL+38TGxkxCflmO+5Z8CSSNY7GidjMIZ7Q4zMjA2n1nGrlTDkzwDCsw+wqFPGQA179cnfGWOWRVruj16z6XyvxvjJwbz0wQZ75XK5tKSb7FNyeIEs4TT4jk+S4dhPeAUC5y+bDYirYgM4GC7uEnztnZyaVWQ7B381AK4Qdrwt51ZqExKbQpTUNn+EjqoTwvqNj4kqx5QUCI0ThS/YkOxJCXmPUWZbhjpCg56i+2aB6CmK2JGhn57K5mj0MNdBXA4/WnwH6XoPWJzK5Nyu2zB3nAZp+S5hpQs+p1vN1/wsjk=
   464      bitbucket.org ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBPIQmuzMBuKdWeF4+a2sjSSpBK0iqitSQ+5BM9KhpexuGt20JpTVM7u5BDZngncgrqDMbWdxMWWOGtZ9UgbqgZE=
   465      bitbucket.org ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIazEu89wgQZ4bqs3d63QSMzYVa0MuJ2e2gKTKqu+UUO
   466      bitbucket.org ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDQeJzhupRu0u0cdegZIa8e86EG2qOCsIsD1Xw0xSeiPDlCr7kq97NLmMbpKTX6Esc30NuoqEEHCuc7yWtwp8dI76EEEB1VqY9QJq6vk+aySyboD5QF61I/1WeTwu+deCbgKMGbUijeXhtfbxSxm6JwGrXrhBdofTsbKRUsrN1WoNgUa8uqN1Vx6WAJw1JHPhglEGGHea6QICwJOAr/6mrui/oB7pkaWKHj3z7d1IC4KWLtY47elvjbaTlkN04Kc/5LFEirorGYVbt15kAUlqGM65pk6ZBxtaO3+30LVlORZkxOh+LKL/BvbZ/iRNhItLqNyieoQj/uh/7Iv4uyH/cV/0b4WDSd3DptigWq84lJubb9t/DnZlrJazxyDCulTmKdOR7vs9gMTo+uoIrPSb8ScTtvw65+odKAlBj59dhnVp9zd7QUojOpXlL62Aw56U4oO+FALuevvMjiWeavKhJqlR7i5n9srYcrNV7ttmDw7kf/97P5zauIhxcjX+xHv4M=
   467      github.com ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEmKSENjQEezOmxkZMy7opKgwFB9nkt5YRrYMjNuG5N87uRgg6CLrbo5wAdT/y6v0mKV0U2w0WZ2YB/++Tpockg=
   468      github.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOMqqnkVzrm0SdG6UOoqKLsabgH5C9okWi0dh2l9GKJl
   469      github.com ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCj7ndNxQowgcQnjshcLrqPEiiphnt+VTTvDP6mHBL9j1aNUkY4Ue1gvwnGLVlOhGeYrnZaMgRK6+PKCUXaDbC7qtbW8gIkhL7aGCsOr/C56SJMy/BCZfxd1nWzAOxSDPgVsmerOBYfNqltV9/hWCqBywINIR+5dIg6JTJ72pcEpEjcYgXkE2YEFXV1JHnsKgbLWNlhScqb2UmyRkQyytRLtL+38TGxkxCflmO+5Z8CSSNY7GidjMIZ7Q4zMjA2n1nGrlTDkzwDCsw+wqFPGQA179cnfGWOWRVruj16z6XyvxvjJwbz0wQZ75XK5tKSb7FNyeIEs4TT4jk+S4dhPeAUC5y+bDYirYgM4GC7uEnztnZyaVWQ7B381AK4Qdrwt51ZqExKbQpTUNn+EjqoTwvqNj4kqx5QUCI0ThS/YkOxJCXmPUWZbhjpCg56i+2aB6CmK2JGhn57K5mj0MNdBXA4/WnwH6XoPWJzK5Nyu2zB3nAZp+S5hpQs+p1vN1/wsjk=
   470      gitlab.com ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBFSMqzJeV9rUzU4kWitGjeR4PWSa29SPqJ1fVkhtj3Hw9xjLVXVYrU9QlYWrOLXBpQ6KWjbjTDTdDkoohFzgbEY=
   471      gitlab.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAfuCHKVTjquxvt6CM6tdG4SLp1Btn/nOeHHE5UOzRdf
   472      gitlab.com ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCsj2bNKTBSpIYDEGk9KxsGh3mySTRgMtXL583qmBpzeQ+jqCMRgBqB98u3z++J1sKlXHWfM9dyhSevkMwSbhoR8XIq/U0tCNyokEi/ueaBMCvbcTHhO7FcwzY92WK4Yt0aGROY5qX2UKSeOvuP4D6TPqKF1onrSzH9bx9XUf2lEdWT/ia1NEKjunUqu1xOB/StKDHMoX4/OKyIzuS0q/T1zOATthvasJFoPrAjkohTyaDUz2LN5JoH839hViyEG82yB+MjcFV5MU3N1l1QL3cVUCh93xSaua1N85qivl+siMkPGbO5xR/En4iEY6K2XPASUEMaieWVNTRCtJ4S8H+9
   473      ssh.dev.azure.com ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC7Hr1oTWqNqOlzGJOfGJ4NakVyIzf1rXYd4d7wo6jBlkLvCA4odBlL0mDUyZ0/QUfTTqeu+tm22gOsv+VrVTMk6vwRU75gY/y9ut5Mb3bR5BV58dKXyq9A9UeB5Cakehn5Zgm6x1mKoVyf+FFn26iYqXJRgzIZZcZ5V6hrE0Qg39kZm4az48o0AUbf6Sp4SLdvnuMa2sVNwHBboS7EJkm57XQPVU3/QpyNLHbWDdzwtrlS+ez30S3AdYhLKEOxAG8weOnyrtLJAUen9mTkol8oII1edf7mWWbWVf0nBmly21+nZcmCTISQBtdcyPaEno7fFQMDD26/s0lfKob4Kw8H
   474      vs-ssh.visualstudio.com ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC7Hr1oTWqNqOlzGJOfGJ4NakVyIzf1rXYd4d7wo6jBlkLvCA4odBlL0mDUyZ0/QUfTTqeu+tm22gOsv+VrVTMk6vwRU75gY/y9ut5Mb3bR5BV58dKXyq9A9UeB5Cakehn5Zgm6x1mKoVyf+FFn26iYqXJRgzIZZcZ5V6hrE0Qg39kZm4az48o0AUbf6Sp4SLdvnuMa2sVNwHBboS7EJkm57XQPVU3/QpyNLHbWDdzwtrlS+ez30S3AdYhLKEOxAG8weOnyrtLJAUen9mTkol8oII1edf7mWWbWVf0nBmly21+nZcmCTISQBtdcyPaEno7fFQMDD26/s0lfKob4Kw8H
   475  ```
   476  
   477  !!! note
   478      The `argocd-ssh-known-hosts-cm` ConfigMap will be mounted as a volume at the mount path `/app/config/ssh` in the pods of `argocd-server` and `argocd-repo-server`. It will create a file `ssh_known_hosts` in that directory, which contains the SSH known hosts data used by Argo CD for connecting to Git repositories via SSH. It might take a while for changes in the ConfigMap to be reflected in your pods, depending on your Kubernetes configuration.
   479  
   480  ### Configure repositories with proxy
   481  
   482  Proxy for your repository can be specified in the `proxy` field of the repository secret, along with a corresponding `noProxy` config. Argo CD uses this proxy/noProxy config to access the repository and do related helm/kustomize operations. Argo CD looks for the standard proxy environment variables in the repository server if the custom proxy config is absent.
   483  
   484  An example repository with proxy and noProxy:
   485  
   486  ```yaml
   487  apiVersion: v1
   488  kind: Secret
   489  metadata:
   490    name: private-repo
   491    namespace: argocd
   492    labels:
   493      argocd.argoproj.io/secret-type: repository
   494  stringData:
   495    type: git
   496    url: https://github.com/argoproj/private-repo
   497    proxy: https://proxy-server-url:8888
   498    noProxy: ".internal.example.com,company.org,10.123.0.0/16"
   499    password: my-password
   500    username: my-username
   501  ```
   502  
   503  A note on noProxy: Argo CD uses exec to interact with different tools such as helm and kustomize. Not all of these tools support the same noProxy syntax as the [httpproxy go package](https://cs.opensource.google/go/x/net/+/internal-branch.go1.21-vendor:http/httpproxy/proxy.go;l=38-50) does. In case you run in trouble with noProxy not beeing respected you might want to try using the full domain instead of a wildcard pattern or IP range to find a common syntax that all tools support.
   504  
   505  ## Clusters
   506  
   507  Cluster credentials are stored in secrets same as repositories or repository credentials. Each secret must have label
   508  `argocd.argoproj.io/secret-type: cluster`.
   509  
   510  The secret data must include following fields:
   511  
   512  * `name` - cluster name
   513  * `server` - cluster api server url
   514  * `namespaces` - optional comma-separated list of namespaces which are accessible in that cluster. Setting namespace values will cause cluster-level resources to be ignored unless `clusterResources` is set to `true`.
   515  * `clusterResources` - optional boolean string (`"true"` or `"false"`) determining whether Argo CD can manage cluster-level resources on this cluster. This setting is only used when namespaces are restricted using the `namespaces` list.
   516  * `project` - optional string to designate this as a project-scoped cluster.
   517  * `config` - JSON representation of the following data structure:
   518  
   519  ```yaml
   520  # Basic authentication settings
   521  username: string
   522  password: string
   523  # Bearer authentication settings
   524  bearerToken: string
   525  # IAM authentication configuration
   526  awsAuthConfig:
   527      clusterName: string
   528      roleARN: string
   529      profile: string
   530  # Configure external command to supply client credentials
   531  # See https://godoc.org/k8s.io/client-go/tools/clientcmd/api#ExecConfig
   532  execProviderConfig:
   533      command: string
   534      args: [
   535        string
   536      ]
   537      env: {
   538        key: value
   539      }
   540      apiVersion: string
   541      installHint: string
   542  # Proxy URL for the kubernetes client to use when connecting to the cluster api server
   543  proxyUrl: string
   544  # Transport layer security configuration settings
   545  tlsClientConfig:
   546      # Base64 encoded PEM-encoded bytes (typically read from a client certificate file).
   547      caData: string
   548      # Base64 encoded PEM-encoded bytes (typically read from a client certificate file).
   549      certData: string
   550      # Server should be accessed without verifying the TLS certificate
   551      insecure: boolean
   552      # Base64 encoded PEM-encoded bytes (typically read from a client certificate key file).
   553      keyData: string
   554      # ServerName is passed to the server for SNI and is used in the client to check server
   555      # certificates against. If ServerName is empty, the hostname used to contact the
   556      # server is used.
   557      serverName: string
   558  # Disable automatic compression for requests to the cluster 
   559  disableCompression: boolean
   560  ```
   561  
   562  !!! important
   563      When `namespaces` is set, Argo CD will perform a separate list/watch operation for each namespace. This can cause
   564      the Application controller to exceed the maximum number of idle connections allowed for the Kubernetes API server.
   565      To resolve this issue, you can increase the `ARGOCD_K8S_CLIENT_MAX_IDLE_CONNECTIONS` environment variable in the
   566      Application controller.
   567  
   568  !!! important 
   569      Note that if you specify a command to run under `execProviderConfig`, that command must be available in the Argo CD image. See [BYOI (Build Your Own Image)](custom_tools.md#byoi-build-your-own-image).
   570  
   571  Cluster secret example:
   572  
   573  ```yaml
   574  apiVersion: v1
   575  kind: Secret
   576  metadata:
   577    name: mycluster-secret
   578    labels:
   579      argocd.argoproj.io/secret-type: cluster
   580  type: Opaque
   581  stringData:
   582    name: mycluster.example.com
   583    server: https://mycluster.example.com
   584    config: |
   585      {
   586        "bearerToken": "<authentication token>",
   587        "tlsClientConfig": {
   588          "insecure": false,
   589          "caData": "<base64 encoded certificate>"
   590        }
   591      }
   592  ```
   593  
   594  ### EKS
   595  
   596  EKS cluster secret example using argocd-k8s-auth and [IRSA](https://docs.aws.amazon.com/eks/latest/userguide/iam-roles-for-service-accounts.html):
   597  
   598  ```yaml
   599  apiVersion: v1
   600  kind: Secret
   601  metadata:
   602    name: mycluster-secret
   603    labels:
   604      argocd.argoproj.io/secret-type: cluster
   605  type: Opaque
   606  stringData:
   607    name: "eks-cluster-name-for-argo"
   608    server: "https://xxxyyyzzz.xyz.some-region.eks.amazonaws.com"
   609    config: |
   610      {
   611        "awsAuthConfig": {
   612          "clusterName": "my-eks-cluster-name",
   613          "roleARN": "arn:aws:iam::<AWS_ACCOUNT_ID>:role/<IAM_ROLE_NAME>"
   614        },
   615        "tlsClientConfig": {
   616          "insecure": false,
   617          "caData": "<base64 encoded certificate>"
   618        }        
   619      }
   620  ```
   621  
   622  This setup requires:
   623  
   624  1. [IRSA enabled](https://docs.aws.amazon.com/eks/latest/userguide/enable-iam-roles-for-service-accounts.html) on your Argo CD EKS cluster
   625  2. An IAM role ("management role") for your Argo CD EKS cluster that has an appropriate trust policy and permission policies (see below)
   626  3. A role created for each cluster being added to Argo CD that is assumable by the Argo CD management role
   627  4. An [Access Entry](https://docs.aws.amazon.com/eks/latest/userguide/access-entries.html) within each EKS cluster added to Argo CD that gives the cluster's role (from point 3) RBAC permissions
   628  to perform actions within the cluster
   629      - Or, alternatively, an entry within the `aws-auth` ConfigMap within the cluster added to Argo CD ([depreciated by EKS](https://docs.aws.amazon.com/eks/latest/userguide/auth-configmap.html))
   630  
   631  #### Argo CD Management Role
   632  
   633  The role created for Argo CD (the "management role") will need to have a trust policy suitable for assumption by certain 
   634  Argo CD Service Accounts *and by itself*.
   635  
   636  The service accounts that need to assume this role are:
   637  
   638  - `argocd-application-controller`,
   639  - `argocd-applicationset-controller`
   640  - `argocd-server`
   641  
   642  If we create role `arn:aws:iam::<AWS_ACCOUNT_ID>:role/<ARGO_CD_MANAGEMENT_IAM_ROLE_NAME>` for this purpose, the following
   643  is an example trust policy suitable for this need. Ensure that the Argo CD cluster has an [IAM OIDC provider configured](https://docs.aws.amazon.com/eks/latest/userguide/enable-iam-roles-for-service-accounts.html).
   644  
   645  ```json
   646  {
   647      "Version": "2012-10-17",
   648      "Statement": [
   649          {
   650              "Sid": "ExplicitSelfRoleAssumption",
   651              "Effect": "Allow",
   652              "Principal": {
   653                  "AWS": "*"
   654              },
   655              "Action": "sts:AssumeRole",
   656              "Condition": {
   657                  "ArnLike": {
   658                    "aws:PrincipalArn": "arn:aws:iam::<AWS_ACCOUNT_ID>:role/<ARGO_CD_MANAGEMENT_IAM_ROLE_NAME>"
   659                  }
   660              }
   661          },
   662          {
   663              "Sid": "ServiceAccountRoleAssumption",
   664              "Effect": "Allow",
   665              "Principal": {
   666                  "Federated": "arn:aws:iam::<AWS_ACCOUNT_ID>:oidc-provider/oidc.eks.<AWS_REGION>.amazonaws.com/id/EXAMPLED539D4633E53DE1B71EXAMPLE"
   667              },
   668              "Action": "sts:AssumeRoleWithWebIdentity",
   669              "Condition": {
   670                  "StringEquals": {
   671                      "oidc.eks.<AWS_REGION>.amazonaws.com/id/EXAMPLED539D4633E53DE1B71EXAMPLE:sub": [
   672                          "system:serviceaccount:argocd:argocd-application-controller",
   673                          "system:serviceaccount:argocd:argocd-applicationset-controller",
   674                          "system:serviceaccount:argocd:argocd-server"
   675                      ],
   676                      "oidc.eks.<AWS_REGION>.amazonaws.com/id/EXAMPLED539D4633E53DE1B71EXAMPLE:aud": "sts.amazonaws.com"
   677                  }
   678              }
   679          }
   680      ]
   681  }
   682  ```
   683  
   684  #### Argo CD Service Accounts
   685  
   686  The 3 service accounts need to be modified to include an annotation with the Argo CD management role ARN.
   687  
   688  Here's an example service account configurations for `argocd-application-controller`, `argocd-applicationset-controller`, and `argocd-server`.
   689  
   690  !!! warning
   691  Once the annotations has been set on the service accounts, the application controller and server pods need to be restarted.
   692  
   693  ```yaml
   694  apiVersion: v1
   695  kind: ServiceAccount
   696  metadata:
   697    annotations:
   698      eks.amazonaws.com/role-arn: "<arn:aws:iam::<AWS_ACCOUNT_ID>:role/<ARGO_CD_MANAGEMENT_IAM_ROLE_NAME>"
   699    name: argocd-application-controller
   700  ---
   701  apiVersion: v1
   702  kind: ServiceAccount
   703  metadata:
   704    annotations:
   705      eks.amazonaws.com/role-arn: "<arn:aws:iam::<AWS_ACCOUNT_ID>:role/<ARGO_CD_MANAGEMENT_IAM_ROLE_NAME>"
   706    name: argocd-applicationset-controller
   707  ---
   708  apiVersion: v1
   709  kind: ServiceAccount
   710  metadata:
   711    annotations:
   712      eks.amazonaws.com/role-arn: "<arn:aws:iam::<AWS_ACCOUNT_ID>:role/<ARGO_CD_MANAGEMENT_IAM_ROLE_NAME>"
   713    name: argocd-server
   714  ```
   715  
   716  #### IAM Permission Policy
   717  
   718  The Argo CD management role (`arn:aws:iam::<AWS_ACCOUNT_ID>:role/<ARGO_CD_MANAGEMENT_IAM_ROLE_NAME>` in our example) additionally
   719  needs to be allowed to assume a role for each cluster added to Argo CD.
   720  
   721  If we create a role named `<IAM_CLUSTER_ROLE>` for an EKS cluster we are adding to Argo CD, we would update the permission 
   722  policy of the Argo CD management role to include the following:
   723  
   724  ```json
   725  {
   726      "Version" : "2012-10-17",
   727      "Statement" : {
   728        "Effect" : "Allow",
   729        "Action" : "sts:AssumeRole",
   730        "Resource" : [
   731          "arn:aws:iam::<AWS_ACCOUNT_ID>:role/<IAM_CLUSTER_ROLE>"
   732        ]
   733      }
   734    }
   735  ```
   736  
   737  This allows the Argo CD management role to assume the cluster role.
   738  
   739  You can add permissions like above to the Argo CD management role for each cluster being managed by Argo CD (assuming you
   740  create a new role per cluster).
   741  
   742  #### Cluster Role Trust Policies
   743  
   744  As stated, each EKS cluster being added to Argo CD should have its own corresponding role. This role should not have any
   745  permission policies. Instead, it will be used to authenticate against the EKS cluster's API. The Argo CD management role
   746  assumes this role, and calls the AWS API to get an auth token via argocd-k8s-auth. That token is used when connecting to
   747  the added cluster's API endpoint.
   748  
   749  If we create role `arn:aws:iam::<AWS_ACCOUNT_ID>:role/<IAM_CLUSTER_ROLE>` for a cluster being added to Argo CD, we should
   750  set its trust policy to give the Argo CD management role permission to assume it. Note that we're granting the Argo CD 
   751  management role permission to assume this role above, but we also need to permit that action via the cluster role's
   752  trust policy.
   753  
   754  A suitable trust policy allowing the `IAM_CLUSTER_ROLE` to be assumed by the `ARGO_CD_MANAGEMENT_IAM_ROLE_NAME` role looks like this:
   755  
   756  ```json
   757  {
   758      "Version": "2012-10-17",
   759      "Statement": [
   760          {
   761              "Effect": "Allow",
   762              "Principal": {
   763                  "AWS": "arn:aws:iam::<AWS_ACCOUNT_ID>:role/<ARGO_CD_MANAGEMENT_IAM_ROLE_NAME>"
   764              },
   765              "Action": "sts:AssumeRole"
   766          }
   767      ]
   768  }
   769  ```
   770  
   771  #### Access Entries
   772  
   773  Each cluster's role (e.g. `arn:aws:iam::<AWS_ACCOUNT_ID>:role/<IAM_CLUSTER_ROLE>`) has no permission policy. Instead, we
   774  associate that role with an EKS permission policy, which grants that role the ability to generate authentication tokens
   775  to the cluster's API. This EKS permission policy decides what RBAC permissions are granted in that process.
   776  
   777  An [access entry](https://docs.aws.amazon.com/eks/latest/userguide/access-entries.html) (and the policy associated to the role) can be created using the following commands:
   778  
   779  ```bash
   780  # For each cluster being added to Argo CD
   781  aws eks create-access-entry \
   782      --cluster-name my-eks-cluster-name \
   783      --principal-arn arn:aws:iam::<AWS_ACCOUNT_ID>:role/<IAM_CLUSTER_ROLE> \
   784      --type STANDARD \
   785      --kubernetes-groups [] # No groups needed
   786  
   787  aws eks associate-access-policy \
   788      --cluster-name my-eks-cluster-name \
   789      --policy-arn arn:aws:eks::aws:cluster-access-policy/AmazonEKSClusterAdminPolicy \
   790      --access-scope type=cluster \
   791      --principal-arn arn:aws:iam::<AWS_ACCOUNT_ID>:role/<IAM_CLUSTER_ROLE>
   792  ```
   793  
   794  The above role is granted cluster admin permissions via `AmazonEKSClusterAdminPolicy`. The Argo CD management role that
   795  assume this role is therefore granted the same cluster admin permissions when it generates an API token when adding the 
   796  associated EKS cluster.
   797  
   798  **AWS Auth (Deprecated)**
   799  
   800  Instead of using Access Entries, you may need to use the depreciated `aws-auth`.
   801  
   802  If so, the `roleARN` of each managed cluster needs to be added to each respective cluster's `aws-auth` config map (see
   803  [Enabling IAM principal access to your cluster](https://docs.aws.amazon.com/eks/latest/userguide/add-user-role.html)), as
   804  well as having an assume role policy which allows it to be assumed by the Argo CD pod role.
   805  
   806  An example assume role policy for a cluster which is managed by Argo CD:
   807  
   808  ```json
   809  {
   810      "Version" : "2012-10-17",
   811      "Statement" : {
   812        "Effect" : "Allow",
   813        "Action" : "sts:AssumeRole",
   814        "Principal" : {
   815          "AWS" : "<arn:aws:iam::<AWS_ACCOUNT_ID>:role/<ARGO_CD_MANAGEMENT_IAM_ROLE_NAME>"
   816        }
   817      }
   818    }
   819  ```
   820  
   821  Example kube-system/aws-auth configmap for your cluster managed by Argo CD:
   822  
   823  ```yaml
   824  apiVersion: v1
   825  data:
   826    # Other groups and accounts omitted for brevity. Ensure that no other rolearns and/or groups are inadvertently removed, 
   827    # or you risk borking access to your cluster.
   828    #
   829    # The group name is a RoleBinding which you use to map to a [Cluster]Role. See https://kubernetes.io/docs/reference/access-authn-authz/rbac/#role-binding-examples  
   830    mapRoles: |
   831      - "groups":
   832        - "<GROUP-NAME-IN-K8S-RBAC>"
   833        "rolearn": "arn:aws:iam::<AWS_ACCOUNT_ID>:role/<IAM_CLUSTER_ROLE>"
   834        "username": "arn:aws:iam::<AWS_ACCOUNT_ID>:role/<IAM_CLUSTER_ROLE>"
   835  ```
   836  
   837  Use the role ARN for both `rolearn` and `username`.
   838  
   839  #### Alternative EKS Authentication Methods
   840  In some scenarios it may not be possible to use IRSA, such as when the Argo CD cluster is running on a different cloud
   841  provider's platform. In this case, there are two options:
   842  1. Use `execProviderConfig` to call the AWS authentication mechanism which enables the injection of environment variables to supply credentials
   843  2. Leverage the new AWS profile option available in Argo CD release 2.10
   844  
   845  Both of these options will require the steps involving IAM and the `aws-auth` config map (defined above) to provide the 
   846  principal with access to the cluster.
   847  
   848  ##### Using execProviderConfig with Environment Variables
   849  ```yaml
   850  ---
   851  apiVersion: v1
   852  kind: Secret
   853  metadata:
   854    name: mycluster-secret
   855    labels:
   856      argocd.argoproj.io/secret-type: cluster
   857  type: Opaque
   858  stringData:
   859    name: mycluster
   860    server: https://mycluster.example.com
   861    namespaces: "my,managed,namespaces"
   862    clusterResources: "true"
   863    config: |
   864      {
   865        "execProviderConfig": {
   866          "command": "argocd-k8s-auth",
   867          "args": ["aws", "--cluster-name", "my-eks-cluster"],
   868          "apiVersion": "client.authentication.k8s.io/v1beta1",
   869          "env": {
   870            "AWS_REGION": "xx-east-1",
   871            "AWS_ACCESS_KEY_ID": "{{ .aws_key_id }}",
   872            "AWS_SECRET_ACCESS_KEY": "{{ .aws_key_secret }}",
   873            "AWS_SESSION_TOKEN": "{{ .aws_token }}"
   874          }
   875        },
   876        "tlsClientConfig": {
   877          "insecure": false,
   878          "caData": "{{ .cluster_cert }}"
   879        }
   880      }
   881  ```
   882  
   883  This example assumes that the role being attached to the credentials that have been supplied, if this is not the case
   884  the role can be appended to the `args` section like so:
   885  
   886  ```yaml
   887  ...
   888      "args": ["aws", "--cluster-name", "my-eks-cluster", "--role-arn", "arn:aws:iam::<AWS_ACCOUNT_ID>:role/<IAM_ROLE_NAME>"],
   889  ...
   890  ```
   891  This construct can be used in conjunction with something like the External Secrets Operator to avoid storing the keys in
   892  plain text and additionally helps to provide a foundation for key rotation.
   893  
   894  ##### Using An AWS Profile For Authentication
   895  The option to use profiles, added in release 2.10, provides a method for supplying credentials while still using the
   896  standard Argo CD EKS cluster declaration with an additional command flag that points to an AWS credentials file:
   897  ```yaml
   898  apiVersion: v1
   899  kind: Secret
   900  metadata:
   901    name: mycluster-secret
   902    labels:
   903      argocd.argoproj.io/secret-type: cluster
   904  type: Opaque
   905  stringData:
   906    name: "mycluster.com"
   907    server: "https://mycluster.com"
   908    config: |
   909      {
   910        "awsAuthConfig": {
   911          "clusterName": "my-eks-cluster-name",
   912          "roleARN": "arn:aws:iam::<AWS_ACCOUNT_ID>:role/<IAM_ROLE_NAME>",
   913          "profile": "/mount/path/to/my-profile-file"
   914        },
   915        "tlsClientConfig": {
   916          "insecure": false,
   917          "caData": "<base64 encoded certificate>"
   918        }        
   919      }
   920  ```
   921  This will instruct Argo CD to read the file at the provided path and use the credentials defined within to authenticate to AWS. 
   922  The profile must be mounted in both the `argocd-server` and `argocd-application-controller` components in order for this to work.
   923  For example, the following values can be defined in a Helm-based Argo CD deployment:
   924  
   925  ```yaml
   926  controller:
   927    extraVolumes:
   928      - name: my-profile-volume
   929        secret:
   930          secretName: my-aws-profile
   931          items:
   932            - key: my-profile-file
   933              path: my-profile-file
   934    extraVolumeMounts:
   935      - name: my-profile-mount
   936        mountPath: /mount/path/to
   937        readOnly: true
   938  
   939  server:
   940    extraVolumes:
   941      - name: my-profile-volume
   942        secret:
   943          secretName: my-aws-profile
   944          items:
   945            - key: my-profile-file
   946              path: my-profile-file
   947    extraVolumeMounts:
   948      - name: my-profile-mount
   949        mountPath: /mount/path/to
   950        readOnly: true
   951  ```
   952  
   953  Where the secret is defined as follows:
   954  ```yaml
   955  apiVersion: v1
   956  kind: Secret
   957  metadata:
   958    name: my-aws-profile
   959  type: Opaque
   960  stringData:
   961    my-profile-file: |
   962      [default]
   963      region = <aws_region>
   964      aws_access_key_id = <aws_access_key_id>
   965      aws_secret_access_key = <aws_secret_access_key>
   966      aws_session_token = <aws_session_token>
   967  ```
   968  
   969  > ⚠️ Secret mounts are updated on an interval, not real time. If rotation is a requirement ensure the token lifetime outlives the mount update interval and the rotation process doesn't immediately invalidate the existing token
   970  
   971  
   972  ### GKE
   973  
   974  GKE cluster secret example using argocd-k8s-auth and [Workload Identity](https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity):
   975  
   976  ```yaml
   977  apiVersion: v1
   978  kind: Secret
   979  metadata:
   980    name: mycluster-secret
   981    labels:
   982      argocd.argoproj.io/secret-type: cluster
   983  type: Opaque
   984  stringData:
   985    name: mycluster.example.com
   986    server: https://mycluster.example.com
   987    config: |
   988      {
   989        "execProviderConfig": {
   990          "command": "argocd-k8s-auth",
   991          "args": ["gcp"],
   992          "apiVersion": "client.authentication.k8s.io/v1beta1"
   993        },
   994        "tlsClientConfig": {
   995          "insecure": false,
   996          "caData": "<base64 encoded certificate>"
   997        }
   998      }
   999  ```
  1000  
  1001  Note that you must enable Workload Identity on your GKE cluster, create GCP service account with appropriate IAM role and bind it to Kubernetes service account for argocd-application-controller and argocd-server (showing Pod logs on UI). See [Use Workload Identity](https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity) and [Authenticating to the Kubernetes API server](https://cloud.google.com/kubernetes-engine/docs/how-to/api-server-authentication).
  1002  
  1003  ### AKS
  1004  
  1005  Azure cluster secret example using argocd-k8s-auth and [kubelogin](https://github.com/Azure/kubelogin).  The option *azure* to the argocd-k8s-auth execProviderConfig encapsulates the *get-token* command for kubelogin.  Depending upon which authentication flow is desired (devicecode, spn, ropc, msi, azurecli, workloadidentity), set the environment variable AAD_LOGIN_METHOD with this value.  Set other appropriate environment variables depending upon which authentication flow is desired.
  1006  
  1007  |Variable Name|Description|
  1008  |-------------|-----------|
  1009  |AAD_LOGIN_METHOD|One of devicecode, spn, ropc, msi, azurecli, or workloadidentity|
  1010  |AZURE_CLIENT_CERTIFICATE_PATH|Path to AAD client cert in pfx.  Used in spn login and WorkloadIdentityLogin flow|
  1011  |AZURE_CLIENT_CERTIFICATE_PASSWORD|Password for the client cert in pfx.  Used in spn login|
  1012  |AZURE_CLIENT_ID|AAD client application ID|
  1013  |AZURE_CLIENT_SECRET|AAD client application secret|
  1014  |AAD_USER_PRINCIPAL_NAME|Used in the ropc flow|
  1015  |AAD_USER_PRINCIPAL_PASSWORD|Used in the ropc flow|
  1016  |AZURE_TENANT_ID|The AAD tenant ID.|
  1017  |AZURE_AUTHORITY_HOST|Used in the WorkloadIdentityLogin flow|
  1018  |AZURE_FEDERATED_TOKEN_FILE|Used in the WorkloadIdentityLogin flow|
  1019  
  1020  In addition to the environment variables above, argocd-k8s-auth accepts two extra environment variables to set the AAD environment, and to set the AAD server application ID.  The AAD server application ID will default to 6dae42f8-4368-4678-94ff-3960e28e3630 if not specified.  See [here](https://github.com/azure/kubelogin#exec-plugin-format) for details.
  1021  
  1022  |Variable Name|Description|
  1023  |-------------|-----------|
  1024  |AAD_ENVIRONMENT_NAME|The azure environment to use, default of AzurePublicCloud|
  1025  |AAD_SERVER_APPLICATION_ID|The optional AAD server application ID, defaults to 6dae42f8-4368-4678-94ff-3960e28e3630|
  1026  
  1027  This is an example of using the [federated workload login flow](https://github.com/Azure/kubelogin#azure-workload-federated-identity-non-interactive).  The federated token file needs to be mounted as a secret into argoCD, so it can be used in the flow.  The location of the token file needs to be set in the environment variable AZURE_FEDERATED_TOKEN_FILE.
  1028  
  1029  If your AKS cluster utilizes the [Mutating Admission Webhook](https://azure.github.io/azure-workload-identity/docs/installation/mutating-admission-webhook.html) from the Azure Workload Identity project, follow these steps to enable the `argocd-application-controller` and `argocd-server` pods to use the federated identity:
  1030  
  1031  1. **Label the Pods**: Add the `azure.workload.identity/use: "true"` label to the `argocd-application-controller` and `argocd-server` pods.
  1032  
  1033  2. **Create Federated Identity Credential**: Generate an Azure federated identity credential for the `argocd-application-controller` and `argocd-server` service accounts. Refer to the [Federated Identity Credential](https://azure.github.io/azure-workload-identity/docs/topics/federated-identity-credential.html) documentation for detailed instructions.
  1034  
  1035  3. **Add Annotations to Service Account** Add `"azure.workload.identity/client-id": "$CLIENT_ID"` and `"azure.workload.identity/tenant-id": "$TENANT_ID"` annotations to the `argocd-application-controller` and `argocd-server` service accounts using the details from the federated credential.
  1036  
  1037  4. **Set the AZURE_CLIENT_ID**: Update the `AZURE_CLIENT_ID` in the cluster secret to match the client id of the newly created federated identity credential.
  1038  
  1039  
  1040  ```yaml
  1041  apiVersion: v1
  1042  kind: Secret
  1043  metadata:
  1044    name: mycluster-secret
  1045    labels:
  1046      argocd.argoproj.io/secret-type: cluster
  1047  type: Opaque
  1048  stringData:
  1049    name: mycluster.example.com
  1050    server: https://mycluster.example.com
  1051    config: |
  1052      {
  1053        "execProviderConfig": {
  1054          "command": "argocd-k8s-auth",
  1055          "env": {
  1056            "AAD_ENVIRONMENT_NAME": "AzurePublicCloud",
  1057            "AZURE_CLIENT_ID": "fill in client id",
  1058            "AZURE_TENANT_ID": "fill in tenant id", # optional, injected by workload identity mutating admission webhook if enabled
  1059            "AZURE_FEDERATED_TOKEN_FILE": "/opt/path/to/federated_file.json", # optional, injected by workload identity mutating admission webhook if enabled
  1060            "AZURE_AUTHORITY_HOST": "https://login.microsoftonline.com/", # optional, injected by workload identity mutating admission webhook if enabled
  1061            "AAD_LOGIN_METHOD": "workloadidentity"
  1062          },
  1063          "args": ["azure"],
  1064          "apiVersion": "client.authentication.k8s.io/v1beta1"
  1065        },
  1066        "tlsClientConfig": {
  1067          "insecure": false,
  1068          "caData": "<base64 encoded certificate>"
  1069        }
  1070      }
  1071  ```
  1072  
  1073  This is an example of using the spn (service principal name) flow.
  1074  
  1075  ```yaml
  1076  apiVersion: v1
  1077  kind: Secret
  1078  metadata:
  1079    name: mycluster-secret
  1080    labels:
  1081      argocd.argoproj.io/secret-type: cluster
  1082  type: Opaque
  1083  stringData:
  1084    name: mycluster.example.com
  1085    server: https://mycluster.example.com
  1086    config: |
  1087      {
  1088        "execProviderConfig": {
  1089          "command": "argocd-k8s-auth",
  1090          "env": {
  1091            "AAD_ENVIRONMENT_NAME": "AzurePublicCloud",
  1092            "AZURE_CLIENT_SECRET": "fill in your service principal client secret",
  1093            "AZURE_TENANT_ID": "fill in tenant id",
  1094            "AZURE_CLIENT_ID": "fill in your service principal client id",
  1095            "AAD_LOGIN_METHOD": "spn"
  1096          },
  1097          "args": ["azure"],
  1098          "apiVersion": "client.authentication.k8s.io/v1beta1"
  1099        },
  1100        "tlsClientConfig": {
  1101          "insecure": false,
  1102          "caData": "<base64 encoded certificate>"
  1103        }
  1104      }
  1105  ```
  1106  
  1107  ## Helm
  1108  
  1109  Helm charts can be sourced from a Helm repository or OCI registry.
  1110  
  1111  This is an example of a Helm chart being sourced from a Helm repository. The `releaseName` property is used to customize the name of the Helm _release_.
  1112  
  1113  ```yaml
  1114  apiVersion: argoproj.io/v1alpha1
  1115  kind: Application
  1116  metadata:
  1117    name: sealed-secrets
  1118    namespace: argocd
  1119  spec:
  1120    project: default
  1121    source:
  1122      chart: sealed-secrets
  1123      repoURL: https://bitnami-labs.github.io/sealed-secrets
  1124      targetRevision: 1.16.1
  1125      helm:
  1126        releaseName: sealed-secrets
  1127    destination:
  1128      server: "https://kubernetes.default.svc"
  1129      namespace: kubeseal
  1130  ```
  1131  
  1132  Another example using a public OCI helm chart:
  1133  
  1134  ```yaml
  1135  apiVersion: argoproj.io/v1alpha1
  1136  kind: Application
  1137  metadata:
  1138    name: nginx
  1139  spec:
  1140    project: default
  1141    source:
  1142      chart: nginx
  1143      repoURL: registry-1.docker.io/bitnamicharts  # note: the oci:// syntax is not included.
  1144      targetRevision: 15.9.0
  1145    destination:
  1146      name: "in-cluster"
  1147      namespace: nginx
  1148  ```
  1149  
  1150  Helm charts located in sources that require additional configuration, such as authentication or TLS connection details, are defined within a _repository_ Secret. Each Secret must specify the `url`, `type` and `name` fields. Additional fields including `username`, `password`, `tlsClientCertData` and `tlsClientCertKey` can be specified as desired.
  1151  
  1152  Helm Chart Repository:
  1153  
  1154  ```yaml
  1155  apiVersion: v1
  1156  kind: Secret
  1157  metadata:
  1158    name: argo-helm
  1159    namespace: argocd
  1160    labels:
  1161      argocd.argoproj.io/secret-type: repository
  1162  stringData:
  1163    name: argo
  1164    url: https://argoproj.github.io/argo-helm
  1165    type: helm
  1166    username: my-username
  1167    password: my-password
  1168    tlsClientCertData: ...
  1169    tlsClientCertKey: ...
  1170  ```
  1171  
  1172  Helm charts sourced from OCI registries should utilize the fields described previously as well as set the `enableOCI` field as `true`.
  1173  
  1174  ```yaml
  1175  apiVersion: v1
  1176  kind: Secret
  1177  metadata:
  1178    name: oci-helm-chart
  1179    namespace: oci-helm-chart
  1180    labels:
  1181      argocd.argoproj.io/secret-type: repository
  1182  stringData:
  1183    name: oci-helm-chart
  1184    url: myregistry.example.com
  1185    type: helm
  1186    enableOCI: "true"
  1187  ```
  1188  
  1189  ## Resource Exclusion/Inclusion
  1190  
  1191  Resources can be excluded from discovery and sync so that Argo CD is unaware of them. For example, the apiGroup/kind `events.k8s.io/*`, `metrics.k8s.io/*` and `coordination.k8s.io/Lease` are always excluded. Use cases:
  1192  
  1193  * You have temporal issues and you want to exclude problematic resources.
  1194  * There are many of a kind of resources that impacts Argo CD's performance.
  1195  * Restrict Argo CD's access to certain kinds of resources, e.g. secrets. See [security.md#cluster-rbac](security.md#cluster-rbac).
  1196  
  1197  To configure this, edit the `argocd-cm` config map:
  1198  
  1199  ```shell
  1200  kubectl edit configmap argocd-cm -n argocd
  1201  ```
  1202  
  1203  Add `resource.exclusions`, e.g.:
  1204  
  1205  ```yaml
  1206  apiVersion: v1
  1207  data:
  1208    resource.exclusions: |
  1209      - apiGroups:
  1210        - "*"
  1211        kinds:
  1212        - "*"
  1213        clusters:
  1214        - https://192.168.0.20
  1215  kind: ConfigMap
  1216  ```
  1217  
  1218  The `resource.exclusions` node is a list of objects. Each object can have:
  1219  
  1220  * `apiGroups` A list of globs to match the API group.
  1221  * `kinds` A list of kinds to match. Can be `"*"` to match all.
  1222  * `clusters` A list of globs to match the cluster.
  1223  
  1224  If all three match, then the resource is ignored.
  1225  
  1226  In addition to exclusions, you might configure the list of included resources using the `resource.inclusions` setting.
  1227  By default, all resource group/kinds are included. The `resource.inclusions` setting allows customizing the list of included group/kinds:
  1228  
  1229  ```yaml
  1230  apiVersion: v1
  1231  data:
  1232    resource.inclusions: |
  1233      - apiGroups:
  1234        - "*"
  1235        kinds:
  1236        - Deployment
  1237        clusters:
  1238        - https://192.168.0.20
  1239  kind: ConfigMap
  1240  ```
  1241  
  1242  The `resource.inclusions` and `resource.exclusions` might be used together. The final list of resources includes group/kinds specified in `resource.inclusions` minus group/kinds
  1243  specified in `resource.exclusions` setting.
  1244  
  1245  Notes:
  1246  
  1247  * Quote globs in your YAML to avoid parsing errors.
  1248  * Invalid globs result in the whole rule being ignored.
  1249  * If you add a rule that matches existing resources, these will appear in the interface as `OutOfSync`.
  1250  * Some excluded objects may already be in the controller cache. A restart of the controller will be necessary to remove them from the Application View.
  1251  
  1252  ## Mask sensitive Annotations on Secrets
  1253  
  1254  An optional comma-separated list of `metadata.annotations` keys can be configured with `resource.sensitive.mask.annotations` to mask their values in UI/CLI on Secrets.
  1255  
  1256  ```yaml
  1257    resource.sensitive.mask.annotations: openshift.io/token-secret.value, api-key
  1258  ```
  1259  
  1260  ## Auto respect RBAC for controller
  1261  
  1262  Argo CD controller can be restricted from discovering/syncing specific resources using just controller RBAC, without having to manually configure resource exclusions.
  1263  This feature can be enabled by setting `resource.respectRBAC` key in argocd cm, once it is set the controller will automatically stop watching for resources 
  1264  that it does not have the permission to list/access. Possible values for `resource.respectRBAC` are:
  1265      - `strict` : This setting checks whether the list call made by controller is forbidden/unauthorized and if it is, it will cross-check the permission by making a `SelfSubjectAccessReview` call for the resource.
  1266      - `normal` : This will only check whether the list call response is forbidden/unauthorized and skip `SelfSubjectAccessReview` call, to minimize any extra api-server calls.
  1267      - unset/empty (default) : This will disable the feature and controller will continue to monitor all resources.
  1268  
  1269  Users who are comfortable with an increase in kube api-server calls can opt for `strict` option while users who are concerned with higher api calls and are willing to compromise on the accuracy can opt for the `normal` option.
  1270  
  1271  Notes:
  1272  
  1273  * When set to use `strict` mode controller must have RBAC permission to `create` a `SelfSubjectAccessReview` resource 
  1274  * The `SelfSubjectAccessReview` request will be only made for the `list` verb, it is assumed that if `list` is allowed for a resource then all other permissions are also available to the controller.
  1275  
  1276  Example argocd cm with `resource.respectRBAC` set to `strict`:
  1277  
  1278  ```yaml
  1279  apiVersion: v1
  1280  kind: ConfigMap
  1281  metadata:
  1282    name: argocd-cm
  1283  data:
  1284    resource.respectRBAC: "strict"
  1285  ```
  1286  
  1287  ## Resource Custom Labels
  1288  
  1289  Custom Labels configured with `resource.customLabels` (comma separated string) will be displayed in the UI (for any resource that defines them).
  1290  
  1291  ## Labels on Application Events
  1292  
  1293  An optional comma-separated list of `metadata.labels` keys can be configured with `resource.includeEventLabelKeys` to add to Kubernetes events generated for Argo CD Applications. When events are generated for Applications containing the specified labels, the controller adds the matching labels to the event. This establishes an easy link between the event and the application, allowing for filtering using labels. In case of conflict between labels on the Application and AppProject, the Application label values are prioritized and added to the event.
  1294  
  1295  ```yaml
  1296    resource.includeEventLabelKeys: team,env*
  1297  ```
  1298  
  1299  To exclude certain labels from events, use the `resource.excludeEventLabelKeys` key, which takes a comma-separated list of `metadata.labels` keys.
  1300  
  1301  ```yaml
  1302    resource.excludeEventLabelKeys: environment,bu
  1303  ```
  1304  
  1305  Both `resource.includeEventLabelKeys` and `resource.excludeEventLabelKeys` support wildcards.
  1306  
  1307  ## SSO & RBAC
  1308  
  1309  * SSO configuration details: [SSO](./user-management/index.md)
  1310  * RBAC configuration details: [RBAC](./rbac.md)
  1311  
  1312  ## Manage Argo CD Using Argo CD
  1313  
  1314  Argo CD is able to manage itself since all settings are represented by Kubernetes manifests. The suggested way is to create [Kustomize](https://github.com/kubernetes-sigs/kustomize)
  1315  based application which uses base Argo CD manifests from [https://github.com/argoproj/argo-cd](https://github.com/argoproj/argo-cd/tree/stable/manifests) and apply required changes on top.
  1316  
  1317  Example of `kustomization.yaml`:
  1318  
  1319  ```yaml
  1320  # additional resources like ingress rules, cluster and repository secrets.
  1321  resources:
  1322  - github.com/argoproj/argo-cd//manifests/cluster-install?ref=stable
  1323  - clusters-secrets.yaml
  1324  - repos-secrets.yaml
  1325  
  1326  # changes to config maps
  1327  patches:
  1328  - path: overlays/argo-cd-cm.yaml
  1329  ```
  1330  
  1331  The live example of self managed Argo CD config is available at [https://cd.apps.argoproj.io](https://cd.apps.argoproj.io) and with configuration
  1332  stored at [argoproj/argoproj-deployments](https://github.com/argoproj/argoproj-deployments/tree/master/argocd).
  1333  
  1334  !!! note
  1335      You will need to sign-in using your GitHub account to get access to [https://cd.apps.argoproj.io](https://cd.apps.argoproj.io)