github.com/argoproj/argo-cd@v1.8.7/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 | File Name | Resource Name | Kind | Description | 8 |-----------|---------------|------|-------------| 9 | [`argocd-cm.yaml`](argocd-cm.yaml) | argocd-cm | ConfigMap | General Argo CD configuration | 10 | [`argocd-secret.yaml`](argocd-secret.yaml) | argocd-secret | Secret | Password, Certificates, Signing Key | 11 | [`argocd-rbac-cm.yaml`](argocd-rbac-cm.yaml) | argocd-rbac-cm | ConfigMap | RBAC Configuration | 12 | [`argocd-tls-certs-cm.yaml`](argocd-tls-certs-cm.yaml) | argocd-tls-certs-cm | ConfigMap | Custom TLS certificates for connecting Git repositories via HTTPS (v1.2 and later) | 13 | [`argocd-ssh-known-hosts-cm.yaml`](argocd-ssh-known-hosts-cm.yaml) | argocd-ssh-known-hosts-cm | ConfigMap | SSH known hosts data for connecting Git repositories via SSH (v1.2 and later) | 14 | [`application.yaml`](application.yaml) | - | Application | Example application spec | 15 | [`project.yaml`](project.yaml) | - | AppProject | Example project spec | 16 17 All resources, including `Application` and `AppProject` specs, have to be installed in the ArgoCD namespace (by default `argocd`). Also, ConfigMap and Secret resources need to be named as shown in the table above. For `Application` and `AppProject` resources, the name of the resource equals the name of the application or project within ArgoCD. This also means that application and project names are unique within the same ArgoCD installation - you cannot i.e. have the same application name for two different applications. 18 19 !!!warning "A note about ConfigMap resources" 20 Be sure to annotate your ConfigMap resources using the label `app.kubernetes.io/part-of: argocd`, otherwise ArgoCD will not be able to use them. 21 22 ## Applications 23 24 The Application CRD is the Kubernetes resource object representing a deployed application instance 25 in an environment. It is defined by two key pieces of information: 26 27 * `source` reference to the desired state in Git (repository, revision, path, environment) 28 * `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). Behind the hood when the server is missing, it is being calculated based on the name and then the server is used for any operations. 29 30 A minimal Application spec is as follows: 31 32 ```yaml 33 apiVersion: argoproj.io/v1alpha1 34 kind: Application 35 metadata: 36 name: guestbook 37 namespace: argocd 38 spec: 39 project: default 40 source: 41 repoURL: https://github.com/argoproj/argocd-example-apps.git 42 targetRevision: HEAD 43 path: guestbook 44 destination: 45 server: https://kubernetes.default.svc 46 namespace: guestbook 47 ``` 48 49 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 already apply this with `kubectl apply -n argocd -f application.yaml` and Argo CD will start deploying the guestbook application. 50 51 !!! note 52 The namespace must match the namespace of your Argo cd, typically this is `argocd`. 53 54 !!! note 55 When creating an application from a Helm repository, the `chart` attribute must be specified instead of the `path` attribute within `spec.source`. 56 57 ```yaml 58 spec: 59 source: 60 repoURL: https://argoproj.github.io/argo-helm 61 chart: argo 62 ``` 63 64 !!! warning 65 By default, deleting an application will not perform a cascade delete, thereby deleting its resources. You must add the finalizer if you want this behaviour - which you may well not want. 66 67 ```yaml 68 metadata: 69 finalizers: 70 - resources-finalizer.argocd.argoproj.io 71 ``` 72 73 ### App of Apps 74 75 You can create an app that creates other apps, which in turn can create other apps. 76 This allows you to declaratively manage a group of app that can be deployed and configured in concert. 77 78 See [cluster bootstrapping](cluster-bootstrapping.md). 79 80 ## Projects 81 82 The AppProject CRD is the Kubernetes resource object representing a logical grouping of applications. 83 It is defined by the following key pieces of information: 84 85 * `sourceRepos` reference to the repositories that applications within the project can pull manifests from. 86 * `destinations` reference to clusters and namespaces that applications within the project can deploy into (don't use the name field, only server is being matched). 87 * `roles` list of entities with definitions of their access to resources within the project. 88 89 An example spec is as follows: 90 91 ```yaml 92 apiVersion: argoproj.io/v1alpha1 93 kind: AppProject 94 metadata: 95 name: my-project 96 namespace: argocd 97 # Finalizer that ensures that project is not deleted until it is not referenced by any application 98 finalizers: 99 - resources-finalizer.argocd.argoproj.io 100 spec: 101 description: Example Project 102 # Allow manifests to deploy from any Git repos 103 sourceRepos: 104 - '*' 105 # Only permit applications to deploy to the guestbook namespace in the same cluster 106 destinations: 107 - namespace: guestbook 108 server: https://kubernetes.default.svc 109 # Deny all cluster-scoped resources from being created, except for Namespace 110 clusterResourceWhitelist: 111 - group: '' 112 kind: Namespace 113 # Allow all namespaced-scoped resources to be created, except for ResourceQuota, LimitRange, NetworkPolicy 114 namespaceResourceBlacklist: 115 - group: '' 116 kind: ResourceQuota 117 - group: '' 118 kind: LimitRange 119 - group: '' 120 kind: NetworkPolicy 121 # Deny all namespaced-scoped resources from being created, except for Deployment and StatefulSet 122 namespaceResourceWhitelist: 123 - group: 'apps' 124 kind: Deployment 125 - group: 'apps' 126 kind: StatefulSet 127 roles: 128 # A role which provides read-only access to all applications in the project 129 - name: read-only 130 description: Read-only privileges to my-project 131 policies: 132 - p, proj:my-project:read-only, applications, get, my-project/*, allow 133 groups: 134 - my-oidc-group 135 # A role which provides sync privileges to only the guestbook-dev application, e.g. to provide 136 # sync privileges to a CI system 137 - name: ci-role 138 description: Sync privileges for guestbook-dev 139 policies: 140 - p, proj:my-project:ci-role, applications, sync, my-project/guestbook-dev, allow 141 # NOTE: JWT tokens can only be generated by the API server and the token is not persisted 142 # anywhere by Argo CD. It can be prematurely revoked by removing the entry from this list. 143 jwtTokens: 144 - iat: 1535390316 145 ``` 146 147 ## Repositories 148 149 !!!note 150 Some Git hosters - notably GitLab and possibly on-premise GitLab instances as well - require you to 151 specify the `.git` suffix in the repository URL, otherwise they will send a HTTP 301 redirect to the 152 repository URL suffixed with `.git`. ArgoCD will **not** follow these redirects, so you have to 153 adapt your repository URL to be suffixed with `.git`. 154 155 Repository credentials are stored in secret. Use following steps to configure a repo: 156 157 1. Create secret which contains repository credentials. Consider using [bitnami-labs/sealed-secrets](https://github.com/bitnami-labs/sealed-secrets) to store encrypted secret 158 definition as a Kubernetes manifest. 159 2. Register repository in the `argocd-cm` config map. Each repository must have `url` field and, depending on whether you connect using HTTPS or SSH, `usernameSecret` and `passwordSecret` (for HTTPS) or `sshPrivateKeySecret` (for SSH). 160 161 Example for HTTPS: 162 163 ```yaml 164 apiVersion: v1 165 kind: ConfigMap 166 metadata: 167 name: argocd-cm 168 namespace: argocd 169 labels: 170 app.kubernetes.io/name: argocd-cm 171 app.kubernetes.io/part-of: argocd 172 data: 173 repositories: | 174 - url: https://github.com/argoproj/my-private-repository 175 passwordSecret: 176 name: my-secret 177 key: password 178 usernameSecret: 179 name: my-secret 180 key: username 181 ``` 182 183 Example for SSH: 184 185 ```yaml 186 apiVersion: v1 187 kind: ConfigMap 188 metadata: 189 name: argocd-cm 190 namespace: argocd 191 labels: 192 app.kubernetes.io/name: argocd-cm 193 app.kubernetes.io/part-of: argocd 194 data: 195 repositories: | 196 - url: git@github.com:argoproj/my-private-repository 197 sshPrivateKeySecret: 198 name: my-secret 199 key: sshPrivateKey 200 ``` 201 202 !!! tip 203 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). 204 205 ### Repository Credentials 206 207 > Earlier than v1.4 208 209 If you want to use the same credentials for multiple repositories, you can use `repository.credentials`: 210 211 ```yaml 212 apiVersion: v1 213 kind: ConfigMap 214 metadata: 215 name: argocd-cm 216 namespace: argocd 217 labels: 218 app.kubernetes.io/name: argocd-cm 219 app.kubernetes.io/part-of: argocd 220 data: 221 repositories: | 222 - url: https://github.com/argoproj/private-repo 223 - url: https://github.com/argoproj/other-private-repo 224 repository.credentials: | 225 - url: https://github.com/argoproj 226 passwordSecret: 227 name: my-secret 228 key: password 229 usernameSecret: 230 name: my-secret 231 key: username 232 - url: git@github.com:argoproj-labs 233 sshPrivateKeySecret: 234 name: my-secret 235 key: sshPrivateKey 236 ``` 237 238 Argo CD will only use the credentials if you omit `usernameSecret`, `passwordSecret`, and `sshPrivateKeySecret` fields (`insecureIgnoreHostKey` is ignored) or if your repository is not listed in `repositories`. 239 240 A credential may be match if it's URL is the prefix of the repository's URL. The means that credentials may match, e.g in the above example both [https://github.com/argoproj](https://github.com/argoproj) and [https://github.com](https://github.com) would match. Argo CD selects the first one that matches. 241 242 !!! tip 243 Order your credentials with the most specific at the top and the least specific at the bottom. 244 245 A complete example. 246 247 ```yaml 248 apiVersion: v1 249 kind: ConfigMap 250 metadata: 251 name: argocd-cm 252 namespace: argocd 253 labels: 254 app.kubernetes.io/name: argocd-cm 255 app.kubernetes.io/part-of: argocd 256 data: 257 repositories: | 258 # this has it's own credentials 259 - url: https://github.com/argoproj/private-repo 260 passwordSecret: 261 name: private-repo-secret 262 key: password 263 usernameSecret: 264 name: private-repo-secret 265 key: username 266 sshPrivateKeySecret: 267 name: private-repo-secret 268 key: sshPrivateKey 269 - url: https://github.com/argoproj/other-private-repo 270 - url: https://github.com/otherproj/another-private-repo 271 repository.credentials: | 272 # this will be used for the second repo 273 - url: https://github.com/argoproj 274 passwordSecret: 275 name: other-private-repo-secret 276 key: password 277 usernameSecret: 278 name: other-private-repo-secret 279 key: username 280 sshPrivateKeySecret: 281 name: other-private-repo-secret 282 key: sshPrivateKey 283 # this will be used for the third repo 284 - url: https://github.com 285 passwordSecret: 286 name: another-private-repo-secret 287 key: password 288 usernameSecret: 289 name: another-private-repo-secret 290 key: username 291 sshPrivateKeySecret: 292 name: another-private-repo-secret 293 key: sshPrivateKey 294 ``` 295 296 > v1.4 or later 297 298 If you want to use the same credentials for multiple repositories, you can use `repository.credentials` to configure credential templates. Credential templates can carry the same credentials information as repositories. 299 300 ```yaml 301 apiVersion: v1 302 kind: ConfigMap 303 metadata: 304 name: argocd-cm 305 namespace: argocd 306 labels: 307 app.kubernetes.io/name: argocd-cm 308 app.kubernetes.io/part-of: argocd 309 data: 310 repositories: | 311 - url: https://github.com/argoproj/private-repo 312 - url: https://github.com/argoproj/other-private-repo 313 repository.credentials: | 314 - url: https://github.com/argoproj 315 passwordSecret: 316 name: my-secret 317 key: password 318 usernameSecret: 319 name: my-secret 320 key: username 321 ``` 322 323 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 `my-secret` for connecting to Git. 324 325 In order for ArgoCD to use a credential template for any given repository, the following conditions must be met: 326 327 * The repository must either not be configured at all, or if configured, must not contain any credential information (i.e. contain none of `sshPrivateKeySecret`, `usernameSecret`, `passwordSecret` ) 328 * 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`). 329 330 !!! note 331 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. 332 333 The following keys are valid to refer to credential secrets: 334 335 #### SSH repositories 336 337 * `sshPrivateKeySecret` refers to a secret where an SSH private key is stored for accessing the repositories 338 339 #### HTTPS repositories 340 341 * `usernameSecret` and `passwordSecret` refer to secrets where username and/or password are stored for accessing the repositories 342 * `tlsClientCertData` and `tlsClientCertKey` refer to secrets where a TLS client certificate (`tlsClientCertData`) and the corresponding private key `tlsClientCertKey` are stored for accessing the repositories 343 344 345 ### Repositories using self-signed TLS certificates (or are signed by custom CA) 346 347 > v1.2 or later 348 349 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. 350 351 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. 352 353 An example ConfigMap object: 354 355 ```yaml 356 apiVersion: v1 357 kind: ConfigMap 358 metadata: 359 name: argocd-tls-certs-cm 360 namespace: argocd 361 labels: 362 app.kubernetes.io/name: argocd-cm 363 app.kubernetes.io/part-of: argocd 364 data: 365 server.example.com: | 366 -----BEGIN CERTIFICATE----- 367 MIIF1zCCA7+gAwIBAgIUQdTcSHY2Sxd3Tq/v1eIEZPCNbOowDQYJKoZIhvcNAQEL 368 BQAwezELMAkGA1UEBhMCREUxFTATBgNVBAgMDExvd2VyIFNheG9ueTEQMA4GA1UE 369 BwwHSGFub3ZlcjEVMBMGA1UECgwMVGVzdGluZyBDb3JwMRIwEAYDVQQLDAlUZXN0 370 c3VpdGUxGDAWBgNVBAMMD2Jhci5leGFtcGxlLmNvbTAeFw0xOTA3MDgxMzU2MTda 371 Fw0yMDA3MDcxMzU2MTdaMHsxCzAJBgNVBAYTAkRFMRUwEwYDVQQIDAxMb3dlciBT 372 YXhvbnkxEDAOBgNVBAcMB0hhbm92ZXIxFTATBgNVBAoMDFRlc3RpbmcgQ29ycDES 373 MBAGA1UECwwJVGVzdHN1aXRlMRgwFgYDVQQDDA9iYXIuZXhhbXBsZS5jb20wggIi 374 MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCv4mHMdVUcafmaSHVpUM0zZWp5 375 NFXfboxA4inuOkE8kZlbGSe7wiG9WqLirdr39Ts+WSAFA6oANvbzlu3JrEQ2CHPc 376 CNQm6diPREFwcDPFCe/eMawbwkQAPVSHPts0UoRxnpZox5pn69ghncBR+jtvx+/u 377 P6HdwW0qqTvfJnfAF1hBJ4oIk2AXiip5kkIznsAh9W6WRy6nTVCeetmIepDOGe0G 378 ZJIRn/OfSz7NzKylfDCat2z3EAutyeT/5oXZoWOmGg/8T7pn/pR588GoYYKRQnp+ 379 YilqCPFX+az09EqqK/iHXnkdZ/Z2fCuU+9M/Zhrnlwlygl3RuVBI6xhm/ZsXtL2E 380 Gxa61lNy6pyx5+hSxHEFEJshXLtioRd702VdLKxEOuYSXKeJDs1x9o6cJ75S6hko 381 Ml1L4zCU+xEsMcvb1iQ2n7PZdacqhkFRUVVVmJ56th8aYyX7KNX6M9C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K 398 XWyb96wrUlv+E8I= 399 -----END CERTIFICATE----- 400 401 ``` 402 403 !!! note 404 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. 405 406 ### SSH known host public keys 407 408 If you are connecting repositories via SSH, ArgoCD will need to know the SSH known hosts public key of the repository servers. You can manage the SSH known hosts data in the ConfigMap named `argocd-ssh-known-hosts-cm`. This ConfigMap contains a single key/value pair, with `ssh_known_hosts` as the key and the actual public keys of the SSH servers as data. As opposed to TLS configuration, the public key(s) of each single repository server ArgoCD will connect via SSH must be configured, otherwise the connections to the repository will fail. There is no fallback. The data can be copied from any existing `ssh_known_hosts` file, or from the output of the `ssh-keyscan` utility. The basic format is `<servername> <keydata>`, one entry per line. 409 410 An example ConfigMap object: 411 412 ```yaml 413 apiVersion: v1 414 kind: ConfigMap 415 metadata: 416 name: argocd-ssh-known-hosts-cm 417 namespace: argocd 418 labels: 419 app.kubernetes.io/name: argocd-cm 420 app.kubernetes.io/part-of: argocd 421 data: 422 ssh_known_hosts: | 423 bitbucket.org ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAubiN81eDcafrgMeLzaFPsw2kNvEcqTKl/VqLat/MaB33pZy0y3rJZtnqwR2qOOvbwKZYKiEO1O6VqNEBxKvJJelCq0dTXWT5pbO2gDXC6h6QDXCaHo6pOHGPUy+YBaGQRGuSusMEASYiWunYN0vCAI8QaXnWMXNMdFP3jHAJH0eDsoiGnLPBlBp4TNm6rYI74nMzgz3B9IikW4WVK+dc8KZJZWYjAuORU3jc1c/NPskD2ASinf8v3xnfXeukU0sJ5N6m5E8VLjObPEO+mN2t/FZTMZLiFqPWc/ALSqnMnnhwrNi2rbfg/rd/IpL8Le3pSBne8+seeFVBoGqzHM9yXw== 424 github.com ssh-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GJOfGJ4NakVyIzf1rXYd4d7wo6jBlkLvCA4odBlL0mDUyZ0/QUfTTqeu+tm22gOsv+VrVTMk6vwRU75gY/y9ut5Mb3bR5BV58dKXyq9A9UeB5Cakehn5Zgm6x1mKoVyf+FFn26iYqXJRgzIZZcZ5V6hrE0Qg39kZm4az48o0AUbf6Sp4SLdvnuMa2sVNwHBboS7EJkm57XQPVU3/QpyNLHbWDdzwtrlS+ez30S3AdYhLKEOxAG8weOnyrtLJAUen9mTkol8oII1edf7mWWbWVf0nBmly21+nZcmCTISQBtdcyPaEno7fFQMDD26/s0lfKob4Kw8H 429 vs-ssh.visualstudio.com ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC7Hr1oTWqNqOlzGJOfGJ4NakVyIzf1rXYd4d7wo6jBlkLvCA4odBlL0mDUyZ0/QUfTTqeu+tm22gOsv+VrVTMk6vwRU75gY/y9ut5Mb3bR5BV58dKXyq9A9UeB5Cakehn5Zgm6x1mKoVyf+FFn26iYqXJRgzIZZcZ5V6hrE0Qg39kZm4az48o0AUbf6Sp4SLdvnuMa2sVNwHBboS7EJkm57XQPVU3/QpyNLHbWDdzwtrlS+ez30S3AdYhLKEOxAG8weOnyrtLJAUen9mTkol8oII1edf7mWWbWVf0nBmly21+nZcmCTISQBtdcyPaEno7fFQMDD26/s0lfKob4Kw8H 430 ``` 431 432 !!! note 433 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 ArgoCD 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. 434 435 ## Clusters 436 437 Cluster credentials are stored in secrets same as repository credentials but does not require entry in `argocd-cm` config map. Each secret must have label 438 `argocd.argoproj.io/secret-type: cluster`. 439 440 The secret data must include following fields: 441 442 * `name` - cluster name 443 * `server` - cluster api server url 444 * `namespaces` - optional comma-separated list of namespaces which are accessible in that cluster. Cluster level resources would be ignored if namespace list is not empty. 445 * `config` - JSON representation of following data structure: 446 447 ```yaml 448 # Basic authentication settings 449 username: string 450 password: string 451 # Bearer authentication settings 452 bearerToken: string 453 # IAM authentication configuration 454 awsAuthConfig: 455 clusterName: string 456 roleARN: string 457 # Configure external command to supply client credentials 458 # See https://godoc.org/k8s.io/client-go/tools/clientcmd/api#ExecConfig 459 execProviderConfig: 460 command: string 461 args: [ 462 string 463 ] 464 env: { 465 key: value 466 } 467 apiVersion: string 468 installHint: string 469 # Transport layer security configuration settings 470 tlsClientConfig: 471 # PEM-encoded bytes (typically read from a client certificate file). 472 caData: string 473 # PEM-encoded bytes (typically read from a client certificate file). 474 certData: string 475 # Server should be accessed without verifying the TLS certificate 476 insecure: boolean 477 # PEM-encoded bytes (typically read from a client certificate key file). 478 keyData: string 479 # ServerName is passed to the server for SNI and is used in the client to check server 480 # certificates against. If ServerName is empty, the hostname used to contact the 481 # server is used. 482 serverName: string 483 ``` 484 485 Note that if you specify a command to run under `execProviderConfig`, that command must be available in the ArgoCD image. See [BYOI (Build Your Own Image)](custom_tools.md#byoi-build-your-own-image). 486 487 Cluster secret example: 488 489 ```yaml 490 apiVersion: v1 491 kind: Secret 492 metadata: 493 name: mycluster-secret 494 labels: 495 argocd.argoproj.io/secret-type: cluster 496 type: Opaque 497 stringData: 498 name: mycluster.com 499 server: https://mycluster.com 500 config: | 501 { 502 "bearerToken": "<authentication token>", 503 "tlsClientConfig": { 504 "insecure": false, 505 "caData": "<base64 encoded certificate>" 506 } 507 } 508 ``` 509 510 ## Helm Chart Repositories 511 512 Non standard Helm Chart repositories have to be registered under the `repositories` key in the 513 `argocd-cm` ConfigMap. Each repository must have `url`, `type` and `name` fields. For private Helm repos you 514 may need to configure access credentials and HTTPS settings using `usernameSecret`, `passwordSecret`, 515 `caSecret`, `certSecret` and `keySecret` fields. 516 517 Example: 518 519 ```yaml 520 apiVersion: v1 521 kind: ConfigMap 522 metadata: 523 name: argocd-cm 524 namespace: argocd 525 labels: 526 app.kubernetes.io/name: argocd-cm 527 app.kubernetes.io/part-of: argocd 528 data: 529 # v1.2 or earlier use `helm.repositories` 530 helm.repositories: | 531 - url: https://storage.googleapis.com/istio-prerelease/daily-build/master-latest-daily/charts 532 name: istio.io 533 # v1.3 or later use `repositories` with `type: helm` 534 repositories: | 535 - type: helm 536 url: https://storage.googleapis.com/istio-prerelease/daily-build/master-latest-daily/charts 537 name: istio.io 538 - type: helm 539 url: https://argoproj.github.io/argo-helm 540 name: argo 541 usernameSecret: 542 name: my-secret 543 key: username 544 passwordSecret: 545 name: my-secret 546 key: password 547 caSecret: 548 name: my-secret 549 key: ca 550 certSecret: 551 name: my-secret 552 key: cert 553 keySecret: 554 name: my-secret 555 key: key 556 ``` 557 558 ## Resource Exclusion/Inclusion 559 560 Resources can be excluded from discovery and sync so that ArgoCD is unaware of them. For example, `events.k8s.io` and `metrics.k8s.io` are always excluded. Use cases: 561 562 * You have temporal issues and you want to exclude problematic resources. 563 * There are many of a kind of resources that impacts ArgoCD's performance. 564 * Restrict ArgoCD's access to certain kinds of resources, e.g. secrets. See [security.md#cluster-rbac](security.md#cluster-rbac). 565 566 To configure this, edit the `argcd-cm` config map: 567 568 ```shell 569 kubectl edit configmap argocd-cm -n argocd 570 ``` 571 572 Add `resource.exclusions`, e.g.: 573 574 ```yaml 575 apiVersion: v1 576 data: 577 resource.exclusions: | 578 - apiGroups: 579 - "*" 580 kinds: 581 - "*" 582 clusters: 583 - https://192.168.0.20 584 kind: ConfigMap 585 ``` 586 587 The `resource.exclusions` node is a list of objects. Each object can have: 588 589 * `apiGroups` A list of globs to match the API group. 590 * `kinds` A list of kinds to match. Can be "*" to match all. 591 * `cluster` A list of globs to match the cluster. 592 593 If all three match, then the resource is ignored. 594 595 In addition to exclusions, you might configure the list of included resources using the `resource.inclusions` setting. 596 By default, all resource group/kinds are included. The `resource.inclusions` setting allows customizing the list of included group/kinds: 597 598 ```yaml 599 apiVersion: v1 600 data: 601 resource.inclusions: | 602 - apiGroups: 603 - "*" 604 kinds: 605 - Deployment 606 clusters: 607 - https://192.168.0.20 608 kind: ConfigMap 609 ``` 610 611 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 612 specified in `resource.exclusions` setting. 613 614 Notes: 615 616 * Quote globs in your YAML to avoid parsing errors. 617 * Invalid globs result in the whole rule being ignored. 618 * If you add a rule that matches existing resources, these will appear in the interface as `OutOfSync`. 619 620 ## SSO & RBAC 621 622 * SSO configuration details: [SSO](./user-management/index.md) 623 * RBAC configuration details: [RBAC](./rbac.md) 624 625 ## Manage Argo CD Using Argo CD 626 627 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) 628 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. 629 630 Example of `kustomization.yaml`: 631 632 ```yaml 633 bases: 634 - github.com/argoproj/argo-cd//manifests/cluster-install?ref=v1.0.1 635 636 # additional resources like ingress rules, cluster and repository secrets. 637 resources: 638 - clusters-secrets.yaml 639 - repos-secrets.yaml 640 641 # changes to config maps 642 patchesStrategicMerge: 643 - overlays/argo-cd-cm.yaml 644 ``` 645 646 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 647 stored at [argoproj/argoproj-deployments](https://github.com/argoproj/argoproj-deployments/tree/master/argocd). 648 649 !!! note 650 You will need to sign-in using your github account to get access to [https://cd.apps.argoproj.io](https://cd.apps.argoproj.io)