content large_stringlengths 3 20.5k | url large_stringlengths 54 193 | branch large_stringclasses 4
values | source large_stringclasses 42
values | embeddings listlengths 384 384 | score float64 -0.21 0.65 |
|---|---|---|---|---|---|
| :------: | :----: | | \*\*applications\*\* | β
| β
| β
| β
| β
| β
| β
| β | | \*\*applicationsets\*\* | β
| β
| β
| β
| β | β | β | β | | \*\*clusters\*\* | β
| β
| β
| β
| β | β | β | β | | \*\*projects\*\* | β
| β
| β
| β
| β | β | β | β | | \*\*repositories\*\* | β
| β
| β
| β
| β | β | β | β | | \*\*accounts\*\* | β
| β | β
| β | β | β | β | β | | \*\*certificates\*\* | β
| β
| β | β
| β | β | β | β | | \*\*gpgkeys\*\* | β
| β
| β | β
| β | β | β | β | | \*\*logs\*\* | β
| β | β | β | β | β | β | β | | \*\*exec\*\* | β | β
| β | β | β | β | β | β | | \*\*extensions\*\* | β | β | β | β | β | β | β | β
| ### Application-Specific Policy Some policy only have meaning within an application. It is the case with the following resources: - `applications` - `applicationsets` - `logs` - `exec` While they can be set in the global configuration, they can also be configured in [AppProject's roles](../user-guide/projects.md#project-roles). The expected `` value in the policy structure is replaced by `/`. For instance, these policies would grant `example-user` access to get any applications, but only be able to see logs in `my-app` application part of the `example-project` project. ```csv p, example-user, applications, get, \*, allow p, example-user, logs, get, example-project/my-app, allow ``` #### Application in Any Namespaces When [application in any namespace](app-any-namespace.md) is enabled, the expected `` value in the policy structure is replaced by `//`. Since multiple applications could have the same name in the same project, the policy below makes sure to restrict access only to `app-namespace`. ```csv p, example-user, applications, get, \*/app-namespace/\*, allow p, example-user, logs, get, example-project/app-namespace/my-app, allow ``` ### The `applications` resource The `applications` resource is an [Application-Specific Policy](#application-specific-policy). #### Fine-grained Permissions for `update`/`delete` action The `update` and `delete` actions, when granted on an application, will allow the user to perform the operation on the application itself, but not on its resources. To allow an action on the application's resources, specify the action as `////`. For instance, to grant access to `example-user` to only delete Pods in the `prod-app` Application, the policy could be: ```csv p, example-user, applications, delete/\*/Pod/\*/\*, default/prod-app, allow ``` > [!WARNING] > \*\*Understand glob pattern behavior\*\* > > Argo CD RBAC does not use `/` as a separator when evaluating glob patterns. So the pattern `delete/\*/kind/\*` > will match `delete//kind//` but also `delete///kind/`. > > The fact that both of these match will generally not be a problem, because resource kinds generally contain capital > letters, and namespaces cannot contain capital letters. However, it is possible for a resource kind to be lowercase. > So it is better to just always include all the parts of the resource in the pattern (in other words, always use four > slashes). If we want to grant access to the user to update all resources of an application, but not the application itself: ```csv p, example-user, applications, update/\*, default/prod-app, allow ``` If we want to explicitly deny delete of the application, but allow the user to | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/rbac.md | master | argo-cd | [
-0.04141738638281822,
-0.06395251303911209,
-0.1302173137664795,
-0.007555168587714434,
-0.008871146477758884,
-0.0062624444253742695,
0.12341982871294022,
0.021066149696707726,
-0.07220739871263504,
0.0440022237598896,
0.04535072669386864,
-0.07643700391054153,
0.10488034039735794,
-0.065... | 0.06321 |
words, always use four > slashes). If we want to grant access to the user to update all resources of an application, but not the application itself: ```csv p, example-user, applications, update/\*, default/prod-app, allow ``` If we want to explicitly deny delete of the application, but allow the user to delete Pods: ```csv p, example-user, applications, delete, default/prod-app, deny p, example-user, applications, delete/\*/Pod/\*/\*, default/prod-app, allow ``` If we want to explicitly allow updates to the application, but deny updates to any sub-resources: ```csv p, example-user, applications, update, default/prod-app, allow p, example-user, applications, update/\*, default/prod-app, deny ``` > [!NOTE] > \*\*Preserve Application permission Inheritance (Since v3.0.0)\*\* > > Prior to v3, `update` and `delete` actions (without a `/\*`) were also evaluated > on sub-resources. > > To preserve this behavior, you can set the config value > `server.rbac.disableApplicationFineGrainedRBACInheritance` to `false` in > the Argo CD ConfigMap `argocd-cm`. > > When disabled, it is not possible to deny fine-grained permissions for a sub-resource > if the action was \*\*explicitly allowed on the application\*\*. > For instance, the following policies will \*\*allow\*\* a user to delete the Pod and any > other resources in the application: > > ```csv > p, example-user, applications, delete, default/prod-app, allow > p, example-user, applications, delete/\*/Pod/\*, default/prod-app, deny > ``` #### The `action` action The `action` action corresponds to either built-in resource customizations defined [in the Argo CD repository](https://github.com/argoproj/argo-cd/tree/master/resource\_customizations), or to [custom resource actions](resource\_actions.md#custom-resource-actions) defined by you. See the [resource actions documentation](resource\_actions.md#built-in-actions) for a list of built-in actions. The `` has the `action///` format. For example, a resource customization path `resource\_customizations/extensions/DaemonSet/actions/restart/action.lua` corresponds to the `action` path `action/extensions/DaemonSet/restart`. If the resource is not under a group (for example, Pods or ConfigMaps), then the path will be `action//Pod/action-name`. The following policies allows the user to perform any action on the DaemonSet resources, as well as the `maintenance-off` action on a Pod: ```csv p, example-user, applications, action//Pod/maintenance-off, default/\*, allow p, example-user, applications, action/extensions/DaemonSet/\*, default/\*, allow ``` To allow the user to perform any actions: ```csv p, example-user, applications, action/\*, default/\*, allow ``` #### The `override` action The `override` action privilege can be used to allow passing arbitrary manifests or different revisions when syncing an `Application`. This can e.g. be used for development or testing purposes. \*\*Attention:\*\* This allows users to completely change/delete the deployed resources of the application. While the `sync` action privilege gives the right to synchronize the objects in the cluster to the desired state as defined in the `Application` Object, the `override` action privilege will allow a user to synchronize arbitrary local manifests to the Application. These manifests will be used \_instead of\_ the configured source, until the next sync is performed. After performing such a override sync, the application will most probably be OutOfSync with the state defined via the `Application` object. It is not possible to perform an `override` sync when auto-sync is enabled. New since v3.2: When `application.sync.requireOverridePrivilegeForRevisionSync: 'true'` is set in the `argcd-cm` configmap, passing a revision when syncing an `Application` is also considered as an `override`, to prevent synchronizing to arbitrary revisions other than the revision(s) given in the `Application` object. Similar as synching to an arbitrary yaml manifest, syncing to a different revision/branch/commit will also bring the controlled objects to a state differing, and thus OufOfSync from the state as defined in the `Application`. The default setting of this flag is 'false', to prevent breaking changes in existing installations. It is recommended to set this setting to 'true' and only grant the `override` privilege per AppProject to the users that actually need this behavior. ### The `applicationsets` resource The `applicationsets` resource is | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/rbac.md | master | argo-cd | [
-0.03583787381649017,
0.032585371285676956,
-0.04415017366409302,
-0.06746325641870499,
-0.006228061392903328,
-0.045475054532289505,
0.046870335936546326,
-0.017859289422631264,
0.04501504451036453,
0.0784926563501358,
0.055574361234903336,
-0.03272739052772522,
0.05725134164094925,
0.032... | 0.120399 |
the `Application`. The default setting of this flag is 'false', to prevent breaking changes in existing installations. It is recommended to set this setting to 'true' and only grant the `override` privilege per AppProject to the users that actually need this behavior. ### The `applicationsets` resource The `applicationsets` resource is an [Application-Specific policy](#application-specific-policy). [ApplicationSets](applicationset/index.md) provide a declarative way to automatically create/update/delete Applications. Allowing the `create` action on the resource effectively grants the ability to create Applications. While it doesn't allow the user to create Applications directly, they can create Applications via an ApplicationSet. > [!NOTE] > In v2.5, it is not possible to create an ApplicationSet with a templated Project field (e.g. `project: {{path.basename}}`) > via the API (or, by extension, the CLI). Disallowing templated projects makes project restrictions via RBAC safe: With the resource being application-specific, the `` of the applicationsets policy will have the format `/`. However, since an ApplicationSet does belong to any project, the `` value represents the projects in which the ApplicationSet will be able to create Applications. With the following policy, a `dev-group` user will be unable to create an ApplicationSet capable of creating Applications outside the `dev-project` project. ```csv p, dev-group, applicationsets, \*, dev-project/\*, allow ``` ### The `logs` resource The `logs` resource is an [Application-Specific Policy](#application-specific-policy). When granted with the `get` action, this policy allows a user to see Pod's logs of an application via the Argo CD UI. The functionality is similar to `kubectl logs`. ### The `exec` resource The `exec` resource is an [Application-Specific Policy](#application-specific-policy). When granted with the `create` action, this policy allows a user to `exec` into Pods of an application via the Argo CD UI. The functionality is similar to `kubectl exec`. See [Web-based Terminal](web\_based\_terminal.md) for more info. ### The `extensions` resource With the `extensions` resource, it is possible to configure permissions to invoke [proxy extensions](../developer-guide/extensions/proxy-extensions.md). The `extensions` RBAC validation works in conjunction with the `applications` resource. A user \*\*needs to have read permission on the application\*\* where the request is originated from. Consider the example below, it will allow the `example-user` to invoke the `httpbin` extensions in all applications under the `default` project. ```csv p, example-user, applications, get, default/\*, allow p, example-user, extensions, invoke, httpbin, allow ``` ### The `deny` effect When `deny` is used as an effect in a policy, it will be effective if the policy matches. Even if more specific policies with the `allow` effect match as well, the `deny` will have priority. The order in which the policies appears in the policy file configuration has no impact, and the result is deterministic. ## Policies Evaluation and Matching The evaluation of access is done in two parts: validating against the default policy configuration, then validating against the policies for the current user. \*\*If an action is allowed or denied by the default policies, then this effect will be effective without further evaluation\*\*. When the effect is undefined, the evaluation will continue with subject-specific policies. The access will be evaluated for the user, then for each configured group that the user is part of. The matching engine, configured in `policy.matchMode`, can use two different match modes to compare the values of tokens: - `glob`: based on the [`glob` package](https://pkg.go.dev/github.com/gobwas/glob). - `regex`: based on the [`regexp` package](https://pkg.go.dev/regexp). When all tokens match during the evaluation, the effect will be returned. The evaluation will continue until all matching policies are evaluated, or until a policy with the `deny` effect matches. After all policies are evaluated, if there was at least one `allow` effect and no `deny`, access will be granted. ### Glob matching When `glob` is used, | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/rbac.md | master | argo-cd | [
-0.07248824834823608,
-0.0032273815013468266,
-0.05365409702062607,
-0.045756660401821136,
-0.0037442240864038467,
-0.006949617061764002,
0.016172921285033226,
0.041055694222450256,
-0.00014531747729051858,
0.05984419584274292,
-0.041688285768032074,
-0.0038407144602388144,
0.045846734195947... | 0.051998 |
effect will be returned. The evaluation will continue until all matching policies are evaluated, or until a policy with the `deny` effect matches. After all policies are evaluated, if there was at least one `allow` effect and no `deny`, access will be granted. ### Glob matching When `glob` is used, the policy tokens are treated as single terms, without separators. Consider the following policy: ``` p, example-user, applications, action/extensions/\*, default/\*, allow ``` When the `example-user` executes the `extensions/DaemonSet/test` action, the following `glob` matches will happen: 1. The current user `example-user` matches the token `example-user`. 2. The value `applications` matches the token `applications`. 3. The value `action/extensions/DaemonSet/test` matches `action/extensions/\*`. Note that `/` is not treated as a separator and the use of `\*\*` is not necessary. 4. The value `default/my-app` matches `default/\*`. ## Using SSO Users/Groups The `scopes` field controls which OIDC scopes to examine during RBAC enforcement (in addition to `sub` scope). If omitted, it defaults to `'[groups]'`. The scope value can be a string, or a list of strings. For more information on `scopes` please review the [User Management Documentation](user-management/index.md). The following example shows targeting `email` as well as `groups` from your OIDC provider, and also demonstrates explicit role assignments and role-to-role inheritance: ```yaml apiVersion: v1 kind: ConfigMap metadata: name: argocd-rbac-cm namespace: argocd labels: app.kubernetes.io/name: argocd-rbac-cm app.kubernetes.io/part-of: argocd data: policy.csv: | p, my-org:team-alpha, applications, sync, my-project/\*, allow g, my-org:team-beta, role:admin g, user@example.org, role:admin g, admin, role:admin g, role:admin, role:readonly policy.default: role:readonly scopes: '[groups, email]' ``` Here: 1. `g, admin, role:admin` explicitly binds the built-in admin user to the admin role. 2. `g, role:admin, role:readonly` shows role inheritance, so anyone granted `role:admin` also automatically has all the permissions of `role:readonly`. This approach can be combined with AppProjects to associate users' emails and groups directly at the project level: ```yaml apiVersion: argoproj.io/v1alpha1 kind: AppProject metadata: name: team-beta-project namespace: argocd spec: roles: - name: admin description: Admin privileges to team-beta policies: - p, proj:team-beta-project:admin, applications, \*, team-beta-project/\*, allow groups: - user@example.org # Value from the email scope - my-org:team-beta # Value from the groups scope ``` ## Local Users/Accounts [Local users](user-management/index.md#local-usersaccounts) are assigned access by either grouping them with a role or by assigning policies directly to them. The example below shows how to assign a policy directly to a local user. ```yaml p, my-local-user, applications, sync, my-project/\*, allow ``` This example shows how to assign a role to a local user. ```yaml g, my-local-user, role:admin ``` > [!WARNING] > \*\*Ambiguous Group Assignments\*\* > > If you have [enabled SSO](user-management/index.md#sso), any SSO user with a scope that matches a local user will be > added to the same roles as the local user. For example, if local user `sally` is assigned to `role:admin`, and if an > SSO user has a scope which happens to be named `sally`, that SSO user will also be assigned to `role:admin`. > > An example of where this may be a problem is if your SSO provider is an SCM, and org members are automatically > granted scopes named after the orgs. If a user can create or add themselves to an org in the SCM, they can gain the > permissions of the local user with the same name. > > To avoid ambiguity, if you are using local users and SSO, it is recommended to assign policies directly to local > users, and not to assign roles to local users. In other words, instead of using `g, my-local-user, role:admin`, you > should explicitly assign policies to `my-local-user`: > > ```yaml > p, my-local-user, \*, \*, \*, allow > ``` ## Policy CSV Composition It | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/rbac.md | master | argo-cd | [
-0.07266059517860413,
0.03325729817152023,
0.016749370843172073,
-0.03672875463962555,
0.041212134063243866,
-0.05386189743876457,
0.08108324557542801,
-0.002041201340034604,
-0.019213343039155006,
-0.011081942357122898,
0.08350895345211029,
0.009871987625956535,
0.03360805660486221,
0.019... | 0.114022 |
to assign policies directly to local > users, and not to assign roles to local users. In other words, instead of using `g, my-local-user, role:admin`, you > should explicitly assign policies to `my-local-user`: > > ```yaml > p, my-local-user, \*, \*, \*, allow > ``` ## Policy CSV Composition It is possible to provide additional entries in the `argocd-rbac-cm` configmap to compose the final policy csv. In this case, the key must follow the pattern `policy..csv`. Argo CD will concatenate all additional policies it finds with this pattern below the main one ('policy.csv'). The order of additional provided policies are determined by the key string. Example: if two additional policies are provided with keys `policy.A.csv` and `policy.B.csv`, it will first concatenate `policy.A.csv` and then `policy.B.csv`. This is useful to allow composing policies in config management tools like Kustomize, Helm, etc. The example below shows how a Kustomize patch can be provided in an overlay to add additional configuration to an existing RBAC ConfigMap. ```yaml apiVersion: v1 kind: ConfigMap metadata: name: argocd-rbac-cm namespace: argocd data: policy.tester-overlay.csv: | p, role:tester, applications, \*, \*/\*, allow p, role:tester, projects, \*, \*, allow g, my-org:team-qa, role:tester ``` ## Validating and testing your RBAC policies If you want to ensure that your RBAC policies are working as expected, you can use the [`argocd admin settings rbac` command](../user-guide/commands/argocd\_admin\_settings\_rbac.md) to validate them. This tool allows you to test whether a certain role or subject can perform the requested action with a policy that's not live yet in the system, i.e. from a local file or config map. Additionally, it can be used against the live RBAC configuration in the cluster your Argo CD is running in. ### Validating a policy To check whether your new policy configuration is valid and understood by Argo CD's RBAC implementation, you can use the [`argocd admin settings rbac validate` command](../user-guide/commands/argocd\_admin\_settings\_rbac\_validate.md). ### Testing a policy To test whether a role or subject (group or local user) has sufficient permissions to execute certain actions on certain resources, you can use the [`argocd admin settings rbac can` command](../user-guide/commands/argocd\_admin\_settings\_rbac\_can.md). | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/rbac.md | master | argo-cd | [
-0.004984365310519934,
-0.001947899116203189,
-0.08215773105621338,
-0.0073096780106425285,
-0.03533653914928436,
-0.008442733436822891,
0.11501361429691315,
-0.01508922129869461,
-0.06136980652809143,
0.062340445816516876,
0.016295384615659714,
-0.06593828648328781,
0.0472865104675293,
-0... | 0.018626 |
# Feature Maturity Argo CD features may be marked with a certain [status](https://github.com/argoproj/argoproj/blob/main/community/feature-status.md) to indicate their stability and maturity. These are the statuses of non-stable features in Argo CD: > [!CAUTION] > \*\*Using Alpha/Beta features risks\*\* > > Alpha and Beta features do not guarantee backward compatibility and are subject to breaking changes in the future releases. > It is highly suggested for Argo users not to rely on these features in production environments, especially if you do not have > control over the Argo CD upgrades. > > Furthermore, removal of Alpha features may modify your resources to an unpredictable state after Argo CD is upgraded. > You should make sure to document which features are in use and review the [release notes](./upgrading/overview.md) before upgrading. ## Overview | Feature | Introduced | Status | |-------------------------------------------|------------|--------| | [AppSet Progressive Syncs][2] | v2.6.0 | Beta | | [Proxy Extensions][3] | v2.7.0 | Beta | | [Skip Application Reconcile][4] | v2.7.0 | Alpha | | [AppSets in any Namespace][5] | v2.8.0 | Beta | | [Cluster Sharding: round-robin][6] | v2.8.0 | Alpha | | [Dynamic Cluster Distribution][7] | v2.9.0 | Alpha | | [Cluster Sharding: consistent-hashing][9] | v2.12.0 | Alpha | | [Service Account Impersonation][10] | v2.13.0 | Alpha | | [Source Hydrator][11] | v2.14.0 | Alpha | ## Unstable Configurations ### Application CRD | Feature | Property | Status | | ------------------------------- | --------------------------------------------------------------------------------------- | ------ | | [Skip Application Reconcile][4] | `metadata.annotations[argocd.argoproj.io/skip-reconcile]` | Alpha | ### AppProject CRD | Feature | Property | Status | | ----------------------------------- | ----------------------------------- | ------ | | [Service Account Impersonation][10] | `spec.destinationServiceAccounts.\*` | Alpha | ### ApplicationSet CRD | Feature | Property | Status | | ----------------------------- | ---------------------------- | ------ | | [AppSet Progressive Syncs][2] | `spec.strategy.\*` | Alpha | | [AppSet Progressive Syncs][2] | `status.applicationStatus.\*` | Alpha | ### Configuration | Feature | Resource | Property / Variable | Status | | ----------------------------------------- | --------------------------------------------- | ----------------------------------------------------------- | ------ | | [AppSets in any Namespace][5] | `Deployment/argocd-applicationset-controller` | `ARGOCD\_APPLICATIONSET\_CONTROLLER\_ALLOWED\_SCM\_PROVIDERS` | Beta | | [AppSets in any Namespace][5] | `ConfigMap/argocd-cmd-params-cm` | `applicationsetcontroller.allowed.scm.providers` | Beta | | [AppSets in any Namespace][5] | `ConfigMap/argocd-cmd-params-cm` | `applicationsetcontroller.enable.scm.providers` | Beta | | [AppSets in any Namespace][5] | `Deployment/argocd-applicationset-controller` | `ARGOCD\_APPLICATIONSET\_CONTROLLER\_ENABLE\_SCM\_PROVIDERS` | Beta | | [AppSets in any Namespace][5] | `Deployment/argocd-applicationset-controller` | `ARGOCD\_APPLICATIONSET\_CONTROLLER\_NAMESPACES` | Beta | | [AppSets in any Namespace][5] | `ConfigMap/argocd-cmd-params-cm` | `applicationsetcontroller.namespaces` | Beta | | [AppSet Progressive Syncs][2] | `ConfigMap/argocd-cmd-params-cm` | `applicationsetcontroller.enable.progressive.syncs` | Alpha | | [AppSet Progressive Syncs][2] | `Deployment/argocd-applicationset-controller` | `ARGOCD\_APPLICATIONSET\_CONTROLLER\_ENABLE\_PROGRESSIVE\_SYNCS` | Alpha | | [Proxy Extensions][3] | `ConfigMap/argocd-cmd-params-cm` | `server.enable.proxy.extension` | Alpha | | [Proxy Extensions][3] | `Deployment/argocd-server` | `ARGOCD\_SERVER\_ENABLE\_PROXY\_EXTENSION` | Alpha | | [Proxy Extensions][3] | `ConfigMap/argocd-cm` | `extension.config` | Alpha | | [Dynamic Cluster Distribution][7] | `Deployment/argocd-application-controller` | `ARGOCD\_ENABLE\_DYNAMIC\_CLUSTER\_DISTRIBUTION` | Alpha | | [Dynamic Cluster Distribution][7] | `Deployment/argocd-application-controller` | `ARGOCD\_CONTROLLER\_HEARTBEAT\_TIME` | Alpha | | [Cluster Sharding: round-robin][6] | `ConfigMap/argocd-cmd-params-cm` | `controller.sharding.algorithm: round-robin` | Alpha | | [Cluster Sharding: round-robin][6] | `StatefulSet/argocd-application-controller` | `ARGOCD\_CONTROLLER\_SHARDING\_ALGORITHM=round-robin` | Alpha | | [Cluster Sharding: consistent-hashing][9] | `ConfigMap/argocd-cmd-params-cm` | `controller.sharding.algorithm: consistent-hashing` | Alpha | | [Cluster Sharding: consistent-hashing][9] | `StatefulSet/argocd-application-controller` | `ARGOCD\_CONTROLLER\_SHARDING\_ALGORITHM=consistent-hashing` | Alpha | | [Service Account Impersonation][10] | `ConfigMap/argocd-cm` | `application.sync.impersonation.enabled` | Alpha | [2]: applicationset/Progressive-Syncs.md [3]: ../developer-guide/extensions/proxy-extensions.md [4]: ../user-guide/skip\_reconcile.md [5]: applicationset/Appset-Any-Namespace.md [6]: ./high\_availability.md#argocd-application-controller [7]: dynamic-cluster-distribution.md [8]: ../user-guide/diff-strategies.md#server-side-diff [9]: ./high\_availability.md#argocd-application-controller [10]: app-sync-using-impersonation.md [11]: ../user-guide/source-hydrator.md | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/feature-maturity.md | master | argo-cd | [
0.02383541315793991,
-0.0257852952927351,
-0.01462979894131422,
0.012533226050436497,
0.024985961616039276,
-0.04095396772027016,
-0.02589644119143486,
-0.04819951951503754,
-0.1406375765800476,
0.04053302854299545,
0.019058916717767715,
0.07681634277105331,
-0.13255693018436432,
-0.006377... | 0.102069 |
../user-guide/source-hydrator.md | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/feature-maturity.md | master | argo-cd | [
-0.08032239228487015,
0.03734903782606125,
-0.026961125433444977,
-0.024726752191781998,
0.09154874086380005,
-0.05190147086977959,
0.03102654591202736,
0.038293857127428055,
0.01485099270939827,
-0.083952397108078,
-0.045045845210552216,
-0.01917511597275734,
-0.0035613160580396652,
0.008... | 0.032753 |
# Custom Styles Argo CD imports the majority of its UI stylesheets from the [argo-ui](https://github.com/argoproj/argo-ui) project. Sometimes, it may be desired to customize certain components of the UI for branding purposes or to help distinguish between multiple instances of Argo CD running in different environments. Such custom styling can be applied either by supplying a URL to a remotely hosted CSS file, or by loading a CSS file directly onto the argocd-server container. Both mechanisms are driven by modifying the argocd-cm configMap. ## Adding Styles Via Remote URL The first method simply requires the addition of the remote URL to the argocd-cm configMap: ### argocd-cm ```yaml --- apiVersion: v1 kind: ConfigMap metadata: ... name: argocd-cm data: ui.cssurl: "https://www.example.com/my-styles.css" ``` ## Adding Styles Via Volume Mounts The second method requires mounting the CSS file directly onto the argocd-server container and then providing the argocd-cm with the properly configured path to that file. In the following example, the CSS file is actually defined inside of a separate configMap (the same effect could be achieved by generating or downloading a CSS file in an initContainer): ### argocd-cm ```yaml --- apiVersion: v1 kind: ConfigMap metadata: ... name: argocd-cm data: ui.cssurl: "./custom/my-styles.css" ``` Note that the `cssurl` should be specified relative to the "/shared/app" directory; not as an absolute path. ### argocd-styles-cm ```yaml --- apiVersion: v1 kind: ConfigMap metadata: ... name: argocd-styles-cm data: my-styles.css: | .sidebar { background: linear-gradient(to bottom, #999, #777, #333, #222, #111); } ``` ### argocd-server ```yaml --- apiVersion: apps/v1 kind: Deployment metadata: name: argocd-server ... spec: template: ... spec: containers: - command: ... volumeMounts: ... - mountPath: /shared/app/custom name: styles ... volumes: ... - configMap: name: argocd-styles-cm name: styles ``` Note that the CSS file should be mounted within a subdirectory of the "/shared/app" directory (e.g. "/shared/app/custom"). Otherwise, the file will likely fail to be imported by the browser with an "incorrect MIME type" error. The subdirectory can be changed using `server.staticassets` key of the [argocd-cmd-params-cm.yaml](./argocd-cmd-params-cm.yaml) ConfigMap. ## Developing Style Overlays The styles specified in the injected CSS file should be specific to components and classes defined in [argo-ui](https://github.com/argoproj/argo-ui). It is recommended to test out the styles you wish to apply first by making use of your browser's built-in developer tools. For a more full-featured experience, you may wish to build a separate project using the [Argo CD UI dev server](https://webpack.js.org/configuration/dev-server/). ## Banners Argo CD can optionally display a banner that can be used to notify your users of upcoming maintenance and operational changes. This feature can be enabled by specifying the banner message using the `ui.bannercontent` field in the `argocd-cm` ConfigMap and Argo CD will display this message at the top of every UI page. You can optionally add a link to this message by setting `ui.bannerurl`. You can also make the banner sticky (permanent) by setting `ui.bannerpermanent` to true and change its position to "both" or "bottom" by using `ui.bannerposition: "both"`, allowing the banner to display on both the top and bottom, or `ui.bannerposition: "bottom"` to display it exclusively at the bottom. ### argocd-cm ```yaml --- apiVersion: v1 kind: ConfigMap metadata: ... name: argocd-cm data: ui.bannercontent: "Banner message linked to a URL" ui.bannerurl: "www.bannerlink.com" ui.bannerpermanent: "true" ui.bannerposition: "bottom" ```  | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/custom-styles.md | master | argo-cd | [
-0.02643105573952198,
0.0021521716844290495,
-0.07452806830406189,
0.028709476813673973,
-0.015756648033857346,
-0.05717284977436066,
0.04421934857964516,
-0.016523361206054688,
-0.04279984533786774,
0.08032023161649704,
-0.025580888614058495,
0.021057194098830223,
-0.016539374366402626,
-... | 0.096505 |
# Web-based Terminal  Since v2.4, Argo CD has a web-based terminal that allows you to get a shell inside a running pod just like you would with `kubectl exec`. It's basically SSH from your browser, full ANSI color support and all! However, for security this feature is disabled by default. This is a powerful privilege. It allows the user to run arbitrary code on any Pod managed by an Application for which they have the `exec/create` privilege. If the Pod mounts a ServiceAccount token (which is the default behavior of Kubernetes), then the user effectively has the same privileges as that ServiceAccount. ## Enabling the terminal 1. In the `argocd-cm` ConfigMap, set the `exec.enabled` key to `"true"`. This enables the exec feature in Argo CD. ``` apiVersion: v1 kind: ConfigMap metadata: name: argocd-cm namespace: # Replace with your actual namespace data: exec.enabled: "true" ``` 2. Restart Argo CD ### Permissions for Kubernetes <1.31 Starting in Kubernetes 1.31, the `get` privilege is enough to exec into a container, so no additional permissions are required. Enabling web terminal before Kubernetes 1.31 requires adding additional RBAC permissions. 1. Patch the `argocd-server` Role (if using namespaced Argo) or ClusterRole (if using clustered Argo) to allow `argocd-server` to `exec` into pods - apiGroups: - "" resources: - pods/exec verbs: - create If you'd like to perform the patch imperatively, you can use the following command: - For namespaced Argo ``` kubectl patch role -n argocd --type='json' -p='[{"op": "add", "path": "/rules/-", "value": {"apiGroups": ["\*"], "resources": ["pods/exec"], "verbs": ["create"]}}]' ``` - For clustered Argo ``` kubectl patch clusterrole --type='json' -p='[{"op": "add", "path": "/rules/-", "value": {"apiGroups": ["\*"], "resources": ["pods/exec"], "verbs": ["create"]}}]' ``` 2. Add RBAC rules to allow your users to `create` the `exec` resource i.e. p, role:myrole, exec, create, \*/\*, allow This can be added either to the `argocd-cm` `Configmap` manifest or an `AppProject` manifest. See [RBAC Configuration](rbac.md#exec-resource) for more info. ## Changing allowed shells By default, Argo CD attempts to execute shells in this order: 1. bash 2. sh 3. powershell 4. cmd If none of the shells are found, the terminal session will fail. To add to or change the allowed shells, change the `exec.shells` key in the `argocd-cm` ConfigMap, separating them with commas. | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/web_based_terminal.md | master | argo-cd | [
0.06846631318330765,
0.0035770044196397066,
-0.04523630440235138,
-0.023928236216306686,
-0.05035274848341942,
-0.026136038824915886,
0.055821508169174194,
0.022032614797353745,
0.07739121466875076,
0.08813495934009552,
-0.011807882227003574,
-0.02094532735645771,
-0.027416445314884186,
-0... | 0.215915 |
# Cluster Bootstrapping This guide is for operators who have already installed Argo CD, and have a new cluster and are looking to install many apps in that cluster. There's no one particular pattern to solve this problem, e.g. you could write a script to create your apps, or you could even manually create them. Our recommendation is to look at [ApplicationSets](./applicationset/index.md) and more specifically the [cluster generator](./applicationset/Generators-Cluster.md) which can handle most typical scenarios. ## Application Sets and cluster labels (recommended) Following the [Declaratively setup guide](declarative-setup.md) you can create a cluster and assign it several labels. Example ```yaml apiVersion: v1 data: [...snip..] kind: Secret metadata: annotations: managed-by: argocd.argoproj.io labels: argocd.argoproj.io/secret-type: cluster cloud: gcp department: billing env: qa region: eu type: workload name: cluster-qa-eu-example namespace: argocd ``` Then as soon as you add the cluster to Argo CD, any application set that uses these labels will deploy the respective applications. ```yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: name: eu-only-appset namespace: argocd spec: goTemplate: true goTemplateOptions: ["missingkey=error"] generators: - matrix: generators: - git: repoURL: revision: HEAD directories: - path: my-eu-apps/\* - clusters: selector: matchLabels: type: "workload" region: "eu" template: metadata: name: 'eu-only-{{index .path.segments 1}}-{{.name}}' spec: project: default source: repoURL: targetRevision: HEAD path: '{{.path.path}}' destination: server: '{{.server}}' namespace: 'eu-only-{{index .path.segments 1}}' syncPolicy: syncOptions: - CreateNamespace=true automated: prune: true selfHeal: true ``` If you use Application Sets you also have access to all [gotemplate functions](./applicationset/GoTemplate.md) as well as [Sprig methods](https://masterminds.github.io/sprig/). So no Helm templating is required. For more information see also [Templating](./applicationset/Template.md). ## App Of Apps Pattern (Alternative) You can also use the \*\*app of apps pattern\*\*. > [!WARNING] > \*\*App of Apps is an admin-only tool\*\* > > The ability to create Applications in arbitrary [Projects](./declarative-setup.md#projects) > is an admin-level capability. Only admins should have push access to the parent Application's source repository. > Admins should review pull requests to that repository, paying particular attention to the `project` field in each > Application. Projects with access to the namespace in which Argo CD is installed effectively have admin-level > privileges. [Declaratively](declarative-setup.md) specify one Argo CD app that consists only of other apps.  ### Helm Example This example shows how to use Helm to achieve this. You can, of course, use another tool if you like. Notice that most Helm functions are also available in Application Sets. A typical layout of your Git repository for this might be: ``` βββ Chart.yaml βββ templates β βββ guestbook.yaml β βββ helm-dependency.yaml β βββ helm-guestbook.yaml β βββ kustomize-guestbook.yaml βββ values.yaml ``` `Chart.yaml` is boiler-plate. `templates` contains one file for each child app, roughly: ```yaml apiVersion: argoproj.io/v1alpha1 kind: Application metadata: name: guestbook namespace: argocd finalizers: - resources-finalizer.argocd.argoproj.io spec: destination: namespace: argocd server: {{ .Values.spec.destination.server }} project: default source: path: guestbook repoURL: https://github.com/argoproj/argocd-example-apps targetRevision: HEAD syncPolicy: automated: prune: true ``` This example sets the sync policy to automated with pruning enabled, so child apps are automatically created, synced, and deleted when the parent app's manifest changes. You may wish to disable automated sync for more control over when changes are applied. The finalizer ensures that child app resources are properly cleaned up on deletion. Fix the revision to a specific Git commit SHA to make sure that, even if the child apps repo changes, the app will only change when the parent app change that revision. Alternatively, you can set it to HEAD or a branch name. As you probably want to override the cluster server, this is a templated values. `values.yaml` contains the default values: ```yaml spec: destination: server: https://kubernetes.default.svc ``` Next, you need to create and sync your parent app, e.g. via the CLI: ```bash | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/cluster-bootstrapping.md | master | argo-cd | [
0.012626993469893932,
-0.04218960553407669,
-0.09139830619096756,
-0.02693472057580948,
-0.0037018454167991877,
0.01729998178780079,
0.022563207894563675,
0.009115876629948616,
-0.03820119425654411,
0.0315629206597805,
0.007928763516247272,
-0.08222400397062302,
0.03307339921593666,
-0.002... | 0.157703 |
you can set it to HEAD or a branch name. As you probably want to override the cluster server, this is a templated values. `values.yaml` contains the default values: ```yaml spec: destination: server: https://kubernetes.default.svc ``` Next, you need to create and sync your parent app, e.g. via the CLI: ```bash argocd app create apps \ --dest-namespace argocd \ --dest-server https://kubernetes.default.svc \ --repo https://github.com/argoproj/argocd-example-apps.git \ --path apps argocd app sync apps ``` The parent app will appear as in-sync but the child apps will be out of sync:  > NOTE: You may want to modify this behavior to bootstrap your cluster in waves; see [the health assessment of Applications](./health.md#argocd-app) for information on changing this. You can either sync via the UI, firstly filter by the correct label:  Then select the "out of sync" apps and sync:  Or, via the CLI: ```bash argocd app sync -l app.kubernetes.io/instance=apps ``` View [the example on GitHub](https://github.com/argoproj/argocd-example-apps/tree/master/apps). ### Cascading deletion If you want to ensure that child-apps and all of their resources are deleted when the parent-app is deleted make sure to add the appropriate [finalizer](../user-guide/app\_deletion.md#about-the-deletion-finalizer) to your `Application` definition ```yaml apiVersion: argoproj.io/v1alpha1 kind: Application metadata: name: guestbook namespace: argocd finalizers: - resources-finalizer.argocd.argoproj.io spec: ... ``` ### Deleting child applications When working with the App of Apps pattern, you may need to delete individual child applications. Starting in 3.2, Argo CD provides consistent deletion behaviour whether you delete from the Applications List or from the parent application's Resource Tree. For detailed information about deletion options and behaviour, including: - Consistent deletion across UI views - Non-cascading (orphan) deletion to preserve managed resources - Child application detection and improved dialog messages - Best practices and example scenarios See [Deleting Applications in the UI](../user-guide/app\_deletion.md#deleting-applications-in-the-ui). ### Ignoring differences in child applications To allow changes in child apps without triggering an out-of-sync status, or modification for debugging etc, the app of apps pattern works with [diff customization](../user-guide/diffing/). The example below shows how to ignore changes to syncPolicy and other common values. ```yaml spec: ... syncPolicy: ... syncOptions: - RespectIgnoreDifferences=true ... ignoreDifferences: - group: "\*" kind: "Application" jsonPointers: # Allow manually disabling auto sync for apps, useful for debugging. - /spec/syncPolicy/automated # These are automatically updated on a regular basis. Not ignoring last applied configuration since it's used for computing diffs after normalization. - /metadata/annotations/argocd.argoproj.io~1refresh - /operation ... ``` | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/cluster-bootstrapping.md | master | argo-cd | [
-0.006032008212059736,
-0.06685616821050644,
-0.07180025428533554,
-0.004835138563066721,
-0.04528270661830902,
-0.035517994314432144,
0.027482330799102783,
0.02006068080663681,
0.07339636981487274,
0.080581434071064,
0.009624805301427841,
-0.004496181849390268,
-0.03763327747583389,
-0.01... | 0.139663 |
# UI Customization ## Default Application Details View By default, the Application Details will show the `Tree` view. This can be configured on an Application basis, by setting the `pref.argocd.argoproj.io/default-view` annotation, accepting one of: `tree`, `pods`, `network`, `list` as values. For the Pods view, the default grouping mechanism can be configured using the `pref.argocd.argoproj.io/default-pod-sort` annotation, accepting one of: `node`, `parentResource`, `topLevelResource` as values. ## Node Labels in Pod View It's possible to propagate node labels to node information in the pod view by configuring `application.allowedNodeLabels` in the [argocd-cm](argocd-cm-yaml.md) ConfigMap. The following configuration: ```yaml application.allowedNodeLabels: topology.kubernetes.io/zone,karpenter.sh/capacity-type ``` Would result in:  | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/ui-customization.md | master | argo-cd | [
0.028126303106546402,
-0.005149154458194971,
-0.030956020578742027,
0.02214425429701805,
0.01350704301148653,
0.026320403441786766,
0.010144567117094994,
0.021519623696804047,
0.020310884341597557,
0.07413528859615326,
-0.023182542994618416,
-0.04261472821235657,
-0.05814759433269501,
-0.0... | 0.194857 |
# Installation Argo CD has two type of installations: multi-tenant and core. ## Multi-Tenant The multi-tenant installation is the most common way to install Argo CD. This type of installation is typically used to service multiple application developer teams in the organization and maintained by a platform team. The end-users can access Argo CD via the API server using the Web UI or `argocd` CLI. The `argocd` CLI has to be configured using `argocd login ` command (learn more [here](../user-guide/commands/argocd\_login.md)). Two types of installation manifests are provided: ### Non High Availability: Not recommended for production use. This type of installation is typically used during evaluation period for demonstrations and testing. \* [install.yaml](https://github.com/argoproj/argo-cd/blob/stable/manifests/install.yaml) - Standard Argo CD installation with cluster-admin access. Use this manifest set if you plan to use Argo CD to deploy applications in the same cluster that Argo CD runs in (i.e. kubernetes.svc.default). It will still be able to deploy to external clusters with inputted credentials. > Note: The ClusterRoleBinding in the installation manifest is bound to a ServiceAccount in the argocd namespace. > Be cautious when modifying the namespace, as changing it may cause permission-related errors unless the ClusterRoleBinding is correctly adjusted to reflect the new namespace. \* [namespace-install.yaml](https://github.com/argoproj/argo-cd/blob/stable/manifests/namespace-install.yaml) - Installation of Argo CD which requires only namespace level privileges (does not need cluster roles). Use this manifest set if you do not need Argo CD to deploy applications in the same cluster that Argo CD runs in, and will rely solely on inputted cluster credentials. An example of using this set of manifests is if you run several Argo CD instances for different teams, where each instance will be deploying applications to external clusters. It will still be possible to deploy to the same cluster (kubernetes.svc.default) with inputted credentials (i.e. `argocd cluster add --in-cluster --namespace `). With the default roles included, you will only be able to deploy Argo CD resources (Applications, ApplicationSets and AppProjects) in the same cluster, as it's only supporting the GitOps mode with real deployments being done to external clusters. You can modify that by defining new roles and binding them to the `argocd-application-controller` service account. > Note: Argo CD CRDs are not included into [namespace-install.yaml](https://github.com/argoproj/argo-cd/blob/stable/manifests/namespace-install.yaml). > and have to be installed separately. The CRD manifests are located in the [manifests/crds](https://github.com/argoproj/argo-cd/blob/stable/manifests/crds) directory. > Use the following command to install them: > ``` > kubectl apply -k https://github.com/argoproj/argo-cd/manifests/crds\?ref\=stable > ``` ### High Availability: High Availability installation is recommended for production use. This bundle includes the same components but tuned for high availability and resiliency. \* [ha/install.yaml](https://github.com/argoproj/argo-cd/blob/stable/manifests/ha/install.yaml) - the same as install.yaml but with multiple replicas for supported components. \* [ha/namespace-install.yaml](https://github.com/argoproj/argo-cd/blob/stable/manifests/ha/namespace-install.yaml) - the same as namespace-install.yaml but with multiple replicas for supported components. ## Core The Argo CD Core installation is primarily used to deploy Argo CD in headless mode. This type of installation is most suitable for cluster administrators who independently use Argo CD and don't need multi-tenancy features. This installation includes fewer components and is easier to setup. The bundle does not include the API server or UI, and installs the lightweight (non-HA) version of each component. Installation manifest is available at [core-install.yaml](https://github.com/argoproj/argo-cd/blob/stable/manifests/core-install.yaml). For more details about Argo CD Core please refer to the [official documentation](./core.md) ## Kustomize The Argo CD manifests can also be installed using Kustomize. It is recommended to include the manifest as a remote resource and apply additional customizations using Kustomize patches. ```yaml apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization namespace: argocd resources: - https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml ``` For an example of this, see the [kustomization.yaml](https://github.com/argoproj/argoproj-deployments/blob/master/argocd/kustomization.yaml) used to deploy the [Argoproj CI/CD infrastructure](https://github.com/argoproj/argoproj-deployments#argoproj-deployments). #### Installing Argo CD in a Custom Namespace If you | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/installation.md | master | argo-cd | [
0.018396446481347084,
-0.058198943734169006,
-0.06990064680576324,
-0.060558851808309555,
-0.039464887231588364,
-0.07296203076839447,
0.0396808497607708,
0.012174179777503014,
-0.00010330935037927702,
0.06633797287940979,
0.04233158752322197,
0.02895023301243782,
-0.0631069615483284,
-0.0... | 0.19607 |
include the manifest as a remote resource and apply additional customizations using Kustomize patches. ```yaml apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization namespace: argocd resources: - https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml ``` For an example of this, see the [kustomization.yaml](https://github.com/argoproj/argoproj-deployments/blob/master/argocd/kustomization.yaml) used to deploy the [Argoproj CI/CD infrastructure](https://github.com/argoproj/argoproj-deployments#argoproj-deployments). #### Installing Argo CD in a Custom Namespace If you want to install Argo CD in a namespace other than the default argocd, you can use Kustomize to apply a patch that updates the ClusterRoleBinding to reference the correct namespace for the ServiceAccount. This ensures that the necessary permissions are correctly set in your custom namespace. Below is an example of how to configure your kustomization.yaml to install Argo CD in a custom namespace: ```yaml apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization namespace: resources: - https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml patches: - patch: |- - op: replace path: /subjects/0/namespace value: target: kind: ClusterRoleBinding ``` This patch ensures that the ClusterRoleBinding correctly maps to the ServiceAccount in your custom namespace, preventing any permission-related issues during the deployment. ## Helm The Argo CD can be installed using [Helm](https://helm.sh/). The Helm chart is currently community maintained and available at [argo-helm/charts/argo-cd](https://github.com/argoproj/argo-helm/tree/main/charts/argo-cd). ## Supported versions For detailed information regarding Argo CD's version support policy, please refer to the [Release Process and Cadence documentation](https://argo-cd.readthedocs.io/en/stable/developer-guide/release-process-and-cadence/). ## Tested versions The following table shows the versions of Kubernetes that are tested with each version of Argo CD. {!docs/operator-manual/tested-kubernetes-versions.md!} | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/installation.md | master | argo-cd | [
0.008795120753347874,
-0.014360706321895123,
-0.01582796685397625,
-0.06015416607260704,
-0.06922446191310883,
-0.028630955144762993,
0.05480369180440903,
-0.008279712870717049,
-0.053160250186920166,
0.09889634698629379,
-0.014406479895114899,
0.004818149376660585,
-0.045679863542318344,
... | 0.17733 |
# Ingress Configuration Argo CD API server runs both a gRPC server (used by the CLI), as well as a HTTP/HTTPS server (used by the UI). Both protocols are exposed by the argocd-server service object on the following ports: \* 443 - gRPC/HTTPS \* 80 - HTTP (redirects to HTTPS) There are several ways how Ingress can be configured. ## [Ambassador](https://www.getambassador.io/) The Ambassador Edge Stack can be used as a Kubernetes ingress controller with [automatic TLS termination](https://www.getambassador.io/docs/latest/topics/running/tls/#host) and routing capabilities for both the CLI and the UI. The API server should be run with TLS disabled. Edit the `argocd-server` deployment to add the `--insecure` flag to the argocd-server command, or simply set `server.insecure: "true"` in the `argocd-cmd-params-cm` ConfigMap [as described here](server-commands/additional-configuration-method.md). Given the `argocd` CLI includes the port number in the request `host` header, 2 Mappings are required. Note: Disabling TLS in not required if you are using grpc-web ### Option 1: Mapping CRD for Host-based Routing ```yaml apiVersion: getambassador.io/v2 kind: Mapping metadata: name: argocd-server-ui namespace: argocd spec: host: argocd.example.com prefix: / service: https://argocd-server:443 --- apiVersion: getambassador.io/v2 kind: Mapping metadata: name: argocd-server-cli namespace: argocd spec: # NOTE: the port must be ignored if you have strip\_matching\_host\_port enabled on envoy host: argocd.example.com:443 prefix: / service: argocd-server:80 regex\_headers: Content-Type: "^application/grpc.\*$" grpc: true ``` Login with the `argocd` CLI: ```shell argocd login ``` ### Option 2: Mapping CRD for Path-based Routing The API server must be configured to be available under a non-root path (e.g. `/argo-cd`). Edit the `argocd-server` deployment to add the `--rootpath=/argo-cd` flag to the argocd-server command. ```yaml apiVersion: getambassador.io/v2 kind: Mapping metadata: name: argocd-server namespace: argocd spec: prefix: /argo-cd rewrite: /argo-cd service: https://argocd-server:443 ``` Example of `argocd-cmd-params-cm` configmap ```yaml apiVersion: v1 kind: ConfigMap metadata: name: argocd-cmd-params-cm namespace: argocd labels: app.kubernetes.io/name: argocd-cmd-params-cm app.kubernetes.io/part-of: argocd data: ## Server properties # Value for base href in index.html. Used if Argo CD is running behind reverse proxy under subpath different from / (default "/") server.basehref: "/argo-cd" # Used if Argo CD is running behind reverse proxy under subpath different from / server.rootpath: "/argo-cd" ``` Login with the `argocd` CLI using the extra `--grpc-web-root-path` flag for non-root paths. ```shell argocd login : --grpc-web-root-path /argo-cd ``` ## [Contour](https://projectcontour.io/) The Contour ingress controller can terminate TLS ingress traffic at the edge. The Argo CD API server should be run with TLS disabled. Edit the `argocd-server` Deployment to add the `--insecure` flag to the argocd-server container command, or simply set `server.insecure: "true"` in the `argocd-cmd-params-cm` ConfigMap [as described here](server-commands/additional-configuration-method.md). It is also possible to provide an internal-only ingress path and an external-only ingress path by deploying two instances of Contour: one behind a private-subnet LoadBalancer service and one behind a public-subnet LoadBalancer service. The private Contour deployment will pick up Ingresses annotated with `kubernetes.io/ingress.class: contour-internal` and the public Contour deployment will pick up Ingresses annotated with `kubernetes.io/ingress.class: contour-external`. This provides the opportunity to deploy the Argo CD UI privately but still allow for SSO callbacks to succeed. ### Private Argo CD UI with Multiple Ingress Objects and BYO Certificate Since Contour Ingress supports only a single protocol per Ingress object, define three Ingress objects. One for private HTTP/HTTPS, one for private gRPC, and one for public HTTPS SSO callbacks. Internal HTTP/HTTPS Ingress: ```yaml apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: argocd-server-http annotations: kubernetes.io/ingress.class: contour-internal ingress.kubernetes.io/force-ssl-redirect: "true" spec: rules: - host: internal.path.to.argocd.io http: paths: - path: / pathType: Prefix backend: service: name: argocd-server port: name: http tls: - hosts: - internal.path.to.argocd.io secretName: your-certificate-name ``` Internal gRPC Ingress: ```yaml apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: argocd-server-grpc annotations: kubernetes.io/ingress.class: contour-internal spec: rules: - host: grpc-internal.path.to.argocd.io http: paths: - path: / pathType: Prefix | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/ingress.md | master | argo-cd | [
-0.027490342035889626,
0.04558444023132324,
-0.04877995327115059,
-0.0377364344894886,
-0.06850330531597137,
-0.08172160387039185,
0.015996290370821953,
-0.05971285700798035,
0.0676191970705986,
0.08373071998357773,
-0.000745279947295785,
-0.047004688531160355,
-0.01232096366584301,
0.0121... | 0.181414 |
host: internal.path.to.argocd.io http: paths: - path: / pathType: Prefix backend: service: name: argocd-server port: name: http tls: - hosts: - internal.path.to.argocd.io secretName: your-certificate-name ``` Internal gRPC Ingress: ```yaml apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: argocd-server-grpc annotations: kubernetes.io/ingress.class: contour-internal spec: rules: - host: grpc-internal.path.to.argocd.io http: paths: - path: / pathType: Prefix backend: service: name: argocd-server port: name: https tls: - hosts: - grpc-internal.path.to.argocd.io secretName: your-certificate-name ``` External HTTPS SSO Callback Ingress: ```yaml apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: argocd-server-external-callback-http annotations: kubernetes.io/ingress.class: contour-external ingress.kubernetes.io/force-ssl-redirect: "true" spec: rules: - host: external.path.to.argocd.io http: paths: - path: /api/dex/callback pathType: Prefix backend: service: name: argocd-server port: name: http tls: - hosts: - external.path.to.argocd.io secretName: your-certificate-name ``` The argocd-server Service needs to be annotated with `projectcontour.io/upstream-protocol.h2c: "https,443"` to wire up the gRPC protocol proxying. The API server should then be run with TLS disabled. Edit the `argocd-server` deployment to add the `--insecure` flag to the argocd-server command, or simply set `server.insecure: "true"` in the `argocd-cmd-params-cm` ConfigMap [as described here](server-commands/additional-configuration-method.md). Contour httpproxy CRD: Using a contour httpproxy CRD allows you to use the same hostname for the GRPC and REST api. ```yaml apiVersion: projectcontour.io/v1 kind: HTTPProxy metadata: name: argocd-server namespace: argocd spec: ingressClassName: contour virtualhost: fqdn: path.to.argocd.io tls: secretName: wildcard-tls routes: - conditions: - prefix: / - header: name: Content-Type contains: application/grpc services: - name: argocd-server port: 80 protocol: h2c # allows for unencrypted http2 connections timeoutPolicy: response: 1h idle: 600s idleConnection: 600s - conditions: - prefix: / services: - name: argocd-server port: 80 ``` ## [kubernetes/ingress-nginx](https://github.com/kubernetes/ingress-nginx) ### Option 1: SSL-Passthrough Argo CD serves multiple protocols (gRPC/HTTPS) on the same port (443), this provides a challenge when attempting to define a single nginx ingress object and rule for the argocd-service, since the `nginx.ingress.kubernetes.io/backend-protocol` [annotation](https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/annotations/#backend-protocol) accepts only a single value for the backend protocol (e.g. HTTP, HTTPS, GRPC, GRPCS). In order to expose the Argo CD API server with a single ingress rule and hostname, the `nginx.ingress.kubernetes.io/ssl-passthrough` [annotation](https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/annotations/#ssl-passthrough) must be used to passthrough TLS connections and terminate TLS at the Argo CD API server. ```yaml apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: argocd-server-ingress namespace: argocd annotations: nginx.ingress.kubernetes.io/force-ssl-redirect: "true" nginx.ingress.kubernetes.io/ssl-passthrough: "true" spec: ingressClassName: nginx rules: - host: argocd.example.com http: paths: - path: / pathType: Prefix backend: service: name: argocd-server port: name: https ``` The above rule terminates TLS at the Argo CD API server, which detects the protocol being used, and responds appropriately. Note that the `nginx.ingress.kubernetes.io/ssl-passthrough` annotation requires that the `--enable-ssl-passthrough` flag be added to the command line arguments to `nginx-ingress-controller`. #### SSL-Passthrough with cert-manager and Let's Encrypt ```yaml apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: argocd-server-ingress namespace: argocd annotations: cert-manager.io/cluster-issuer: letsencrypt-prod nginx.ingress.kubernetes.io/ssl-passthrough: "true" # If you encounter a redirect loop or are getting a 307 response code # then you need to force the nginx ingress to connect to the backend using HTTPS. # nginx.ingress.kubernetes.io/backend-protocol: "HTTPS" spec: ingressClassName: nginx rules: - host: argocd.example.com http: paths: - path: / pathType: Prefix backend: service: name: argocd-server port: name: https tls: - hosts: - argocd.example.com secretName: argocd-server-tls # as expected by argocd-server ``` ### Option 2: SSL Termination at Ingress Controller An alternative approach is to perform the SSL termination at the Ingress. Since an `ingress-nginx` Ingress supports only a single protocol per Ingress object, two Ingress objects need to be defined using the `nginx.ingress.kubernetes.io/backend-protocol` annotation, one for HTTP/HTTPS and the other for gRPC. Each ingress will be for a different domain (`argocd.example.com` and `grpc.argocd.example.com`). This requires that the Ingress resources use different TLS `secretName`s to avoid unexpected behavior. HTTP/HTTPS Ingress: ```yaml apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: argocd-server-http-ingress namespace: argocd annotations: nginx.ingress.kubernetes.io/force-ssl-redirect: "true" nginx.ingress.kubernetes.io/backend-protocol: "HTTP" spec: ingressClassName: nginx rules: - http: paths: | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/ingress.md | master | argo-cd | [
-0.01055455207824707,
0.014474468305706978,
-0.055705927312374115,
-0.02423548325896263,
-0.0001776835269993171,
-0.1028592512011528,
0.037503551691770554,
-0.024649551138281822,
0.09442273527383804,
0.07938141375780106,
0.02365395426750183,
-0.05995837599039078,
-0.06136952340602875,
0.03... | 0.157738 |
gRPC. Each ingress will be for a different domain (`argocd.example.com` and `grpc.argocd.example.com`). This requires that the Ingress resources use different TLS `secretName`s to avoid unexpected behavior. HTTP/HTTPS Ingress: ```yaml apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: argocd-server-http-ingress namespace: argocd annotations: nginx.ingress.kubernetes.io/force-ssl-redirect: "true" nginx.ingress.kubernetes.io/backend-protocol: "HTTP" spec: ingressClassName: nginx rules: - http: paths: - path: / pathType: Prefix backend: service: name: argocd-server port: name: http host: argocd.example.com tls: - hosts: - argocd.example.com secretName: argocd-ingress-http ``` gRPC Ingress: ```yaml apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: argocd-server-grpc-ingress namespace: argocd annotations: nginx.ingress.kubernetes.io/backend-protocol: "GRPC" spec: ingressClassName: nginx rules: - http: paths: - path: / pathType: Prefix backend: service: name: argocd-server port: name: https host: grpc.argocd.example.com tls: - hosts: - grpc.argocd.example.com secretName: argocd-ingress-grpc ``` The API server should then be run with TLS disabled. Edit the `argocd-server` deployment to add the `--insecure` flag to the argocd-server command, or simply set `server.insecure: "true"` in the `argocd-cmd-params-cm` ConfigMap [as described here](server-commands/additional-configuration-method.md). The obvious disadvantage to this approach is that this technique requires two separate hostnames for the API server -- one for gRPC and the other for HTTP/HTTPS. However it allows TLS termination to happen at the ingress controller. ## [Traefik (v3.0)](https://docs.traefik.io/) Traefik can be used as an edge router and provide [TLS](https://docs.traefik.io/user-guides/grpc/) termination within the same deployment. It currently has an advantage over NGINX in that it can terminate both TCP and HTTP connections \_on the same port\_ meaning you do not require multiple hosts or paths. The API server should be run with TLS disabled. Edit the `argocd-server` deployment to add the `--insecure` flag to the argocd-server command or set `server.insecure: "true"` in the `argocd-cmd-params-cm` ConfigMap [as described here](server-commands/additional-configuration-method.md). ### IngressRoute CRD ```yaml apiVersion: traefik.io/v1alpha1 kind: IngressRoute metadata: name: argocd-server namespace: argocd spec: entryPoints: - websecure routes: - kind: Rule match: Host(`argocd.example.com`) priority: 10 services: - name: argocd-server port: 80 - kind: Rule match: Host(`argocd.example.com`) && Header(`Content-Type`, `application/grpc`) priority: 11 services: - name: argocd-server port: 80 scheme: h2c tls: certResolver: default ``` ## AWS Application Load Balancers (ALBs) And Classic ELB (HTTP Mode) AWS ALBs can be used as an L7 Load Balancer for both UI and gRPC traffic, whereas Classic ELBs and NLBs can be used as L4 Load Balancers for both. When using an ALB, you'll want to create a second service for argocd-server. This is necessary because we need to tell the ALB to send the GRPC traffic to a different target group than the UI traffic, since the backend protocol is HTTP2 instead of HTTP1. ```yaml apiVersion: v1 kind: Service metadata: annotations: alb.ingress.kubernetes.io/backend-protocol-version: GRPC # This tells AWS to send traffic from the ALB using GRPC. Plain HTTP2 can be used, but the health checks won't be available because argo currently downgrades non-grpc calls to HTTP1 labels: app: argogrpc name: argogrpc namespace: argocd spec: ports: - name: "443" port: 443 protocol: TCP targetPort: 8080 selector: app.kubernetes.io/name: argocd-server sessionAffinity: None type: NodePort ``` Once we create this service, we can configure the Ingress to conditionally route all `application/grpc` traffic to the new HTTP2 backend, using the `alb.ingress.kubernetes.io/conditions` annotation, as seen below. Note: The value after the . in the condition annotation \_must\_ be the same name as the service that you want traffic to route to - and will be applied on any path with a matching serviceName. Also note that we can configure the health check to return the gRPC health status code `OK - 0` from the argocd-server by setting the health check path to `/grpc.health.v1.Health/Check`. By default, the ALB health check for gRPC returns the status code `UNIMPLEMENTED - 12` on health check path `/AWS.ALB/healthcheck`. ```yaml apiVersion: networking.k8s.io/v1 kind: Ingress metadata: annotations: | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/ingress.md | master | argo-cd | [
-0.034247659146785736,
0.00325694028288126,
-0.020728081464767456,
-0.029259871691465378,
-0.05781462416052818,
-0.09808803349733353,
0.0506342314183712,
-0.09008379280567169,
0.12346354871988297,
0.04268011078238487,
-0.0350043922662735,
-0.053944673389196396,
-0.0015074691036716104,
0.04... | 0.078424 |
health check to return the gRPC health status code `OK - 0` from the argocd-server by setting the health check path to `/grpc.health.v1.Health/Check`. By default, the ALB health check for gRPC returns the status code `UNIMPLEMENTED - 12` on health check path `/AWS.ALB/healthcheck`. ```yaml apiVersion: networking.k8s.io/v1 kind: Ingress metadata: annotations: alb.ingress.kubernetes.io/backend-protocol: HTTPS # Use this annotation (which must match a service name) to route traffic to HTTP2 backends. alb.ingress.kubernetes.io/conditions.argogrpc: | [{"field":"http-header","httpHeaderConfig":{"httpHeaderName": "Content-Type", "values":["application/grpc"]}}] alb.ingress.kubernetes.io/listen-ports: '[{"HTTPS":443}]' # Use this annotation to receive OK - 0 instead of UNIMPLEMENTED - 12 for gRPC health check. alb.ingress.kubernetes.io/healthcheck-path: /grpc.health.v1.Health/Check alb.ingress.kubernetes.io/success-codes: '0' name: argocd namespace: argocd spec: rules: - host: argocd.argoproj.io http: paths: - path: / backend: service: name: argogrpc # The grpc service must be placed before the argocd-server for the listening rules to be created in the correct order port: number: 443 pathType: Prefix - path: / backend: service: name: argocd-server port: number: 443 pathType: Prefix tls: - hosts: - argocd.argoproj.io ``` ## [Istio](https://www.istio.io) You can put Argo CD behind Istio using following configurations. Here we will achieve both serving Argo CD behind istio and using subpath on Istio First we need to make sure that we can run Argo CD with subpath (ie /argocd). For this we have used install.yaml from argocd project as is ```bash curl -kLs -o install.yaml https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml ``` save following file as kustomization.yml ```yaml apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: - ./install.yaml patches: - path: ./patch.yml ``` And following lines as patch.yml ```yaml # Use --insecure so Ingress can send traffic with HTTP # --bashref /argocd is the subpath like https://IP/argocd # env was added because of https://github.com/argoproj/argo-cd/issues/3572 error --- apiVersion: apps/v1 kind: Deployment metadata: name: argocd-server spec: template: spec: containers: - args: - /usr/local/bin/argocd-server - --staticassets - /shared/app - --redis - argocd-redis:6379 - --insecure - --basehref - /argocd - --rootpath - /argocd name: argocd-server env: - name: ARGOCD\_MAX\_CONCURRENT\_LOGIN\_REQUESTS\_COUNT value: "0" ``` After that install Argo CD (there should be only 3 yml file defined above in current directory ) ```bash kubectl apply -k ./ -n argocd --wait=true ``` Be sure you create secret for Istio ( in our case secretname is argocd-server-tls on argocd Namespace). After that we create Istio Resources ```yaml apiVersion: networking.istio.io/v1alpha3 kind: Gateway metadata: name: argocd-gateway namespace: argocd spec: selector: istio: ingressgateway servers: - port: number: 80 name: http protocol: HTTP hosts: - "\*" tls: httpsRedirect: true - port: number: 443 name: https protocol: HTTPS hosts: - "\*" tls: credentialName: argocd-server-tls maxProtocolVersion: TLSV1\_3 minProtocolVersion: TLSV1\_2 mode: SIMPLE cipherSuites: - ECDHE-ECDSA-AES128-GCM-SHA256 - ECDHE-RSA-AES128-GCM-SHA256 - ECDHE-ECDSA-AES128-SHA - AES128-GCM-SHA256 - AES128-SHA - ECDHE-ECDSA-AES256-GCM-SHA384 - ECDHE-RSA-AES256-GCM-SHA384 - ECDHE-ECDSA-AES256-SHA - AES256-GCM-SHA384 - AES256-SHA --- apiVersion: networking.istio.io/v1alpha3 kind: VirtualService metadata: name: argocd-virtualservice namespace: argocd spec: hosts: - "\*" gateways: - argocd-gateway http: - match: - uri: prefix: /argocd route: - destination: host: argocd-server port: number: 80 ``` And now we can browse http://{{ IP }}/argocd (it will be rewritten to https://{{ IP }}/argocd ## Google Cloud load balancers with Kubernetes Ingress You can make use of the integration of GKE with Google Cloud to deploy Load Balancers using just Kubernetes objects. For this we will need these five objects: - A Service - A BackendConfig - A FrontendConfig - A secret with your SSL certificate - An Ingress for GKE If you need detail for all the options available for these Google integrations, you can check the [Google docs on configuring Ingress features](https://cloud.google.com/kubernetes-engine/docs/how-to/ingress-features) ### Disable internal TLS First, to avoid internal redirection loops from HTTP to HTTPS, the API server should be run with TLS disabled. Edit the `--insecure` flag in the `argocd-server` command of the argocd-server deployment, or simply set | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/ingress.md | master | argo-cd | [
0.011883135885000229,
0.05189333111047745,
-0.0705086961388588,
-0.018675025552511215,
-0.026135418564081192,
-0.09047243744134903,
0.032579317688941956,
-0.07699743658304214,
0.0601075179874897,
0.07191968709230423,
-0.006158299744129181,
-0.04754111170768738,
-0.04993593692779541,
-0.040... | 0.104074 |
Google integrations, you can check the [Google docs on configuring Ingress features](https://cloud.google.com/kubernetes-engine/docs/how-to/ingress-features) ### Disable internal TLS First, to avoid internal redirection loops from HTTP to HTTPS, the API server should be run with TLS disabled. Edit the `--insecure` flag in the `argocd-server` command of the argocd-server deployment, or simply set `server.insecure: "true"` in the `argocd-cmd-params-cm` ConfigMap [as described here](server-commands/additional-configuration-method.md). ### Creating a service Now you need an externally accessible service. This is practically the same as the internal service Argo CD has, but with Google Cloud annotations. Note that this service is annotated to use a [Network Endpoint Group](https://cloud.google.com/load-balancing/docs/negs) (NEG) to allow your load balancer to send traffic directly to your pods without using kube-proxy, so remove the `neg` annotation if that's not what you want. The service: ```yaml apiVersion: v1 kind: Service metadata: name: argocd-server namespace: argocd annotations: cloud.google.com/neg: '{"ingress": true}' cloud.google.com/backend-config: '{"ports": {"http":"argocd-backend-config"}}' spec: type: ClusterIP ports: - name: http port: 80 protocol: TCP targetPort: 8080 selector: app.kubernetes.io/name: argocd-server ``` ### Creating a BackendConfig See that previous service referencing a backend config called `argocd-backend-config`? So lets deploy it using this yaml: ```yaml apiVersion: cloud.google.com/v1 kind: BackendConfig metadata: name: argocd-backend-config namespace: argocd spec: healthCheck: checkIntervalSec: 30 timeoutSec: 5 healthyThreshold: 1 unhealthyThreshold: 2 type: HTTP requestPath: /healthz port: 8080 ``` It uses the same health check as the pods. ### Creating a FrontendConfig Now we can deploy a frontend config with an HTTP to HTTPS redirect: ```yaml apiVersion: networking.gke.io/v1beta1 kind: FrontendConfig metadata: name: argocd-frontend-config namespace: argocd spec: redirectToHttps: enabled: true ``` --- > [!NOTE] > The next two steps (the certificate secret and the Ingress) are described supposing that you manage the certificate yourself, and you have the certificate and key files for it. In the case that your certificate is Google-managed, fix the next two steps using the [guide to use a Google-managed SSL certificate](https://cloud.google.com/kubernetes-engine/docs/how-to/managed-certs#creating\_an\_ingress\_with\_a\_google-managed\_certificate). --- ### Creating a certificate secret We need now to create a secret with the SSL certificate we want in our load balancer. It's as easy as executing this command on the path you have your certificate keys stored: ``` kubectl -n argocd create secret tls secret-yourdomain-com \ --cert cert-file.crt --key key-file.key ``` ### Creating an Ingress And finally, to top it all, our Ingress. Note the reference to our frontend config, the service, and to the certificate secret. --- > [!NOTE] > GKE clusters running versions earlier than `1.21.3-gke.1600`, [the only supported value for the pathType field](https://cloud.google.com/kubernetes-engine/docs/how-to/load-balance-ingress#creating\_an\_ingress) is `ImplementationSpecific`. So you must check your GKE cluster's version. You need to use different YAML depending on the version. --- If you use the version earlier than `1.21.3-gke.1600`, you should use the following Ingress resource: ```yaml apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: argocd namespace: argocd annotations: networking.gke.io/v1beta1.FrontendConfig: argocd-frontend-config spec: tls: - secretName: secret-example-com rules: - host: argocd.example.com http: paths: - pathType: ImplementationSpecific path: "/\*" # "\*" is needed. Without this, the UI Javascript and CSS will not load properly backend: service: name: argocd-server port: number: 80 ``` If you use the version `1.21.3-gke.1600` or later, you should use the following Ingress resource: ```yaml apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: argocd namespace: argocd annotations: networking.gke.io/v1beta1.FrontendConfig: argocd-frontend-config spec: tls: - secretName: secret-example-com rules: - host: argocd.example.com http: paths: - pathType: Prefix path: "/" backend: service: name: argocd-server port: number: 80 ``` As you may know already, it can take some minutes to deploy the load balancer and become ready to accept connections. Once it's ready, get the public IP address for your Load Balancer, go to your DNS server (Google or third party) and point your domain or subdomain (i.e. argocd.example.com) to that IP address. You can | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/ingress.md | master | argo-cd | [
-0.05543352663516998,
0.0025509661063551903,
0.003351053688675165,
-0.027322856709361076,
-0.07962384074926376,
-0.06379102915525436,
0.021294068545103073,
-0.051416315138339996,
0.003280197735875845,
0.07016728073358536,
-0.033982109278440475,
-0.04936007037758827,
0.006457366514950991,
-... | 0.100495 |
can take some minutes to deploy the load balancer and become ready to accept connections. Once it's ready, get the public IP address for your Load Balancer, go to your DNS server (Google or third party) and point your domain or subdomain (i.e. argocd.example.com) to that IP address. You can get that IP address describing the Ingress object like this: ``` kubectl -n argocd describe ingresses argocd | grep Address ``` Once the DNS change is propagated, you're ready to use Argo with your Google Cloud Load Balancer ## Authenticating through multiple layers of authenticating reverse proxies Argo CD endpoints may be protected by one or more reverse proxies layers, in that case, you can provide additional headers through the `argocd` CLI `--header` parameter to authenticate through those layers. ```shell $ argocd login : --header 'x-token1:foo' --header 'x-token2:bar' # can be repeated multiple times $ argocd login : --header 'x-token1:foo,x-token2:bar' # headers can also be comma separated ``` ## ArgoCD Server and UI Root Path (v1.5.3) Argo CD server and UI can be configured to be available under a non-root path (e.g. `/argo-cd`). To do this, add the `--rootpath` flag into the `argocd-server` deployment command: ```yaml spec: template: spec: name: argocd-server containers: - command: - /argocd-server - --repo-server - argocd-repo-server:8081 - --rootpath - /argo-cd ``` NOTE: The flag `--rootpath` changes both API Server and UI base URL. Example nginx.conf: ``` worker\_processes 1; events { worker\_connections 1024; } http { sendfile on; server { listen 443; location /argo-cd/ { proxy\_pass https://localhost:8080/argo-cd/; proxy\_redirect off; proxy\_set\_header Host $host; proxy\_set\_header X-Real-IP $remote\_addr; proxy\_set\_header X-Forwarded-For $proxy\_add\_x\_forwarded\_for; proxy\_set\_header X-Forwarded-Host $server\_name; # buffering should be disabled for api/v1/stream/applications to support chunked response proxy\_buffering off; } } } ``` Flag ```--grpc-web-root-path ``` is used to provide a non-root path (e.g. /argo-cd) ```shell $ argocd login : --grpc-web-root-path /argo-cd ``` ## UI Base Path If the Argo CD UI is available under a non-root path (e.g. `/argo-cd` instead of `/`) then the UI path should be configured in the API server. To configure the UI path add the `--basehref` flag into the `argocd-server` deployment command: ```yaml spec: template: spec: name: argocd-server containers: - command: - /argocd-server - --repo-server - argocd-repo-server:8081 - --basehref - /argo-cd ``` NOTE: The flag `--basehref` only changes the UI base URL. The API server will keep using the `/` path so you need to add a URL rewrite rule to the proxy config. Example nginx.conf with URL rewrite: ``` worker\_processes 1; events { worker\_connections 1024; } http { sendfile on; server { listen 443; location /argo-cd { rewrite /argo-cd/(.\*) /$1 break; proxy\_pass https://localhost:8080; proxy\_redirect off; proxy\_set\_header Host $host; proxy\_set\_header X-Real-IP $remote\_addr; proxy\_set\_header X-Forwarded-For $proxy\_add\_x\_forwarded\_for; proxy\_set\_header X-Forwarded-Host $server\_name; # buffering should be disabled for api/v1/stream/applications to support chunked response proxy\_buffering off; } } } ``` ## Gateway API Example This section discusses using Gateway API to expose the Argo CD server in various TLS configurations, accomodating both HTTP and gRPC traffic, possibly using HTTP/2. ### TLS termination at the Gateway Assume the following cluster-wide `Gateway` resource, that terminates the TLS conection with a certificate stored in a `Secret` in the same namespace: ```yaml apiVersion: gateway.networking.k8s.io/v1 kind: Gateway metadata: name: cluster-gateway namespace: gateway spec: gatewayClassName: example listeners: - protocol: HTTPS port: 443 name: https hostname: "\*.local.example.com" allowedRoutes: namespaces: from: All tls: mode: Terminate certificateRefs: - name: cluster-gateway-tls kind: Secret group: "" ``` To automate certificate management, `cert-manager` supports [gateway annotations](https://cert-manager.io/docs/usage/gateway/). #### Securing traffic between Argo CD and the gateway If your security requirements allow it, the Argo CD API server can be run with TLS disabled: pass the `--insecure` flag to the `argocd-server` command, or set `server.insecure: | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/ingress.md | master | argo-cd | [
-0.07596935331821442,
-0.04441449046134949,
0.007438183296471834,
-0.061563536524772644,
-0.11909123510122299,
-0.0743384137749672,
0.05544891580939293,
-0.08026254177093506,
0.03422028198838234,
0.05542004108428955,
-0.04803488776087761,
-0.045470353215932846,
-0.0228028055280447,
-0.1019... | 0.048841 |
kind: Secret group: "" ``` To automate certificate management, `cert-manager` supports [gateway annotations](https://cert-manager.io/docs/usage/gateway/). #### Securing traffic between Argo CD and the gateway If your security requirements allow it, the Argo CD API server can be run with TLS disabled: pass the `--insecure` flag to the `argocd-server` command, or set `server.insecure: "true"` in the `argocd-cmd-params-cm` ConfigMap [as described here](server-commands/additional-configuration-method.md). It is also possible to keep TLS enabled, encrypting traffic between the gateway and the Argo CD API server, by using a [BackendTLSPolicy](https://gateway-api.sigs.k8s.io/api-types/backendtlspolicy/). Consult the [Upstream TLS](https://gateway-api.sigs.k8s.io/guides/tls/#upstream-tls) documentation for more details. ```yaml apiVersion: gateway.networking.k8s.io/v1 kind: BackendTLSPolicy metadata: name: tls-upstream-auth namespace: argocd spec: targetRefs: - kind: Service name: argocd-server group: "" validation: caCertificateRefs: - kind: ConfigMap name: argocd-server-ca-cert group: "" hostname: argocd-server.argocd.svc.cluster.local ``` #### Routing HTTP requests ```yaml apiVersion: gateway.networking.k8s.io/v1 kind: HTTPRoute metadata: name: argocd-http-route namespace: argocd spec: parentRefs: - name: cluster-gateway namespace: gateway sectionName: https hostnames: - "argocd.local.example.com" rules: - backendRefs: - name: argocd-server port: 80 matches: - path: type: PathPrefix value: / ``` #### Routing gRPC requests The `argocd` CLI operates at full capability when using gRPC over HTTP/2 to communicate with the API server, falling back to HTTP/1.1. (`--grpc-web` flag). gRPC can be configured using a `GRPCRoute`, and HTTP/2 requested as the application protocol on the `argocd-server` service: ```yaml apiVersion: gateway.networking.k8s.io/v1 kind: GRPCRoute metadata: name: argocd-grpc-route namespace: argocd spec: parentRefs: - name: cluster-gateway namespace: gateway sectionName: https hostnames: - "grpc.argocd.local.example.com" rules: - backendRefs: - name: argocd-server port: 443 ``` And in Argo CD's `values.yaml` (or [directly](https://kubernetes.io/docs/concepts/services-networking/service/#application-protocol) in the service manifest): ``` server: service: # Enable gRPC over HTTP/2 servicePortHttpsAppProtocol: kubernetes.io/h2c ``` ##### Routing gRPC and HTTP on through the same domain Although officially [discouraged](https://gateway-api.sigs.k8s.io/api-types/grpcroute/#cross-serving), attaching the `HTTPRoute` and `GRPCRoute` to the same domain may be supported by some implementations. Matching requests headers become necessary to disambiguate the destination, as shown below: ```yaml apiVersion: gateway.networking.k8s.io/v1 kind: GRPCRoute metadata: name: argocd-grpc-route namespace: argocd spec: parentRefs: - name: cluster-gateway namespace: gateway hostnames: - "grpc.argocd.local.example.com" rules: - backendRefs: - name: argocd-server port: 443 matches: - headers: - name: Content-Type type: RegularExpression value: "^application/grpc.\*$" ``` ### TLS passthrough TLS can also be configured to terminate at the Argo CD API server. This require attaching a `TLSRoute` to the gateway, which is part of the [Experimental](https://gateway-api.sigs.k8s.io/reference/1.4/specx/) Gateway API CRDs. ```yaml kind: Gateway metadata: name: cluster-gateway namespace: gateway spec: gatewayClassName: example listeners: - name: tls port: 443 protocol: TLS hostname: "argocd.example.com" allowedRoutes: namespaces: from: All kinds: - kind: TLSRoute tls: mode: Passthrough ``` ```yaml apiVersion: gateway.networking.k8s.io/v1alpha2 kind: TLSRoute metadata: namespace: argocd name: argocd-server-tlsroute spec: parentRefs: - name: cluster-gateway namespace: gateway sectionName: tls hostnames: - argocd.example.com rules: - backendRefs: - name: argocd-server port: 443 ``` The TLS certificates are implicit here, and found by the Argo CD server in the `argocd-server-tls` secret. Note that `cert-manager` does not support generating certificates for passthrough gateway listeners. | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/ingress.md | master | argo-cd | [
-0.0495421476662159,
0.0724782794713974,
-0.12027104198932648,
0.05334581062197685,
-0.042114224284887314,
-0.05929309129714966,
0.0404156818985939,
-0.007005379069596529,
0.0027029758784919977,
0.08087180554866791,
-0.011928694322705269,
-0.017025897279381752,
0.011501521803438663,
-0.012... | 0.099596 |
# Resource Health ## Overview Argo CD provides built-in health assessment for several standard Kubernetes types, which is then surfaced to the overall Application health status as a whole. The following checks are made for specific types of Kubernetes resources: ### Deployment, ReplicaSet, StatefulSet, DaemonSet \* Observed generation is equal to desired generation. \* Number of \*\*updated\*\* replicas equals the number of desired replicas. ### Service \* If service type is of type `LoadBalancer`, the `status.loadBalancer.ingress` list is non-empty, with at least one value for `hostname` or `IP`. ### Ingress \* The `status.loadBalancer.ingress` list is non-empty, with at least one value for `hostname` or `IP`. ### CronJob \* If the last scheduled job for this CronJob failed, the CronJob will be marked as "Degraded" \* If the last scheduled job for this CronJob is running, the CronJob will be marked as "Progressing" ### Job \* If job `.spec.suspended` is set to 'true', then the job and app health will be marked as suspended. ### PersistentVolumeClaim \* The `status.phase` is `Bound` ### Argocd App The health assessment of `argoproj.io/Application` CRD has been removed in argocd 1.8 (see [#3781](https://github.com/argoproj/argo-cd/issues/3781) for more information). You might need to restore it if you are using app-of-apps pattern and orchestrating synchronization using sync waves. Add the following resource customization in `argocd-cm` ConfigMap: ```yaml --- apiVersion: v1 kind: ConfigMap metadata: name: argocd-cm namespace: argocd labels: app.kubernetes.io/name: argocd-cm app.kubernetes.io/part-of: argocd data: resource.customizations.health.argoproj.io\_Application: | hs = {} hs.status = "Progressing" hs.message = "" if obj.status ~= nil then if obj.status.health ~= nil then hs.status = obj.status.health.status if obj.status.health.message ~= nil then hs.message = obj.status.health.message end end end return hs ``` ## Custom Health Checks Argo CD supports custom health checks written in [Lua](https://www.lua.org/). This is useful if you: \* Are affected by known issues where your `Ingress` or `StatefulSet` resources are stuck in `Progressing` state because of bug in your resource controller. \* Have a custom resource for which Argo CD does not have a built-in health check. There are two ways to configure a custom health check. The next two sections describe those ways. ### Way 1. Define a Custom Health Check in `argocd-cm` ConfigMap Custom health checks can be defined in ```yaml resource.customizations.health.\_: | ``` field of `argocd-cm`. If you are using argocd-operator, this is overridden by [the argocd-operator resourceCustomizations](https://argocd-operator.readthedocs.io/en/latest/reference/argocd/#resource-customizations). The following example demonstrates a health check for `cert-manager.io/Certificate`. ```yaml data: resource.customizations.health.cert-manager.io\_Certificate: | hs = {} if obj.status ~= nil then if obj.status.conditions ~= nil then for i, condition in ipairs(obj.status.conditions) do if condition.type == "Ready" and condition.status == "False" then hs.status = "Degraded" hs.message = condition.message return hs end if condition.type == "Ready" and condition.status == "True" then hs.status = "Healthy" hs.message = condition.message return hs end end end end hs.status = "Progressing" hs.message = "Waiting for certificate" return hs ``` In order to prevent duplication of custom health checks for potentially multiple resources, it is also possible to specify a wildcard in the resource kind, and anywhere in the resource group, like this: ```yaml resource.customizations: | ec2.aws.crossplane.io/\*: health.lua: | ... ``` ```yaml # If a key \_begins\_ with a wildcard, please ensure that the GVK key is quoted. resource.customizations: | "\*.aws.crossplane.io/\*": health.lua: | ... ``` > [!IMPORTANT] > Please, note that wildcards are only supported when using the `resource.customizations` key, the `resource.customizations.health.\_` > style keys do not work since wildcards (`\*`) are not supported in Kubernetes configmap keys. The `obj` is a global variable which contains the resource. The script must return an object with status and optional message field. The custom health check might return one of the following health statuses: \* `Healthy` - | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/health.md | master | argo-cd | [
-0.05982375890016556,
0.04853164777159691,
-0.004485638812184334,
0.006629785522818565,
-0.008004609495401382,
-0.040948934853076935,
0.05724130570888519,
-0.017664477229118347,
0.020992513746023178,
0.0689467117190361,
-0.038100313395261765,
-0.07684552669525146,
-0.013012164272367954,
-0... | 0.263807 |
do not work since wildcards (`\*`) are not supported in Kubernetes configmap keys. The `obj` is a global variable which contains the resource. The script must return an object with status and optional message field. The custom health check might return one of the following health statuses: \* `Healthy` - the resource is healthy \* `Progressing` - the resource is not healthy yet but still making progress and might be healthy soon \* `Degraded` - the resource is degraded \* `Suspended` - the resource is suspended and waiting for some external event to resume (e.g. suspended CronJob or paused Deployment) By default, health typically returns a `Progressing` status. NOTE: As a security measure, access to the standard Lua libraries will be disabled by default. Admins can control access by setting `resource.customizations.useOpenLibs.\_`. In the following example, standard libraries are enabled for health check of `cert-manager.io/Certificate`. ```yaml data: resource.customizations.useOpenLibs.cert-manager.io\_Certificate: true resource.customizations.health.cert-manager.io\_Certificate: | # Lua standard libraries are enabled for this script ``` ### Way 2. Contribute a Custom Health Check A health check can be bundled into Argo CD. Custom health check scripts are located in the `resource\_customizations` directory of [https://github.com/argoproj/argo-cd](https://github.com/argoproj/argo-cd). This must have the following directory structure: ``` argo-cd |-- resource\_customizations | |-- your.crd.group.io # CRD group | | |-- MyKind # Resource kind | | | |-- health.lua # Health check | | | |-- health\_test.yaml # Test inputs and expected results | | | +-- testdata # Directory with test resource YAML definitions ``` Each health check must have tests defined in `health\_test.yaml` file. The `health\_test.yaml` is a YAML file with the following structure: ```yaml tests: - healthStatus: status: ExpectedStatus message: Expected message inputPath: testdata/test-resource-definition.yaml ``` To test the implemented custom health checks, run `go test -v ./util/lua/`. The [PR#1139](https://github.com/argoproj/argo-cd/pull/1139) is an example of Cert Manager CRDs custom health check. #### Wildcard Support for Built-in Health Checks You can use a single health check for multiple resources by using a wildcard in the group or kind directory names. The `\_` character behaves like a `\*` wildcard. For example, consider the following directory structure: ``` argo-cd |-- resource\_customizations | |-- \_.group.io # CRD group | | |-- \_ # Resource kind | | | |-- health.lua # Health check ``` Any resource with a group that ends with `.group.io` will use the health check in `health.lua`. Wildcard checks are only evaluated if there is no specific check for the resource. If multiple wildcard checks match, the first one in the directory structure is used. We use the [doublestar](https://github.com/bmatcuk/doublestar) glob library to match the wildcard checks. We currently only treat a path as a wildcard if it contains a `\_` character, but this may change in the future. > [!IMPORTANT] > \*\*Avoid Massive Scripts\*\* > > Avoid writing massive scripts to handle multiple resources. They'll get hard to read and maintain. Instead, just > duplicate the relevant parts in resource-specific scripts. ## Overriding Go-Based Health Checks Health checks for some resources were [hardcoded as Go code](https://github.com/argoproj/argo-cd/tree/master/gitops-engine/pkg/health) because Lua support was introduced later. Also, the logic of health checks for some resources were too complex, so it was easier to implement it in Go. It is possible to override health checks for built-in resource. Argo will prefer the configured health check over the Go-based built-in check. The following resources have Go-based health checks: \* PersistentVolumeClaim \* Pod \* Service \* apiregistration.k8s.io/APIService \* apps/DaemonSet \* apps/Deployment \* apps/ReplicaSet \* apps/StatefulSet \* argoproj.io/Workflow \* autoscaling/HorizontalPodAutoscaler \* batch/Job \* extensions/Ingress \* networking.k8s.io/Ingress ## Health Checks Argo CD App health is inferred from the health of its immediate child resources as represented in the application source. | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/health.md | master | argo-cd | [
-0.0005283425562083721,
0.0535699687898159,
0.009921344928443432,
0.02450648322701454,
0.02768206223845482,
-0.047820039093494415,
0.03114454075694084,
0.01441462617367506,
0.052445441484451294,
0.008304142393171787,
0.02039143070578575,
-0.05403873324394226,
-0.02340077795088291,
-0.00223... | 0.121958 |
checks: \* PersistentVolumeClaim \* Pod \* Service \* apiregistration.k8s.io/APIService \* apps/DaemonSet \* apps/Deployment \* apps/ReplicaSet \* apps/StatefulSet \* argoproj.io/Workflow \* autoscaling/HorizontalPodAutoscaler \* batch/Job \* extensions/Ingress \* networking.k8s.io/Ingress ## Health Checks Argo CD App health is inferred from the health of its immediate child resources as represented in the application source. The App health will be the \*\*worst health of its immediate child resources\*\*, based on the following priority (from most to least healthy): \*\*Healthy, Suspended, Progressing, Missing, Degraded, Unknown.\*\* For example, if an App has a Missing resource and a Degraded resource, the App's health will be \*\*Degraded\*\*. But the health of a resource is not inherited from child resources - it is calculated using only information about the resource itself. A resource's status field may or may not contain information about the health of a child resource, and the resource's health check may or may not take that information into account. The lack of inheritance is by design. A resource's health can't be inferred from its children because the health of a child resource may not be relevant to the health of the parent resource. For example, a Deployment's health is not necessarily affected by the health of its Pods. ``` App (healthy) βββ Deployment (healthy) βββ ReplicaSet (healthy) βββ Pod (healthy) βββ ReplicaSet (unhealthy) βββ Pod (unhealthy) ``` If you want the health of a child resource to affect the health of its parent, you need to configure the parent's health check to take the child's health into account. Since only the parent resource's state is available to the health check, the parent resource's controller needs to make the child resource's health available in the parent resource's status field. ``` App (healthy) βββ CustomResource (healthy) <- This resource's health check needs to be fixed to mark the App as unhealthy βββ CustomChildResource (unhealthy) ``` ## Ignoring Child Resource Health Check in Applications To ignore the health check of an immediate child resource within an Application, set the annotation `argocd.argoproj.io/ignore-healthcheck` to `true`. For example: ```yaml apiVersion: apps/v1 kind: Deployment metadata: annotations: argocd.argoproj.io/ignore-healthcheck: "true" ``` By doing this, the health status of the Deployment will not affect the health of its parent Application. | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/health.md | master | argo-cd | [
-0.058347318321466446,
0.07562389969825745,
-0.02194196730852127,
0.014055873267352581,
0.036165956407785416,
-0.05220281332731247,
0.1071339026093483,
0.010287458077073097,
-0.013283398933708668,
0.09762673079967499,
0.017321504652500153,
-0.03302079439163208,
0.02604203298687935,
0.00703... | 0.261093 |
# Security Argo CD has undergone rigorous internal security reviews and penetration testing to satisfy [PCI compliance](https://www.pcisecuritystandards.org) requirements. The following are some security topics and implementation details of Argo CD. ## Authentication Authentication to Argo CD API server is performed exclusively using [JSON Web Tokens](https://jwt.io) (JWTs). Username/password bearer tokens are not used for authentication. The JWT is obtained/managed in one of the following ways: 1. For the local `admin` user, a username/password is exchanged for a JWT using the `/api/v1/session` endpoint. This token is signed & issued by the Argo CD API server itself and it expires after 24 hours (this token used not to expire, see [CVE-2021-26921](https://github.com/argoproj/argo-cd/security/advisories/GHSA-9h6w-j7w4-jr52)). When the admin password is updated, all existing admin JWT tokens are immediately revoked. The password is stored as a bcrypt hash in the [`argocd-secret`](https://github.com/argoproj/argo-cd/blob/master/manifests/base/config/argocd-secret.yaml) Secret. 2. For Single Sign-On users, the user completes an OAuth2 login flow to the configured OIDC identity provider (either delegated through the bundled Dex provider, or directly to a self-managed OIDC provider). This JWT is signed & issued by the IDP, and expiration and revocation is handled by the provider. Dex tokens expire after 24 hours. 3. Automation tokens are generated for a project using the `/api/v1/projects/{project}/roles/{role}/token` endpoint, and are signed & issued by Argo CD. These tokens are limited in scope and privilege, and can only be used to manage application resources in the project which it belongs to. Project JWTs have a configurable expiration and can be immediately revoked by deleting the JWT reference ID from the project role. ## Authorization Authorization is performed by iterating the list of group membership in a user's JWT groups claims, and comparing each group against the roles/rules in the [RBAC](./rbac.md) policy. Any matched rule permits access to the API request. ## TLS All network communication is performed over TLS including service-to-service communication between the three components (argocd-server, argocd-repo-server, argocd-application-controller). The Argo CD API server can enforce the use of TLS 1.2 using the flag: `--tlsminversion 1.2`. Communication with Redis is performed over plain HTTP by default. TLS can be setup with command line arguments. ## Git & Helm Repositories Git and helm repositories are managed by a stand-alone service, called the repo-server. The repo-server does not carry any Kubernetes privileges and does not store credentials to any services (including git). The repo-server is responsible for cloning repositories which have been permitted and trusted by Argo CD operators, and generating Kubernetes manifests at a given path in the repository. For performance and bandwidth efficiency, the repo-server maintains local clones of these repositories so that subsequent commits to the repository are efficiently downloaded. There are security considerations when configuring git repositories that Argo CD is permitted to deploy from. In short, gaining unauthorized write access to a git repository trusted by Argo CD will have serious security implications outlined below. ### Unauthorized Deployments Since Argo CD deploys the Kubernetes resources defined in git, an attacker with access to a trusted git repo would be able to affect the Kubernetes resources which are deployed. For example, an attacker could update the deployment manifest deploy malicious container images to the environment, or delete resources in git causing them to be pruned in the live environment. ### Tool command invocation In addition to raw YAML, Argo CD natively supports two popular Kubernetes config management tools, helm and kustomize. When rendering manifests, Argo CD executes these config management tools (i.e. `helm template`, `kustomize build`) to generate the manifests. It is possible that an attacker with write access to a trusted git repository may construct malicious helm charts or kustomizations that attempt to read | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/security.md | master | argo-cd | [
-0.098058320581913,
0.019572945311665535,
-0.06895797699689865,
-0.003630260704085231,
-0.023477360606193542,
-0.07909422367811203,
0.05797109752893448,
-0.027038563042879105,
0.0334189273416996,
0.03958688676357269,
-0.012684183195233345,
0.0719728022813797,
-0.006496714893728495,
-0.0541... | 0.161923 |
config management tools, helm and kustomize. When rendering manifests, Argo CD executes these config management tools (i.e. `helm template`, `kustomize build`) to generate the manifests. It is possible that an attacker with write access to a trusted git repository may construct malicious helm charts or kustomizations that attempt to read files out-of-tree. This includes adjacent git repos, as well as files on the repo-server itself. Whether or not this is a risk to your organization depends on if the contents in the git repos are sensitive in nature. By default, the repo-server itself does not contain sensitive information, but might be configured with Config Management Plugins which do (e.g. decryption keys). If such plugins are used, extreme care must be taken to ensure the repository contents can be trusted at all times. Optionally the built-in config management tools might be individually disabled. If you know that your users will not need a certain config management tool, it's advisable to disable that tool. See [Tool Detection](../user-guide/tool\_detection.md) for more information. ### Remote bases and helm chart dependencies Argo CD's repository allow-list only restricts the initial repository which is cloned. However, both kustomize and helm contain features to reference and follow \*additional\* repositories (e.g. kustomize remote bases, helm chart dependencies), of which might not be in the repository allow-list. Argo CD operators must understand that users with write access to trusted git repositories could reference other remote git repositories containing Kubernetes resources not easily searchable or auditable in the configured git repositories. ## Sensitive Information ### Secrets Argo CD never returns sensitive data from its API, and redacts all sensitive data in API payloads and logs. This includes: \* cluster credentials \* Git credentials \* OAuth2 client secrets \* Kubernetes Secret values ### External Cluster Credentials To manage external clusters, Argo CD stores the credentials of the external cluster as a Kubernetes Secret in the argocd namespace. This secret contains the K8s API bearer token associated with the `argocd-manager` ServiceAccount created during `argocd cluster add`, along with connection options to that API server (TLS configuration/certs, AWS role-arn, etc...). The information is used to reconstruct a REST config and kubeconfig to the cluster used by Argo CD services. To rotate the bearer token used by Argo CD, the token can be deleted (e.g. using kubectl) which causes Kubernetes to generate a new secret with a new bearer token. The new token can be re-inputted to Argo CD by re-running `argocd cluster add`. Run the following commands against the \*\_managed\_\* cluster: ```bash # run using a kubeconfig for the externally managed cluster kubectl delete secret argocd-manager-token-XXXXXX -n kube-system argocd cluster add CONTEXTNAME ``` > [!NOTE] > Kubernetes 1.24 [stopped automatically creating tokens for Service Accounts](https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG/CHANGELOG-1.24.md#no-really-you-must-read-this-before-you-upgrade). > [Starting in Argo CD 2.4](https://github.com/argoproj/argo-cd/pull/9546), `argocd cluster add` creates a > ServiceAccount \_and\_ a non-expiring Service Account token Secret when adding 1.24 clusters. In the future, Argo CD > will [add support for the Kubernetes TokenRequest API](https://github.com/argoproj/argo-cd/issues/9610) to avoid > using long-lived tokens. To revoke Argo CD's access to a managed cluster, delete the RBAC artifacts against the \*\_managed\_\* cluster, and remove the cluster entry from Argo CD: ```bash # run using a kubeconfig for the externally managed cluster kubectl delete sa argocd-manager -n kube-system kubectl delete clusterrole argocd-manager-role kubectl delete clusterrolebinding argocd-manager-role-binding argocd cluster rm https://your-kubernetes-cluster-addr ``` > NOTE: for AWS EKS clusters, the [get-token](https://docs.aws.amazon.com/cli/latest/reference/eks/get-token.html) command is used to authenticate to the external cluster, which uses IAM roles in lieu of locally stored tokens, so token rotation is not needed, and revocation is handled through IAM. ## Cluster RBAC By default, Argo CD uses a [clusteradmin level role](https://github.com/argoproj/argo-cd/blob/master/manifests/base/application-controller-roles/argocd-application-controller-role.yaml) | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/security.md | master | argo-cd | [
-0.028988031670451164,
0.033639028668403625,
-0.016281789168715477,
0.009106470271945,
0.037933144718408585,
-0.055022601038217545,
0.07786015421152115,
0.000042396775825181976,
0.05426272377371788,
0.051910653710365295,
0.05029943585395813,
0.04193297028541565,
0.0404319129884243,
-0.0323... | 0.109918 |
NOTE: for AWS EKS clusters, the [get-token](https://docs.aws.amazon.com/cli/latest/reference/eks/get-token.html) command is used to authenticate to the external cluster, which uses IAM roles in lieu of locally stored tokens, so token rotation is not needed, and revocation is handled through IAM. ## Cluster RBAC By default, Argo CD uses a [clusteradmin level role](https://github.com/argoproj/argo-cd/blob/master/manifests/base/application-controller-roles/argocd-application-controller-role.yaml) in order to: 1. watch & operate on cluster state 2. deploy resources to the cluster Although Argo CD requires cluster-wide \*\*\_read\_\*\* privileges to resources in the managed cluster to function properly, it does not necessarily need full \*\*\_write\_\*\* privileges to the cluster. The ClusterRole used by argocd-server and argocd-application-controller can be modified such that write privileges are limited to only the namespaces and resources that you wish Argo CD to manage. To fine-tune privileges of externally managed clusters, edit the ClusterRole of the `argocd-manager-role` ```bash # run using a kubeconfig for the externally managed cluster kubectl edit clusterrole argocd-manager-role ``` To fine-tune privileges which Argo CD has against its own cluster (i.e. `https://kubernetes.default.svc`), edit the following cluster roles where Argo CD is running in: ```bash # run using a kubeconfig to the cluster Argo CD is running in kubectl edit clusterrole argocd-server kubectl edit clusterrole argocd-application-controller ``` > [!TIP] > If you want to deny Argo CD access to a kind of resource then add it as an [excluded resource](declarative-setup.md#resource-exclusion). ## Auditing As a GitOps deployment tool, the Git commit history provides a natural audit log of what changes were made to application configuration, when they were made, and by whom. However, this audit log only applies to what happened in Git and does not necessarily correlate one-to-one with events that happen in a cluster. For example, User A could have made multiple commits to application manifests, but User B could have just only synced those changes to the cluster sometime later. To complement the Git revision history, Argo CD emits Kubernetes Events of application activity, indicating the responsible actor when applicable. For example: ```bash $ kubectl get events LAST SEEN FIRST SEEN COUNT NAME KIND SUBOBJECT TYPE REASON SOURCE MESSAGE 1m 1m 1 guestbook.157f7c5edd33aeac Application Normal ResourceCreated argocd-server admin created application 1m 1m 1 guestbook.157f7c5f0f747acf Application Normal ResourceUpdated argocd-application-controller Updated sync status: -> OutOfSync 1m 1m 1 guestbook.157f7c5f0fbebbff Application Normal ResourceUpdated argocd-application-controller Updated health status: -> Missing 1m 1m 1 guestbook.157f7c6069e14f4d Application Normal OperationStarted argocd-server admin initiated sync to HEAD (8a1cb4a02d3538e54907c827352f66f20c3d7b0d) 1m 1m 1 guestbook.157f7c60a55a81a8 Application Normal OperationCompleted argocd-application-controller Sync operation to 8a1cb4a02d3538e54907c827352f66f20c3d7b0d succeeded 1m 1m 1 guestbook.157f7c60af1ccae2 Application Normal ResourceUpdated argocd-application-controller Updated sync status: OutOfSync -> Synced 1m 1m 1 guestbook.157f7c60af5bc4f0 Application Normal ResourceUpdated argocd-application-controller Updated health status: Missing -> Progressing 1m 1m 1 guestbook.157f7c651990e848 Application Normal ResourceUpdated argocd-application-controller Updated health status: Progressing -> Healthy ``` These events can be then be persisted for longer periods of time using other tools as [Event Exporter](https://github.com/GoogleCloudPlatform/k8s-stackdriver/tree/master/event-exporter) or [Event Router](https://github.com/heptiolabs/eventrouter). ## WebHook Payloads Payloads from webhook events are considered untrusted. Argo CD only examines the payload to infer the involved applications of the webhook event (e.g. which repo was modified), then refreshes the related application for reconciliation. This refresh is the same refresh which occurs regularly at three minute intervals, just fast-tracked by the webhook event. ## Logging ### Security field Security-related logs are tagged with a `security` field to make them easier to find, analyze, and report on. | Level | Friendly Level | Description | Example | |-------|----------------|---------------------------------------------------------------------------------------------------|---------------------------------------------| | 1 | Low | Unexceptional, non-malicious events | Successful access | | 2 | Medium | Could indicate malicious events, but has a high likelihood of being user/system error | Access denied | | 3 | High | Likely | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/security.md | master | argo-cd | [
-0.02206508070230484,
0.0009557898156344891,
-0.0666101947426796,
0.06437288224697113,
-0.015699006617069244,
-0.011580940335988998,
0.08970537036657333,
-0.01914609782397747,
0.05357036367058754,
0.11332683265209198,
0.027654021978378296,
0.03216294199228287,
0.030505722388625145,
-0.0713... | 0.199651 |
Level | Friendly Level | Description | Example | |-------|----------------|---------------------------------------------------------------------------------------------------|---------------------------------------------| | 1 | Low | Unexceptional, non-malicious events | Successful access | | 2 | Medium | Could indicate malicious events, but has a high likelihood of being user/system error | Access denied | | 3 | High | Likely malicious events but one that had no side effects or was blocked | Out of bounds symlinks in repo | | 4 | Critical | Any malicious or exploitable event that had a side effect | Secrets being left behind on the filesystem | | 5 | Emergency | Unmistakably malicious events that should NEVER occur accidentally and indicates an active attack | Brute forcing of accounts | Where applicable, a `CWE` field is also added specifying the [Common Weakness Enumeration](https://cwe.mitre.org/index.html) number. > [!WARNING] > Please be aware that not all security logs are comprehensively tagged yet and these examples are not necessarily implemented. ### API Logs Argo CD logs payloads of most API requests except request that are considered sensitive, such as `/cluster.ClusterService/Create`, `/session.SessionService/Create` etc. The full list of method can be found in [server/server.go](https://github.com/argoproj/argo-cd/blob/abba8dddce8cd897ba23320e3715690f465b4a95/server/server.go#L516). Argo CD does not log IP addresses of clients requesting API endpoints, since the API server is typically behind a proxy. Instead, it is recommended to configure IP addresses logging in the proxy server that sits in front of the API server. ### Standard Application log fields For logs related to an Application, Argo CD will log the following standard fields : \* \*application\*: the Application name, without the namespace \* \*app-namespace\*: the Application's namespace \* \*project\*: the Application's project ## ApplicationSets Argo CD's ApplicationSets feature has its own [security considerations](./applicationset/Security.md). Be aware of those issues before using ApplicationSets. ## Limiting Directory App Memory Usage > >2.2.10, 2.1.16, >2.3.5 Directory-type Applications (those whose source is raw JSON or YAML files) can consume significant [repo-server](architecture.md#repository-server) memory, depending on the size and structure of the YAML files. To avoid over-using memory in the repo-server (potentially causing a crash and denial of service), set the `reposerver.max.combined.directory.manifests.size` config option in [argocd-cmd-params-cm](argocd-cmd-params-cm.yaml). This option limits the combined size of all JSON or YAML files in an individual app. Note that the in-memory representation of a manifest may be as much as 300x the size of the manifest on disk. Also note that the limit is per Application. If manifests are generated for multiple applications at once, memory usage will be higher. \*\*Example:\*\* Suppose your repo-server has a 10G memory limit, and you have ten Applications which use raw JSON or YAML files. To calculate the max safe combined file size per Application, divide 10G by 300 \* 10 Apps (300 being the worst-case memory growth factor for the manifests). ``` 10G / 300 \* 10 = 3M ``` So a reasonably safe configuration for this setup would be a 3M limit per app. ```yaml apiVersion: v1 kind: ConfigMap metadata: name: argocd-cmd-params-cm data: reposerver.max.combined.directory.manifests.size: '3M' ``` The 300x ratio assumes a maliciously-crafted manifest file. If you only want to protect against accidental excessive memory use, it is probably safe to use a smaller ratio. Keep in mind that if a malicious user can create additional Applications, they can increase the total memory usage. Grant [App creation privileges](rbac.md) carefully. | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/security.md | master | argo-cd | [
-0.029161961749196053,
-0.021075984463095665,
-0.045414507389068604,
-0.012998350895941257,
0.04219450801610947,
-0.057230520993471146,
0.04992983490228653,
0.03524855896830559,
-0.01803326979279518,
0.0065713124349713326,
0.07716935127973557,
0.011110913008451462,
0.11160401254892349,
-0.... | 0.105257 |
# Git Generator The Git generator contains two subtypes: the Git directory generator, and Git file generator. > [!WARNING] > Git generators are often used to make it easier for (non-admin) developers to create Applications. > If the `project` field in your ApplicationSet is templated, developers may be able to create Applications under Projects with excessive permissions. > For ApplicationSets with a templated `project` field, [the source of truth \_must\_ be controlled by admins](./Security.md#templated-project-field) > - in the case of git generators, PRs must require admin approval. > - Git generator does not support Signature Verification For ApplicationSets with a templated `project` field. > - You must only use "non-scoped" repositories for ApplicationSets with a templated `project` field (see ["Repository Credentials for Applicationsets" below](#repository-credentials-for-applicationsets)). ## Git Generator: Directories The Git directory generator, one of two subtypes of the Git generator, generates parameters using the directory structure of a specified Git repository. Suppose you have a Git repository with the following directory structure: ``` βββ argo-workflows β βββ kustomization.yaml β βββ namespace-install.yaml βββ prometheus-operator βββ Chart.yaml βββ README.md βββ requirements.yaml βββ values.yaml ``` This repository contains two directories, one for each of the workloads to deploy: - an Argo Workflow controller kustomization YAML file - a Prometheus Operator Helm chart We can deploy both workloads, using this example: ```yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: name: cluster-addons namespace: argocd spec: goTemplate: true goTemplateOptions: ["missingkey=error"] generators: - git: repoURL: https://github.com/argoproj/argo-cd.git revision: HEAD directories: - path: applicationset/examples/git-generator-directory/cluster-addons/\* template: metadata: name: '{{.path.basename}}' spec: project: "my-project" source: repoURL: https://github.com/argoproj/argo-cd.git targetRevision: HEAD path: '{{.path.path}}' destination: server: https://kubernetes.default.svc namespace: '{{.path.basename}}' syncPolicy: syncOptions: - CreateNamespace=true ``` (\*The full example can be found [here](https://github.com/argoproj/argo-cd/tree/master/applicationset/examples/git-generator-directory).\*) The generator parameters are: - `{{.path.path}}`: The directory paths within the Git repository that match the `path` wildcard. - `{{index .path.segments n}}`: The directory paths within the Git repository that match the `path` wildcard, split into array elements (`n` - array index) - `{{.path.basename}}`: For any directory path within the Git repository that matches the `path` wildcard, the right-most path name is extracted (e.g. `/directory/directory2` would produce `directory2`). - `{{.path.basenameNormalized}}`: This field is the same as `path.basename` with unsupported characters replaced with `-` (e.g. a `path` of `/directory/directory\_2`, and `path.basename` of `directory\_2` would produce `directory-2` here). \*\*Note\*\*: The right-most path name always becomes `{{.path.basename}}`. For example, for `- path: /one/two/three/four`, `{{.path.basename}}` is `four`. \*\*Note\*\*: If the `pathParamPrefix` option is specified, all `path`-related parameter names above will be prefixed with the specified value and a dot separator. E.g., if `pathParamPrefix` is `myRepo`, then the generated parameter name would be `.myRepo.path` instead of `.path`. Using this option is necessary in a Matrix generator where both child generators are Git generators (to avoid conflicts when merging the child generatorsβ items). Whenever a new Helm chart/Kustomize YAML/Application/plain subdirectory is added to the Git repository, the ApplicationSet controller will detect this change and automatically deploy the resulting manifests within new `Application` resources. As with other generators, clusters \*must\* already be defined within Argo CD, in order to generate Applications for them. ### Exclude directories The Git directory generator will automatically exclude directories that begin with `.` (such as `.git`). The Git directory generator also supports an `exclude` option in order to exclude directories in the repository from being scanned by the ApplicationSet controller: ```yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: name: cluster-addons namespace: argocd spec: goTemplate: true goTemplateOptions: ["missingkey=error"] generators: - git: repoURL: https://github.com/argoproj/argo-cd.git revision: HEAD directories: - path: applicationset/examples/git-generator-directory/excludes/cluster-addons/\* - path: applicationset/examples/git-generator-directory/excludes/cluster-addons/exclude-helm-guestbook exclude: true template: metadata: name: '{{.path.basename}}' spec: project: "my-project" source: repoURL: https://github.com/argoproj/argo-cd.git targetRevision: HEAD path: '{{.path.path}}' destination: server: https://kubernetes.default.svc namespace: '{{.path.basename}}' ``` (\*The full example can be found [here](https://github.com/argoproj/argo-cd/tree/master/applicationset/examples/git-generator-directory/excludes).\*) | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/applicationset/Generators-Git.md | master | argo-cd | [
-0.09993907809257507,
-0.01591646485030651,
-0.08812226355075836,
-0.003351247403770685,
0.0026963192503899336,
-0.0791454017162323,
0.0527421198785305,
0.04766644164919853,
0.011414389126002789,
0.004375266842544079,
-0.009609665721654892,
-0.05245325714349747,
0.1259215772151947,
-0.0285... | 0.031214 |
namespace: argocd spec: goTemplate: true goTemplateOptions: ["missingkey=error"] generators: - git: repoURL: https://github.com/argoproj/argo-cd.git revision: HEAD directories: - path: applicationset/examples/git-generator-directory/excludes/cluster-addons/\* - path: applicationset/examples/git-generator-directory/excludes/cluster-addons/exclude-helm-guestbook exclude: true template: metadata: name: '{{.path.basename}}' spec: project: "my-project" source: repoURL: https://github.com/argoproj/argo-cd.git targetRevision: HEAD path: '{{.path.path}}' destination: server: https://kubernetes.default.svc namespace: '{{.path.basename}}' ``` (\*The full example can be found [here](https://github.com/argoproj/argo-cd/tree/master/applicationset/examples/git-generator-directory/excludes).\*) This example excludes the `exclude-helm-guestbook` directory from the list of directories scanned for this `ApplicationSet` resource. > [!NOTE] > \*\*Exclude rules have higher priority than include rules\*\* > > If a directory matches at least one `exclude` pattern, it will be excluded. Or, said another way, \*exclude rules take precedence over include rules.\* > > As a corollary, which directories are included/excluded is not affected by the order of `path`s in the `directories` field list (because, as above, exclude rules always take precedence over include rules). For example, with these directories: ``` . βββ d βββ e βββ f βββ g ``` Say you want to include `/d/e`, but exclude `/d/f` and `/d/g`. This will \*not\* work: ```yaml - path: /d/e exclude: false - path: /d/\* exclude: true ``` Why? Because the exclude `/d/\*` exclude rule will take precedence over the `/d/e` include rule. When the `/d/e` path in the Git repository is processed by the ApplicationSet controller, the controller detects that at least one exclude rule is matched, and thus that directory should not be scanned. You would instead need to do: ```yaml - path: /d/\* - path: /d/f exclude: true - path: /d/g exclude: true ``` Or, a shorter way (using [path.Match](https://golang.org/pkg/path/#Match) syntax) would be: ```yaml - path: /d/\* - path: /d/[fg] exclude: true ``` ### Root Of Git Repo The Git directory generator can be configured to deploy from the root of the git repository by providing `'\*'` as the `path`. To exclude directories, you only need to put the name/[path.Match](https://golang.org/pkg/path/#Match) of the directory you do not want to deploy. ```yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: name: cluster-addons namespace: argocd spec: goTemplate: true goTemplateOptions: ["missingkey=error"] generators: - git: repoURL: https://github.com/example/example-repo.git revision: HEAD directories: - path: '\*' - path: donotdeploy exclude: true template: metadata: name: '{{.path.basename}}' spec: project: "my-project" source: repoURL: https://github.com/example/example-repo.git targetRevision: HEAD path: '{{.path.path}}' destination: server: https://kubernetes.default.svc namespace: '{{.path.basename}}' ``` ### Pass additional key-value pairs via `values` field You may pass additional, arbitrary string key-value pairs via the `values` field of the git directory generator. Values added via the `values` field are added as `values.(field)`. In this example, a `cluster` parameter value is passed. It is interpolated from the `path` variable, to then be used to determine the destination namespace. ```yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: name: cluster-addons namespace: argocd spec: goTemplate: true goTemplateOptions: ["missingkey=error"] generators: - git: repoURL: https://github.com/example/example-repo.git revision: HEAD directories: - path: '\*' values: cluster: '{{.path.basename}}' template: metadata: name: '{{.path.basename}}' spec: project: "my-project" source: repoURL: https://github.com/example/example-repo.git targetRevision: HEAD path: '{{.path.path}}' destination: server: https://kubernetes.default.svc namespace: '{{.values.cluster}}' ``` > [!NOTE] > The `values.` prefix is always prepended to values provided via `generators.git.values` field. Ensure you include this prefix in the parameter name within the `template` when using it. In `values` we can also interpolate all fields set by the git directory generator as mentioned above. ## Git Generator: Files The Git file generator is the second subtype of the Git generator. The Git file generator generates parameters using the contents of JSON/YAML files found within a specified repository. Suppose you have a Git repository with the following directory structure: ``` βββ apps β βββ guestbook β βββ guestbook-ui-deployment.yaml β βββ guestbook-ui-svc.yaml β βββ kustomization.yaml βββ cluster-config β βββ engineering β βββ dev β β βββ config.json β βββ prod β βββ config.json βββ git-generator-files.yaml ``` | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/applicationset/Generators-Git.md | master | argo-cd | [
-0.0006363205029629171,
0.032498009502887726,
-0.06364364176988602,
0.03997042775154114,
0.042028944939374924,
-0.0011675350833684206,
0.025843506678938866,
-0.04438665136694908,
0.06399061530828476,
0.05053118243813515,
0.05479441210627556,
-0.07286322861909866,
-0.040729667991399765,
-0.... | 0.107858 |
a specified repository. Suppose you have a Git repository with the following directory structure: ``` βββ apps β βββ guestbook β βββ guestbook-ui-deployment.yaml β βββ guestbook-ui-svc.yaml β βββ kustomization.yaml βββ cluster-config β βββ engineering β βββ dev β β βββ config.json β βββ prod β βββ config.json βββ git-generator-files.yaml ``` The directories are: - `guestbook` contains the Kubernetes resources for a simple guestbook application - `cluster-config` contains JSON/YAML files describing the individual engineering clusters: one for `dev` and one for `prod`. - `git-generator-files.yaml` is the example `ApplicationSet` resource that deploys `guestbook` to the specified clusters. The `config.json` files contain information describing the cluster (along with extra sample data): ```json { "aws\_account": "123456", "asset\_id": "11223344", "cluster": { "owner": "cluster-admin@company.com", "name": "engineering-dev", "address": "https://1.2.3.4" } } ``` Git commits containing changes to the `config.json` files are automatically discovered by the Git generator, and the contents of those files are parsed and converted into template parameters. Here are the parameters generated for the above JSON: ```text aws\_account: 123456 asset\_id: 11223344 cluster.owner: cluster-admin@company.com cluster.name: engineering-dev cluster.address: https://1.2.3.4 ``` And the generated parameters for all discovered `config.json` files will be substituted into ApplicationSet template: ```yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: name: guestbook namespace: argocd spec: goTemplate: true goTemplateOptions: ["missingkey=error"] generators: - git: repoURL: https://github.com/argoproj/argo-cd.git revision: HEAD files: - path: "applicationset/examples/git-generator-files-discovery/cluster-config/\*\*/config.json" template: metadata: name: '{{.cluster.name}}-guestbook' spec: project: default source: repoURL: https://github.com/argoproj/argo-cd.git targetRevision: HEAD path: "applicationset/examples/git-generator-files-discovery/apps/guestbook" destination: server: '{{.cluster.address}}' namespace: guestbook ``` (\*The full example can be found [here](https://github.com/argoproj/argo-cd/tree/master/applicationset/examples/git-generator-files-discovery).\*) Any `config.json` files found under the `cluster-config` directory will be parameterized based on the `path` wildcard pattern specified. Within each file JSON fields are flattened into key/value pairs, with this ApplicationSet example using the `cluster.address` and `cluster.name` parameters in the template. As with other generators, clusters \*must\* already be defined within Argo CD, in order to generate Applications for them. In addition to the flattened key/value pairs from the configuration file, the following generator parameters are provided: - `{{.path.path}}`: The path to the directory containing matching configuration file within the Git repository. Example: `/clusters/clusterA`, if the config file was `/clusters/clusterA/config.json` - `{{index .path.segments n}}`: The path to the matching configuration file within the Git repository, split into array elements (`n` - array index). Example: `index .path.segments 0: clusters`, `index .path.segments 1: clusterA` - `{{.path.basename}}`: Basename of the path to the directory containing the configuration file (e.g. `clusterA`, with the above example.) - `{{.path.basenameNormalized}}`: This field is the same as `.path.basename` with unsupported characters replaced with `-` (e.g. a `path` of `/directory/directory\_2`, and `.path.basename` of `directory\_2` would produce `directory-2` here). - `{{.path.filename}}`: The matched filename. e.g., `config.json` in the above example. - `{{.path.filenameNormalized}}`: The matched filename with unsupported characters replaced with `-`. \*\*Note\*\*: The right-most \*directory\* name always becomes `{{.path.basename}}`. For example, from `- path: /one/two/three/four/config.json`, `{{.path.basename}}` will be `four`. The filename can always be accessed using `{{.path.filename}}`. \*\*Note\*\*: If the `pathParamPrefix` option is specified, all `path`-related parameter names above will be prefixed with the specified value and a dot separator. E.g., if `pathParamPrefix` is `myRepo`, then the generated parameter name would be `myRepo.path` instead of `path`. Using this option is necessary in a Matrix generator where both child generators are Git generators (to avoid conflicts when merging the child generatorsβ items). \*\*Note\*\*: The default behavior of the Git file generator is very greedy. Please see [Git File Generator Globbing](./Generators-Git-File-Globbing.md) for more information. ### Exclude files The Git file generator also supports an `exclude` option in order to exclude files in the repository from being scanned by the ApplicationSet controller: ```yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: name: guestbook spec: goTemplate: true goTemplateOptions: ["missingkey=error"] generators: - git: repoURL: https://github.com/argoproj/argo-cd.git revision: | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/applicationset/Generators-Git.md | master | argo-cd | [
-0.00979529321193695,
0.014724958688020706,
-0.039668843150138855,
0.02536872960627079,
0.08374389261007309,
-0.04559437930583954,
0.03344447910785675,
-0.029139941558241844,
0.09167465567588806,
0.02791452407836914,
0.08095470070838928,
-0.05133455991744995,
0.04728517308831215,
-0.045550... | 0.094099 |
Globbing](./Generators-Git-File-Globbing.md) for more information. ### Exclude files The Git file generator also supports an `exclude` option in order to exclude files in the repository from being scanned by the ApplicationSet controller: ```yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: name: guestbook spec: goTemplate: true goTemplateOptions: ["missingkey=error"] generators: - git: repoURL: https://github.com/argoproj/argo-cd.git revision: HEAD files: - path: "applicationset/examples/git-generator-files-discovery/cluster-config/\*\*/config.json" - path: "applicationset/examples/git-generator-files-discovery/cluster-config/\*/dev/config.json" exclude: true template: metadata: name: '{{.cluster.name}}-guestbook' spec: project: default source: repoURL: https://github.com/argoproj/argo-cd.git targetRevision: HEAD path: "applicationset/examples/git-generator-files-discovery/apps/guestbook" destination: server: https://kubernetes.default.svc #server: '{{.cluster.address}}' namespace: guestbook ``` This example excludes the `config.json` file in the `dev` directory from the list of files scanned for this `ApplicationSet` resource. (\*The full example can be found [here](https://github.com/argoproj/argo-cd/tree/master/applicationset/examples/git-generator-files-discovery/excludes).\*) ### Pass additional key-value pairs via `values` field You may pass additional, arbitrary string key-value pairs via the `values` field of the git files generator. Values added via the `values` field are added as `values.(field)`. In this example, a `base\_dir` parameter value is passed. It is interpolated from `path` segments, to then be used to determine the source path. ```yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: name: guestbook namespace: argocd spec: goTemplate: true goTemplateOptions: ["missingkey=error"] generators: - git: repoURL: https://github.com/argoproj/argo-cd.git revision: HEAD files: - path: "applicationset/examples/git-generator-files-discovery/cluster-config/\*\*/config.json" values: base\_dir: "{{index .path.segments 0}}/{{index .path.segments 1}}/{{index .path.segments 2}}" template: metadata: name: '{{.cluster.name}}-guestbook' spec: project: default source: repoURL: https://github.com/argoproj/argo-cd.git targetRevision: HEAD path: "{{.values.base\_dir}}/apps/guestbook" destination: server: '{{.cluster.address}}' namespace: guestbook ``` > [!NOTE] > The `values.` prefix is always prepended to values provided via `generators.git.values` field. Ensure you include this prefix in the parameter name within the `template` when using it. In `values` we can also interpolate all fields set by the git files generator as mentioned above. ## Git Polling Interval When using a Git generator, the ApplicationSet controller polls Git repositories, by default, every 3 minutes to detect changes, unless different default value is set by the `ARGOCD\_APPLICATIONSET\_CONTROLLER\_REQUEUE\_AFTER` environment variable. You can customize this interval per ApplicationSet using `requeueAfterSeconds`. > [!NOTE] > The Git generator uses the ArgoCD Repo Server to retrieve file > and directory lists from Git. Therefore, the Git generator is > affected by the Repo Server's Revision Cache Expiration setting > (see the description of the `timeout.reconciliation` parameter in > [argocd-cm.yaml](../argocd-cm-yaml.md/#:~:text=timeout.reconciliation%3A)). > If this value exceeds the configured Git Polling Interval, the > Git generator might not see files or directories from new commits > until the previous cache entry expires. > ## The `argocd.argoproj.io/application-set-refresh` Annotation Setting the `argocd.argoproj.io/application-set-refresh` annotation (to any value) triggers an ApplicationSet refresh. This annotation forces the Git provider to resolve Git references directly, bypassing the Revision Cache. The ApplicationSet controller removes this annotation after reconciliation. ## Webhook Configuration To eliminate the polling delay, the ApplicationSet webhook server can be configured to receive webhook events. ApplicationSet supports Git webhook notifications from GitHub and GitLab. The following explains how to configure a Git webhook for GitHub, but the same process should be applicable to other providers. ```yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: name: guestbook namespace: argocd spec: goTemplate: true goTemplateOptions: ["missingkey=error"] generators: - git: # When using a Git generator, the ApplicationSet controller polls every `requeueAfterSeconds` interval (defaulting to every 3 minutes) to detect changes. requeueAfterSeconds: 180 repoURL: https://github.com/argoproj/argo-cd.git revision: HEAD # ... ``` > [!NOTE] > The ApplicationSet controller webhook does not use the same webhook as the API server as defined [here](../webhook.md). ApplicationSet exposes a webhook server as a service of type ClusterIP. An ApplicationSet specific Ingress resource needs to be created to expose this service to the webhook source. ### 1. Create the webhook in the Git provider In your Git provider, navigate to the settings page where webhooks can be configured. The payload URL configured | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/applicationset/Generators-Git.md | master | argo-cd | [
-0.006179583724588156,
0.06461954861879349,
-0.0652027428150177,
0.012692508287727833,
0.06628229469060898,
-0.03749219328165054,
0.04752353951334953,
-0.05117198824882507,
0.032472189515829086,
0.010545309633016586,
0.06358115375041962,
-0.003824437502771616,
0.002592569449916482,
-0.1060... | 0.06586 |
as a service of type ClusterIP. An ApplicationSet specific Ingress resource needs to be created to expose this service to the webhook source. ### 1. Create the webhook in the Git provider In your Git provider, navigate to the settings page where webhooks can be configured. The payload URL configured in the Git provider should use the `/api/webhook` endpoint of your ApplicationSet instance (e.g. `https://applicationset.example.com/api/webhook`). If you wish to use a shared secret, input an arbitrary value in the secret. This value will be used when configuring the webhook in the next step.  > [!NOTE] > When creating the webhook in GitHub, the "Content type" needs to be set to "application/json". The default value "application/x-www-form-urlencoded" is not supported by the library used to handle the hooks ### 2. Configure ApplicationSet with the webhook secret (Optional) Configuring a webhook shared secret is optional, since ApplicationSet will still refresh applications generated by Git generators, even with unauthenticated webhook events. This is safe to do since the contents of webhook payloads are considered untrusted, and will only result in a refresh of the application (a process which already occurs at three-minute intervals). If ApplicationSet is publicly accessible, then configuring a webhook secret is recommended to prevent a DDoS attack. In the `argocd-secret` Kubernetes secret, include the Git provider's webhook secret configured in step 1. Edit the Argo CD Kubernetes secret: ```bash kubectl edit secret argocd-secret -n argocd ``` TIP: for ease of entering secrets, Kubernetes supports inputting secrets in the `stringData` field, which saves you the trouble of base64 encoding the values and copying it to the `data` field. Simply copy the shared webhook secret created in step 1, to the corresponding GitHub/GitLab/BitBucket key under the `stringData` field: ```yaml apiVersion: v1 kind: Secret metadata: name: argocd-secret namespace: argocd type: Opaque data: ... stringData: # github webhook secret webhook.github.secret: shhhh! it's a github secret # gitlab webhook secret webhook.gitlab.secret: shhhh! it's a gitlab secret ``` After saving, please restart the ApplicationSet pod for the changes to take effect. ## Repository credentials for ApplicationSets If your [ApplicationSets](index.md) uses a repository where you need credentials to be able to access it \_and\_ if the ApplicationSet project field is templated (i.e. the `project` field of the ApplicationSet contains `{{ ... }}`), you need to add the repository as a "non project scoped" repository. - When doing that through the UI, set this to a \*\*blank\*\* value in the dropdown menu. - When doing that through the CLI, make sure you \*\*DO NOT\*\* supply the parameter `--project` ([argocd repo add docs](../../user-guide/commands/argocd\_repo\_add.md)) - When doing that declaratively, make sure you \*\*DO NOT\*\* have `project:` defined under `stringData:` ([complete yaml example](../argocd-repositories-yaml.md)) | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/applicationset/Generators-Git.md | master | argo-cd | [
-0.08241603523492813,
0.0003172859433107078,
-0.09224157780408859,
0.02797936461865902,
-0.010077989660203457,
-0.0464114174246788,
0.029692599549889565,
0.02640657126903534,
0.0695875808596611,
0.022598205134272575,
0.03339991718530655,
-0.08380800485610962,
0.06961814314126968,
-0.025869... | 0.122603 |
# Templates The template fields of the ApplicationSet `spec` are used to generate Argo CD `Application` resources. ApplicationSet is using [fasttemplate](https://github.com/valyala/fasttemplate) but will be soon deprecated in favor of Go Template. ## Template fields An Argo CD Application is created by combining the parameters from the generator with fields of the template (via `{{values}}`), and from that a concrete `Application` resource is produced and applied to the cluster. Here is the template subfield from a Cluster generator: ```yaml # (...) template: metadata: name: '{{ .nameNormalized }}-guestbook' spec: source: repoURL: https://github.com/infra-team/cluster-deployments.git targetRevision: HEAD path: guestbook/{{ .nameNormalized }} destination: server: '{{ .server }}' namespace: guestbook ``` For details on all available parameters (like `.name`, `.nameNormalized`, etc.) please refer to the [Cluster Generator docs](./Generators-Cluster.md). The template subfields correspond directly to [the spec of an Argo CD `Application` resource](../../declarative-setup/#applications): - `project` refers to the [Argo CD Project](../../user-guide/projects.md) in use (`default` may be used here to utilize the default Argo CD Project) - `source` defines from which Git repository to extract the desired Application manifests - \*\*repoURL\*\*: URL of the repository (eg `https://github.com/argoproj/argocd-example-apps.git`) - \*\*targetRevision\*\*: Revision (tag/branch/commit) of the repository (eg `HEAD`) - \*\*path\*\*: Path within the repository where Kubernetes manifests (and/or Helm, Kustomize, Jsonnet resources) are located - `destination`: Defines which Kubernetes cluster/namespace to deploy to - \*\*name\*\*: Name of the cluster (within Argo CD) to deploy to - \*\*server\*\*: API Server URL for the cluster (Example: `https://kubernetes.default.svc`) - \*\*namespace\*\*: Target namespace in which to deploy the manifests from `source` (Example: `my-app-namespace`) Note: - Referenced clusters must already be defined in Argo CD, for the ApplicationSet controller to use them - Only \*\*one\*\* of `name` or `server` may be specified: if both are specified, an error is returned. - Signature Verification does not work with the templated `project` field when using git generator. The `metadata` field of template may also be used to set an Application `name`, or to add labels or annotations to the Application. While the ApplicationSet spec provides a basic form of templating, it is not intended to replace the full-fledged configuration management capabilities of tools such as Kustomize, Helm, or Jsonnet. ### Deploying ApplicationSet resources as part of a Helm chart ApplicationSet uses the same templating notation as Helm (`{{}}`). When Helm renders the chart templates, it will also process the template meant for ApplicationSet rendering. If the ApplicationSet template uses a function like: ```yaml metadata: name: '{{ "guestbook" | normalize }}' ``` Helm will throw an error like: `function "normalize" not defined`. If the ApplicationSet template uses a generator parameter like: ```yaml metadata: name: '{{.cluster}}-guestbook' ``` Helm will silently replace `.cluster` with an empty string. To avoid those errors, write the template as a Helm string literal. For example: ```yaml metadata: name: '{{`{{ .cluster | normalize }}`}}-guestbook' ``` This \_only\_ applies if you use Helm to deploy your ApplicationSet resources. ## Generator templates In addition to specifying a template within the `.spec.template` of the `ApplicationSet` resource, templates may also be specified within generators. This is useful for overriding the values of the `spec`-level template. The generator's `template` field takes precedence over the `spec`'s template fields: - If both templates contain the same field, the generator's field value will be used. - If only one of those templates' fields has a value, that value will be used. Generator templates can thus be thought of as patches against the outer `spec`-level template fields. ```yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: name: guestbook spec: generators: - list: elements: - cluster: engineering-dev url: https://kubernetes.default.svc template: metadata: {} spec: project: "default" source: targetRevision: HEAD repoURL: https://github.com/argoproj/argo-cd.git # New path value is generated here: path: 'applicationset/examples/template-override/{{ | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/applicationset/Template.md | master | argo-cd | [
0.007774469908326864,
0.10525866597890854,
-0.08956032246351242,
0.012056355364620686,
0.03084806352853775,
0.0184367373585701,
0.006960485130548477,
0.04092349484562874,
-0.01306107733398676,
-0.0030440371483564377,
0.03039693459868431,
-0.03815096244215965,
-0.06118038669228554,
-0.05040... | 0.183888 |
thus be thought of as patches against the outer `spec`-level template fields. ```yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: name: guestbook spec: generators: - list: elements: - cluster: engineering-dev url: https://kubernetes.default.svc template: metadata: {} spec: project: "default" source: targetRevision: HEAD repoURL: https://github.com/argoproj/argo-cd.git # New path value is generated here: path: 'applicationset/examples/template-override/{{ .nameNormalized }}-override' destination: {} template: metadata: name: '{{ .nameNormalized }}-guestbook' spec: project: "default" source: repoURL: https://github.com/argoproj/argo-cd.git targetRevision: HEAD # This 'default' value is not used: it is replaced by the generator's template path, above path: applicationset/examples/template-override/default destination: server: '{{ .server }}' namespace: guestbook ``` (\*The full example can be found [here](https://github.com/argoproj/argo-cd/tree/master/applicationset/examples/template-override).\*) In this example, the ApplicationSet controller will generate an `Application` resource using the `path` generated by the List generator, rather than the `path` value defined in `.spec.template`. ## Template Patch Templating is only available on string type. However, some use cases may require applying templating on other types. Example: - Conditionally set the automated sync policy. - Conditionally switch prune boolean to `true`. - Add multiple helm value files from a list. The `templatePatch` feature enables advanced templating, with support for `json` and `yaml`. ```yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: name: guestbook spec: goTemplate: true generators: - list: elements: - cluster: engineering-dev url: https://kubernetes.default.svc autoSync: true prune: true valueFiles: - values.large.yaml - values.debug.yaml template: metadata: name: '{{ .nameNormalized }}-deployment' spec: project: "default" source: repoURL: https://github.com/infra-team/cluster-deployments.git targetRevision: HEAD path: guestbook/{{ .nameNormalized }} destination: server: '{{ .server }}' namespace: guestbook templatePatch: | spec: source: helm: valueFiles: {{- range $valueFile := .valueFiles }} - {{ $valueFile }} {{- end }} {{- if .autoSync }} syncPolicy: automated: prune: {{ .prune }} {{- end }} ``` > [!IMPORTANT] > `templatePatch` only works when [go templating](../applicationset/GoTemplate.md) is enabled. > This means that the `goTemplate` field under `spec` needs to be set to `true` for template patching to work. > [!IMPORTANT] > The `templatePatch` can apply arbitrary changes to the template. If parameters include untrustworthy user input, it > may be possible to inject malicious changes into the template. It is recommended to use `templatePatch` only with > trusted input or to carefully escape the input before using it in the template. Piping input to `toJson` should help > prevent, for example, a user from successfully injecting a string with newlines. > > The `spec.project` field is not supported in `templatePatch`. If you need to change the project, you can use the > `spec.project` field in the `template` field. > [!IMPORTANT] > When writing a `templatePatch`, you're crafting a patch. So, if the patch includes an empty `spec: # nothing in here`, it will effectively clear out existing fields. See [#17040](https://github.com/argoproj/argo-cd/issues/17040) for an example of this behavior. | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/applicationset/Template.md | master | argo-cd | [
0.012623484246432781,
0.0682225376367569,
-0.03807438910007477,
0.0332261361181736,
0.018708067014813423,
0.008681842125952244,
0.013858099468052387,
0.0005262147169560194,
0.0388936884701252,
0.07959283888339996,
-0.01157869677990675,
-0.03278264030814171,
-0.09274214506149292,
-0.0722550... | 0.140284 |
# How ApplicationSet controller interacts with Argo CD When you create, update, or delete an `ApplicationSet` resource, the ApplicationSet controller responds by creating, updating, or deleting one or more corresponding Argo CD `Application` resources. In fact, the \*sole\* responsibility of the ApplicationSet controller is to create, update, and delete `Application` resources within the Argo CD namespace. The controller's only job is to ensure that the `Application` resources remain consistent with the defined declarative `ApplicationSet` resource, and nothing more. Thus the ApplicationSet controller: - Does not create/modify/delete Kubernetes resources (other than the `Application` CR) - Does not connect to clusters other than the one Argo CD is deployed to - Does not interact with namespaces other than the one Argo CD is deployed within > [!IMPORTANT] > \*\*Use the Argo CD namespace\*\* > > All ApplicationSet resources and the ApplicationSet controller must be installed in the same namespace as Argo CD. > ApplicationSet resources in a different namespace will be ignored. It is Argo CD itself that is responsible for the actual deployment of the generated child `Application` resources, such as Deployments, Services, and ConfigMaps. The ApplicationSet controller can thus be thought of as an `Application` 'factory', taking an `ApplicationSet` resource as input, and outputting one or more Argo CD `Application` resources that correspond to the parameters of that set.  In this diagram an `ApplicationSet` resource is defined, and it is the responsibility of the ApplicationSet controller to create the corresponding `Application` resources. The resulting `Application` resources are then managed Argo CD: that is, Argo CD is responsible for actually deploying the child resources. Argo CD generates the application's Kubernetes resources based on the contents of the Git repository defined within the Application `spec` field, deploying e.g. Deployments, Service, and other resources. Creation, update, or deletion of ApplicationSets will have a direct effect on the Applications present in the Argo CD namespace. Likewise, cluster events (the addition/deletion of Argo CD cluster secrets, when using Cluster generator), or changes in Git (when using Git generator), will be used as input to the ApplicationSet controller in constructing `Application` resources. Argo CD and the ApplicationSet controller work together to ensure a consistent set of Application resources exist, and are deployed across the target clusters. | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/applicationset/Argo-CD-Integration.md | master | argo-cd | [
-0.023291051387786865,
-0.0426681749522686,
-0.06947380304336548,
-0.015183741226792336,
-0.012274542823433876,
-0.03287216275930405,
0.11675088107585907,
-0.03879870846867561,
0.10746452212333679,
0.07601708173751831,
0.034229159355163574,
-0.01574619673192501,
0.0016703229630365968,
-0.0... | 0.201568 |
# Plugin Generator The Plugin generator is a generator type which allows you to provide your own custom generator through a plugin. In contrast to other generators with predetermined logic (the [Cluster generator](Generators-Cluster.md) fetching clusters using a selector on ArgoCD secrets, [Git generator](Generators-Git.md) using a Git repository, etc.), a Plugin generator can use any custom code with input and output parameters. - You can write in any language - Simple: a plugin just responds to RPC HTTP requests. - You can use it in a sidecar, or standalone deployment. - You can get your plugin running today, no need to wait 3-5 months for review, approval, merge and an Argo software release. - You can combine it with [Matrix generator](Generators-Matrix.md) or [Merge generator](Generators-Merge.md) In general, the flow of an ApplicationSet with a Plugin generator is as follows: - The ApplicationSet controller sends an HTTP POST to `baseUrl` every `requeueAfterSeconds`. The request includes `input.parameters` defined in the ApplicationSet. - Your custom plugin service receives the request, reads the input parameters and executes its custom logic to fetch any necessary data and construct a list of output parameter objects. - The plugin service returns the parameter list in a response to the ApplicationSet controller. - The ApplicationSet controller iterates through the parameter objects and uses each one to fill out the template (defined in the ApplicationSet object) to create an Application. - This allows for dynamic creation of Argo CD Applications based on custom user-created defined templates, parameters, and logic. To start working on your own plugin, you can generate a new repository based on the example [applicationset-hello-plugin](https://github.com/argoproj-labs/applicationset-hello-plugin). ## Simple example Using a generator plugin without combining it with Matrix or Merge. ```yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: name: myplugin spec: goTemplate: true goTemplateOptions: ["missingkey=error"] generators: - plugin: # Specify the configMap where the plugin configuration is located. configMapRef: name: my-plugin # You can pass arbitrary parameters to the plugin. `input.parameters` is a map, but values may be any type. # These parameters will also be available on the generator's output under the `generator.input.parameters` key. input: parameters: key1: "value1" key2: "value2" list: ["list", "of", "values"] boolean: true map: key1: "value1" key2: "value2" key3: "value3" # You can also attach arbitrary values to the generator's output under the `values` key. These values will be # available in templates under the `values` key. values: value1: something # When using a Plugin generator, the ApplicationSet controller polls every `requeueAfterSeconds` interval (defaulting to every 30 minutes) to detect changes. requeueAfterSeconds: 30 template: metadata: name: myplugin annotations: example.from.input.parameters: "{{ index .generator.input.parameters.map "key1" }}" example.from.values: "{{ .values.value1 }}" # The plugin determines what else it produces. example.from.plugin.output: "{{ .something.from.the.plugin }}" ``` - `configMapRef.name`: A `ConfigMap` name containing the plugin configuration to use for RPC call. - `input.parameters`: Input parameters included in the RPC call to the plugin. (Optional) > [!NOTE] > The concept of the plugin should not undermine the spirit of GitOps by externalizing data outside of Git. The goal is to be complementary in specific contexts. > For example, when using one of the PullRequest generators, it's impossible to retrieve parameters related to the CI (only the commit hash is available), which limits the possibilities. By using a plugin, it's possible to retrieve the necessary parameters from a separate data source and use them to extend the functionality of the generator. ### Add a ConfigMap to configure the access of the plugin ```yaml apiVersion: v1 kind: ConfigMap metadata: name: my-plugin namespace: argocd data: token: "$plugin.myplugin.token" # Alternatively $:plugin.myplugin.token baseUrl: "http://myplugin.plugin-ns.svc.cluster.local." requestTimeout: "60" ``` - `token`: Pre-shared token used to authenticate HTTP request (points to the right | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/applicationset/Generators-Plugin.md | master | argo-cd | [
-0.11671898514032364,
-0.03887180984020233,
-0.19908908009529114,
0.05530219152569771,
-0.03234037011861801,
-0.01794888637959957,
-0.027702676132321358,
-0.01500936783850193,
-0.08046237379312515,
0.05831589177250862,
0.03644378483295441,
-0.023076534271240234,
0.011461044661700726,
-0.04... | 0.169849 |
the functionality of the generator. ### Add a ConfigMap to configure the access of the plugin ```yaml apiVersion: v1 kind: ConfigMap metadata: name: my-plugin namespace: argocd data: token: "$plugin.myplugin.token" # Alternatively $:plugin.myplugin.token baseUrl: "http://myplugin.plugin-ns.svc.cluster.local." requestTimeout: "60" ``` - `token`: Pre-shared token used to authenticate HTTP request (points to the right key you created in the `argocd-secret` Secret) - `baseUrl`: BaseUrl of the k8s service exposing your plugin in the cluster. - `requestTimeout`: Timeout of the request to the plugin in seconds (default: 30) ### Store credentials ```yaml apiVersion: v1 kind: Secret metadata: name: argocd-secret namespace: argocd labels: app.kubernetes.io/name: argocd-secret app.kubernetes.io/part-of: argocd type: Opaque data: # ... # The secret value must be base64 encoded \*\*once\*\*. # this value corresponds to: `printf "strong-password" | base64`. plugin.myplugin.token: "c3Ryb25nLXBhc3N3b3Jk" # ... ``` #### Alternative If you want to store sensitive data in \*\*another\*\* Kubernetes `Secret`, instead of `argocd-secret`, ArgoCD knows how to check the keys under `data` in your Kubernetes `Secret` for a corresponding key whenever a value in a configmap starts with `$`, then your Kubernetes `Secret` name and `:` (colon) followed by the key name. Syntax: `$:` > NOTE: Secret must have label `app.kubernetes.io/part-of: argocd` ##### Example `another-secret`: ```yaml apiVersion: v1 kind: Secret metadata: name: another-secret namespace: argocd labels: app.kubernetes.io/part-of: argocd type: Opaque data: # ... # Store client secret like below. # The secret value must be base64 encoded \*\*once\*\*. # This value corresponds to: `printf "strong-password" | base64`. plugin.myplugin.token: "c3Ryb25nLXBhc3N3b3Jk" ``` ### HTTP server #### A Simple Python Plugin You can deploy it either as a sidecar or as a standalone deployment (the latter is recommended). In the example, the token is stored in a file at this location : `/var/run/argo/token` ``` strong-password ``` ```python import json from http.server import BaseHTTPRequestHandler, HTTPServer with open("/var/run/argo/token") as f: plugin\_token = f.read().strip() class Plugin(BaseHTTPRequestHandler): def args(self): return json.loads(self.rfile.read(int(self.headers.get('Content-Length')))) def reply(self, reply): self.send\_response(200) self.end\_headers() self.wfile.write(json.dumps(reply).encode("UTF-8")) def forbidden(self): self.send\_response(403) self.end\_headers() def unsupported(self): self.send\_response(404) self.end\_headers() def do\_POST(self): if self.headers.get("Authorization") != "Bearer " + plugin\_token: self.forbidden() if self.path == '/api/v1/getparams.execute': args = self.args() self.reply({ "output": { "parameters": [ { "key1": "val1", "key2": "val2" }, { "key1": "val2", "key2": "val2" } ] } }) else: self.unsupported() if \_\_name\_\_ == '\_\_main\_\_': httpd = HTTPServer(('', 4355), Plugin) httpd.serve\_forever() ``` Execute getparams with curl : ``` curl http://localhost:4355/api/v1/getparams.execute -H "Authorization: Bearer strong-password" -d \ '{ "applicationSetName": "fake-appset", "input": { "parameters": { "param1": "value1" } } }' ``` Some things to note here: - You only need to implement the calls `/api/v1/getparams.execute` - You should check that the `Authorization` header contains the same bearer value as `/var/run/argo/token`. Return 403 if not - The input parameters are included in the request body and can be accessed using the `input.parameters` variable. - The output must always be a list of object maps nested under the `output.parameters` key in a map. - `generator.input.parameters` and `values` are reserved keys. If present in the plugin output, these keys will be overwritten by the contents of the `input.parameters` and `values` keys in the ApplicationSet's Plugin generator spec. ## With matrix and pull request example In the following example, the plugin implementation is returning a set of image digests for the given branch. The returned list contains only one item corresponding to the latest built image for the branch. ```yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: name: fb-matrix spec: goTemplate: true goTemplateOptions: ["missingkey=error"] generators: - matrix: generators: - pullRequest: github: ... requeueAfterSeconds: 30 - plugin: configMapRef: name: cm-plugin input: parameters: branch: "{{.branch}}" # provided by generator pull request values: branchLink: "https://git.example.com/org/repo/tree/{{.branch}}" template: metadata: name: "fb-matrix-{{.branch}}" spec: source: repoURL: "https://github.com/myorg/myrepo.git" targetRevision: "HEAD" path: charts/my-chart helm: releaseName: fb-matrix-{{.branch}} valueFiles: - values.yaml | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/applicationset/Generators-Plugin.md | master | argo-cd | [
-0.10265517234802246,
-0.011151377111673355,
-0.11039627343416214,
0.06490218639373779,
-0.029112208634614944,
-0.007796245161443949,
-0.005047375336289406,
-0.0276576429605484,
0.07465630769729614,
0.07482097297906876,
0.007955249398946762,
-0.056550342589616776,
-0.05355517193675041,
-0.... | 0.153265 |
goTemplate: true goTemplateOptions: ["missingkey=error"] generators: - matrix: generators: - pullRequest: github: ... requeueAfterSeconds: 30 - plugin: configMapRef: name: cm-plugin input: parameters: branch: "{{.branch}}" # provided by generator pull request values: branchLink: "https://git.example.com/org/repo/tree/{{.branch}}" template: metadata: name: "fb-matrix-{{.branch}}" spec: source: repoURL: "https://github.com/myorg/myrepo.git" targetRevision: "HEAD" path: charts/my-chart helm: releaseName: fb-matrix-{{.branch}} valueFiles: - values.yaml values: | front: image: myregistry:{{.branch}}@{{ .digestFront }} # digestFront is generated by the plugin back: image: myregistry:{{.branch}}@{{ .digestBack }} # digestBack is generated by the plugin project: default syncPolicy: automated: prune: true selfHeal: true syncOptions: - CreateNamespace=true destination: server: https://kubernetes.default.svc namespace: "{{.branch}}" info: - name: Link to the Application's branch value: "{{values.branchLink}}" ``` To illustrate : - The generator pullRequest would return, for example, 2 branches: `feature-branch-1` and `feature-branch-2`. - The Plugin generator would then perform 2 requests as follows : ```shell curl http://localhost:4355/api/v1/getparams.execute -H "Authorization: Bearer strong-password" -d \ '{ "applicationSetName": "fb-matrix", "input": { "parameters": { "branch": "feature-branch-1" } } }' ``` Then, ```shell curl http://localhost:4355/api/v1/getparams.execute -H "Authorization: Bearer strong-password" -d \ '{ "applicationSetName": "fb-matrix", "input": { "parameters": { "branch": "feature-branch-2" } } }' ``` For each call, it would return a unique result such as : ```json { "output": { "parameters": [ { "digestFront": "sha256:a3f18c17771cc1051b790b453a0217b585723b37f14b413ad7c5b12d4534d411", "digestBack": "sha256:4411417d614d5b1b479933b7420079671facd434fd42db196dc1f4cc55ba13ce" } ] } } ``` Then, ```json { "output": { "parameters": [ { "digestFront": "sha256:7c20b927946805124f67a0cb8848a8fb1344d16b4d0425d63aaa3f2427c20497", "digestBack": "sha256:e55e7e40700bbab9e542aba56c593cb87d680cefdfba3dd2ab9cfcb27ec384c2" } ] } } ``` In this example, by combining the two, you ensure that one or more pull requests are available and that the generated tag has been properly generated. This wouldn't have been possible with just a commit hash because a hash alone does not certify the success of the build. | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/applicationset/Generators-Plugin.md | master | argo-cd | [
0.023685947060585022,
0.031004291027784348,
-0.09492653608322144,
0.036648839712142944,
0.030673794448375702,
0.04528135433793068,
-0.06351911276578903,
0.028466658666729927,
0.0017442986136302352,
0.044592611491680145,
0.03278760612010956,
-0.07686018198728561,
0.001870273845270276,
-0.06... | -0.00095 |
# Cluster Decision Resource Generator The cluster decision resource generates a list of Argo CD clusters. This is done using [duck-typing](https://pkg.go.dev/knative.dev/pkg/apis/duck), which does not require knowledge of the full shape of the referenced Kubernetes resource. The following is an example of a cluster-decision-resource-based ApplicationSet generator: ```yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: name: guestbook namespace: argocd spec: goTemplate: true goTemplateOptions: ["missingkey=error"] generators: - clusterDecisionResource: # ConfigMap with GVK information for the duck type resource configMapRef: my-configmap name: quak # Choose either "name" of the resource or "labelSelector" labelSelector: matchLabels: # OPTIONAL duck: spotted matchExpressions: # OPTIONAL - key: duck operator: In values: - "spotted" - "canvasback" # OPTIONAL: Checks for changes every 60sec (default 3min) requeueAfterSeconds: 60 template: metadata: name: '{{.name}}-guestbook' spec: project: "default" source: repoURL: https://github.com/argoproj/argocd-example-apps/ targetRevision: HEAD path: guestbook destination: server: '{{.clusterName}}' # 'server' field of the secret namespace: guestbook ``` The `quak` resource, referenced by the ApplicationSet `clusterDecisionResource` generator: ```yaml apiVersion: mallard.io/v1beta1 kind: Duck metadata: name: quak spec: {} status: # Duck-typing ignores all other aspects of the resource except # the "decisions" list decisions: - clusterName: cluster-01 - clusterName: cluster-02 ``` The `ApplicationSet` resource references a `ConfigMap` that defines the resource to be used in this duck-typing. Only one ConfigMap is required per `ArgoCD` instance, to identify a resource. You can support multiple resource types by creating a `ConfigMap` for each. ```yaml apiVersion: v1 kind: ConfigMap metadata: name: my-configmap data: # apiVersion of the target resource apiVersion: mallard.io/v1beta1 # kind of the target resource kind: ducks # status key name that holds the list of Argo CD clusters statusListKey: decisions # The key in the status list whose value is the cluster name found in Argo CD matchKey: clusterName ``` (\*The full example can be found [here](https://github.com/argoproj/argo-cd/tree/master/applicationset/examples/clusterDecisionResource).\*) This example leverages the cluster management capabilities of the [open-cluster-management.io community](https://open-cluster-management.io/). By creating a `ConfigMap` with the GVK for the `open-cluster-management.io` Placement rule, your ApplicationSet can provision to different clusters in a number of novel ways. One example is to have the ApplicationSet maintain only two Argo CD Applications across 3 or more clusters. Then as maintenance or outages occur, the ApplicationSet will always maintain two Applications, moving the application to available clusters under the Placement rule's direction. ## How it works The ApplicationSet needs to be created in the Argo CD namespace, placing the `ConfigMap` in the same namespace allows the ClusterDecisionResource generator to read it. The `ConfigMap` stores the GVK information as well as the status key definitions. In the open-cluster-management example, the ApplicationSet generator will read the kind `placementrules` with an apiVersion of `apps.open-cluster-management.io/v1`. It will attempt to extract the \*\*list\*\* of clusters from the key `decisions`. It then validates the actual cluster name as defined in Argo CD against the \*\*value\*\* from the key `clusterName` in each of the elements in the list. The ClusterDecisionResource generator passes the 'name', 'server' and any other key/value in the duck-type resource's status list as parameters into the ApplicationSet template. In this example, the decision array contained an additional key `clusterName`, which is now available to the ApplicationSet template. > [!NOTE] > \*\*Clusters listed as `Status.Decisions` must be predefined in Argo CD\*\* > > The cluster names listed in the `Status.Decisions` \*must\* be defined within Argo CD, in order to generate applications for these values. The ApplicationSet controller does not create clusters within Argo CD. > > The Default Cluster list key is `clusters`. | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/applicationset/Generators-Cluster-Decision-Resource.md | master | argo-cd | [
-0.01076908502727747,
0.019823463633656502,
-0.09951601177453995,
0.009860451333224773,
0.04408957436680794,
0.010550525039434433,
0.08779522776603699,
-0.06011499837040901,
0.061483997851610184,
0.04176309332251549,
-0.025109367445111275,
-0.10288073867559433,
-0.016951775178313255,
-0.04... | 0.133588 |
create clusters within Argo CD. > > The Default Cluster list key is `clusters`. | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/applicationset/Generators-Cluster-Decision-Resource.md | master | argo-cd | [
0.05758753791451454,
-0.12384583801031113,
-0.11732941120862961,
0.03493167832493782,
-0.0025905047077685595,
-0.030757885426282883,
-0.01797819323837757,
-0.0355420783162117,
-0.05567535385489464,
0.07150696963071823,
0.03883098438382149,
-0.05386538803577423,
-0.036636728793382645,
0.009... | 0.148456 |
# Generators Generators are responsible for generating \*parameters\*, which are then rendered into the `template:` fields of the ApplicationSet resource. See the [Introduction](index.md) for an example of how generators work with templates, to create Argo CD Applications. Generators are primarily based on the data source that they use to generate the template parameters. For example: the List generator provides a set of parameters from a \*literal list\*, the Cluster generator uses the \*Argo CD cluster list\* as a source, the Git generator uses files/directories from a \*Git repository\*, and so. As of this writing there are nine generators: - [List generator](Generators-List.md): The List generator allows you to target Argo CD Applications to clusters based on a fixed list of any chosen key/value element pairs. - [Cluster generator](Generators-Cluster.md): The Cluster generator allows you to target Argo CD Applications to clusters, based on the list of clusters defined within (and managed by) Argo CD (which includes automatically responding to cluster addition/removal events from Argo CD). - [Git generator](Generators-Git.md): The Git generator allows you to create Applications based on files within a Git repository, or based on the directory structure of a Git repository. - [Matrix generator](Generators-Matrix.md): The Matrix generator may be used to combine the generated parameters of two separate generators. - [Merge generator](Generators-Merge.md): The Merge generator may be used to merge the generated parameters of two or more generators. Additional generators can override the values of the base generator. - [SCM Provider generator](Generators-SCM-Provider.md): The SCM Provider generator uses the API of an SCM provider (eg GitHub) to automatically discover repositories within an organization. - [Pull Request generator](Generators-Pull-Request.md): The Pull Request generator uses the API of an SCMaaS provider (eg GitHub) to automatically discover open pull requests within an repository. - [Cluster Decision Resource generator](Generators-Cluster-Decision-Resource.md): The Cluster Decision Resource generator is used to interface with Kubernetes custom resources that use custom resource-specific logic to decide which set of Argo CD clusters to deploy to. - [Plugin generator](Generators-Plugin.md): The Plugin generator makes RPC HTTP requests to provide parameters. All generators can be filtered by using the [Post Selector](Generators-Post-Selector.md) If you are new to generators, begin with the \*\*List\*\* and \*\*Cluster\*\* generators. For more advanced use cases, see the documentation for the remaining generators above. | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/applicationset/Generators.md | master | argo-cd | [
-0.11348625272512436,
0.025345519185066223,
-0.06033260375261307,
0.06677751243114471,
0.026792820543050766,
-0.013533351942896843,
0.06253873556852341,
-0.020903445780277252,
-0.01406064908951521,
-0.011989227496087551,
-0.026922928169369698,
-0.022069737315177917,
0.07093744724988937,
-0... | 0.188941 |
# ApplicationSet in any namespace > [!WARNING] > \*\*Beta Feature (Since v2.8.0)\*\* > > This feature is in the [Beta](https://github.com/argoproj/argoproj/blob/main/community/feature-status.md#beta) stage. > It is generally considered stable, but there may be unhandled edge cases. > [!WARNING] > Please read this documentation carefully before you enable this feature. Misconfiguration could lead to potential security issues. ## Introduction As of version 2.8, Argo CD supports managing `ApplicationSet` resources in namespaces other than the control plane's namespace (which is usually `argocd`), but this feature has to be explicitly enabled and configured appropriately. Argo CD administrators can define a certain set of namespaces where `ApplicationSet` resources may be created, updated and reconciled in. As Applications generated by an ApplicationSet are generated in the same namespace as the ApplicationSet itself, this works in combination with [App in any namespace](../app-any-namespace.md). ## Prerequisites ### App in any namespace configured This feature needs [App in any namespace](../app-any-namespace.md) feature activated. The list of namespaces must be the same. ### Cluster-scoped Argo CD installation This feature can only be enabled and used when your Argo CD ApplicationSet controller is installed as a cluster-wide instance, so it has permissions to list and manipulate resources on a cluster scope. It will \*not\* work with an Argo CD installed in namespace-scoped mode. ### SCM Providers secrets consideration By allowing ApplicationSet in any namespace you must be aware that any secrets can be exfiltrated using `scmProvider` or `pullRequest` generators. This means if ApplicationSet controller is configured to allow namespace `appNs` and some user is allowed to create an ApplicationSet in `appNs` namespace, then the user can install a malicious Pod into the `appNs` namespace as described below and read out the content of the secret indirectly, thus exfiltrating the secret value. Here is an example: ```yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: name: myapps namespace: appNs spec: goTemplate: true goTemplateOptions: ["missingkey=error"] generators: - scmProvider: gitea: # The Gitea owner to scan. owner: myorg # With this malicious setting, user can send all request to a Pod that will log incoming requests including headers with tokens api: http://my-service.appNs.svc.cluster.local # If true, scan every branch of every repository. If false, scan only the default branch. Defaults to false. allBranches: true # By changing this token reference, user can exfiltrate any secrets tokenRef: secretName: gitea-token key: token template: ``` In order to prevent the scenario above administrator must restrict the urls of the allowed SCM Providers (example: `https://git.mydomain.com/,https://gitlab.mydomain.com/`) by setting the environment variable `ARGOCD\_APPLICATIONSET\_CONTROLLER\_ALLOWED\_SCM\_PROVIDERS` to argocd-cmd-params-cm `applicationsetcontroller.allowed.scm.providers`. If another url is used, it will be rejected by the applicationset controller. For example: ```yaml apiVersion: v1 kind: ConfigMap metadata: name: argocd-cmd-params-cm data: applicationsetcontroller.allowed.scm.providers: https://git.mydomain.com/,https://gitlab.mydomain.com/ ``` > [!NOTE] > Please note url used in the `api` field of the `ApplicationSet` must match the url declared by the Administrator including the protocol > [!WARNING] > The allow-list only applies to SCM providers for which the user may configure a custom `api`. Where an SCM or PR > generator does not accept a custom API URL, the provider is implicitly allowed. If you do not intend to allow users to use the SCM or PR generators, you can disable them entirely by setting the environment variable `ARGOCD\_APPLICATIONSET\_CONTROLLER\_ENABLE\_SCM\_PROVIDERS` to argocd-cmd-params-cm `applicationsetcontroller.enable.scm.providers` to `false`. #### `tokenRef` Restrictions It is \*\*highly recommended\*\* to enable SCM Providers secrets restrictions to avoid any secrets exfiltration. This recommendation applies even when AppSets-in-any-namespace is disabled, but is especially important when it is enabled, since non-Argo-admins may attempt to reference out-of-bounds secrets in the `argocd` namespace from an AppSet `tokenRef`. When this mode is enabled, the referenced secret must have a label `argocd.argoproj.io/secret-type` with value `scm-creds`. To enable this mode, | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/applicationset/Appset-Any-Namespace.md | master | argo-cd | [
-0.06923230737447739,
-0.06521764397621155,
-0.062327753752470016,
0.035033777356147766,
-0.01735547184944153,
-0.05646953359246254,
0.1050058975815773,
0.014297631569206715,
-0.05739375948905945,
0.041343361139297485,
-0.013754650019109249,
0.010804654099047184,
-0.010703192092478275,
-0.... | 0.139078 |
applies even when AppSets-in-any-namespace is disabled, but is especially important when it is enabled, since non-Argo-admins may attempt to reference out-of-bounds secrets in the `argocd` namespace from an AppSet `tokenRef`. When this mode is enabled, the referenced secret must have a label `argocd.argoproj.io/secret-type` with value `scm-creds`. To enable this mode, set the `ARGOCD\_APPLICATIONSET\_CONTROLLER\_TOKENREF\_STRICT\_MODE` environment variable to `true` in the `argocd-application-controller` deployment. You can do this by adding the following to your `argocd-cmd-paramscm` ConfigMap: ```yaml apiVersion: v1 kind: ConfigMap metadata: name: argocd-cmd-params-cm data: applicationsetcontroller.tokenref.strict.mode: "true" ``` ### Overview In order for an ApplicationSet to be managed and reconciled outside the Argo CD's control plane namespace, two prerequisites must match: 1. The namespace list from which `argocd-applicationset-controller` can source `ApplicationSets` must be explicitly set using environment variable `ARGOCD\_APPLICATIONSET\_CONTROLLER\_NAMESPACES` or alternatively using parameter `--applicationset-namespaces`. 2. The enabled namespaces must be entirely covered by the [App in any namespace](../app-any-namespace.md), otherwise the generated Applications generated outside the allowed Application namespaces won't be reconciled It can be achieved by setting the environment variable `ARGOCD\_APPLICATIONSET\_CONTROLLER\_NAMESPACES` to argocd-cmd-params-cm `applicationsetcontroller.namespaces` `ApplicationSets` in different namespaces can be created and managed just like any other `ApplicationSet` in the `argocd` namespace previously, either declaratively or through the Argo CD API (e.g. using the CLI, the web UI, the REST API, etc). ### Reconfigure Argo CD to allow certain namespaces #### Change workload startup parameters In order to enable this feature, the Argo CD administrator must reconfigure the `argocd-applicationset-controller` workloads to add the `--applicationset-namespaces` parameter to the container's startup command. The `--applicationset-namespaces` parameter takes a comma-separated list of namespaces where `ApplicationSet` are to be allowed in. Each entry of the list supports: - shell-style wildcards such as `\*`, so for example the entry `app-team-\*` would match `app-team-one` and `app-team-two`. To enable all namespaces on the cluster where Argo CD is running on, you can just specify `\*`, i.e. `--application-namespaces=\*`. - regex, requires wrapping the string in ```/```, example to allow all namespaces except a particular one: ```/^((?!not-allowed).)\*$/```. The startup parameters for the `argocd-applicationset-controller` can also be conveniently set up and kept in sync by specifying the `applicationsetcontroller.namespaces` settings in the `argocd-cmd-params-cm` ConfigMap \_instead\_ of changing the manifests for the `ApplicationSet`. For example: ```yaml data: applicationsetcontroller.namespaces: "app-team-one, app-team-two" ``` would allow the `app-team-one` and `app-team-two` namespaces for managing `ApplicationSet` resources. After a change to the `argocd-cmd-params-cm` namespace, the `ApplicationSet` workload need to be restarted: ```bash kubectl rollout restart -n argocd deployment argocd-applicationset-controller ``` ### Safely template project As [App in any namespace](../app-any-namespace.md) is a prerequisite, it is possible to safely template project. Let's take an example with two teams and an infra project: ```yaml kind: AppProject apiVersion: argoproj.io/v1alpha1 metadata: name: infra-project namespace: argocd spec: destinations: - namespace: '\*' ``` ```yaml kind: AppProject apiVersion: argoproj.io/v1alpha1 metadata: name: team-one-project namespace: argocd spec: sourceNamespaces: - team-one-cd ``` ```yaml kind: AppProject apiVersion: argoproj.io/v1alpha1 metadata: name: team-two-project namespace: argocd spec: sourceNamespaces: - team-two-cd ``` Creating following `ApplicationSet` generates two Applications `infra-escalation` and `team-two-escalation`. Both will be rejected as they are outside `argocd` namespace, therefore `sourceNamespaces` will be checked ```yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: name: team-one-product-one namespace: team-one-cd spec: goTemplate: true goTemplateOptions: ["missingkey=error"] generators: list: - name: infra project: infra-project - name: team-two project: team-two-project template: metadata: name: '{{.name}}-escalation' spec: project: "{{.project}}" ``` ### ApplicationSet names For the CLI, applicationSets are now referred to and displayed as in the format `/`. For backwards compatibility, if the namespace of the ApplicationSet is the control plane's namespace (i.e. `argocd`), the `` can be omitted from the applicationset name when referring to it. For example, the application names `argocd/someappset` and `someappset` are semantically the same and refer to the same application in | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/applicationset/Appset-Any-Namespace.md | master | argo-cd | [
-0.059608399868011475,
-0.08108332008123398,
-0.12833558022975922,
0.002332541858777404,
0.00542221125215292,
-0.05083984136581421,
0.07581348717212677,
0.03882604092359543,
-0.021740073338150978,
0.0899658128619194,
0.05890844762325287,
-0.03751394897699356,
0.002299903193488717,
-0.01252... | 0.074192 |
format `/`. For backwards compatibility, if the namespace of the ApplicationSet is the control plane's namespace (i.e. `argocd`), the `` can be omitted from the applicationset name when referring to it. For example, the application names `argocd/someappset` and `someappset` are semantically the same and refer to the same application in the CLI and the UI. ### Applicationsets RBAC The RBAC syntax for Application objects has been changed from `/` to `//` to accommodate the need to restrict access based on the source namespace of the Application to be managed. For backwards compatibility, Applications in the argocd namespace can still be referred to as `/` in the RBAC policy rules. Wildcards do not make any distinction between project and applicationset namespaces yet. For example, the following RBAC rule would match any application belonging to project foo, regardless of the namespace it is created in: ``` p, somerole, applicationsets, get, foo/\*, allow ``` If you want to restrict access to be granted only to `ApplicationSets` with project `foo` within namespace `bar`, the rule would need to be adapted as follows: ``` p, somerole, applicationsets, get, foo/bar/\*, allow ``` ## Managing applicationSets in other namespaces ### Using the CLI You can use all existing Argo CD CLI commands for managing applications in other namespaces, exactly as you would use the CLI to manage applications in the control plane's namespace. For example, to retrieve the `ApplicationSet` named `foo` in the namespace `bar`, you can use the following CLI command: ```shell argocd appset get foo/bar ``` Likewise, to manage this applicationSet, keep referring to it as `foo/bar`: ```bash # Delete the application argocd appset delete foo/bar ``` There is no change on the create command as it is using a file. You just need to add the namespace in the `metadata.namespace` field. As stated previously, for applicationSets in the Argo CD's control plane namespace, you can omit the namespace from the application name. ### Using the REST API If you are using the REST API, the namespace for `ApplicationSet` cannot be specified as the application name, and resources need to be specified using the optional `appNamespace` query parameter. For example, to work with the `ApplicationSet` resource named `foo` in the namespace `bar`, the request would look like follows: ```bash GET /api/v1/applicationsets/foo?appsetNamespace=bar ``` For other operations such as `POST` and `PUT`, the `appNamespace` parameter must be part of the request's payload. For `ApplicationSet` resources in the control plane namespace, this parameter can be omitted. ## Clusters secrets consideration By allowing ApplicationSet in any namespace you must be aware that clusters can be discovered and used. Example: Following will discover all clusters ```yaml spec: generators: - clusters: {} # Automatically use all clusters defined within Argo CD ``` If you don't want to allow users to discover all clusters with ApplicationSets from other namespaces you may consider deploying ArgoCD in namespace scope or use OPA rules. | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/applicationset/Appset-Any-Namespace.md | master | argo-cd | [
-0.06615135818719864,
-0.09036892652511597,
-0.15315133333206177,
-0.03779583424329758,
-0.03736421465873718,
-0.03588682413101196,
0.07795414328575134,
0.04444415494799614,
-0.021867413073778152,
-0.01695472188293934,
-0.02949252538383007,
0.007465264294296503,
0.05669579654932022,
0.0297... | 0.136162 |
# Post Selector all generators The `selector` field on a generator allows an `ApplicationSet` to post-filter results using [the Kubernetes common labelSelector format](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors) and the generated values. `matchLabels` is a map of `{key,value}` pairs. This `list` generator generates a set of two `Applications`, which is then filtered using `matchLabels` to only the list element containing the key `env` with value `staging`: ``` spec: generators: - list: elements: - cluster: engineering-dev url: https://kubernetes.default.svc env: staging - cluster: engineering-prod url: https://kubernetes.default.svc env: prod selector: matchLabels: env: staging ``` The `list` generator + `matchLabels` selector generates a single set of parameters: ```yaml - cluster: engineering-dev url: https://kubernetes.default.svc env: staging ``` It is also possible to use `matchExpressions` for more powerful selectors. A single `{key,value}` in the `matchLabels` map is equivalent to an element of `matchExpressions`, whose `key` field is the "key", the `operator` is "In", and the `values` array contains only the "value". So the same example using `matchExpressions` looks like: ```yaml spec: generators: - list: elements: - cluster: engineering-dev url: https://kubernetes.default.svc env: staging - cluster: engineering-prod url: https://kubernetes.default.svc env: prod selector: matchExpressions: - key: env operator: In values: - staging ``` Valid `operators` include `In`, `NotIn`, `Exists`, and `DoesNotExist`. The `values` set must be non-empty in the case of `In` and `NotIn`. ## Full Example In the example, the list generator generates a set of two applications, which then filter by the key value to only select the `env` with value `staging`: ```yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: name: guestbook spec: goTemplate: true goTemplateOptions: ["missingkey=error"] generators: - list: elements: - cluster: engineering-dev url: https://kubernetes.default.svc env: staging - cluster: engineering-prod url: https://kubernetes.default.svc env: prod selector: matchLabels: env: staging template: metadata: name: '{{.cluster}}-guestbook' spec: project: default source: repoURL: https://github.com/argoproj-labs/applicationset.git targetRevision: HEAD path: examples/list-generator/guestbook/{{.cluster}} destination: server: '{{.url}}' namespace: guestbook ``` | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/applicationset/Generators-Post-Selector.md | master | argo-cd | [
-0.023359937593340874,
0.09605925530195236,
-0.016336524859070778,
-0.019112827256321907,
0.02492491900920868,
0.030356114730238914,
0.06618086993694305,
-0.06357990950345993,
0.052394747734069824,
-0.025189004838466644,
-0.008054036647081375,
-0.13772635161876678,
0.021085981279611588,
-0... | 0.125978 |
# List Generator The List generator generates parameters based on an arbitrary list of key/value pairs (as long as the values are string values). In this example, we're targeting a local cluster named `engineering-dev`: ```yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: name: guestbook namespace: argocd spec: goTemplate: true goTemplateOptions: ["missingkey=error"] generators: - list: elements: - cluster: engineering-dev url: https://kubernetes.default.svc # - cluster: engineering-prod # url: https://kubernetes.default.svc template: metadata: name: '{{.cluster}}-guestbook' spec: project: "my-project" source: repoURL: https://github.com/argoproj/argo-cd.git targetRevision: HEAD path: applicationset/examples/list-generator/guestbook/{{.cluster}} destination: server: '{{.url}}' namespace: guestbook ``` (\*The full example can be found [here](https://github.com/argoproj/argo-cd/tree/master/applicationset/examples/list-generator).\*) In this example, the List generator passes the `url` and `cluster` fields as parameters into the template. If we wanted to add a second environment, we could uncomment the second element and the ApplicationSet controller would automatically target it with the defined application. With the ApplicationSet v0.1.0 release, one could \*only\* specify `url` and `cluster` element fields (plus arbitrary `values`). As of ApplicationSet v0.2.0, any key/value `element` pair is supported (which is also fully backwards compatible with the v0.1.0 form): ```yaml spec: generators: - list: elements: # v0.1.0 form - requires cluster/url keys: - cluster: engineering-dev url: https://kubernetes.default.svc values: additional: value # v0.2.0+ form - does not require cluster/URL keys # (but they are still supported). - staging: "true" gitRepo: https://kubernetes.default.svc # (...) ``` > [!NOTE] > \*\*Clusters must be predefined in Argo CD\*\* > > These clusters \*must\* already be defined within Argo CD, in order to generate applications for these values. The ApplicationSet controller does not create clusters within Argo CD (for instance, it does not have the credentials to do so). ## Dynamically generated elements The List generator can also dynamically generate its elements based on a yaml/json it gets from a previous generator like git by combining the two with a matrix generator. In this example we are using the matrix generator with a git followed by a list generator and pass the content of a file in git as input to the `elementsYaml` field of the list generator: ```yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: name: elements-yaml namespace: argocd spec: goTemplate: true goTemplateOptions: ["missingkey=error"] generators: - matrix: generators: - git: repoURL: https://github.com/argoproj/argo-cd.git revision: HEAD files: - path: applicationset/examples/list-generator/list-elementsYaml-example.yaml - list: elementsYaml: "{{ .key.components | toJson }}" template: metadata: name: '{{.name}}' spec: project: default syncPolicy: automated: selfHeal: true syncOptions: - CreateNamespace=true sources: - chart: '{{.chart}}' repoURL: '{{.repoUrl}}' targetRevision: '{{.version}}' helm: releaseName: '{{.releaseName}}' destination: server: https://kubernetes.default.svc namespace: '{{.namespace}}' ``` where `list-elementsYaml-example.yaml` content is: ```yaml key: components: - name: component1 chart: podinfo version: "6.3.2" releaseName: component1 repoUrl: "https://stefanprodan.github.io/podinfo" namespace: component1 - name: component2 chart: podinfo version: "6.3.3" releaseName: component2 repoUrl: "ghcr.io/stefanprodan/charts" namespace: component2 ``` | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/applicationset/Generators-List.md | master | argo-cd | [
-0.0032043445389717817,
0.07424604147672653,
-0.054906927049160004,
0.04350849241018295,
0.03360559418797493,
0.013696499168872833,
0.024418814107775688,
-0.029346639290452003,
0.01627887785434723,
0.04838896170258522,
-0.0026170231867581606,
-0.10091447830200195,
-0.011863747611641884,
-0... | 0.087765 |
# Cluster Generator In Argo CD, managed clusters [are stored within Secrets](../../declarative-setup/#clusters) in the Argo CD namespace. The ApplicationSet controller uses those same Secrets to generate parameters to identify and target available clusters. For each cluster registered with Argo CD, the Cluster generator produces parameters based on the list of items found within the cluster secret. It automatically provides the following parameter values to the Application template for each cluster: - `name` - `nameNormalized` \*('name' but normalized to contain only lowercase alphanumeric characters, '-' or '.')\* - `server` - `project` \*(the Secret's 'project' field, if present; otherwise, it defaults to '')\* - `metadata.labels.` \*(for each label in the Secret)\* - `metadata.annotations.` \*(for each annotation in the Secret)\* > [!NOTE] > Use the `nameNormalized` parameter if your cluster name contains characters (such as underscores) that are not valid for Kubernetes resource names. This prevents rendering invalid Kubernetes resources with names like `my\_cluster-app1`, and instead would convert them to `my-cluster-app1`. Within [Argo CD cluster Secrets](../../declarative-setup/#clusters) are data fields describing the cluster: ```yaml kind: Secret data: # Within Kubernetes these fields are actually encoded in Base64; they are decoded here for convenience. # (They are likewise decoded when passed as parameters by the Cluster generator) config: "{'tlsClientConfig':{'insecure':false}}" name: "in-cluster2" server: "https://kubernetes.default.svc" metadata: labels: argocd.argoproj.io/secret-type: cluster # (...) ``` The Cluster generator will automatically identify clusters defined with Argo CD, and extract the cluster data as parameters: ```yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: name: guestbook namespace: argocd spec: goTemplate: true goTemplateOptions: ["missingkey=error"] generators: - clusters: {} # Automatically use all clusters defined within Argo CD template: metadata: name: '{{.name}}-guestbook' # 'name' field of the Secret spec: project: "my-project" source: repoURL: https://github.com/argoproj/argocd-example-apps/ targetRevision: HEAD path: guestbook destination: server: '{{.server}}' # 'server' field of the secret namespace: guestbook ``` (\*The full example can be found [here](https://github.com/argoproj/argo-cd/tree/master/applicationset/examples/cluster).\*) In this example, the cluster secret's `name` and `server` fields are used to populate the `Application` resource `name` and `server` (which are then used to target that same cluster). ### Label selector A label selector may be used to narrow the scope of targeted clusters to only those matching a specific label: ```yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: name: guestbook namespace: argocd spec: goTemplate: true goTemplateOptions: ["missingkey=error"] generators: - clusters: selector: matchLabels: staging: "true" # The cluster generator also supports matchExpressions. #matchExpressions: # - key: staging # operator: In # values: # - "true" template: # (...) ``` This would match an Argo CD cluster secret containing: ```yaml apiVersion: v1 kind: Secret data: # (... fields as above ...) metadata: labels: argocd.argoproj.io/secret-type: cluster staging: "true" # (...) ``` The cluster selector also supports set-based requirements, as used by [several core Kubernetes resources](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#resources-that-support-set-based-requirements). ### Deploying to the local cluster In Argo CD, the 'local cluster' is the cluster upon which Argo CD (and the ApplicationSet controller) is installed. This is to distinguish it from 'remote clusters', which are those that are added to Argo CD [declaratively](../../declarative-setup/#clusters) or via the [Argo CD CLI](../../getting\_started.md/#5-register-a-cluster-to-deploy-apps-to-optional). The cluster generator will automatically target both local and non-local clusters, for every cluster that matches the cluster selector. If you wish to target only remote clusters with your Applications (e.g. you want to exclude the local cluster), then use a cluster selector with labels, for example: ```yaml spec: goTemplate: true goTemplateOptions: ["missingkey=error"] generators: - clusters: selector: matchLabels: argocd.argoproj.io/secret-type: cluster # The cluster generator also supports matchExpressions. #matchExpressions: # - key: staging # operator: In # values: # - "true" ``` This selector will not match the default local cluster, since the default local cluster does not have a Secret (and thus does not have the `argocd.argoproj.io/secret-type` label on | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/applicationset/Generators-Cluster.md | master | argo-cd | [
-0.005205658730119467,
-0.0014232867397367954,
-0.09575824439525604,
0.05988648906350136,
0.012029440142214298,
0.007270677015185356,
0.06837637722492218,
-0.05507931858301163,
0.009164847433567047,
0.04903383553028107,
0.011774180456995964,
-0.10648685693740845,
0.018245995044708252,
-0.0... | 0.191915 |
cluster # The cluster generator also supports matchExpressions. #matchExpressions: # - key: staging # operator: In # values: # - "true" ``` This selector will not match the default local cluster, since the default local cluster does not have a Secret (and thus does not have the `argocd.argoproj.io/secret-type` label on that secret). Any cluster selector that selects on that label will automatically exclude the default local cluster. However, if you do wish to target both local and non-local clusters, while also using label matching, you can create a secret for the local cluster within the Argo CD web UI: 1. Within the Argo CD web UI, select \*Settings\*, then \*Clusters\*. 2. Select your local cluster, usually named `in-cluster`. 3. Click the \*Edit\* button, and change the \*NAME\* of the cluster to another value, for example `in-cluster-local`. Any other value here is fine. 4. Leave all other fields unchanged. 5. Click \*Save\*. These steps might seem counterintuitive, but the act of changing one of the default values for the local cluster causes the Argo CD Web UI to create a new secret for this cluster. In the Argo CD namespace, you should now see a Secret resource named `cluster-(cluster suffix)` with label `argocd.argoproj.io/secret-type": "cluster"`. You may also create a local [cluster secret declaratively](../../declarative-setup/#clusters), or with the CLI using `argocd cluster add "(context name)" --in-cluster`, rather than through the Web UI. ### Fetch clusters based on their K8s version There is also the possibility to fetch clusters based upon their Kubernetes version. To do this, the label `argocd.argoproj.io/auto-label-cluster-info` needs to be set to `true` on the cluster secret. Once that has been set, the controller will dynamically label the cluster secret with the Kubernetes version it is running on. To retrieve that value, you need to use the `argocd.argoproj.io/kubernetes-version`, as the example below demonstrates: ```yaml spec: goTemplate: true generators: - clusters: selector: matchLabels: argocd.argoproj.io/kubernetes-version: 1.28 # matchExpressions are also supported. #matchExpressions: # - key: argocd.argoproj.io/kubernetes-version # operator: In # values: # - "1.27" # - "1.28" ``` ### Pass additional key-value pairs via `values` field You may pass additional, arbitrary string key-value pairs via the `values` field of the cluster generator. Values added via the `values` field are added as `values.(field)` In this example, a `revision` parameter value is passed, based on matching labels on the cluster secret: ```yaml spec: goTemplate: true goTemplateOptions: ["missingkey=error"] generators: - clusters: selector: matchLabels: type: 'staging' # A key-value map for arbitrary parameters values: revision: HEAD # staging clusters use HEAD branch - clusters: selector: matchLabels: type: 'production' values: # production uses a different revision value, for 'stable' branch revision: stable template: metadata: name: '{{.name}}-guestbook' spec: project: "my-project" source: repoURL: https://github.com/argoproj/argocd-example-apps/ # The cluster values field for each generator will be substituted here: targetRevision: '{{.values.revision}}' path: guestbook destination: server: '{{.server}}' namespace: guestbook ``` In this example the `revision` value from the `generators.clusters` fields is passed into the template as `values.revision`, containing either `HEAD` or `stable` (based on which generator generated the set of parameters). > [!NOTE] > The `values.` prefix is always prepended to values provided via `generators.clusters.values` field. Ensure you include this prefix in the parameter name within the `template` when using it. In `values` we can also interpolate the following parameter values (i.e. the same values as presented in the beginning of this page) - `name` - `nameNormalized` \*('name' but normalized to contain only lowercase alphanumeric characters, '-' or '.')\* - `server` - `metadata.labels.` \*(for each label in the Secret)\* - `metadata.annotations.` \*(for each annotation in the Secret)\* Extending the example above, we could do something like this: ```yaml spec: goTemplate: true goTemplateOptions: ["missingkey=error"] generators: | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/applicationset/Generators-Cluster.md | master | argo-cd | [
-0.016411105170845985,
0.018954990431666374,
-0.07704945653676987,
0.060181863605976105,
0.04738790541887283,
0.01408157404512167,
0.0550730936229229,
-0.11903629451990128,
-0.024784795939922333,
0.0014625234762206674,
0.025551360100507736,
-0.10371425747871399,
0.00077859777957201,
-0.034... | 0.140975 |
`name` - `nameNormalized` \*('name' but normalized to contain only lowercase alphanumeric characters, '-' or '.')\* - `server` - `metadata.labels.` \*(for each label in the Secret)\* - `metadata.annotations.` \*(for each annotation in the Secret)\* Extending the example above, we could do something like this: ```yaml spec: goTemplate: true goTemplateOptions: ["missingkey=error"] generators: - clusters: selector: matchLabels: type: 'staging' # A key-value map for arbitrary parameters values: # If `my-custom-annotation` is in your cluster secret, `revision` will be substituted with it. revision: '{{index .metadata.annotations "my-custom-annotation"}}' clusterName: '{{.name}}' - clusters: selector: matchLabels: type: 'production' values: # production uses a different revision value, for 'stable' branch revision: stable clusterName: '{{.name}}' template: metadata: name: '{{.name}}-guestbook' spec: project: "my-project" source: repoURL: https://github.com/argoproj/argocd-example-apps/ # The cluster values field for each generator will be substituted here: targetRevision: '{{.values.revision}}' path: guestbook destination: # In this case this is equivalent to just using {{name}} server: '{{.values.clusterName}}' namespace: guestbook ``` ### Gather cluster information as a flat list You may sometimes need to gather your clusters information, without having to deploy one application per cluster found. For that, you can use the option `flatList` in the cluster generator. Here is an example of cluster generator using this option: ```yaml spec: goTemplate: true goTemplateOptions: ["missingkey=error"] generators: - clusters: selector: matchLabels: type: 'staging' flatList: true template: metadata: name: 'flat-list-guestbook' spec: project: "my-project" source: repoURL: https://github.com/argoproj/argocd-example-apps/ # The cluster values field for each generator will be substituted here: targetRevision: 'HEAD' path: helm-guestbook helm: values: | clusters: {{- range .clusters }} - name: {{ .name }} {{- end }} destination: # In this case this is equivalent to just using {{name}} server: 'my-cluster' namespace: guestbook ``` Given that you have two cluster secrets matching with names cluster1 and cluster2, this would generate the \*\*single\*\* following Application: ```yaml apiVersion: argoproj.io/v1alpha1 kind: Application metadata: name: flat-list-guestbook namespace: guestbook spec: project: "my-project" source: repoURL: https://github.com/argoproj/argocd-example-apps/ targetRevision: 'HEAD' path: helm-guestbook helm: values: | clusters: - name: cluster1 - name: cluster2 ``` In case you are using several cluster generators, each with the flatList option, one Application would be generated by cluster generator, as we can't simply merge values and templates that would potentially differ in each generator. | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/applicationset/Generators-Cluster.md | master | argo-cd | [
0.0028807290364056826,
0.11967901140451431,
0.0029690784867852926,
0.05927123874425888,
0.0446990467607975,
0.032977912575006485,
0.02311990223824978,
-0.0350063219666481,
0.007792471442371607,
0.007804987020790577,
0.004683998879045248,
-0.10966142266988754,
-0.0007202955894172192,
-0.006... | 0.085212 |
# Pull Request Generator The Pull Request generator uses the API of an SCMaaS provider (GitHub, Gitea, or Bitbucket Server) to automatically discover open pull requests within a repository. This fits well with the style of building a test environment when you create a pull request. ```yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: name: myapps spec: goTemplate: true goTemplateOptions: ["missingkey=error"] generators: - pullRequest: # When using a Pull Request generator, the ApplicationSet controller polls every `requeueAfterSeconds` interval (defaulting to every 30 minutes) to detect changes. requeueAfterSeconds: 1800 # See below for provider specific options. github: # ... ``` > [!NOTE] > Know the security implications of PR generators in ApplicationSets. > [Only admins may create ApplicationSets](./Security.md#only-admins-may-createupdatedelete-applicationsets) to avoid > leaking Secrets, and [only admins may create PRs](./Security.md#templated-project-field) if the `project` field of > an ApplicationSet with a PR generator is templated, to avoid granting management of out-of-bounds resources. ## GitHub Specify the repository from which to fetch the GitHub Pull requests. ```yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: name: myapps spec: goTemplate: true goTemplateOptions: ["missingkey=error"] generators: - pullRequest: github: # The GitHub organization or user. owner: myorg # The Github repository repo: myrepository # For GitHub Enterprise (optional) api: https://git.example.com/ # Reference to a Secret containing an access token. (optional) tokenRef: secretName: github-token key: token # (optional) use a GitHub App to access the API instead of a PAT. appSecretName: github-app-repo-creds # Labels is used to filter the PRs that you want to target. (optional) labels: - preview requeueAfterSeconds: 1800 template: # ... ``` \* `owner`: Required name of the GitHub organization or user. \* `repo`: Required name of the GitHub repository. \* `api`: If using GitHub Enterprise, the URL to access it. (Optional) \* `tokenRef`: A `Secret` name and key containing the GitHub access token to use for requests. If not specified, will make anonymous requests which have a lower rate limit and can only see public repositories. (Optional) \* `labels`: Filter the PRs to those containing \*\*all\*\* of the labels listed. (Optional) \* `appSecretName`: A `Secret` name containing a GitHub App secret in [repo-creds format][repo-creds]. [repo-creds]: ../declarative-setup.md#repository-credentials ## GitLab Specify the project from which to fetch the GitLab merge requests. ```yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: name: myapps spec: goTemplate: true goTemplateOptions: ["missingkey=error"] generators: - pullRequest: gitlab: # The GitLab project ID. project: "12341234" # For self-hosted GitLab (optional) api: https://git.example.com/ # Reference to a Secret containing an access token. (optional) tokenRef: secretName: gitlab-token key: token # Labels is used to filter the MRs that you want to target. (optional) labels: - preview # MR state is used to filter MRs only with a certain state. (optional) pullRequestState: opened # If true, skips validating the SCM provider's TLS certificate - useful for self-signed certificates. insecure: false # Reference to a ConfigMap containing trusted CA certs - useful for self-signed certificates. (optional) caRef: configMapName: argocd-tls-certs-cm key: gitlab-ca requeueAfterSeconds: 1800 template: # ... ``` \* `project`: Required project ID of the GitLab project. \* `api`: If using self-hosted GitLab, the URL to access it. (Optional) \* `tokenRef`: A `Secret` name and key containing the GitLab access token to use for requests. If not specified, will make anonymous requests which have a lower rate limit and can only see public repositories. (Optional) \* `labels`: Labels is used to filter the MRs that you want to target. (Optional) \* `pullRequestState`: PullRequestState is an additional MRs filter to get only those with a certain state. By default all states. Default: "" (all states). Valid values: `""`, `opened`, `closed`, `merged` or `locked`. (Optional) \* `insecure`: By default (false) - Skip checking the validity of the SCM's | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/applicationset/Generators-Pull-Request.md | master | argo-cd | [
-0.10188882052898407,
-0.03010883368551731,
-0.08352045714855194,
0.012940103188157082,
0.0295048039406538,
-0.051332298666238785,
-0.016216540709137917,
0.01885031908750534,
0.028068484738469124,
0.07230594009160995,
-0.0023025223053991795,
-0.032133396714925766,
-0.014815034344792366,
-0... | 0.143419 |
want to target. (Optional) \* `pullRequestState`: PullRequestState is an additional MRs filter to get only those with a certain state. By default all states. Default: "" (all states). Valid values: `""`, `opened`, `closed`, `merged` or `locked`. (Optional) \* `insecure`: By default (false) - Skip checking the validity of the SCM's certificate - useful for self-signed TLS certificates. \* `caRef`: Optional `ConfigMap` name and key containing the GitLab certificates to trust - useful for self-signed TLS certificates. Possibly reference the ArgoCD CM holding the trusted certs. As a preferable alternative to setting `insecure` to true, you can configure self-signed TLS certificates for Gitlab by [mounting self-signed certificate to the applicationset controller](./Generators-SCM-Provider.md#self-signed-tls-certificates). ## Gitea Specify the repository from which to fetch the Gitea Pull requests. ```yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: name: myapps spec: goTemplate: true goTemplateOptions: ["missingkey=error"] generators: - pullRequest: gitea: # The Gitea organization or user. owner: myorg # The Gitea repository repo: myrepository # The Gitea url to use api: https://gitea.mydomain.com/ # Reference to a Secret containing an access token. (optional) tokenRef: secretName: gitea-token key: token # many gitea deployments use TLS, but many are self-hosted and self-signed certificates insecure: true requeueAfterSeconds: 1800 template: # ... ``` \* `owner`: Required name of the Gitea organization or user. \* `repo`: Required name of the Gitea repository. \* `api`: The url of the Gitea instance. \* `tokenRef`: A `Secret` name and key containing the Gitea access token to use for requests. If not specified, will make anonymous requests which have a lower rate limit and can only see public repositories. (Optional) \* `insecure`: `Allow for self-signed certificates, primarily for testing.` ## Bitbucket Server Fetch pull requests from a repo hosted on a Bitbucket Server (not the same as Bitbucket Cloud). ```yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: name: myapps spec: goTemplate: true goTemplateOptions: ["missingkey=error"] generators: - pullRequest: bitbucketServer: project: myproject repo: myrepository # URL of the Bitbucket Server. Required. api: https://mycompany.bitbucket.org # Credentials for Basic authentication (App Password). Either basicAuth or bearerToken # authentication is required to access private repositories basicAuth: # The username to authenticate with username: myuser # Reference to a Secret containing the password or personal access token. passwordRef: secretName: mypassword key: password # Credentials for Bearer Token (App Token) authentication. Either basicAuth or bearerToken # authentication is required to access private repositories bearerToken: # Reference to a Secret containing the bearer token. tokenRef: secretName: repotoken key: token # If true, skips validating the SCM provider's TLS certificate - useful for self-signed certificates. insecure: true # Reference to a ConfigMap containing trusted CA certs - useful for self-signed certificates. (optional) caRef: configMapName: argocd-tls-certs-cm key: bitbucket-ca # Labels are not supported by Bitbucket Server, so filtering by label is not possible. # Filter PRs using the source branch name. (optional) filters: - branchMatch: ".\*-argocd" template: # ... ``` \* `project`: Required name of the Bitbucket project \* `repo`: Required name of the Bitbucket repository. \* `api`: Required URL to access the Bitbucket REST API. For the example above, an API request would be made to `https://mycompany.bitbucket.org/rest/api/1.0/projects/myproject/repos/myrepository/pull-requests` \* `branchMatch`: Optional regexp filter which should match the source branch name. This is an alternative to labels which are not supported by Bitbucket server. If you want to access a private repository, you must also provide the credentials for Basic auth (this is the only auth supported currently): \* `username`: The username to authenticate with. It only needs read access to the relevant repo. \* `passwordRef`: A `Secret` name and key containing the password or personal access token to use for requests. In case of Bitbucket App Token, go with `bearerToken` section. \* | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/applicationset/Generators-Pull-Request.md | master | argo-cd | [
-0.08588964492082596,
-0.005092067178338766,
-0.11300382763147354,
0.019744843244552612,
-0.023602528497576714,
-0.08566481620073318,
0.047669667750597,
-0.0034363046288490295,
-0.009685549885034561,
0.008942141197621822,
-0.01759936846792698,
-0.05422345548868179,
0.11995475739240646,
0.0... | -0.043338 |
the only auth supported currently): \* `username`: The username to authenticate with. It only needs read access to the relevant repo. \* `passwordRef`: A `Secret` name and key containing the password or personal access token to use for requests. In case of Bitbucket App Token, go with `bearerToken` section. \* `tokenRef`: A `Secret` name and key containing the app token to use for requests. In case of self-signed BitBucket Server certificates, the following options can be useful: \* `insecure`: By default (false) - Skip checking the validity of the SCM's certificate - useful for self-signed TLS certificates. \* `caRef`: Optional `ConfigMap` name and key containing the BitBucket server certificates to trust - useful for self-signed TLS certificates. Possibly reference the ArgoCD CM holding the trusted certs. ## Bitbucket Cloud Fetch pull requests from a repo hosted on a Bitbucket Cloud. ```yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: name: myapps spec: goTemplate: true goTemplateOptions: ["missingkey=error"] generators: - pullRequest: bitbucket: # Workspace name where the repository is stored under. Required. owner: myproject # Repository slug. Required. repo: myrepository # URL of the Bitbucket Server. (optional) Will default to 'https://api.bitbucket.org/2.0'. api: https://api.bitbucket.org/2.0 # Credentials for Basic authentication (App Password). Either basicAuth or bearerToken # authentication is required to access private repositories basicAuth: # The username to authenticate with username: myuser # Reference to a Secret containing the password or personal access token. passwordRef: secretName: mypassword key: password # Credentials for Bearer Token (App Token) authentication. Either basicAuth or bearerToken # authentication is required to access private repositories bearerToken: # Reference to a Secret containing the bearer token. tokenRef: secretName: repotoken key: token # Labels are not supported by Bitbucket Cloud, so filtering by label is not possible. # Filter PRs using the source branch name. (optional) filters: - branchMatch: ".\*-argocd" # If you need to filter destination branch too, you can use this - targetBranchMatch: "master" # Also you can combine source and target branch filters like # This case will match any pull-request where source branch ends with "-argocd" and destination branch is master - branchMatch: ".\*-argocd" targetBranchMatch: "master" template: # ... ``` - `owner`: Required name of the Bitbucket workspace - `repo`: Required name of the Bitbucket repository. - `api`: Optional URL to access the Bitbucket REST API. For the example above, an API request would be made to `https://api.bitbucket.org/2.0/repositories/{workspace}/{repo\_slug}/pullrequests`. If not set, defaults to `https://api.bitbucket.org/2.0` You can use branch `filters` like - `branchMatch`: Optional regexp filter which should match the source branch name. - `targetBranchMatch`: Optional regexp filter which should match destination branch name. > Note: Labels are not supported by Bitbucket. If you want to access a private repository, Argo CD will need credentials to access repository in Bitbucket Cloud. You can use Bitbucket App Password (generated per user, with access to whole workspace), or Bitbucket App Token (generated per repository, with access limited to repository scope only). If both App Password and App Token are defined, App Token will be used. To use Bitbucket App Password, use `basicAuth` section. - `username`: The username to authenticate with. It only needs read access to the relevant repo. - `passwordRef`: A `Secret` name and key containing the password or personal access token to use for requests. In case of Bitbucket App Token, go with `bearerToken` section. - `tokenRef`: A `Secret` name and key containing the app token to use for requests. ## Azure DevOps Specify the organization, project and repository from which you want to fetch pull requests. ```yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: name: myapps spec: goTemplate: true goTemplateOptions: ["missingkey=error"] generators: - pullRequest: azuredevops: # Azure DevOps org to scan. Required. | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/applicationset/Generators-Pull-Request.md | master | argo-cd | [
-0.08747594803571701,
-0.028055420145392418,
-0.09025373309850693,
0.011268671602010727,
0.012411915697157383,
-0.01970321126282215,
0.056569699198007584,
0.021194107830524445,
-0.010321768932044506,
0.08032836765050888,
0.018305713310837746,
-0.051103685051202774,
0.07547152042388916,
-0.... | 0.011989 |
key containing the app token to use for requests. ## Azure DevOps Specify the organization, project and repository from which you want to fetch pull requests. ```yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: name: myapps spec: goTemplate: true goTemplateOptions: ["missingkey=error"] generators: - pullRequest: azuredevops: # Azure DevOps org to scan. Required. organization: myorg # Azure DevOps project name to scan. Required. project: myproject # Azure DevOps repo name to scan. Required. repo: myrepository # The Azure DevOps API URL to talk to. If blank, use https://dev.azure.com/. api: https://dev.azure.com/ # Reference to a Secret containing an access token. (optional) tokenRef: secretName: azure-devops-token key: token # Labels is used to filter the PRs that you want to target. (optional) labels: - preview requeueAfterSeconds: 1800 template: # ... ``` \* `organization`: Required name of the Azure DevOps organization. \* `project`: Required name of the Azure DevOps project. \* `repo`: Required name of the Azure DevOps repository. \* `api`: If using self-hosted Azure DevOps Repos, the URL to access it. (Optional) \* `tokenRef`: A `Secret` name and key containing the Azure DevOps access token to use for requests. If not specified, will make anonymous requests which have a lower rate limit and can only see public repositories. (Optional) \* `labels`: Filter the PRs to those containing \*\*all\*\* of the labels listed. (Optional) ## Filters Filters allow selecting which pull requests to generate for. Each filter can declare one or more conditions, all of which must pass. If multiple filters are present, any can match for a repository to be included. If no filters are specified, all pull requests will be processed. Currently, only a subset of filters is available when comparing with [SCM provider](Generators-SCM-Provider.md) filters. ```yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: name: myapps spec: goTemplate: true goTemplateOptions: ["missingkey=error"] generators: - pullRequest: # ... # Include any pull request branch ending with "argocd" # and pull request title starting with "feat:". (optional) filters: - branchMatch: ".\*-argocd" - titleMatch: "^feat:" template: # ... ``` \* `branchMatch`: A regexp matched against source branch names. \* `targetBranchMatch`: A regexp matched against target branch names. \* `titleMatch`: A regexp matched against Pull Request title. [GitHub](#github) and [GitLab](#gitlab) also support a `labels` filter. ## Template As with all generators, several keys are available for replacement in the generated application. The following is a comprehensive Helm Application example; ```yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: name: myapps spec: goTemplate: true goTemplateOptions: ["missingkey=error"] generators: - pullRequest: # ... template: metadata: name: 'myapp-{{.branch}}-{{.number}}' spec: source: repoURL: 'https://github.com/myorg/myrepo.git' targetRevision: '{{.head\_sha}}' path: kubernetes/ helm: parameters: - name: "image.tag" value: "pull-{{.author}}-{{.head\_sha}}" project: "my-project" destination: server: https://kubernetes.default.svc namespace: default ``` And, here is a robust Kustomize example; ```yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: name: myapps spec: goTemplate: true goTemplateOptions: ["missingkey=error"] generators: - pullRequest: # ... template: metadata: name: 'myapp-{{.branch}}-{{.number}}' spec: source: repoURL: 'https://github.com/myorg/myrepo.git' targetRevision: '{{.head\_sha}}' path: kubernetes/ kustomize: nameSuffix: '{{.branch}}' commonLabels: app.kubernetes.io/instance: '{{.branch}}-{{.number}}' images: - 'ghcr.io/myorg/myrepo:{{.author}}-{{.head\_sha}}' project: "my-project" destination: server: https://kubernetes.default.svc namespace: default ``` \* `number`: The ID number of the pull request. \* `title`: The title of the pull request. \* `branch`: The name of the branch of the pull request head. \* `branch\_slug`: The branch name will be cleaned to be conform to the DNS label standard as defined in [RFC 1123](https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#dns-label-names), and truncated to 50 characters to give room to append/suffix-ing it with 13 more characters. \* `target\_branch`: The name of the target branch of the pull request. \* `target\_branch\_slug`: The target branch name will be cleaned to be conform to the DNS label standard as defined in [RFC 1123](https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#dns-label-names), and truncated to 50 characters to give room to append/suffix-ing it with 13 more characters. \* | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/applicationset/Generators-Pull-Request.md | master | argo-cd | [
-0.03996103256940842,
0.00019473068823572248,
-0.04932534694671631,
0.00966055877506733,
0.013593015260994434,
-0.02504596672952175,
0.07085441797971725,
-0.02945500798523426,
0.059797026216983795,
0.1090763732790947,
-0.012141138315200806,
-0.09520187228918076,
0.02104276604950428,
-0.011... | 0.083148 |
\* `target\_branch`: The name of the target branch of the pull request. \* `target\_branch\_slug`: The target branch name will be cleaned to be conform to the DNS label standard as defined in [RFC 1123](https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#dns-label-names), and truncated to 50 characters to give room to append/suffix-ing it with 13 more characters. \* `head\_sha`: This is the SHA of the head of the pull request. \* `head\_short\_sha`: This is the short SHA of the head of the pull request (8 characters long or the length of the head SHA if it's shorter). \* `head\_short\_sha\_7`: This is the short SHA of the head of the pull request (7 characters long or the length of the head SHA if it's shorter). \* `labels`: The array of pull request labels. (Supported only for Go Template ApplicationSet manifests.) \* `author`: The author/creator of the pull request. ## Webhook Configuration When using a Pull Request generator, the ApplicationSet controller polls every `requeueAfterSeconds` interval (defaulting to every 30 minutes) to detect changes. To eliminate this delay from polling, the ApplicationSet webhook server can be configured to receive webhook events, which will trigger Application generation by the Pull Request generator. The configuration is almost the same as the one described [in the Git generator](Generators-Git.md), but there is one difference: if you want to use the Pull Request Generator as well, additionally configure the following settings. > [!NOTE] > The ApplicationSet controller webhook does not use the same webhook as the API server as defined [here](../webhook.md). ApplicationSet exposes a webhook server as a service of type ClusterIP. An ApplicationSet specific Ingress resource needs to be created to expose this service to the webhook source. ### Github webhook configuration In section 1, \_"Create the webhook in the Git provider"\_, add an event so that a webhook request will be sent when a pull request is created, closed, or label changed. Add Webhook URL with uri `/api/webhook` and select content-type as json  Select `Let me select individual events` and enable the checkbox for `Pull requests`.  The Pull Request Generator will requeue when the next action occurs. - `opened` - `closed` - `reopened` - `labeled` - `unlabeled` - `synchronized` For more information about each event, please refer to the [official documentation](https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads). ### Gitlab webhook configuration Enable checkbox for "Merge request events" in triggers list.  The Pull Request Generator will requeue when the next action occurs. - `open` - `close` - `reopen` - `update` - `merge` For more information about each event, please refer to the [official documentation](https://docs.gitlab.com/ee/user/project/integrations/webhook\_events.html#merge-request-events). ## Lifecycle An Application will be generated when a Pull Request is discovered when the configured criteria is met - i.e. for GitHub when a Pull Request matches the specified `labels` and/or `pullRequestState`. Application will be removed when a Pull Request no longer meets the specified criteria. ## Pass additional key-value pairs via `values` field You may pass additional, arbitrary string key-value pairs via the `values` field of any Pull Request generator. Values added via the `values` field are added as `values.(field)`. ```yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: name: myapps spec: goTemplate: true goTemplateOptions: ["missingkey=error"] generators: - pullRequest: # ... values: pr\_branch: '{{ .branch }}' template: metadata: name: '{{ .values.name }}' spec: source: repoURL: '{{ .url }}' targetRevision: '{{ .branch }}' path: kubernetes/ project: default destination: server: https://kubernetes.default.svc namespace: default ``` > [!NOTE] > The `values.` prefix is always prepended to values provided via `generators.pullRequest.values` field. Ensure you include this prefix in the parameter name within the `template` when using it. In `values` we can also interpolate | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/applicationset/Generators-Pull-Request.md | master | argo-cd | [
-0.03767469525337219,
0.014700579456984997,
0.05487664043903351,
-0.07498800754547119,
-0.08848802745342255,
0.021776698529720306,
0.014931985177099705,
0.02864878624677658,
0.1390044391155243,
-0.009987671859562397,
0.001005789847113192,
-0.0575949102640152,
-0.045518383383750916,
-0.0271... | 0.159166 |
targetRevision: '{{ .branch }}' path: kubernetes/ project: default destination: server: https://kubernetes.default.svc namespace: default ``` > [!NOTE] > The `values.` prefix is always prepended to values provided via `generators.pullRequest.values` field. Ensure you include this prefix in the parameter name within the `template` when using it. In `values` we can also interpolate all fields set by the Pull Request generator as mentioned above. | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/applicationset/Generators-Pull-Request.md | master | argo-cd | [
0.03186437860131264,
0.025240181013941765,
0.010016950778663158,
0.019466210156679153,
-0.04389240965247154,
0.01804245449602604,
-0.020015748217701912,
0.026203710585832596,
0.08708230406045914,
0.04082553833723068,
-0.0728759616613388,
-0.08088485896587372,
-0.056742243468761444,
-0.0320... | 0.03358 |
# Controlling if/when the ApplicationSet controller modifies `Application` resources The ApplicationSet controller supports a number of settings that limit the ability of the controller to make changes to generated Applications, for example, preventing the controller from deleting child Applications. These settings allow you to exert control over when, and how, changes are made to your Applications, and to their corresponding cluster resources (`Deployments`, `Services`, etc). Here are some of the controller settings that may be modified to alter the ApplicationSet controller's resource-handling behaviour. ## Dry run: prevent ApplicationSet from creating, modifying, or deleting all Applications To prevent the ApplicationSet controller from creating, modifying, or deleting any `Application` resources, you may enable `dry-run` mode. This essentially switches the controller into a "read only" mode, where the controller Reconcile loop will run, but no resources will be modified. To enable dry-run, add `--dryrun true` to the ApplicationSet Deployment's container launch parameters. See 'How to modify ApplicationSet container parameters' below for detailed steps on how to add this parameter to the controller. ## Managed Applications modification Policies The ApplicationSet controller supports a parameter `--policy`, which is specified on launch (within the controller Deployment container), and which restricts what types of modifications will be made to managed Argo CD `Application` resources. The `--policy` parameter takes four values: `sync`, `create-only`, `create-delete`, and `create-update`. (`sync` is the default, which is used if the `--policy` parameter is not specified; the other policies are described below). It is also possible to set this policy per ApplicationSet. ```yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet spec: # (...) syncPolicy: applicationsSync: create-only # create-update, create-delete sync ``` - Policy `create-only`: Prevents ApplicationSet controller from modifying or deleting Applications. \*\*WARNING\*\*: It doesn't prevent Application controller from deleting Applications according to [ownerReferences](https://kubernetes.io/docs/concepts/overview/working-with-objects/owners-dependents/) when deleting ApplicationSet. - Policy `create-update`: Prevents ApplicationSet controller from deleting Applications. Update is allowed. \*\*WARNING\*\*: It doesn't prevent Application controller from deleting Applications according to [ownerReferences](https://kubernetes.io/docs/concepts/overview/working-with-objects/owners-dependents/) when deleting ApplicationSet. - Policy `create-delete`: Prevents ApplicationSet controller from modifying Applications. Delete is allowed. - Policy `sync`: Create, Update and Delete are allowed. If the controller parameter `--policy` is set, it takes precedence on the field `applicationsSync`. It is possible to allow per ApplicationSet sync policy by setting variable `ARGOCD\_APPLICATIONSET\_CONTROLLER\_ENABLE\_POLICY\_OVERRIDE` to argocd-cmd-params-cm `applicationsetcontroller.enable.policy.override` or directly with controller parameter `--enable-policy-override` (default to `false`). ### Policy - `create-only`: Prevent ApplicationSet controller from modifying and deleting Applications To allow the ApplicationSet controller to \*create\* `Application` resources, but prevent any further modification, such as \*deletion\*, or modification of Application fields, add this parameter in the ApplicationSet controller: \*\*WARNING\*\*: "\*deletion\*" indicates the case as the result of comparing generated Application between before and after, there are Applications which no longer exist. It doesn't indicate the case Applications are deleted according to ownerReferences to ApplicationSet. See [How to prevent Application controller from deleting Applications when deleting ApplicationSet](#how-to-prevent-application-controller-from-deleting-applications-when-deleting-applicationset) ``` --policy create-only ``` At ApplicationSet level ```yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet spec: # (...) syncPolicy: applicationsSync: create-only ``` ### Policy - `create-update`: Prevent ApplicationSet controller from deleting Applications To allow the ApplicationSet controller to create or modify `Application` resources, but prevent Applications from being deleted, add the following parameter to the ApplicationSet controller `Deployment`: \*\*WARNING\*\*: "\*deletion\*" indicates the case as the result of comparing generated Application between before and after, there are Applications which no longer exist. It doesn't indicate the case Applications are deleted according to ownerReferences to ApplicationSet. See [How to prevent Application controller from deleting Applications when deleting ApplicationSet](#how-to-prevent-application-controller-from-deleting-applications-when-deleting-applicationset) ``` --policy create-update ``` This may be useful to users looking for additional protection against deletion of the Applications generated by the controller. At ApplicationSet level ```yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/applicationset/Controlling-Resource-Modification.md | master | argo-cd | [
-0.033990416675806046,
-0.02330886386334896,
-0.07448983192443848,
0.011085890233516693,
0.0331110842525959,
-0.046208444982767105,
0.07865934818983078,
0.010369853116571903,
0.04288892075419426,
0.035527829080820084,
0.003358330111950636,
0.018469715490937233,
0.021546291187405586,
-0.068... | 0.085635 |
are deleted according to ownerReferences to ApplicationSet. See [How to prevent Application controller from deleting Applications when deleting ApplicationSet](#how-to-prevent-application-controller-from-deleting-applications-when-deleting-applicationset) ``` --policy create-update ``` This may be useful to users looking for additional protection against deletion of the Applications generated by the controller. At ApplicationSet level ```yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet spec: # (...) syncPolicy: applicationsSync: create-update ``` ### How to prevent Application controller from deleting Applications when deleting ApplicationSet By default, `create-only` and `create-update` policy isn't effective against preventing deletion of Applications when deleting ApplicationSet. You must set the finalizer to ApplicationSet to prevent deletion in such case, and use background cascading deletion. If you use foreground cascading deletion, there's no guarantee to preserve applications. ```yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: finalizers: - resources-finalizer.argocd.argoproj.io spec: # (...) ``` ## Ignore certain changes to Applications The ApplicationSet spec includes an `ignoreApplicationDifferences` field, which allows you to specify which fields of the ApplicationSet should be ignored when comparing Applications. The field supports multiple ignore rules. Each ignore rule may specify a list of either `jsonPointers` or `jqPathExpressions` to ignore. You may optionally also specify a `name` to apply the ignore rule to a specific Application, or omit the `name` to apply the ignore rule to all Applications. ```yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet spec: ignoreApplicationDifferences: - jsonPointers: - /spec/source/targetRevision - name: some-app jqPathExpressions: - .spec.source.helm.values ``` ### Allow temporarily toggling auto-sync One of the most common use cases for ignoring differences is to allow temporarily toggling auto-sync for an Application. For example, if you have an ApplicationSet that is configured to automatically sync Applications, you may want to temporarily disable auto-sync for a specific Application. You can do this by adding an ignore rule for the `spec.syncPolicy.automated` field. ```yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet spec: ignoreApplicationDifferences: - jsonPointers: - /spec/syncPolicy ``` ### Limitations of `ignoreApplicationDifferences` When an ApplicationSet is reconciled, the controller will compare the ApplicationSet spec with the spec of each Application that it manages. If there are any differences, the controller will generate a patch to update the Application to match the ApplicationSet spec. The generated patch is a MergePatch. According to the MergePatch documentation, "existing lists will be completely replaced by new lists" when there is a change to the list. This limits the effectiveness of `ignoreApplicationDifferences` when the ignored field is in a list. For example, if you have an application with multiple sources, and you want to ignore changes to the `targetRevision` of one of the sources, changes in other fields or in other sources will cause the entire `sources` list to be replaced, and the `targetRevision` field will be reset to the value defined in the ApplicationSet. For example, consider this ApplicationSet: ```yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet spec: ignoreApplicationDifferences: - jqPathExpressions: - .spec.sources[] | select(.repoURL == "https://git.example.com/org/repo1").targetRevision template: spec: sources: - repoURL: https://git.example.com/org/repo1 targetRevision: main - repoURL: https://git.example.com/org/repo2 targetRevision: main ``` You can freely change the `targetRevision` of the `repo1` source, and the ApplicationSet controller will not overwrite your change. ```yaml apiVersion: argoproj.io/v1alpha1 kind: Application spec: sources: - repoURL: https://git.example.com/org/repo1 targetRevision: fix/bug-123 - repoURL: https://git.example.com/org/repo2 targetRevision: main ``` However, if you change the `targetRevision` of the `repo2` source, the ApplicationSet controller will overwrite the entire `sources` field. ```yaml apiVersion: argoproj.io/v1alpha1 kind: Application spec: sources: - repoURL: https://git.example.com/org/repo1 targetRevision: main - repoURL: https://git.example.com/org/repo2 targetRevision: main ``` > [!NOTE] > [Future improvements](https://github.com/argoproj/argo-cd/issues/15975) to the ApplicationSet controller may > eliminate this problem. For example, the `ref` field might be made a merge key, allowing the ApplicationSet > controller to generate and use a StrategicMergePatch instead of a MergePatch. You could then target a specific > source by `ref`, ignore changes to | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/applicationset/Controlling-Resource-Modification.md | master | argo-cd | [
-0.06771614402532578,
-0.06837432831525803,
-0.08779670298099518,
-0.06731461733579636,
0.05764690414071083,
-0.037472497671842575,
0.07834960520267487,
-0.0710635557770729,
0.04111415520310402,
0.06110064312815666,
0.061136532574892044,
0.050684940069913864,
0.008353622630238533,
-0.03741... | 0.05247 |
[Future improvements](https://github.com/argoproj/argo-cd/issues/15975) to the ApplicationSet controller may > eliminate this problem. For example, the `ref` field might be made a merge key, allowing the ApplicationSet > controller to generate and use a StrategicMergePatch instead of a MergePatch. You could then target a specific > source by `ref`, ignore changes to a field in that source, and changes to other sources would not cause the ignored > field to be overwritten. ## Prevent an `Application`'s child resources from being deleted, when the parent Application is deleted By default, when an `Application` resource is deleted by the ApplicationSet controller, all of the child resources of the Application will be deleted as well (such as, all of the Application's `Deployments`, `Services`, etc). To prevent an Application's child resources from being deleted when the parent Application is deleted, add the `preserveResourcesOnDeletion: true` field to the `syncPolicy` of the ApplicationSet: ```yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet spec: # (...) syncPolicy: preserveResourcesOnDeletion: true ``` More information on the specific behaviour of `preserveResourcesOnDeletion`, and deletion in ApplicationSet controller and Argo CD in general, can be found on the [Application Deletion](Application-Deletion.md) page. ## Prevent an Application's child resources from being modified Changes made to the ApplicationSet will propagate to the Applications managed by the ApplicationSet, and then Argo CD will propagate the Application changes to the underlying cluster resources (as per [Argo CD Integration](Argo-CD-Integration.md)). The propagation of Application changes to the cluster is managed by the [automated sync settings](../../user-guide/auto\_sync.md), which are referenced in the ApplicationSet `template` field: - `spec.template.syncPolicy.automated`: If enabled, changes to Applications will automatically propagate to the cluster resources of the cluster. - Unset this within the ApplicationSet template to 'pause' updates to cluster resources managed by the `Application` resource. - `spec.template.syncPolicy.automated.prune`: By default, Automated sync will not delete resources when Argo CD detects the resource is no longer defined in Git. - For extra safety, set this to false to prevent unexpected changes to the backing Git repository from affecting cluster resources. ## How to modify ApplicationSet container launch parameters There are a couple of ways to modify the ApplicationSet container parameters, so as to enable the above settings. ### A) Use `kubectl edit` to modify the deployment on the cluster Edit the applicationset-controller `Deployment` resource on the cluster: ``` kubectl edit deployment/argocd-applicationset-controller -n argocd ``` Locate the `.spec.template.spec.containers[0].command` field, and add the required parameter(s): ```yaml spec: # (...) template: # (...) spec: containers: - command: - entrypoint.sh - argocd-applicationset-controller # Insert new parameters here, for example: # --policy create-only # (...) ``` Save and exit the editor. Wait for a new `Pod` to start containing the updated parameters. ### Or, B) Edit the `install.yaml` manifest for the ApplicationSet installation Rather than directly editing the cluster resource, you may instead choose to modify the installation YAML that is used to install the ApplicationSet controller: Applicable for applicationset versions less than 0.4.0. ```bash # Clone the repository git clone https://github.com/argoproj/applicationset # Checkout the version that corresponds to the one you have installed. git checkout "(version of applicationset)" # example: git checkout "0.1.0" cd applicationset/manifests # open 'install.yaml' in a text editor, make the same modifications to Deployment # as described in the previous section. # Apply the change to the cluster kubectl apply -n argocd --server-side --force-conflicts -f install.yaml ``` ## Preserving changes made to an Applications annotations and labels > [!NOTE] > The same behavior can be achieved on a per-app basis using the [`ignoreApplicationDifferences`](#ignore-certain-changes-to-applications) > feature described above. However, preserved fields may be configured globally, a feature that is not yet available > for `ignoreApplicationDifferences`. It is common practice in Kubernetes to store state in | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/applicationset/Controlling-Resource-Modification.md | master | argo-cd | [
-0.10457885265350342,
-0.005532677285373211,
-0.05091223493218422,
0.01191791333258152,
0.02678816393017769,
-0.04479477182030678,
0.08611354231834412,
-0.05781572312116623,
0.019570806995034218,
0.09314052015542984,
0.005135831423103809,
0.06484535336494446,
-0.005681514739990234,
-0.0608... | 0.073686 |
annotations and labels > [!NOTE] > The same behavior can be achieved on a per-app basis using the [`ignoreApplicationDifferences`](#ignore-certain-changes-to-applications) > feature described above. However, preserved fields may be configured globally, a feature that is not yet available > for `ignoreApplicationDifferences`. It is common practice in Kubernetes to store state in annotations, operators will often make use of this. To allow for this, it is possible to configure a list of annotations that the ApplicationSet should preserve when reconciling. For example, imagine that we have an Application created from an ApplicationSet, but a custom annotation and label has since been added (to the Application) that does not exist in the `ApplicationSet` resource: ```yaml apiVersion: argoproj.io/v1alpha1 kind: Application metadata: # This annotation and label exists only on this Application, and not in # the parent ApplicationSet template: annotations: my-custom-annotation: some-value labels: my-custom-label: some-value spec: # (...) ``` To preserve this annotation and label we can use the `preservedFields` property of the `ApplicationSet` like so: ```yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet spec: # (...) preservedFields: annotations: ["my-custom-annotation"] labels: ["my-custom-label"] ``` The ApplicationSet controller will leave this annotation and label as-is when reconciling, even though it is not defined in the metadata of the ApplicationSet itself. By default, the Argo CD notifications and the Argo CD refresh type annotations are also preserved. > [!NOTE] > One can also set global preserved fields for the controller by passing a comma separated list of annotations and labels to > `ARGOCD\_APPLICATIONSET\_CONTROLLER\_GLOBAL\_PRESERVED\_ANNOTATIONS` and `ARGOCD\_APPLICATIONSET\_CONTROLLER\_GLOBAL\_PRESERVED\_LABELS` respectively. ## Debugging unexpected changes to Applications When the ApplicationSet controller makes a change to an application, it logs the patch at the debug level. To see these logs, set the log level to debug in the `argocd-cmd-params-cm` ConfigMap in the `argocd` namespace: ```yaml apiVersion: v1 kind: ConfigMap metadata: name: argocd-cmd-params-cm namespace: argocd data: applicationsetcontroller.log.level: debug ``` ## Previewing changes To preview changes that the ApplicationSet controller would make to Applications, you can create the AppSet in dry-run mode. This works whether the AppSet already exists or not. ```shell argocd appset create --dry-run ./appset.yaml -o json | jq -r '.status.resources[].name' ``` The dry-run will populate the returned ApplicationSet's status with the Applications which would be managed with the given config. You can compare to the existing Applications to see what would change. | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/applicationset/Controlling-Resource-Modification.md | master | argo-cd | [
-0.01990622654557228,
0.056314144283533096,
0.01938346028327942,
-0.023572007194161415,
0.04339860379695892,
0.03161955624818802,
0.10828247666358948,
-0.06120413541793823,
0.1327713429927826,
-0.012235350906848907,
-0.020761078223586082,
-0.06231650337576866,
-0.023915143683552742,
-0.022... | 0.164221 |
# Getting Started This guide assumes you are familiar with Argo CD and its basic concepts. See the [Argo CD documentation](../../core\_concepts.md) for more information. ## Requirements \* Installed [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/) command-line tool \* Have a [kubeconfig](https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/) file (default location is `~/.kube/config`). ## Installation There are a few options for installing the ApplicationSet controller. ### A) Install ApplicationSet as part of Argo CD Starting with Argo CD v2.3, the ApplicationSet controller is bundled with Argo CD. It is no longer necessary to install the ApplicationSet controller separately from Argo CD. Follow the [Argo CD Getting Started](../../getting\_started.md) instructions for more information. ### B) Install ApplicationSet into an existing Argo CD install (pre-Argo CD v2.3) \*\*Note\*\*: These instructions only apply to versions of Argo CD before v2.3.0. The ApplicationSet controller \*must\* be installed into the same namespace as the Argo CD it is targeting. Presuming that Argo CD is installed into the `argocd` namespace, run the following command: ```bash kubectl apply -n argocd --server-side --force-conflicts -f https://raw.githubusercontent.com/argoproj/applicationset/v0.4.0/manifests/install.yaml ``` Once installed, the ApplicationSet controller requires no additional setup. The `manifests/install.yaml` file contains the Kubernetes manifests required to install the ApplicationSet controller: - CustomResourceDefinition for `ApplicationSet` resource - Deployment for `argocd-applicationset-controller` - ServiceAccount for use by ApplicationSet controller, to access Argo CD resources - Role granting RBAC access to needed resources, for ServiceAccount - RoleBinding to bind the ServiceAccount and Role ## Enabling high availability mode To enable high availability, you have to set the command ``` --enable-leader-election=true ``` in argocd-applicationset-controller container and increase the replicas. do following changes in manifests/install.yaml ```bash spec: containers: - command: - entrypoint.sh - argocd-applicationset-controller - --enable-leader-election=true ``` ### Optional: Additional Post-Upgrade Safeguards See the [Controlling Resource Modification](Controlling-Resource-Modification.md) page for information on additional parameters you may wish to add to the ApplicationSet Resource in `install.yaml`, to provide extra security against any initial, unexpected post-upgrade behaviour. For instance, to temporarily prevent the upgraded ApplicationSet controller from making any changes, you could: - Enable dry-run - Use a create-only policy - Enable `preserveResourcesOnDeletion` on your ApplicationSets - Temporarily disable automated sync in your ApplicationSets' template These parameters would allow you to observe/control the behaviour of the new version of the ApplicationSet controller in your environment, to ensure you are happy with the result (see the ApplicationSet log file for details). Just don't forget to remove any temporary changes when you are done testing! However, as mentioned above, these steps are not strictly necessary: upgrading the ApplicationSet controller should be a minimally invasive process, and these are only suggested as an optional precaution for extra safety. ## Next Steps Once your ApplicationSet controller is up and running, proceed to [Use Cases](Use-Cases.md) to learn more about the supported scenarios, or proceed directly to [Generators](Generators.md) to see example `ApplicationSet` resources. | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/applicationset/Getting-Started.md | master | argo-cd | [
0.00895517785102129,
-0.058069076389074326,
-0.08675704896450043,
-0.029773376882076263,
-0.053573135286569595,
0.014034758321940899,
0.041864652186632156,
0.049962591379880905,
0.000736743095330894,
0.07098212093114853,
-0.01796884462237358,
-0.060553137212991714,
-0.02646128460764885,
-0... | 0.195383 |
# Go Template ## Introduction ApplicationSet is able to use [Go Text Template](https://pkg.go.dev/text/template). To activate this feature, add `goTemplate: true` to your ApplicationSet manifest. The [Sprig function library](https://masterminds.github.io/sprig/) (except for `env`, `expandenv` and `getHostByName`) is available in addition to the default Go Text Template functions. An additional `normalize` function makes any string parameter usable as a valid DNS name by replacing invalid characters with hyphens and truncating at 253 characters. This is useful when making parameters safe for things like Application names. Another `slugify` function has been added which, by default, sanitizes and smart truncates (it doesn't cut a word into 2). This function accepts a couple of arguments: - The first argument (if provided) is an integer specifying the maximum length of the slug. - The second argument (if provided) is a boolean indicating whether smart truncation is enabled. - The last argument (if provided) is the input name that needs to be slugified. #### Usage example ``` apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: name: test-appset spec: ... template: metadata: name: 'hellos3-{{.name}}-{{ cat .branch | slugify 23 }}' annotations: label-1: '{{ cat .branch | slugify }}' label-2: '{{ cat .branch | slugify 23 }}' label-3: '{{ cat .branch | slugify 50 false }}' ``` If you want to customize [options defined by text/template](https://pkg.go.dev/text/template#Template.Option), you can add the `goTemplateOptions: ["opt1", "opt2", ...]` key to your ApplicationSet next to `goTemplate: true`. Note that at the time of writing, there is only one useful option defined, which is `missingkey=error`. The recommended setting of `goTemplateOptions` is `["missingkey=error"]`, which ensures that if undefined values are looked up by your template then an error is reported instead of being ignored silently. This is not currently the default behavior, for backwards compatibility. ## Motivation Go Template is the Go Standard for string templating. It is also more powerful than fasttemplate (the default templating engine) as it allows doing complex templating logic. ## Limitations Go templates are applied on a per-field basis, and only on string fields. Here are some examples of what is \*\*not\*\* possible with Go text templates: - Templating a boolean field. ::yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet spec: goTemplate: true goTemplateOptions: ["missingkey=error"] template: spec: source: helm: useCredentials: "{{.useCredentials}}" # This field may NOT be templated, because it is a boolean field. - Templating an object field: ::yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet spec: goTemplate: true goTemplateOptions: ["missingkey=error"] template: spec: syncPolicy: "{{.syncPolicy}}" # This field may NOT be templated, because it is an object field. - Using control keywords across fields: ::yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet spec: goTemplate: true goTemplateOptions: ["missingkey=error"] template: spec: source: helm: parameters: # Each of these fields is evaluated as an independent template, so the first one will fail with an error. - name: "{{range .parameters}}" - name: "{{.name}}" value: "{{.value}}" - name: throw-away value: "{{end}}" - Signature verification is not supported for the templated `project` field when using the Git generator. ::yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet spec: goTemplate: true template: spec: project: {{.project}} ## Migration guide ### Globals All your templates must replace parameters with GoTemplate Syntax: Example: `{{ some.value }}` becomes `{{ .some.value }}` ### Cluster Generators By activating Go Templating, `{{ .metadata }}` becomes an object. - `{{ metadata.labels.my-label }}` becomes `{{ index .metadata.labels "my-label" }}` - `{{ metadata.annotations.my/annotation }}` becomes `{{ index .metadata.annotations "my/annotation" }}` ### Git Generators By activating Go Templating, `{{ .path }}` becomes an object. Therefore, some changes must be made to the Git generators' templating: - `{{ path }}` becomes `{{ .path.path }}` - `{{ path.basename }}` becomes `{{ .path.basename }}` - `{{ path.basenameNormalized }}` becomes `{{ .path.basenameNormalized }}` - `{{ path.filename }}` becomes `{{ | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/applicationset/GoTemplate.md | master | argo-cd | [
-0.04207797348499298,
0.0425143837928772,
0.004370590206235647,
-0.09797023236751556,
-0.10904380679130554,
-0.021313628181815147,
0.020383328199386597,
0.09231411665678024,
-0.01001017913222313,
-0.050406888127326965,
0.01549032423645258,
0.0167554784566164,
-0.04098238795995712,
0.041934... | 0.085303 |
activating Go Templating, `{{ .path }}` becomes an object. Therefore, some changes must be made to the Git generators' templating: - `{{ path }}` becomes `{{ .path.path }}` - `{{ path.basename }}` becomes `{{ .path.basename }}` - `{{ path.basenameNormalized }}` becomes `{{ .path.basenameNormalized }}` - `{{ path.filename }}` becomes `{{ .path.filename }}` - `{{ path.filenameNormalized }}` becomes `{{ .path.filenameNormalized }}` - `{{ path[n] }}` becomes `{{ index .path.segments n }}` - `{{ values }}` if being used in the file generator becomes `{{ .values }}` Here is an example: ```yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: name: cluster-addons spec: generators: - git: repoURL: https://github.com/argoproj/argo-cd.git revision: HEAD directories: - path: applicationset/examples/git-generator-directory/cluster-addons/\* template: metadata: name: '{{path.basename}}' spec: project: default source: repoURL: https://github.com/argoproj/argo-cd.git targetRevision: HEAD path: '{{path}}' destination: server: https://kubernetes.default.svc namespace: '{{path.basename}}' ``` becomes ```yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: name: cluster-addons spec: goTemplate: true goTemplateOptions: ["missingkey=error"] generators: - git: repoURL: https://github.com/argoproj/argo-cd.git revision: HEAD directories: - path: applicationset/examples/git-generator-directory/cluster-addons/\* template: metadata: name: '{{.path.basename}}' spec: project: default source: repoURL: https://github.com/argoproj/argo-cd.git targetRevision: HEAD path: '{{.path.path}}' destination: server: https://kubernetes.default.svc namespace: '{{.path.basename}}' ``` It is also possible to use Sprig functions to construct the path variables manually: | with `goTemplate: false` | with `goTemplate: true` | with `goTemplate: true` + Sprig | | ------------ | ----------- | --------------------- | | `{{path}}` | `{{.path.path}}` | `{{.path.path}}` | | `{{path.basename}}` | `{{.path.basename}}` | `{{base .path.path}}` | | `{{path.filename}}` | `{{.path.filename}}` | `{{.path.filename}}` | | `{{path.basenameNormalized}}` | `{{.path.basenameNormalized}}` | `{{normalize .path.path}}` | | `{{path.filenameNormalized}}` | `{{.path.filenameNormalized}}` | `{{normalize .path.filename}}` | | `{{path[N]}}` | `-` | `{{index .path.segments N}}` | ## Available template functions ApplicationSet controller provides: - all [sprig](http://masterminds.github.io/sprig/) Go templates function except `env`, `expandenv` and `getHostByName` - `normalize`: sanitizes the input so that it complies with the following rules: 1. contains no more than 253 characters 2. contains only lowercase alphanumeric characters, '-' or '.' 3. starts and ends with an alphanumeric character - `slugify`: sanitizes like `normalize` and smart truncates (it doesn't cut a word into 2) like described in the [introduction](#introduction) section. - `toYaml` / `fromYaml` / `fromYamlArray` helm like functions ## Examples ### Basic Go template usage This example shows basic string parameter substitution. ```yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: name: guestbook spec: goTemplate: true goTemplateOptions: ["missingkey=error"] generators: - list: elements: - cluster: engineering-dev url: https://1.2.3.4 - cluster: engineering-prod url: https://2.4.6.8 - cluster: finance-preprod url: https://9.8.7.6 template: metadata: name: '{{.cluster}}-guestbook' spec: project: my-project source: repoURL: https://github.com/infra-team/cluster-deployments.git targetRevision: HEAD path: guestbook/{{.cluster}} destination: server: '{{.url}}' namespace: guestbook ``` ### Fallbacks for unset parameters For some generators, a parameter of a certain name might not always be populated (for example, with the values generator or the git files generator). In these cases, you can use a Go template to provide a fallback value. ```yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: name: guestbook spec: goTemplate: true goTemplateOptions: ["missingkey=error"] generators: - list: elements: - cluster: engineering-dev url: https://kubernetes.default.svc - cluster: engineering-prod url: https://kubernetes.default.svc nameSuffix: -my-name-suffix template: metadata: name: '{{.cluster}}{{dig "nameSuffix" "" .}}' spec: project: default source: repoURL: https://github.com/argoproj/argo-cd.git targetRevision: HEAD path: applicationset/examples/list-generator/guestbook/{{.cluster}} destination: server: '{{.url}}' namespace: guestbook ``` This ApplicationSet will produce an Application called `engineering-dev` and another called `engineering-prod-my-name-suffix`. Note that unset parameters are an error, so you need to avoid looking up a property that doesn't exist. Instead, use template functions like `dig` to do the lookup with a default. If you prefer to have unset parameters default to zero, you can remove `goTemplateOptions: ["missingkey=error"]` or set it to `goTemplateOptions: ["missingkey=invalid"]` | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/applicationset/GoTemplate.md | master | argo-cd | [
-0.02180703729391098,
0.061693381518125534,
-0.010746295563876629,
0.06425829976797104,
-0.021158650517463684,
-0.040336497128009796,
0.02721276320517063,
0.029062649235129356,
0.03369220346212387,
0.003995520528405905,
0.022715887054800987,
-0.014341422356665134,
-0.05819064378738403,
0.0... | 0.075656 |
prefer to have unset parameters default to zero, you can remove `goTemplateOptions: ["missingkey=error"]` or set it to `goTemplateOptions: ["missingkey=invalid"]` | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/applicationset/GoTemplate.md | master | argo-cd | [
-0.011184650473296642,
0.04816160351037979,
-0.025213677436113358,
0.0514867939054966,
-0.05730829015374184,
0.05586826801300049,
-0.01742987148463726,
0.021814486011862755,
0.0005378185887821019,
0.006246526259928942,
0.07451359182596207,
-0.10324858874082565,
0.02378726564347744,
-0.0602... | -0.097431 |
# Merge Generator The Merge generator combines parameters produced by the base (first) generator with matching parameter sets produced by subsequent generators. A \_matching\_ parameter set has the same values for the configured \_merge keys\_. \_Non-matching\_ parameter sets are discarded. Override precedence is bottom-to-top: the values from a matching parameter set produced by generator 3 will take precedence over the values from the corresponding parameter set produced by generator 2. Using a Merge generator is appropriate when a subset of parameter sets require overriding. ## Example: Base Cluster generator + override Cluster generator + List generator As an example, imagine that we have two clusters: - A `staging` cluster (at `https://1.2.3.4`) - A `production` cluster (at `https://2.4.6.8`) ```yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: name: cluster-git spec: goTemplate: true goTemplateOptions: ["missingkey=error"] generators: # merge 'parent' generator - merge: mergeKeys: - server generators: - clusters: values: kafka: 'true' redis: 'false' # For clusters with a specific label, enable Kafka. - clusters: selector: matchLabels: use-kafka: 'false' values: kafka: 'false' # For a specific cluster, enable Redis. - list: elements: - server: https://2.4.6.8 values.redis: 'true' template: metadata: name: '{{.name}}' spec: project: '{{index .metadata.labels "environment"}}' source: repoURL: https://github.com/argoproj/argo-cd.git targetRevision: HEAD path: app helm: parameters: - name: kafka value: '{{.values.kafka}}' - name: redis value: '{{.values.redis}}' destination: server: '{{.server}}' namespace: default ``` The base Cluster generator scans the [set of clusters defined in Argo CD](Generators-Cluster.md), finds the staging and production cluster secrets, and produces two corresponding sets of parameters: ```yaml - name: staging server: https://1.2.3.4 values.kafka: 'true' values.redis: 'false' - name: production server: https://2.4.6.8 values.kafka: 'true' values.redis: 'false' ``` The override Cluster generator scans the [set of clusters defined in Argo CD](Generators-Cluster.md), finds the staging cluster secret (which has the required label), and produces the following parameters: ```yaml - name: staging server: https://1.2.3.4 values.kafka: 'false' ``` When merged with the base generator's parameters, the `values.kafka` value for the staging cluster is set to `'false'`. ```yaml - name: staging server: https://1.2.3.4 values.kafka: 'false' values.redis: 'false' - name: production server: https://2.4.6.8 values.kafka: 'true' values.redis: 'false' ``` Finally, the List cluster generates a single set of parameters: ```yaml - server: https://2.4.6.8 values.redis: 'true' ``` When merged with the updated base parameters, the `values.redis` value for the production cluster is set to `'true'`. This is the merge generator's final output: ```yaml - name: staging server: https://1.2.3.4 values.kafka: 'false' values.redis: 'false' - name: production server: https://2.4.6.8 values.kafka: 'true' values.redis: 'true' ``` ## Example: Use value interpolation in merge Some generators support additional values and interpolating from generated variables to selected values. This can be used to teach the merge generator which generated variables to use to combine different generators. The following example combines discovered clusters and a git repository by cluster labels and the branch name: ```yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: name: cluster-git spec: goTemplate: true goTemplateOptions: ["missingkey=error"] generators: # merge 'parent' generator: # Use the selector set by both child generators to combine them. - merge: mergeKeys: # Note that this would not work with goTemplate enabled, # nested merge keys are not supported there. - values.selector generators: # Assuming, all configured clusters have a label for their location: # Set the selector to this location. - clusters: values: selector: '{{index .metadata.labels "location"}}' # The git repo may have different directories which correspond to the # cluster locations, using these as a selector. - git: repoURL: https://github.com/argoproj/argocd-example-apps/ revision: HEAD directories: - path: '\*' values: selector: '{{.path.path}}' template: metadata: name: '{{.name}}' spec: project: '{{index .metadata.labels "environment"}}' source: repoURL: https://github.com/argoproj/argocd-example-apps/ # The cluster values field for each generator will be substituted here: targetRevision: HEAD path: '{{.path.path}}' destination: server: '{{.server}}' namespace: default ``` | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/applicationset/Generators-Merge.md | master | argo-cd | [
-0.07424617558717728,
-0.008829346857964993,
-0.010278210043907166,
-0.0007766195340082049,
-0.011937079951167107,
-0.045442551374435425,
0.007571419235318899,
-0.03257044777274132,
-0.05191927030682564,
-0.009209469892084599,
0.04154656454920769,
-0.060527123510837555,
0.03652486577630043,
... | 0.070514 |
as a selector. - git: repoURL: https://github.com/argoproj/argocd-example-apps/ revision: HEAD directories: - path: '\*' values: selector: '{{.path.path}}' template: metadata: name: '{{.name}}' spec: project: '{{index .metadata.labels "environment"}}' source: repoURL: https://github.com/argoproj/argocd-example-apps/ # The cluster values field for each generator will be substituted here: targetRevision: HEAD path: '{{.path.path}}' destination: server: '{{.server}}' namespace: default ``` Assuming a cluster named `germany01` with the label `metadata.labels.location=Germany` and a git repository containing a directory called `Germany`, this could combine to values as follows: ```yaml # From the cluster generator - name: germany01 server: https://1.2.3.4 # From the git generator path: Germany # Combining selector with the merge generator values.selector: 'Germany' # More values from cluster & git generator # [β¦] ``` ## Restrictions 1. You should specify only a single generator per array entry. This is not valid: - merge: generators: - list: # (...) git: # (...) - While this \*will\* be accepted by Kubernetes API validation, the controller will report an error on generation. Each generator should be specified in a separate array element, as in the examples above. 1. The Merge generator does not support [`template` overrides](Template.md#generator-templates) specified on child generators. This `template` will not be processed: - merge: generators: - list: elements: - # (...) template: { } # Not processed 1. Combination-type generators (Matrix or Merge) can only be nested once. For example, this will not work: - merge: generators: - merge: generators: - merge: # This third level is invalid. generators: - list: elements: - # (...) 1. Merging on nested values while using `goTemplate: true` is currently not supported, this will not work spec: goTemplate: true generators: - merge: mergeKeys: - values.merge | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/applicationset/Generators-Merge.md | master | argo-cd | [
-0.0016753224190324545,
0.03907504305243492,
-0.045679427683353424,
0.07621932774782181,
0.020689059048891068,
-0.0038728131912648678,
0.09429174661636353,
-0.025983095169067383,
0.030233580619096756,
0.01079554669559002,
0.022167647257447243,
-0.06804629415273666,
-0.004620684310793877,
-... | 0.102228 |
# Matrix Generator The Matrix generator combines the parameters generated by two child generators, iterating through every combination of each generator's generated parameters. By combining both generators parameters, to produce every possible combination, this allows you to gain the intrinsic properties of both generators. For example, a small subset of the many possible use cases include: - \*SCM Provider Generator + Cluster Generator\*: Scanning the repositories of a GitHub organization for application resources, and targeting those resources to all available clusters. - \*Git File Generator + List Generator\*: Providing a list of applications to deploy via configuration files, with optional configuration options, and deploying them to a fixed list of clusters. - \*Git Directory Generator + Cluster Decision Resource Generator\*: Locate application resources contained within folders of a Git repository, and deploy them to a list of clusters provided via an external custom resource. - And so on... Any set of generators may be used, with the combined values of those generators inserted into the `template` parameters, as usual. \*\*Note\*\*: If both child generators are Git generators, one or both of them must use the `pathParamPrefix` option to avoid conflicts when merging the child generatorsβ items. ## Example: Git Directory generator + Cluster generator As an example, imagine that we have two clusters: - A `staging` cluster (at `https://1.2.3.4`) - A `production` cluster (at `https://2.4.6.8`) And our application YAMLs are defined in a Git repository: - [Argo Workflows controller](https://github.com/argoproj/argo-cd/tree/master/applicationset/examples/git-generator-directory/cluster-addons/argo-workflows) - [Prometheus operator](https://github.com/argoproj/argo-cd/tree/master/applicationset/examples/git-generator-directory/cluster-addons/prometheus-operator) Our goal is to deploy both applications onto both clusters, and, more generally, in the future to automatically deploy new applications in the Git repository, and to new clusters defined within Argo CD, as well. For this we will use the Matrix generator, with the Git and the Cluster as child generators: ```yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: name: cluster-git spec: goTemplate: true goTemplateOptions: ["missingkey=error"] generators: # matrix 'parent' generator - matrix: generators: # git generator, 'child' #1 - git: repoURL: https://github.com/argoproj/argo-cd.git revision: HEAD directories: - path: applicationset/examples/matrix/cluster-addons/\* # cluster generator, 'child' #2 - clusters: selector: matchLabels: argocd.argoproj.io/secret-type: cluster template: metadata: name: '{{.path.basename}}-{{.name}}' spec: project: '{{index .metadata.labels "environment"}}' source: repoURL: https://github.com/argoproj/argo-cd.git targetRevision: HEAD path: '{{.path.path}}' destination: server: '{{.server}}' namespace: '{{.path.basename}}' ``` First, the Git directory generator will scan the Git repository, discovering directories under the specified path. It discovers the argo-workflows and prometheus-operator applications, and produces two corresponding sets of parameters: ```yaml - path: /examples/git-generator-directory/cluster-addons/argo-workflows path.basename: argo-workflows - path: /examples/git-generator-directory/cluster-addons/prometheus-operator path.basename: prometheus-operator ``` Next, the Cluster generator scans the [set of clusters defined in Argo CD](Generators-Cluster.md), finds the staging and production cluster secrets, and produce two corresponding sets of parameters: ```yaml - name: staging server: https://1.2.3.4 - name: production server: https://2.4.6.8 ``` Finally, the Matrix generator will combine both sets of outputs, and produce: ```yaml - name: staging server: https://1.2.3.4 path: /examples/git-generator-directory/cluster-addons/argo-workflows path.basename: argo-workflows - name: staging server: https://1.2.3.4 path: /examples/git-generator-directory/cluster-addons/prometheus-operator path.basename: prometheus-operator - name: production server: https://2.4.6.8 path: /examples/git-generator-directory/cluster-addons/argo-workflows path.basename: argo-workflows - name: production server: https://2.4.6.8 path: /examples/git-generator-directory/cluster-addons/prometheus-operator path.basename: prometheus-operator ``` (\*The full example can be found [here](https://github.com/argoproj/argo-cd/tree/master/applicationset/examples/matrix).\*) ## Using Parameters from one child generator in another child generator The Matrix generator allows using the parameters generated by one child generator inside another child generator. Below is an example that uses a git-files generator in conjunction with a cluster generator. ```yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: name: cluster-git spec: goTemplate: true goTemplateOptions: ["missingkey=error"] generators: # matrix 'parent' generator - matrix: generators: # git generator, 'child' #1 - git: repoURL: https://github.com/argoproj/applicationset.git revision: HEAD files: - path: "examples/git-generator-files-discovery/cluster-config/\*\*/config.json" # cluster generator, 'child' #2 - clusters: selector: matchLabels: argocd.argoproj.io/secret-type: cluster kubernetes.io/environment: '{{.path.basename}}' template: metadata: name: '{{.name}}-guestbook' spec: project: default source: | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/applicationset/Generators-Matrix.md | master | argo-cd | [
-0.049946170300245285,
-0.01890271157026291,
-0.16619662940502167,
0.03854711726307869,
0.03487468138337135,
0.015371005050837994,
-0.005488249938935041,
-0.04987567290663719,
-0.05517726019024849,
-0.0005238630692474544,
0.03183966502547264,
-0.055867522954940796,
0.09953051060438156,
-0.... | 0.158566 |
cluster-git spec: goTemplate: true goTemplateOptions: ["missingkey=error"] generators: # matrix 'parent' generator - matrix: generators: # git generator, 'child' #1 - git: repoURL: https://github.com/argoproj/applicationset.git revision: HEAD files: - path: "examples/git-generator-files-discovery/cluster-config/\*\*/config.json" # cluster generator, 'child' #2 - clusters: selector: matchLabels: argocd.argoproj.io/secret-type: cluster kubernetes.io/environment: '{{.path.basename}}' template: metadata: name: '{{.name}}-guestbook' spec: project: default source: repoURL: https://github.com/argoproj/applicationset.git targetRevision: HEAD path: "examples/git-generator-files-discovery/apps/guestbook" destination: server: '{{.server}}' namespace: guestbook ``` Here is the corresponding folder structure for the git repository used by the git-files generator: ``` βββ apps β βββ guestbook β βββ guestbook-ui-deployment.yaml β βββ guestbook-ui-svc.yaml β βββ kustomization.yaml βββ cluster-config β βββ engineering β βββ dev β β βββ config.json β βββ prod β βββ config.json βββ git-generator-files.yaml ``` In the above example, the `{{.path.basename}}` parameters produced by the git-files generator will resolve to `dev` and `prod`. In the 2nd child generator, the label selector with label `kubernetes.io/environment: {{.path.basename}}` will resolve with the values produced by the first child generator's parameters (`kubernetes.io/environment: prod` and `kubernetes.io/environment: dev`). So in the above example, clusters with the label `kubernetes.io/environment: prod` will have only prod-specific configuration (ie. `prod/config.json`) applied to it, whereas clusters with the label `kubernetes.io/environment: dev` will have only dev-specific configuration (ie. `dev/config.json`) ## Overriding parameters from one child generator in another child generator The Matrix Generator allows parameters with the same name to be defined in multiple child generators. This is useful, for example, to define default values for all stages in one generator and override them with stage-specific values in another generator. The example below generates a Helm-based application using a matrix generator with two git generators: the first provides stage-specific values (one directory per stage) and the second provides global values for all stages. ```yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: name: parameter-override-example spec: generators: - matrix: generators: - git: repoURL: https://github.com/example/values.git revision: HEAD files: - path: "\*\*/stage.values.yaml" - git: repoURL: https://github.com/example/values.git revision: HEAD files: - path: "global.values.yaml" goTemplate: true template: metadata: name: example spec: project: default source: repoURL: https://github.com/example/example-app.git targetRevision: HEAD path: . helm: values: | {{ `{{ . | mustToPrettyJson }}` }} destination: server: in-cluster namespace: default ``` Given the following structure/content of the example/values repository: ``` βββ test β βββ stage.values.yaml β stageName: test β cpuRequest: 100m β debugEnabled: true βββ staging β βββ stage.values.yaml β stageName: staging βββ production β βββ stage.values.yaml β stageName: production β memoryLimit: 512Mi β debugEnabled: false βββ global.values.yaml cpuRequest: 200m memoryLimit: 256Mi debugEnabled: true ``` The matrix generator above would yield the following results: ```yaml - stageName: test cpuRequest: 100m memoryLimit: 256Mi debugEnabled: true - stageName: staging cpuRequest: 200m memoryLimit: 256Mi debugEnabled: true - stageName: production cpuRequest: 200m memoryLimit: 512Mi debugEnabled: false ``` ## Example: Two Git Generators Using `pathParamPrefix` The matrix generator will fail if its children produce results containing identical keys with differing values. This poses a problem for matrix generators where both children are Git generators since they auto-populate `path`-related parameters in their outputs. To avoid this problem, specify a `pathParamPrefix` on one or both of the child generators to avoid conflicting parameter keys in the output. ```yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: name: two-gits-with-path-param-prefix spec: goTemplate: true goTemplateOptions: ["missingkey=error"] generators: - matrix: generators: # git file generator referencing files containing details about each # app to be deployed (e.g., `appName`). - git: repoURL: https://github.com/some-org/some-repo.git revision: HEAD files: - path: "apps/\*.json" pathParamPrefix: app # git file generator referencing files containing details about # locations to which each app should deploy (e.g., `region` and # `clusterName`). - git: repoURL: https://github.com/some-org/some-repo.git revision: HEAD files: - path: "targets/{{.appName}}/\*.json" pathParamPrefix: target template: {} # ... ``` Then, given the following file structure/content: ``` βββ apps β βββ app-one.json | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/applicationset/Generators-Matrix.md | master | argo-cd | [
0.01229919958859682,
0.017793672159314156,
-0.10579270124435425,
0.053832363337278366,
0.037770334631204605,
0.03243933245539665,
-0.0029387108515948057,
-0.03952426835894585,
0.03602694347500801,
0.060347072780132294,
0.05584624409675598,
-0.10014869272708893,
-0.013198081403970718,
-0.07... | 0.096928 |
git file generator referencing files containing details about # locations to which each app should deploy (e.g., `region` and # `clusterName`). - git: repoURL: https://github.com/some-org/some-repo.git revision: HEAD files: - path: "targets/{{.appName}}/\*.json" pathParamPrefix: target template: {} # ... ``` Then, given the following file structure/content: ``` βββ apps β βββ app-one.json β β { "appName": "app-one" } β βββ app-two.json β { "appName": "app-two" } βββ targets βββ app-one β βββ east-cluster-one.json β β { "region": "east", "clusterName": "cluster-one" } β βββ east-cluster-two.json β { "region": "east", "clusterName": "cluster-two" } βββ app-two βββ east-cluster-one.json β { "region": "east", "clusterName": "cluster-one" } βββ west-cluster-three.json { "region": "west", "clusterName": "cluster-three" } ``` β¦the matrix generator above would yield the following results: ```yaml - appName: app-one app.path: /apps app.path.filename: app-one.json # plus additional path-related parameters from the first child generator, all # prefixed with "app". region: east clusterName: cluster-one target.path: /targets/app-one target.path.filename: east-cluster-one.json # plus additional path-related parameters from the second child generator, all # prefixed with "target". - appName: app-one app.path: /apps app.path.filename: app-one.json region: east clusterName: cluster-two target.path: /targets/app-one target.path.filename: east-cluster-two.json - appName: app-two app.path: /apps app.path.filename: app-two.json region: east clusterName: cluster-one target.path: /targets/app-two target.path.filename: east-cluster-one.json - appName: app-two app.path: /apps app.path.filename: app-two.json region: west clusterName: cluster-three target.path: /targets/app-two target.path.filename: west-cluster-three.json ``` ## Restrictions 1. The Matrix generator currently only supports combining the outputs of only two child generators (eg does not support generating combinations for 3 or more). 1. You should specify only a single generator per array entry, eg this is not valid: - matrix: generators: - list: # (...) git: # (...) - While this \*will\* be accepted by Kubernetes API validation, the controller will report an error on generation. Each generator should be specified in a separate array element, as in the examples above. 1. The Matrix generator does not currently support [`template` overrides](Template.md#generator-templates) specified on child generators, eg this `template` will not be processed: - matrix: generators: - list: elements: - # (...) template: { } # Not processed 1. Combination-type generators (matrix or merge) can only be nested once. For example, this will not work: - matrix: generators: - matrix: generators: - matrix: # This third level is invalid. generators: - list: elements: - # (...) 1. When using parameters from one child generator inside another child generator, the child generator that \*consumes\* the parameters \*\*must come after\*\* the child generator that \*produces\* the parameters. For example, the below example would be invalid (cluster-generator must come after the git-files generator): - matrix: generators: # cluster generator, 'child' #1 - clusters: selector: matchLabels: argocd.argoproj.io/secret-type: cluster kubernetes.io/environment: '{{.path.basename}}' # {{.path.basename}} is produced by git-files generator # git generator, 'child' #2 - git: repoURL: https://github.com/argoproj/applicationset.git revision: HEAD files: - path: "examples/git-generator-files-discovery/cluster-config/\*\*/config.json" 1. You cannot have both child generators consuming parameters from each another. In the example below, the cluster generator is consuming the `{{.path.basename}}` parameter produced by the git-files generator, whereas the git-files generator is consuming the `{{.name}}` parameter produced by the cluster generator. This will result in a circular dependency, which is invalid. - matrix: generators: # cluster generator, 'child' #1 - clusters: selector: matchLabels: argocd.argoproj.io/secret-type: cluster kubernetes.io/environment: '{{.path.basename}}' # {{.path.basename}} is produced by git-files generator # git generator, 'child' #2 - git: repoURL: https://github.com/argoproj/applicationset.git revision: HEAD files: - path: "examples/git-generator-files-discovery/cluster-config/engineering/{{.name}}\*\*/config.json" # {{.name}} is produced by cluster generator | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/applicationset/Generators-Matrix.md | master | argo-cd | [
-0.014299435541033745,
0.027780404314398766,
0.047051411122083664,
0.006991259753704071,
0.040861859917640686,
-0.012205015867948532,
0.01277537364512682,
0.021735182031989098,
0.03564486652612686,
0.0024007910396903753,
0.03336246684193611,
-0.03319151699542999,
0.03988853469491005,
0.014... | 0.032315 |
# Introduction to ApplicationSet controller ## Introduction The ApplicationSet controller is a [Kubernetes controller](https://kubernetes.io/docs/concepts/architecture/controller/) that adds support for an `ApplicationSet` [CustomResourceDefinition](https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/) (CRD). This controller/CRD enables both automation and greater flexibility managing [Argo CD](../../index.md) Applications across a large number of clusters and within monorepos, plus it makes self-service usage possible on multitenant Kubernetes clusters. The ApplicationSet controller works alongside an existing [Argo CD installation](../../index.md). Argo CD is a declarative, GitOps continuous delivery tool, which allows developers to define and control deployment of Kubernetes application resources from within their existing Git workflow. Starting with Argo CD v2.3, the ApplicationSet controller is bundled with Argo CD. The ApplicationSet controller, supplements Argo CD by adding additional features in support of cluster-administrator-focused scenarios. The `ApplicationSet` controller provides: - The ability to use a single Kubernetes manifest to target multiple Kubernetes clusters with Argo CD - The ability to use a single Kubernetes manifest to deploy multiple applications from one or multiple Git repositories with Argo CD - Improved support for monorepos: in the context of Argo CD, a monorepo is multiple Argo CD Application resources defined within a single Git repository - Within multitenant clusters, improves the ability of individual cluster tenants to deploy applications using Argo CD (without needing to involve privileged cluster administrators in enabling the destination clusters/namespaces) > [!NOTE] > Be aware of the [security implications](./Security.md) of ApplicationSets before using them. ## The ApplicationSet resource This example defines a new `guestbook` resource of kind `ApplicationSet`: ```yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: name: guestbook spec: goTemplate: true goTemplateOptions: ["missingkey=error"] generators: - list: elements: - cluster: engineering-dev url: https://1.2.3.4 - cluster: engineering-prod url: https://2.4.6.8 - cluster: finance-preprod url: https://9.8.7.6 template: metadata: name: '{{.cluster}}-guestbook' spec: project: my-project source: repoURL: https://github.com/infra-team/cluster-deployments.git targetRevision: HEAD path: guestbook/{{.cluster}} destination: server: '{{.url}}' namespace: guestbook ``` In this example, we want to deploy our `guestbook` application (with the Kubernetes resources for this application coming from Git, since this is GitOps) to a list of Kubernetes clusters (with the list of target clusters defined in the List items element of the `ApplicationSet` resource). While there are multiple types of \*generators\* that are available to use with the `ApplicationSet` resource, this example uses the List generator, which simply contains a fixed, literal list of clusters to target. This list of clusters will be the clusters upon which Argo CD deploys the `guestbook` application resources, once the ApplicationSet controller has processed the `ApplicationSet` resource. Generators, such as the List generator, are responsible for generating \*parameters\*. Parameters are key-values pairs that are substituted into the `template:` section of the ApplicationSet resource during template rendering. There are multiple generators currently supported by the ApplicationSet controller: - \*\*List generator\*\*: Generates parameters based on a fixed list of cluster name/URL values, as seen in the example above. - \*\*Cluster generator\*\*: Rather than a literal list of clusters (as with the list generator), the cluster generator automatically generates cluster parameters based on the clusters that are defined within Argo CD. - \*\*Git generator\*\*: The Git generator generates parameters based on files or folders that are contained within the Git repository defined within the generator resource. - Files containing JSON values will be parsed and converted into template parameters. - Individual directory paths within the Git repository may be used as parameter values, as well. - \*\*Matrix generator\*\*: The Matrix generators combines the generated parameters of two other generators. See the [generator section](Generators.md) for more information about individual generators, and the other generators not listed above. ## Parameter substitution into templates Independent of which generator is used, parameters generated by a generator are substituted into `{{parameter name}}` values within the | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/applicationset/index.md | master | argo-cd | [
-0.08782792091369629,
-0.03910020366311073,
-0.035192493349313736,
-0.04856622591614723,
-0.046458855271339417,
-0.03092721477150917,
0.07357524335384369,
0.0930878221988678,
0.07679266482591629,
0.10205764323472977,
-0.014926317147910595,
-0.009763897396624088,
-0.008748240768909454,
-0.0... | 0.239562 |
generators combines the generated parameters of two other generators. See the [generator section](Generators.md) for more information about individual generators, and the other generators not listed above. ## Parameter substitution into templates Independent of which generator is used, parameters generated by a generator are substituted into `{{parameter name}}` values within the `template:` section of the `ApplicationSet` resource. In this example, the List generator defines `cluster` and `url` parameters, which are then substituted into the template's `{{cluster}}` and `{{url}}` values, respectively. After substitution, this `guestbook` `ApplicationSet` resource is applied to the Kubernetes cluster: 1. The ApplicationSet controller processes the generator entries, producing a set of template parameters. 2. These parameters are substituted into the template, once for each set of parameters. 3. Each rendered template is converted into an Argo CD `Application` resource, which is then created (or updated) within the Argo CD namespace. 4. Finally, the Argo CD controller is notified of these `Application` resources and is responsible for handling them. With the three different clusters defined in our example -- `engineering-dev`, `engineering-prod`, and `finance-preprod` -- this will produce three new Argo CD `Application` resources: one for each cluster. Here is an example of one of the `Application` resources that would be created, for the `engineering-dev` cluster at `1.2.3.4`: ```yaml apiVersion: argoproj.io/v1alpha1 kind: Application metadata: name: engineering-dev-guestbook spec: source: repoURL: https://github.com/infra-team/cluster-deployments.git targetRevision: HEAD path: guestbook/engineering-dev destination: server: https://1.2.3.4 namespace: guestbook ``` We can see that the generated values have been substituted into the `server` and `path` fields of the template, and the template has been rendered into a fully-fleshed out Argo CD Application. The Applications are now also visible from within the Argo CD UI:  The ApplicationSet controller will ensure that any changes, updates, or deletions made to `ApplicationSet` resources are automatically applied to the corresponding `Application`(s). For instance, if a new cluster/URL list entry was added to the List generator, a new Argo CD `Application` resource would be accordingly created for this new cluster. Any edits made to the `guestbook` `ApplicationSet` resource will affect all the Argo CD Applications that were instantiated by that resource, including the new Application. While the List generator's literal list of clusters is fairly simplistic, much more sophisticated scenarios are supported by the other available generators in the ApplicationSet controller. | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/applicationset/index.md | master | argo-cd | [
-0.042352043092250824,
0.0585491843521595,
-0.05337049812078476,
0.04012784734368324,
0.02428283914923668,
0.026303810998797417,
0.011091574095189571,
-0.05142640322446823,
0.08817195147275925,
-0.008094608783721924,
-0.015138382092118263,
-0.0722975954413414,
0.03822076693177223,
-0.17432... | 0.17684 |
# SCM Provider Generator The SCM Provider generator uses the API of an SCMaaS provider (eg GitHub) to automatically discover repositories within an organization. This fits well with GitOps layout patterns that split microservices across many repositories. ```yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: name: myapps spec: generators: - scmProvider: # Which protocol to clone using. cloneProtocol: ssh # See below for provider specific options. github: # ... ``` \* `cloneProtocol`: Which protocol to use for the SCM URL. Default is provider-specific but ssh if possible. Not all providers necessarily support all protocols, see provider documentation below for available options. > [!NOTE] > Know the security implications of using SCM generators. [Only admins may create ApplicationSets](./Security.md#only-admins-may-createupdatedelete-applicationsets) > to avoid leaking Secrets, and [only admins may create repos/branches](./Security.md#templated-project-field) if the > `project` field of an ApplicationSet with an SCM generator is templated, to avoid granting management of > out-of-bounds resources. ## GitHub The GitHub mode uses the GitHub API to scan an organization in either github.com or GitHub Enterprise. ```yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: name: myapps spec: generators: - scmProvider: github: # The GitHub organization to scan. organization: myorg # For GitHub Enterprise: api: https://git.example.com/ # If true, scan every branch of every repository. If false, scan only the default branch. Defaults to false. allBranches: true # Reference to a Secret containing an access token. (optional) tokenRef: secretName: github-token key: token # (optional) use a GitHub App to access the API instead of a PAT. appSecretName: gh-app-repo-creds template: # ... ``` \* `organization`: Required name of the GitHub organization to scan. If you have multiple organizations, use multiple generators. \* `api`: If using GitHub Enterprise, the URL to access it. \* `allBranches`: By default (false) the template will only be evaluated for the default branch of each repo. If this is true, every branch of every repository will be passed to the filters. If using this flag, you likely want to use a `branchMatch` filter. \* `tokenRef`: A `Secret` name and key containing the GitHub access token to use for requests. If not specified, will make anonymous requests which have a lower rate limit and can only see public repositories. \* `appSecretName`: A `Secret` name containing a GitHub App secret in [repo-creds format][repo-creds]. [repo-creds]: ../declarative-setup.md#repository-credentials For label filtering, the repository topics are used. Available clone protocols are `ssh` and `https`. ## Gitlab The GitLab mode uses the GitLab API to scan and organization in either gitlab.com or self-hosted GitLab. ```yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: name: myapps spec: generators: - scmProvider: gitlab: # The base GitLab group to scan. You can either use the group id or the full namespaced path. group: "8675309" # For self-hosted GitLab: api: https://gitlab.example.com/ # If true, scan every branch of every repository. If false, scan only the default branch. Defaults to false. allBranches: true # If true, recurses through subgroups. If false, it searches only in the base group. Defaults to false. includeSubgroups: true # If true and includeSubgroups is also true, include Shared Projects, which is gitlab API default. # If false only search Projects under the same path. Defaults to true. includeSharedProjects: false # filter projects by topic. A single topic is supported by Gitlab API. Defaults to "" (all topics). topic: "my-topic" # Reference to a Secret containing an access token. (optional) tokenRef: secretName: gitlab-token key: token # If true, skips validating the SCM provider's TLS certificate - useful for self-signed certificates. insecure: false # Reference to a ConfigMap containing trusted CA certs - useful for self-signed certificates. (optional) caRef: configMapName: argocd-tls-certs-cm key: gitlab-ca template: # ... ``` \* `group`: Required name | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/applicationset/Generators-SCM-Provider.md | master | argo-cd | [
-0.07101329416036606,
-0.08162882179021835,
-0.1081293523311615,
-0.022728463634848595,
0.025207646191120148,
0.02336820960044861,
-0.020915064960718155,
-0.032138630747795105,
-0.04553208500146866,
0.06311208754777908,
0.025581683963537216,
-0.028547009453177452,
0.04532578960061073,
-0.0... | 0.12694 |
tokenRef: secretName: gitlab-token key: token # If true, skips validating the SCM provider's TLS certificate - useful for self-signed certificates. insecure: false # Reference to a ConfigMap containing trusted CA certs - useful for self-signed certificates. (optional) caRef: configMapName: argocd-tls-certs-cm key: gitlab-ca template: # ... ``` \* `group`: Required name of the base GitLab group to scan. If you have multiple base groups, use multiple generators. \* `api`: If using self-hosted GitLab, the URL to access it. \* `allBranches`: By default (false) the template will only be evaluated for the default branch of each repo. If this is true, every branch of every repository will be passed to the filters. If using this flag, you likely want to use a `branchMatch` filter. \* `includeSubgroups`: By default (false) the controller will only search for repos directly in the base group. If this is true, it will recurse through all the subgroups searching for repos to scan. \* `includeSharedProjects`: If true and includeSubgroups is also true, include Shared Projects, which is gitlab API default. If false only search Projects under the same path. In general most would want the behaviour when set to false. Defaults to true. \* `topic`: filter projects by topic. A single topic is supported by Gitlab API. Defaults to "" (all topics). \* `tokenRef`: A `Secret` name and key containing the GitLab access token to use for requests. If not specified, will make anonymous requests which have a lower rate limit and can only see public repositories. \* `insecure`: By default (false) - Skip checking the validity of the SCM's certificate - useful for self-signed TLS certificates. \* `caRef`: Optional `ConfigMap` name and key containing the GitLab certificates to trust - useful for self-signed TLS certificates. Possibly reference the ArgoCD CM holding the trusted certs. For label filtering, the repository topics are used. Available clone protocols are `ssh` and `https`. ### Self-signed TLS Certificates As a preferable alternative to setting `insecure` to true, you can configure self-signed TLS certificates for Gitlab. In order for a self-signed TLS certificate be used by an ApplicationSet's SCM / PR Gitlab Generator, the certificate needs to be mounted on the applicationset-controller. The path of the mounted certificate must be explicitly set using the environment variable `ARGOCD\_APPLICATIONSET\_CONTROLLER\_SCM\_ROOT\_CA\_PATH` or alternatively using parameter `--scm-root-ca-path`. The applicationset controller will read the mounted certificate to create the Gitlab client for SCM/PR Providers This can be achieved conveniently by setting `applicationsetcontroller.scm.root.ca.path` in the argocd-cmd-params-cm ConfigMap. Be sure to restart the ApplicationSet controller after setting this value. ## Gitea The Gitea mode uses the Gitea API to scan organizations in your instance ```yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: name: myapps spec: generators: - scmProvider: gitea: # The Gitea owner to scan. owner: myorg # The Gitea instance url api: https://gitea.mydomain.com/ # If true, scan every branch of every repository. If false, scan only the default branch. Defaults to false. allBranches: true # Reference to a Secret containing an access token. (optional) tokenRef: secretName: gitea-token key: token template: # ... ``` \* `owner`: Required name of the Gitea organization to scan. If you have multiple organizations, use multiple generators. \* `api`: The URL of the Gitea instance you are using. \* `allBranches`: By default (false) the template will only be evaluated for the default branch of each repo. If this is true, every branch of every repository will be passed to the filters. If using this flag, you likely want to use a `branchMatch` filter. \* `tokenRef`: A `Secret` name and key containing the Gitea access token to use for requests. If not specified, will make anonymous requests which have | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/applicationset/Generators-SCM-Provider.md | master | argo-cd | [
-0.05504852905869484,
-0.009207374416291714,
-0.08820825070142746,
0.041514378041028976,
0.020814353600144386,
-0.07977098226547241,
0.033784836530685425,
-0.042339716106653214,
0.013209122233092785,
0.001527245156466961,
0.027082160115242004,
-0.07882991433143616,
0.12264811992645264,
-0.... | 0.020484 |
is true, every branch of every repository will be passed to the filters. If using this flag, you likely want to use a `branchMatch` filter. \* `tokenRef`: A `Secret` name and key containing the Gitea access token to use for requests. If not specified, will make anonymous requests which have a lower rate limit and can only see public repositories. \* `insecure`: Allow for self-signed TLS certificates. This SCM provider does not yet support label filtering Available clone protocols are `ssh` and `https`. ## Bitbucket Server Use the Bitbucket Server API (1.0) to scan repos in a project. Note that Bitbucket Server is not to same as Bitbucket Cloud (API 2.0) ```yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: name: myapps spec: generators: - scmProvider: bitbucketServer: project: myproject # URL of the Bitbucket Server. Required. api: https://mycompany.bitbucket.org # If true, scan every branch of every repository. If false, scan only the default branch. Defaults to false. allBranches: true # Credentials for Basic authentication (App Password). Either basicAuth or bearerToken # authentication is required to access private repositories basicAuth: # The username to authenticate with username: myuser # Reference to a Secret containing the password or personal access token. passwordRef: secretName: mypassword key: password # Credentials for Bearer Token (App Token) authentication. Either basicAuth or bearerToken # authentication is required to access private repositories bearerToken: # Reference to a Secret containing the bearer token. tokenRef: secretName: repotoken key: token # If true, skips validating the SCM provider's TLS certificate - useful for self-signed certificates. insecure: true # Reference to a ConfigMap containing trusted CA certs - useful for self-signed certificates. (optional) caRef: configMapName: argocd-tls-certs-cm key: bitbucket-ca # Support for filtering by labels is TODO. Bitbucket server labels are not supported for PRs, but they are for repos template: # ... ``` \* `project`: Required name of the Bitbucket project \* `api`: Required URL to access the Bitbucket REST api. \* `allBranches`: By default (false) the template will only be evaluated for the default branch of each repo. If this is true, every branch of every repository will be passed to the filters. If using this flag, you likely want to use a `branchMatch` filter. If you want to access a private repository, you must also provide the credentials for Basic auth (this is the only auth supported currently): \* `username`: The username to authenticate with. It only needs read access to the relevant repo. \* `passwordRef`: A `Secret` name and key containing the password or personal access token to use for requests. In case of Bitbucket App Token, go with `bearerToken` section. \* `tokenRef`: A `Secret` name and key containing the app token to use for requests. In case of self-signed BitBucket Server certificates, the following options can be useful: \* `insecure`: By default (false) - Skip checking the validity of the SCM's certificate - useful for self-signed TLS certificates. \* `caRef`: Optional `ConfigMap` name and key containing the BitBucket server certificates to trust - useful for self-signed TLS certificates. Possibly reference the ArgoCD CM holding the trusted certs. Available clone protocols are `ssh` and `https`. ## Azure DevOps Uses the Azure DevOps API to look up eligible repositories based on a team project within an Azure DevOps organization. The default Azure DevOps URL is `https://dev.azure.com`, but this can be overridden with the field `azureDevOps.api`. ```yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: name: myapps spec: generators: - scmProvider: azureDevOps: # The Azure DevOps organization. organization: myorg # URL to Azure DevOps. Optional. Defaults to https://dev.azure.com. api: https://dev.azure.com # If true, scan every branch of eligible repositories. If false, check only the default branch of | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/applicationset/Generators-SCM-Provider.md | master | argo-cd | [
-0.03432527184486389,
-0.033484671264886856,
-0.07520025223493576,
0.0045767235569655895,
0.03045867383480072,
-0.026861360296607018,
0.07042977213859558,
-0.05301988124847412,
0.02363140881061554,
0.02770264260470867,
-0.008060420863330364,
-0.024043794721364975,
0.0785912573337555,
0.000... | 0.017062 |
field `azureDevOps.api`. ```yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: name: myapps spec: generators: - scmProvider: azureDevOps: # The Azure DevOps organization. organization: myorg # URL to Azure DevOps. Optional. Defaults to https://dev.azure.com. api: https://dev.azure.com # If true, scan every branch of eligible repositories. If false, check only the default branch of the eligible repositories. Defaults to false. allBranches: true # The team project within the specified Azure DevOps organization. teamProject: myProject # Reference to a Secret containing the Azure DevOps Personal Access Token (PAT) used for accessing Azure DevOps. accessTokenRef: secretName: azure-devops-scm key: accesstoken template: # ... ``` \* `organization`: Required. Name of the Azure DevOps organization. \* `teamProject`: Required. The name of the team project within the specified `organization`. \* `accessTokenRef`: Required. A `Secret` name and key containing the Azure DevOps Personal Access Token (PAT) to use for requests. \* `api`: Optional. URL to Azure DevOps. If not set, `https://dev.azure.com` is used. \* `allBranches`: Optional, default `false`. If `true`, scans every branch of eligible repositories. If `false`, check only the default branch of the eligible repositories. ## Bitbucket Cloud The Bitbucket mode uses the Bitbucket API V2 to scan a workspace in bitbucket.org. ```yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: name: myapps spec: generators: - scmProvider: bitbucket: # The workspace id (slug). owner: "example-owner" # The user to use for basic authentication with an app password. user: "example-user" # If true, scan every branch of every repository. If false, scan only the main branch. Defaults to false. allBranches: true # Reference to a Secret containing an app password. appPasswordRef: secretName: appPassword key: password template: # ... ``` \* `owner`: The workspace ID (slug) to use when looking up repositories. \* `user`: The user to use for authentication to the Bitbucket API V2 at bitbucket.org. \* `allBranches`: By default (false) the template will only be evaluated for the main branch of each repo. If this is true, every branch of every repository will be passed to the filters. If using this flag, you likely want to use a `branchMatch` filter. \* `appPasswordRef`: A `Secret` name and key containing the bitbucket app password to use for requests. This SCM provider does not yet support label filtering Available clone protocols are `ssh` and `https`. ## AWS CodeCommit (Alpha) Uses AWS ResourceGroupsTagging and AWS CodeCommit APIs to scan repos across AWS accounts and regions. ```yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: name: myapps spec: generators: - scmProvider: awsCodeCommit: # AWS region to scan repos. # default to the environmental region from ApplicationSet controller. region: us-east-1 # AWS role to assume to scan repos. # default to the environmental role from ApplicationSet controller. role: arn:aws:iam::111111111111:role/argocd-application-set-discovery # If true, scan every branch of every repository. If false, scan only the main branch. Defaults to false. allBranches: true # AWS resource tags to filter repos with. # see https://docs.aws.amazon.com/resourcegroupstagging/latest/APIReference/API\_GetResources.html#resourcegrouptagging-GetResources-request-TagFilters for details # default to no tagFilters, to include all repos in the region. tagFilters: - key: organization value: platform-engineering - key: argo-ready template: # ... ``` \* `region`: (Optional) AWS region to scan repos. By default, use ApplicationSet controller's current region. \* `role`: (Optional) AWS role to assume to scan repos. By default, use ApplicationSet controller's current role. \* `allBranches`: (Optional) If `true`, scans every branch of eligible repositories. If `false`, check only the default branch of the eligible repositories. Default `false`. \* `tagFilters`: (Optional) A list of tagFilters to filter AWS CodeCommit repos with. See [AWS ResourceGroupsTagging API](https://docs.aws.amazon.com/resourcegroupstagging/latest/APIReference/API\_GetResources.html#resourcegrouptagging-GetResources-request-TagFilters) for details. By default, no filter is included. This SCM provider does not support the following features \* label filtering \* `sha`, `short\_sha` and `short\_sha\_7` template parameters Available clone protocols | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/applicationset/Generators-SCM-Provider.md | master | argo-cd | [
0.008596467785537243,
-0.02190914750099182,
-0.02747703343629837,
0.017512556165456772,
0.07144314050674438,
-0.027336519211530685,
0.006444939412176609,
-0.10879945009946823,
0.05737246945500374,
0.11594521999359131,
0.006765691097825766,
-0.04582521691918373,
-0.002626307774335146,
0.027... | 0.069261 |
repositories. Default `false`. \* `tagFilters`: (Optional) A list of tagFilters to filter AWS CodeCommit repos with. See [AWS ResourceGroupsTagging API](https://docs.aws.amazon.com/resourcegroupstagging/latest/APIReference/API\_GetResources.html#resourcegrouptagging-GetResources-request-TagFilters) for details. By default, no filter is included. This SCM provider does not support the following features \* label filtering \* `sha`, `short\_sha` and `short\_sha\_7` template parameters Available clone protocols are `ssh`, `https` and `https-fips`. ### AWS IAM Permission Considerations In order to call AWS APIs to discover AWS CodeCommit repos, ApplicationSet controller must be configured with valid environmental AWS config, like current AWS region and AWS credentials. AWS config can be provided via all standard options, like Instance Metadata Service (IMDS), config file, environment variables, or IAM roles for service accounts (IRSA). Depending on whether `role` is provided in `awsCodeCommit` property, AWS IAM permission requirement is different. #### Discover AWS CodeCommit Repositories in the same AWS Account as ApplicationSet Controller Without specifying `role`, ApplicationSet controller will use its own AWS identity to scan AWS CodeCommit repos. This is suitable when you have a simple setup that all AWS CodeCommit repos reside in the same AWS account as your Argo CD. As the ApplicationSet controller AWS identity is used directly for repo discovery, it must be granted below AWS permissions. \* `tag:GetResources` \* `codecommit:ListRepositories` \* `codecommit:GetRepository` \* `codecommit:GetFolder` \* `codecommit:ListBranches` #### Discover AWS CodeCommit Repositories across AWS Accounts and Regions By specifying `role`, ApplicationSet controller will first assume the `role`, and use it for repo discovery. This enables more complicated use cases to discover repos from different AWS accounts and regions. The ApplicationSet controller AWS identity should be granted permission to assume target AWS roles. \* `sts:AssumeRole` All AWS roles must have repo discovery related permissions. \* `tag:GetResources` \* `codecommit:ListRepositories` \* `codecommit:GetRepository` \* `codecommit:GetFolder` \* `codecommit:ListBranches` ## Filters Filters allow selecting which repositories to generate for. Each filter can declare one or more conditions, all of which must pass. If multiple filters are present, any can match for a repository to be included. If no filters are specified, all repositories will be processed. ```yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: name: myapps spec: generators: - scmProvider: filters: # Include any repository starting with "myapp" AND including a Kustomize config AND labeled with "deploy-ok" ... - repositoryMatch: ^myapp pathsExist: [kubernetes/kustomization.yaml] labelMatch: deploy-ok # ... OR include any repository starting with "otherapp" AND a Helm folder and doesn't have file disabledrepo.txt. - repositoryMatch: ^otherapp pathsExist: [helm] pathsDoNotExist: [disabledrepo.txt] template: # ... ``` \* `repositoryMatch`: A regexp matched against the repository name. \* `pathsExist`: An array of paths within the repository that must exist. Can be a file or directory. \* `pathsDoNotExist`: An array of paths within the repository that must not exist. Can be a file or directory. \* `labelMatch`: A regexp matched against repository labels. If any label matches, the repository is included. \* `branchMatch`: A regexp matched against branch names. ## Template As with all generators, several parameters are generated for use within the `ApplicationSet` resource template. ```yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: name: myapps spec: goTemplate: true goTemplateOptions: ["missingkey=error"] generators: - scmProvider: # ... template: metadata: name: '{{ .repository }}' spec: source: repoURL: '{{ .url }}' targetRevision: '{{ .branch }}' path: kubernetes/ project: default destination: server: https://kubernetes.default.svc namespace: default ``` \* `organization`: The name of the organization the repository is in. \* `repository`: The name of the repository. \* `repository\_id`: The id of the repository. \* `url`: The clone URL for the repository. \* `branch`: The default branch of the repository. \* `sha`: The Git commit SHA for the branch. \* `short\_sha`: The abbreviated Git commit SHA for the branch (8 chars or the length of the `sha` if it's | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/applicationset/Generators-SCM-Provider.md | master | argo-cd | [
-0.0439787358045578,
0.016188694164156914,
-0.08806402236223221,
-0.02241024747490883,
0.09727643430233002,
0.04226115345954895,
0.04606302082538605,
-0.08888033032417297,
0.01019236259162426,
0.030052248388528824,
0.036495812237262726,
-0.09102533757686615,
0.04652456194162369,
-0.0128159... | 0.05775 |
The id of the repository. \* `url`: The clone URL for the repository. \* `branch`: The default branch of the repository. \* `sha`: The Git commit SHA for the branch. \* `short\_sha`: The abbreviated Git commit SHA for the branch (8 chars or the length of the `sha` if it's shorter). \* `short\_sha\_7`: The abbreviated Git commit SHA for the branch (7 chars or the length of the `sha` if it's shorter). \* `labels`: A comma-separated list of repository labels in case of Gitea, repository topics in case of Gitlab and Github. Not supported by Bitbucket Cloud, Bitbucket Server, or Azure DevOps. \* `branchNormalized`: The value of `branch` normalized to contain only lowercase alphanumeric characters, '-' or '.'. ## Pass additional key-value pairs via `values` field You may pass additional, arbitrary string key-value pairs via the `values` field of any SCM generator. Values added via the `values` field are added as `values.(field)`. In this example, a `name` parameter value is passed. It is interpolated from `organization` and `repository` to generate a different template name. ```yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: name: myapps spec: goTemplate: true goTemplateOptions: ["missingkey=error"] generators: - scmProvider: bitbucketServer: project: myproject api: https://mycompany.bitbucket.org allBranches: true basicAuth: username: myuser passwordRef: secretName: mypassword key: password values: name: "{{.organization}}-{{.repository}}" template: metadata: name: '{{ .values.name }}' spec: source: repoURL: '{{ .url }}' targetRevision: '{{ .branch }}' path: kubernetes/ project: default destination: server: https://kubernetes.default.svc namespace: default ``` > [!NOTE] > The `values.` prefix is always prepended to values provided via `generators.scmProvider.values` field. Ensure you include this prefix in the parameter name within the `template` when using it. In `values` we can also interpolate all fields set by the SCM generator as mentioned above. | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/applicationset/Generators-SCM-Provider.md | master | argo-cd | [
-0.03417230024933815,
-0.036491215229034424,
-0.034208349883556366,
0.020135289058089256,
0.002212745137512684,
0.010626459494233131,
0.03998458385467529,
-0.006440000142902136,
0.09461383521556854,
0.031030138954520226,
0.035333212465047836,
0.031240100041031837,
0.10191450268030167,
-0.0... | 0.077055 |
# Application Pruning & Resource Deletion All `Application` resources created by the ApplicationSet controller (from an ApplicationSet) will contain: - A `.metadata.ownerReferences` reference back to the \*parent\* `ApplicationSet` resource - An Argo CD `resources-finalizer.argocd.argoproj.io` finalizer in `.metadata.finalizers` of the Application if `.syncPolicy.preserveResourcesOnDeletion` is set to false. The end result is that when an ApplicationSet is deleted, the following occurs (in rough order): - The `ApplicationSet` resource itself is deleted - Any `Application` resources that were created from this `ApplicationSet` (as identified by owner reference) will be deleted - Any deployed resources (`Deployments`, `Services`, `ConfigMaps`, etc) on the managed cluster, that were created from that `Application` resource (by Argo CD), will be deleted. - Argo CD is responsible for handling this deletion, via [the deletion finalizer](../../../user-guide/app\_deletion/#about-the-deletion-finalizer). - To preserve deployed resources, set `.syncPolicy.preserveResourcesOnDeletion` to true in the ApplicationSet. Thus the lifecycle of the `ApplicationSet`, the `Application`, and the `Application`'s resources, are equivalent. > [!NOTE] > See also the [controlling resource modification](Controlling-Resource-Modification.md) page for more information about how to prevent deletion or modification of Application resources by the ApplicationSet controller. It \*is\* still possible to delete an `ApplicationSet` resource, while preventing `Application`s (and their deployed resources) from also being deleted, using a non-cascading delete: ``` kubectl delete ApplicationSet (NAME) --cascade=orphan ``` > [!WARNING] > Even if using a non-cascaded delete, the `resources-finalizer.argocd.argoproj.io` is still specified on the `Application`. Thus, when the `Application` is deleted, all of its deployed resources will also be deleted. (The lifecycle of the Application, and its \*child\* objects, are still equivalent.) > > To prevent the deletion of the resources of the Application, such as Services, Deployments, etc, set `.syncPolicy.preserveResourcesOnDeletion` to true in the ApplicationSet. This syncPolicy parameter prevents the finalizer from being added to the Application. | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/applicationset/Application-Deletion.md | master | argo-cd | [
-0.07030303031206131,
0.008428286761045456,
-0.0750289335846901,
-0.0220768004655838,
0.0517067015171051,
-0.07836759090423584,
0.1231057196855545,
-0.06065104901790619,
0.021340589970350266,
0.05316118523478508,
0.0625622421503067,
0.05903259292244911,
0.05385835841298103,
-0.043645780533... | 0.143462 |
# Git File Generator Globbing ## Problem Statement The original and default implementation of the Git file generator does very greedy globbing. This can trigger errors or catch users off-guard. For example, consider the following repository layout: ``` βββ cluster-charts/ βββ cluster1 β βββ mychart/ β β βββ charts/ β β β βββ mysubchart/ β β β βββ values.yaml β β β βββ etcβ¦ β β βββ values.yaml β β βββ etcβ¦ β βββ myotherchart/ β βββ values.yaml β βββ etcβ¦ βββ cluster2 βββ etcβ¦ ``` In `cluster1` we have two charts, one of them with a subchart. Assuming we need the ApplicationSet to template values in the `values.yaml`, then we need to use a Git file generator instead of a directory generator. The value of the `path` key of the Git file generator should be set to: ``` path: cluster-charts/\*/\*/values.yaml ``` However, the default implementation will interpret the above pattern as: ``` path: cluster-charts/\*\*/values.yaml ``` Meaning, for `mychart` in `cluster1`, that it will pick up both the chart's `values.yaml` but also the one from its subchart. This will most likely fail, and even if it didn't it would be wrong. There are multiple other ways this undesirable globbing can fail. For example: ``` path: some-path/\*.yaml ``` This will return all YAML files in any directory at any level under `some-path`, instead of only those directly under it. ## Enabling the New Globbing Since some users may rely on the old behavior it was decided to make the fix optional and not enabled by default. It can be enabled in any of these ways: 1. Pass `--enable-new-git-file-globbing` to the ApplicationSet controller args. 1. Set `ARGOCD\_APPLICATIONSET\_CONTROLLER\_ENABLE\_NEW\_GIT\_FILE\_GLOBBING=true` in the ApplicationSet controller environment variables. 1. Set `applicationsetcontroller.enable.new.git.file.globbing: "true"` in the `argocd-cmd-params-cm` ConfigMap. Note that the default may change in the future. ## Usage The new Git file generator globbing uses the `doublestar` package. You can find it [here](https://github.com/bmatcuk/doublestar). Below is a short excerpt from its documentation. doublestar patterns match files and directories recursively. For example, if you had the following directory structure: ```bash grandparent `-- parent |-- child1 `-- child2 ``` You could find the children with patterns such as: `\*\*/child\*`, `grandparent/\*\*/child?`, `\*\*/parent/\*`, or even just `\*\*` by itself (which will return all files and directories recursively). Bash's globstar is doublestar's inspiration and, as such, works similarly. Note that the doublestar must appear as a path component by itself. A pattern such as `/path\*\*` is invalid and will be treated the same as `/path\*`, but `/path\*/\*\*` should achieve the desired result. Additionally, `/path/\*\*` will match all directories and files under the path directory, but `/path/\*\*/` will only match directories. | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/applicationset/Generators-Git-File-Globbing.md | master | argo-cd | [
-0.013026461005210876,
-0.00566431088373065,
0.002551383338868618,
0.021224623546004295,
0.006658563856035471,
-0.04313261806964874,
0.05278879031538963,
0.08148223906755447,
0.014923878014087677,
-0.034733593463897705,
0.052725210785865784,
-0.029915736988186836,
0.0917566642165184,
-0.00... | 0.061697 |
# Progressive Syncs > [!WARNING] > \*\*Beta Feature (Since v2.6.0)\*\* > This feature is in the [Beta](https://github.com/argoproj/argoproj/blob/main/community/feature-status.md#beta) stage. It is generally considered stable, but there may be unhandled edge cases. This feature allows you to control the order in which the ApplicationSet controller will create or update the Applications owned by an ApplicationSet resource. ## Use Cases The Progressive Syncs feature set is intended to be light and flexible. The feature only interacts with the health of managed Applications. It is not intended to support direct integrations with other Rollout controllers (such as the native ReplicaSet controller or Argo Rollouts). - Progressive Syncs watch for the managed Application resources to become "Healthy" before proceeding to the next stage. - Deployments, DaemonSets, StatefulSets, and [Argo Rollouts](https://argoproj.github.io/argo-rollouts/) are all supported, because the Application enters a "Progressing" state while pods are being rolled out. In fact, any resource with a health check that can report a "Progressing" status is supported. - [Argo CD Resource Hooks](../../user-guide/resource\_hooks.md) are supported. We recommend this approach for users that need advanced functionality when an Argo Rollout cannot be used, such as smoke testing after a DaemonSet change. ## Enabling Progressive Syncs As an experimental feature, progressive syncs must be explicitly enabled, in one of these ways. 1. Pass `--enable-progressive-syncs` to the ApplicationSet controller args. 1. Set `ARGOCD\_APPLICATIONSET\_CONTROLLER\_ENABLE\_PROGRESSIVE\_SYNCS=true` in the ApplicationSet controller environment variables. 1. Set `applicationsetcontroller.enable.progressive.syncs: "true"` in the Argo CD `argocd-cmd-params-cm` ConfigMap. ## Strategies ApplicationSet strategies control both how applications are created (or updated) and deleted. These operations are configured using two separate fields: - \*\*Creation Strategy\*\* (`type` field): Controls application creation and updates - \*\*Deletion Strategy\*\* (`deletionOrder` field): Controls application deletion order ### Creation Strategies The `type` field controls how applications are created and updated. Available values: - \*\*AllAtOnce\*\* (default) - \*\*RollingSync\*\* #### AllAtOnce This default Application update behavior is unchanged from the original ApplicationSet implementation. All Applications managed by the ApplicationSet resource are updated simultaneously when the ApplicationSet is updated. ```yaml spec: strategy: type: AllAtOnce # explicit, but this is the default ``` #### RollingSync This update strategy allows you to group Applications by labels present on the generated Application resources. When the ApplicationSet changes, the changes will be applied to each group of Application resources sequentially. - Application groups are selected using their labels and `matchExpressions`. - All `matchExpressions` must be true for an Application to be selected (multiple expressions match with AND behavior). - The `In` and `NotIn` operators must match at least one value to be considered true (OR behavior). - The `NotIn` operator has priority in the event that both a `NotIn` and `In` operator produce a match. - All Applications in each group must become Healthy before the ApplicationSet controller will proceed to update the next group of Applications. - The number of simultaneous Application updates in a group will not exceed its `maxUpdate` parameter (default is 100%, unbounded). - RollingSync will capture external changes outside the ApplicationSet resource, since it relies on watching the OutOfSync status of the managed Applications. - RollingSync will force all generated Applications to have autosync disabled. Warnings are printed in the applicationset-controller logs for any Application specs with an automated syncPolicy enabled. - Sync operations are triggered the same way as if they were triggered by the UI or CLI (by directly setting the `operation` status field on the Application resource). This means that a RollingSync will respect sync windows just as if a user had clicked the "Sync" button in the Argo UI. - When a sync is triggered, the sync is performed with the same syncPolicy configured for the Application. For example, | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/applicationset/Progressive-Syncs.md | master | argo-cd | [
-0.0545797124505043,
-0.06925569474697113,
-0.08042536675930023,
0.018678933382034302,
-0.006985804066061974,
-0.02072938345372677,
0.02596275508403778,
-0.054675012826919556,
-0.06798440217971802,
0.08827226608991623,
0.005633339285850525,
0.12450262904167175,
-0.012644506059587002,
-0.04... | 0.150398 |
`operation` status field on the Application resource). This means that a RollingSync will respect sync windows just as if a user had clicked the "Sync" button in the Argo UI. - When a sync is triggered, the sync is performed with the same syncPolicy configured for the Application. For example, this preserves the Application's retry settings. - If an Application is not selected in any step, it will be excluded from the rolling sync and needs to be manually synced through the CLI or UI. ```yaml spec: strategy: type: RollingSync rollingSync: steps: - matchExpressions: - key: envLabel operator: In values: - env-dev - matchExpressions: - key: envLabel operator: In values: - env-prod maxUpdate: 10% ``` In the above example, the sync will be performed in two steps: 1. All Applications with the label `envLabel=env-dev` will be selected to sync first. Since `maxUpdate` is not defined, a default of 100% applies and all matched Applications will be synced simultaneously. The controller waits until every selected Application reaches a `Healthy` status before proceeding to the next step. 2. Next, Applications with the label `envLabel=env-prod` will be selected to sync. Here, only 10% of the matched Applications will be synced at a time. Once each batch of Applications reaches a `Healthy` status, the next batch is synced until all matched If there are any applications that don't match the listed expressions, they will not be synced by the RollingSync strategy and must be manually synced as describe above. ### Deletion Strategies The `deletionOrder` field controls the order in which applications are deleted when they are removed from the ApplicationSet. Available values: - \*\*AllAtOnce\*\* (default) - \*\*Reverse\*\* #### AllAtOnce Deletion This is the default behavior where all applications that need to be deleted are removed simultaneously. This works with both `AllAtOnce` and `RollingSync` creation strategies. ```yaml spec: strategy: type: RollingSync # or AllAtOnce deletionOrder: AllAtOnce # explicit, but this is the default ``` #### Reverse Deletion When using `deletionOrder: Reverse` with RollingSync strategy, applications are deleted in reverse order of the steps defined in `rollingSync.steps`. This ensures that applications deployed in later steps are deleted before applications deployed in earlier steps. This strategy is particularly useful when you need to tear down dependent services in the particular sequence. \*\*Requirements for Reverse deletion:\*\* - Must be used with `type: RollingSync` - Requires `rollingSync.steps` to be defined - Applications are deleted in reverse order of step sequence \*\*Important:\*\* The ApplicationSet finalizer is not removed until all applications are successfully deleted. This ensures proper cleanup and prevents the ApplicationSet from being removed before its managed applications. \*\*Note:\*\* ApplicationSet controller ensures there is a finalizer when `deletionOrder` is set as `Reverse` with progressive sync enabled. This means that if the applicationset is missing the required finalizer, the applicationset controller adds the finalizer to ApplicationSet before generating applications. ```yaml spec: strategy: type: RollingSync deletionOrder: Reverse rollingSync: steps: - matchExpressions: - key: envLabel operator: In values: - env-dev # Step 1: Created first, deleted last - matchExpressions: - key: envLabel operator: In values: - env-prod # Step 2: Created second, deleted first ``` In this example, when applications are deleted: 1. `env-prod` applications (Step 2) are deleted first 2. `env-dev` applications (Step 1) are deleted second This deletion order is useful for scenarios where you need to tear down dependent services in the correct sequence, such as deleting frontend services before backend dependencies. ### Example The following example illustrates how to stage a progressive sync over Applications with explicitly configured environment labels. Once a change is pushed, the following will happen in order. - All `env-dev` Applications will be updated | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/applicationset/Progressive-Syncs.md | master | argo-cd | [
-0.10612506419420242,
-0.022018147632479668,
-0.12214162945747375,
-0.017848776653409004,
-0.04052523151040077,
-0.05470653250813484,
0.009213726036250591,
-0.06431092321872711,
-0.0020825155079364777,
0.03954028710722923,
0.04067547619342804,
0.07682056725025177,
-0.007221602369099855,
-0... | 0.124286 |
services in the correct sequence, such as deleting frontend services before backend dependencies. ### Example The following example illustrates how to stage a progressive sync over Applications with explicitly configured environment labels. Once a change is pushed, the following will happen in order. - All `env-dev` Applications will be updated simultaneously. - The rollout will wait for all `env-qa` Applications to be manually synced via the `argocd` CLI or by clicking the Sync button in the UI. - 10% of all `env-prod` Applications will be updated at a time until all `env-prod` Applications have been updated. ```yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: name: guestbook spec: generators: - list: elements: - cluster: engineering-dev url: https://1.2.3.4 env: env-dev - cluster: engineering-qa url: https://2.4.6.8 env: env-qa - cluster: engineering-prod url: https://9.8.7.6/ env: env-prod strategy: type: RollingSync deletionOrder: Reverse # Applications will be deleted in reverse order of steps rollingSync: steps: - matchExpressions: - key: envLabel operator: In values: - env-dev #maxUpdate: 100% # if undefined, all applications matched are updated together (default is 100%) - matchExpressions: - key: envLabel operator: In values: - env-qa maxUpdate: 0 # if 0, no matched applications will be updated - matchExpressions: - key: envLabel operator: In values: - env-prod maxUpdate: 10% # maxUpdate supports both integer and percentage string values (rounds down, but floored at 1 Application for >0%) goTemplate: true goTemplateOptions: ['missingkey=error'] template: metadata: name: '{{.cluster}}-guestbook' labels: envLabel: '{{.env}}' spec: project: my-project source: repoURL: https://github.com/infra-team/cluster-deployments.git targetRevision: HEAD path: guestbook/{{.cluster}} destination: server: '{{.url}}' namespace: guestbook ``` | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/applicationset/Progressive-Syncs.md | master | argo-cd | [
-0.015446417033672333,
-0.027886047959327698,
-0.058610573410987854,
-0.08816494792699814,
0.040202438831329346,
-0.036528244614601135,
-0.028313903138041496,
-0.10725059360265732,
0.04641740769147873,
0.046606920659542084,
0.04885019734501839,
0.04734569787979126,
-0.03237302601337433,
-0... | 0.081647 |
# Use cases supported by the ApplicationSet controller With the concept of generators, the ApplicationSet controller provides a powerful set of tools to automate the templating and modification of Argo CD Applications. Generators produce template parameter data from a variety of sources, including Argo CD clusters and Git repositories, supporting and enabling new use cases. While these tools may be utilized for whichever purpose is desired, here are some of the specific use cases that the ApplicationSet controller was designed to support. ## Use case: cluster add-ons An initial design focus of the ApplicationSet controller was to allow an infrastructure team's Kubernetes cluster administrators the ability to automatically create a large, diverse set of Argo CD Applications, across a significant number of clusters, and manage those Applications as a single unit. One example of why this is needed is the \*cluster add-on use case\*. In the \*cluster add-on use case\*, an administrator is responsible for provisioning cluster add-ons to one or more Kubernetes clusters: cluster-addons are operators such as the [Prometheus operator](https://github.com/prometheus-operator/prometheus-operator), or controllers such as the [argo-workflows controller](https://argoproj.github.io/argo-workflows/) (part of the [Argo ecosystem](https://argoproj.github.io/)). Typically these add-ons are required by the applications of development teams (as tenants of a multi-tenant cluster, for instance, they may wish to provide metrics data to Prometheus or orchestrate workflows via Argo Workflows). Since installing these add-ons requires cluster-level permissions not held by individual development teams, installation is the responsibility of the infrastructure/ops team of an organization, and within a large organization this team might be responsible for tens, hundreds, or thousands of Kubernetes clusters (with new clusters being added/modified/removed on a regular basis). The need to scale across a large number of clusters, and automatically respond to the lifecycle of new clusters, necessarily mandates some form of automation. A further requirement would be allowing the targeting of add-ons to a subset of clusters using specific criteria (eg staging vs production).  In this example, the infrastructure team maintains a Git repository containing application manifests for the Argo Workflows controller, and Prometheus operator. The infrastructure team would like to deploy both these add-on to a large number of clusters, using Argo CD, and likewise wishes to easily manage the creation/deletion of new clusters. In this use case, we may use either the List, Cluster, or Git generators of the ApplicationSet controller to provide the required behaviour: - \*List generator\*: Administrators maintain two `ApplicationSet` resources, one for each application (Workflows and Prometheus), and include the list of clusters they wish to target within the List generator elements of each. - With this generator, adding/removing clusters requires manually updating the `ApplicationSet` resource's list elements. - \*Cluster generator\*: Administrators maintain two `ApplicationSet` resources, one for each application (Workflows and Prometheus), and ensure that all new cluster are defined within Argo CD. - Since the Cluster generator automatically detects and targets the clusters defined within Argo CD, [adding/remove a cluster from Argo CD](../../declarative-setup/#clusters) will automatically cause Argo CD Application resources (for each application) to be created by the ApplicationSet controller. - \*Git generator\*: The Git generator is the most flexible/powerful of the generators, and thus there are a number of different ways to tackle this use case. Here are a couple: - Using the Git generator `files` field: A list of clusters is kept as a JSON file within a Git repository. Updates to the JSON file, through Git commits, cause new clusters to be added/removed. - Using the Git generator `directories` field: For each target cluster, a corresponding directory of that name exists in a Git repository. Adding/modifying a directory, through Git commits, would trigger an | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/applicationset/Use-Cases.md | master | argo-cd | [
-0.06164911761879921,
-0.022149676457047462,
-0.0654321163892746,
0.014856046065688133,
-0.01026726234704256,
-0.019714338704943657,
0.04908476024866104,
0.03955807909369469,
0.04377905651926994,
0.06437338888645172,
0.004969783592969179,
-0.024427475407719612,
0.011224385350942612,
-0.056... | 0.277696 |
file within a Git repository. Updates to the JSON file, through Git commits, cause new clusters to be added/removed. - Using the Git generator `directories` field: For each target cluster, a corresponding directory of that name exists in a Git repository. Adding/modifying a directory, through Git commits, would trigger an update for the cluster that has shares the directory name. See the [generators section](Generators.md) for details on each of the generators. ## Use case: monorepos In the \*monorepo use case\*, Kubernetes cluster administrators manage the entire state of a single Kubernetes cluster from a single Git repository. Manifest changes merged into the Git repository should automatically deploy to the cluster.  In this example, the infrastructure team maintains a Git repository containing application manifests for an Argo Workflows controller, and a Prometheus operator. Independent development teams also have added additional services they wish to deploy to the cluster. Changes made to the Git repository -- for example, updating the version of a deployed artifact -- should automatically cause that update to be applied to the corresponding Kubernetes cluster by Argo CD. The Git generator may be used to support this use case: - The Git generator `directories` field may be used to specify particular subdirectories (using wildcards) containing the individual applications to deploy. - The Git generator `files` field may reference Git repository files containing JSON metadata, with that metadata describing the individual applications to deploy. - See the Git generator documentation for more details. ## Use case: self-service of Argo CD Applications on multitenant clusters The \*self-service use case\* seeks to allow developers (as the end users of a multitenant Kubernetes cluster) greater flexibility to: - Deploy multiple applications to a single cluster, in an automated fashion, using Argo CD - Deploy to multiple clusters, in an automated fashion, using Argo CD - But, in both cases, to empower those developers to be able to do so without needing to involve a cluster administrator (to create the necessarily Argo CD Applications/AppProject resources on their behalf) One potential solution to this use case is for development teams to define Argo CD `Application` resources within a Git repository (containing the manifests they wish to deploy), in an [app-of-apps pattern](../../cluster-bootstrapping/#app-of-apps-pattern), and for cluster administrators to then review/accept changes to this repository via merge requests. While this might sound like an effective solution, a major disadvantage is that a high degree of trust/scrutiny is needed to accept commits containing Argo CD `Application` spec changes. This is because there are many sensitive fields contained within the `Application` spec, including `project`, `cluster`, and `namespace`. An inadvertent merge might allow applications to access namespaces/clusters where they did not belong. Thus in the self-service use case, administrators desire to only allow some fields of the `Application` spec to be controlled by developers (eg the Git source repository) but not other fields (eg the target namespace, or target cluster, should be restricted). Fortunately, the ApplicationSet controller presents an alternative solution to this use case: cluster administrators may safely create an `ApplicationSet` resource containing a Git generator that restricts deployment of application resources to fixed values with the `template` field, while allowing customization of 'safe' fields by developers, at will. The `config.json` files contain information describing the app. ```json { (...) "app": { "source": "https://github.com/argoproj/argo-cd", "revision": "HEAD", "path": "applicationset/examples/git-generator-files-discovery/apps/guestbook" } (...) } ``` ```yaml kind: ApplicationSet # (...) spec: goTemplate: true goTemplateOptions: ["missingkey=error"] generators: - git: repoURL: https://github.com/argoproj/argo-cd.git files: - path: "apps/\*\*/config.json" template: spec: project: dev-team-one # project is restricted source: # developers may customize app details using JSON files from above repo URL repoURL: {{.app.source}} targetRevision: {{.app.revision}} | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/applicationset/Use-Cases.md | master | argo-cd | [
-0.08033991605043411,
-0.05678674206137657,
0.061067644506692886,
0.017113864421844482,
-0.007699671667069197,
-0.04857802018523216,
-0.013023857027292252,
0.011617790907621384,
0.14351080358028412,
0.047932542860507965,
0.05936775356531143,
-0.018140718340873718,
0.0150621198117733,
-0.02... | 0.232115 |
"applicationset/examples/git-generator-files-discovery/apps/guestbook" } (...) } ``` ```yaml kind: ApplicationSet # (...) spec: goTemplate: true goTemplateOptions: ["missingkey=error"] generators: - git: repoURL: https://github.com/argoproj/argo-cd.git files: - path: "apps/\*\*/config.json" template: spec: project: dev-team-one # project is restricted source: # developers may customize app details using JSON files from above repo URL repoURL: {{.app.source}} targetRevision: {{.app.revision}} path: {{.app.path}} destination: name: production-cluster # cluster is restricted namespace: dev-team-one # namespace is restricted ``` See the [Git generator](Generators-Git.md) for more details. | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/applicationset/Use-Cases.md | master | argo-cd | [
-0.04621213674545288,
0.034278880804777145,
-0.07911688834428787,
0.0002127318293787539,
0.030516959726810455,
-0.02462954819202423,
0.0344933420419693,
0.013447433710098267,
-0.016208156943321228,
0.07189010828733444,
0.028012750670313835,
-0.037473466247320175,
-0.012597320601344109,
-0.... | 0.088216 |
# ApplicationSet Security ApplicationSet is a powerful tool, and it is crucial to understand its security implications before using it. ## Only admins may create/update/delete ApplicationSets ApplicationSets can create Applications under arbitrary [Projects](../../user-guide/projects.md). Argo CD setups often include Projects (such as the `default`) with high levels of permissions, often including the ability to manage the resources of Argo CD itself (like the RBAC ConfigMap). ApplicationSets can also quickly create an arbitrary number of Applications and just as quickly delete them. Finally, ApplicationSets can reveal privileged information. For example, the [git generator](./Generators-Git.md) can read Secrets in the Argo CD namespace and send them to arbitrary URLs (e.g. URL provided for the `api` field) as auth headers. (This functionality is intended for authorizing requests to SCM providers like GitHub, but it could be abused by a malicious user.) For these reasons, \*\*only admins\*\* may be given permission (via Kubernetes RBAC or any other mechanism) to create, update, or delete ApplicationSets. ## Admins must apply appropriate controls for ApplicationSets' sources of truth Even if non-admins can't create ApplicationSet resources, they may be able to affect the behavior of ApplicationSets. For example, if an ApplicationSet uses a [git generator](./Generators-Git.md), a malicious user with push access to the source git repository could generate an excessively high number of Applications, putting strain on the ApplicationSet and Application controllers. They could also cause the SCM provider's rate limiting to kick in, degrading ApplicationSet service. ### Templated `project` field It's important to pay special attention to ApplicationSets where the `project` field is templated. A malicious user with write access to the generator's source of truth (for example, someone with push access to the git repo for a git generator) could create Applications under Projects with insufficient restrictions. A malicious user with the ability to create an Application under an unrestricted Project (like the `default` Project) could take control of Argo CD itself by, for example, modifying its RBAC ConfigMap. If the `project` field is not hard-coded in an ApplicationSet's template, then admins \_must\_ control all sources of truth for the ApplicationSet's generators. | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/applicationset/Security.md | master | argo-cd | [
-0.05485918000340462,
-0.013391646556556225,
-0.09587249904870987,
-0.034938301891088486,
0.0030509827192872763,
-0.06489871442317963,
0.10877437144517899,
0.017212696373462677,
0.04566609114408493,
0.046651192009449005,
-0.03202866390347481,
0.014797788113355637,
0.029273739084601402,
-0.... | 0.20066 |
# `argocd-repo-server` Command Reference ## argocd-repo-server Run ArgoCD Repository Server ### Synopsis ArgoCD Repository Server is an internal service which maintains a local cache of the Git repository holding the application manifests, and is responsible for generating and returning the Kubernetes manifests. This command runs Repository Server in the foreground. It can be configured by following options. ``` argocd-repo-server [flags] ``` ### Options ``` --address string Listen on given address for incoming connections (default "0.0.0.0") --allow-oob-symlinks Allow out-of-bounds symlinks in repositories (not recommended) --default-cache-expiration duration Cache expiration default (default 24h0m0s) --disable-helm-manifest-max-extracted-size Disable maximum size of helm manifest archives when extracted --disable-oci-manifest-max-extracted-size Disable maximum size of oci manifest archives when extracted --disable-tls Disable TLS on the gRPC endpoint --enable-builtin-git-config Enable builtin git configuration options that are required for correct argocd-repo-server operation. (default true) --helm-manifest-max-extracted-size string Maximum size of helm manifest archives when extracted (default "1G") --helm-registry-max-index-size string Maximum size of registry index file (default "1G") -h, --help help for argocd-repo-server --include-hidden-directories Include hidden directories from Git --logformat string Set the logging format. One of: json|text (default "json") --loglevel string Set the logging level. One of: debug|info|warn|error (default "info") --max-combined-directory-manifests-size string Max combined size of manifest files in a directory-type Application (default "10M") --metrics-address string Listen on given address for metrics (default "0.0.0.0") --metrics-port int Start metrics server on given port (default 8084) --oci-layer-media-types strings Comma separated list of allowed media types for OCI media types. This only accounts for media types within layers. (default [application/vnd.oci.image.layer.v1.tar,application/vnd.oci.image.layer.v1.tar+gzip,application/vnd.cncf.helm.chart.content.v1.tar+gzip]) --oci-manifest-max-extracted-size string Maximum size of oci manifest archives when extracted (default "1G") --otlp-address string OpenTelemetry collector address to send traces to --otlp-attrs strings List of OpenTelemetry collector extra attrs when send traces, each attribute is separated by a colon(e.g. key:value) --otlp-headers stringToString List of OpenTelemetry collector extra headers sent with traces, headers are comma-separated key-value pairs(e.g. key1=value1,key2=value2) (default []) --otlp-insecure OpenTelemetry collector insecure mode (default true) --parallelismlimit int Limit on number of concurrent manifests generate requests. Any value less the 1 means no limit. --plugin-tar-exclude stringArray Globs to filter when sending tarballs to plugins. --plugin-use-manifest-generate-paths Pass the resources described in argocd.argoproj.io/manifest-generate-paths value to the cmpserver to generate the application manifests. --port int Listen on given port for incoming connections (default 8081) --redis string Redis server hostname and port (e.g. argocd-redis:6379). --redis-ca-certificate string Path to Redis server CA certificate (e.g. /etc/certs/redis/ca.crt). If not specified, system trusted CAs will be used for server certificate validation. --redis-client-certificate string Path to Redis client certificate (e.g. /etc/certs/redis/client.crt). --redis-client-key string Path to Redis client key (e.g. /etc/certs/redis/client.crt). --redis-compress string Enable compression for data sent to Redis with the required compression algorithm. (possible values: gzip, none) (default "gzip") --redis-insecure-skip-tls-verify Skip Redis server certificate validation. --redis-use-tls Use TLS when connecting to Redis. --redisdb int Redis database. --repo-cache-expiration duration Cache expiration for repo state, incl. app lists, app details, manifest generation, revision meta-data (default 24h0m0s) --revision-cache-expiration duration Cache expiration for cached revision (default 3m0s) --revision-cache-lock-timeout duration Cache TTL for locks to prevent duplicate requests on revisions, set to 0 to disable (default 10s) --sentinel stringArray Redis sentinel hostname and port (e.g. argocd-redis-ha-announce-0:6379). --sentinelmaster string Redis sentinel master group name. (default "master") --streamed-manifest-max-extracted-size string Maximum size of streamed manifest archives when extracted (default "1G") --streamed-manifest-max-tar-size string Maximum size of streamed manifest archives (default "100M") --tlsciphers string The list of acceptable ciphers to be used when establishing TLS connections. Use 'list' to list available ciphers. (default "TLS\_ECDHE\_RSA\_WITH\_AES\_256\_GCM\_SHA384") --tlsmaxversion string The maximum SSL/TLS version that is acceptable (one of: 1.0|1.1|1.2|1.3) (default "1.3") --tlsminversion string The minimum SSL/TLS version that is acceptable (one of: 1.0|1.1|1.2|1.3) (default "1.2") ``` | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/server-commands/argocd-repo-server.md | master | argo-cd | [
-0.0008459624950774014,
-0.031130045652389526,
-0.06981215626001358,
-0.03915790468454361,
-0.03052072785794735,
-0.06300840526819229,
0.037716347724199295,
-0.04080434516072273,
0.0750967413187027,
0.098511703312397,
0.03168873488903046,
0.042906615883111954,
-0.07753463834524155,
-0.0539... | 0.190334 |
TLS connections. Use 'list' to list available ciphers. (default "TLS\_ECDHE\_RSA\_WITH\_AES\_256\_GCM\_SHA384") --tlsmaxversion string The maximum SSL/TLS version that is acceptable (one of: 1.0|1.1|1.2|1.3) (default "1.3") --tlsminversion string The minimum SSL/TLS version that is acceptable (one of: 1.0|1.1|1.2|1.3) (default "1.2") ``` | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/server-commands/argocd-repo-server.md | master | argo-cd | [
0.04959839582443237,
0.014079674147069454,
-0.04663408175110817,
-0.05012468621134758,
-0.049562931060791016,
0.0009913224494084716,
-0.04180256277322769,
-0.0618332177400589,
0.02288072183728218,
-0.04384324327111244,
-0.014468096196651459,
-0.052017681300640106,
0.004871169105172157,
0.0... | -0.054874 |
# `argocd-server version` Command Reference ## argocd-server version Print version information ``` argocd-server version [flags] ``` ### Options ``` -h, --help help for version --short print just the version number ``` ### Options inherited from parent commands ``` --as string Username to impersonate for the operation --as-group stringArray Group to impersonate for the operation, this flag can be repeated to specify multiple groups. --as-uid string UID to impersonate for the operation --certificate-authority string Path to a cert file for the certificate authority --client-certificate string Path to a client certificate file for TLS --client-key string Path to a client key file for TLS --cluster string The name of the kubeconfig cluster to use --context string The name of the kubeconfig context to use --disable-compression If true, opt-out of response compression for all requests to the server --insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure --kubeconfig string Path to a kube config. Only required if out-of-cluster -n, --namespace string If present, the namespace scope for this CLI request --password string Password for basic authentication to the API server --proxy-url string If provided, this URL will be used to connect via proxy --request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0") --server string The address and port of the Kubernetes API server --tls-server-name string If provided, this name will be used to validate server certificate. If this is not provided, hostname used to contact the server is used. --token string Bearer token for authentication to the API server --user string The name of the kubeconfig user to use --username string Username for basic authentication to the API server ``` ### SEE ALSO \* [argocd-server](argocd-server.md) - Run the ArgoCD API server | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/server-commands/argocd-server_version.md | master | argo-cd | [
-0.00229025655426085,
0.05497222766280174,
-0.09647124260663986,
-0.02535507269203663,
-0.02742539905011654,
-0.06120404228568077,
0.06845276802778244,
-0.05753569304943085,
0.004348995629698038,
0.004992785397917032,
0.04687980189919472,
-0.03335851430892944,
-0.00019133550813421607,
-0.0... | 0.135706 |
# `argocd-application-controller` Command Reference ## argocd-application-controller Run ArgoCD Application Controller ### Synopsis ArgoCD application controller is a Kubernetes controller that continuously monitors running applications and compares the current, live state against the desired target state (as specified in the repo). This command runs Application Controller in the foreground. It can be configured by following options. ``` argocd-application-controller [flags] ``` ### Options ``` --app-hard-resync int Time period in seconds for application hard resync. --app-resync int Time period in seconds for application resync. (default 120) --app-resync-jitter int Maximum time period in seconds to add as a delay jitter for application resync. (default 60) --app-state-cache-expiration duration Cache expiration for app state (default 1h0m0s) --application-namespaces strings List of additional namespaces that applications are allowed to be reconciled from --as string Username to impersonate for the operation --as-group stringArray Group to impersonate for the operation, this flag can be repeated to specify multiple groups. --as-uid string UID to impersonate for the operation --certificate-authority string Path to a cert file for the certificate authority --client-certificate string Path to a client certificate file for TLS --client-key string Path to a client key file for TLS --cluster string The name of the kubeconfig cluster to use --commit-server string Commit server address. (default "argocd-commit-server:8086") --context string The name of the kubeconfig context to use --default-cache-expiration duration Cache expiration default (default 24h0m0s) --disable-compression If true, opt-out of response compression for all requests to the server --dynamic-cluster-distribution-enabled Enables dynamic cluster distribution. --enable-k8s-event none Enable ArgoCD to use k8s event. For disabling all events, set the value as none. (e.g --enable-k8s-event=none), For enabling specific events, set the value as `event reason`. (e.g --enable-k8s-event=StatusRefreshed,ResourceCreated) (default [all]) --gloglevel int Set the glog logging level -h, --help help for argocd-application-controller --hydrator-enabled Feature flag to enable Hydrator. Default ("false") --ignore-normalizer-jq-execution-timeout-seconds duration Set ignore normalizer JQ execution timeout --insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure --kubeconfig string Path to a kube config. Only required if out-of-cluster --kubectl-parallelism-limit int Number of allowed concurrent kubectl fork/execs. Any value less than 1 means no limit. (default 20) --logformat string Set the logging format. One of: json|text (default "json") --loglevel string Set the logging level. One of: debug|info|warn|error (default "info") --metrics-application-conditions strings List of Application conditions that will be added to the argocd\_application\_conditions metric --metrics-application-labels strings List of Application labels that will be added to the argocd\_application\_labels metric --metrics-cache-expiration duration Prometheus metrics cache expiration (disabled by default. e.g. 24h0m0s) --metrics-cluster-labels strings List of Cluster labels that will be added to the argocd\_cluster\_labels metric --metrics-port int Start metrics server on given port (default 8082) -n, --namespace string If present, the namespace scope for this CLI request --operation-processors int Number of application operation processors (default 10) --otlp-address string OpenTelemetry collector address to send traces to --otlp-attrs strings List of OpenTelemetry collector extra attrs when send traces, each attribute is separated by a colon(e.g. key:value) --otlp-headers stringToString List of OpenTelemetry collector extra headers sent with traces, headers are comma-separated key-value pairs(e.g. key1=value1,key2=value2) (default []) --otlp-insecure OpenTelemetry collector insecure mode (default true) --password string Password for basic authentication to the API server --persist-resource-health Enables storing the managed resources health in the Application CRD --proxy-url string If provided, this URL will be used to connect via proxy --redis string Redis server hostname and port (e.g. argocd-redis:6379). --redis-ca-certificate string Path to Redis server CA certificate (e.g. /etc/certs/redis/ca.crt). If not specified, system trusted CAs will be used for server certificate validation. --redis-client-certificate string Path to Redis client certificate (e.g. /etc/certs/redis/client.crt). --redis-client-key string Path to Redis client key (e.g. /etc/certs/redis/client.crt). --redis-compress string Enable compression for data sent | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/server-commands/argocd-application-controller.md | master | argo-cd | [
-0.03903299197554588,
-0.04870746284723282,
-0.13864196836948395,
-0.03605087101459503,
-0.022499561309814453,
-0.05002279952168465,
0.05971214547753334,
0.006721094250679016,
0.04335132613778114,
0.08552824705839157,
0.021704206243157387,
0.013980439864099026,
-0.05246049165725708,
-0.090... | 0.192789 |
(e.g. argocd-redis:6379). --redis-ca-certificate string Path to Redis server CA certificate (e.g. /etc/certs/redis/ca.crt). If not specified, system trusted CAs will be used for server certificate validation. --redis-client-certificate string Path to Redis client certificate (e.g. /etc/certs/redis/client.crt). --redis-client-key string Path to Redis client key (e.g. /etc/certs/redis/client.crt). --redis-compress string Enable compression for data sent to Redis with the required compression algorithm. (possible values: gzip, none) (default "gzip") --redis-insecure-skip-tls-verify Skip Redis server certificate validation. --redis-use-tls Use TLS when connecting to Redis. --redisdb int Redis database. --repo-error-grace-period-seconds int Grace period in seconds for ignoring consecutive errors while communicating with repo server. (default 180) --repo-server string Repo server address. (default "argocd-repo-server:8081") --repo-server-plaintext Disable TLS on connections to repo server --repo-server-strict-tls Whether to use strict validation of the TLS cert presented by the repo server --repo-server-timeout-seconds int Repo server RPC call timeout seconds. (default 60) --request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0") --self-heal-backoff-cap-seconds int Specifies max timeout of exponential backoff between application self heal attempts (default 300) --self-heal-backoff-factor int Specifies factor of exponential timeout between application self heal attempts (default 3) --self-heal-backoff-timeout-seconds int Specifies initial timeout of exponential backoff between self heal attempts (default 2) --self-heal-timeout-seconds int Specifies timeout between application self heal attempts --sentinel stringArray Redis sentinel hostname and port (e.g. argocd-redis-ha-announce-0:6379). --sentinelmaster string Redis sentinel master group name. (default "master") --server string The address and port of the Kubernetes API server --server-side-diff-enabled Feature flag to enable ServerSide diff. Default ("false") --sharding-method string Enables choice of sharding method. Supported sharding methods are : [legacy, round-robin, consistent-hashing] (default "legacy") --status-processors int Number of application status processors (default 20) --sync-timeout int Specifies the timeout after which a sync would be terminated. 0 means no timeout (default 0). --tls-server-name string If provided, this name will be used to validate server certificate. If this is not provided, hostname used to contact the server is used. --token string Bearer token for authentication to the API server --user string The name of the kubeconfig user to use --username string Username for basic authentication to the API server --wq-backoff-factor float Set Workqueue Per Item Rate Limiter Backoff Factor, default is 1.5 (default 1.5) --wq-basedelay-ns duration Set Workqueue Per Item Rate Limiter Base Delay duration in nanoseconds, default 1000000 (1ms) (default 1ms) --wq-bucket-qps float Set Workqueue Rate Limiter Bucket QPS, default set to MaxFloat64 which disables the bucket limiter (default 1.7976931348623157e+308) --wq-bucket-size int Set Workqueue Rate Limiter Bucket Size, default 500 (default 500) --wq-cooldown-ns duration Set Workqueue Per Item Rate Limiter Cooldown duration in ns, default 0(per item rate limiter disabled) --wq-maxdelay-ns duration Set Workqueue Per Item Rate Limiter Max Delay duration in nanoseconds, default 1000000000 (1s) (default 1s) ``` | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/server-commands/argocd-application-controller.md | master | argo-cd | [
-0.07889366149902344,
0.017254436388611794,
-0.15115024149417877,
-0.0007415417931042612,
-0.04260297492146492,
-0.0950111448764801,
0.008482541888952255,
0.010223540477454662,
-0.006098111160099506,
-0.023972466588020325,
-0.026034168899059296,
-0.00919294822961092,
0.13089269399642944,
-... | 0.064359 |
# `argocd-applicationset-controller` Command Reference ## argocd-applicationset-controller Starts Argo CD ApplicationSet controller ``` argocd-applicationset-controller [flags] ``` ### Options ``` --allowed-scm-providers strings The list of allowed custom SCM provider API URLs. This restriction does not apply to SCM or PR generators which do not accept a custom API URL. (Default: Empty = all) --applicationset-namespaces strings Argo CD applicationset namespaces --argocd-repo-server string Argo CD repo server address (default "argocd-repo-server:8081") --as string Username to impersonate for the operation --as-group stringArray Group to impersonate for the operation, this flag can be repeated to specify multiple groups. --as-uid string UID to impersonate for the operation --certificate-authority string Path to a cert file for the certificate authority --client-certificate string Path to a client certificate file for TLS --client-key string Path to a client key file for TLS --cluster string The name of the kubeconfig cluster to use --concurrent-reconciliations int Max concurrent reconciliations limit for the controller (default 10) --context string The name of the kubeconfig context to use --debug Print debug logs. Takes precedence over loglevel --disable-compression If true, opt-out of response compression for all requests to the server --dry-run Enable dry run mode --enable-github-api-metrics Enable GitHub API metrics for generators that use the GitHub API --enable-leader-election Enable leader election for controller manager. Enabling this will ensure there is only one active controller manager. --enable-new-git-file-globbing Enable new globbing in Git files generator. --enable-policy-override For security reason if 'policy' is set, it is not possible to override it at applicationSet level. 'allow-policy-override' allows user to define their own policy (default true) --enable-progressive-syncs Enable use of the experimental progressive syncs feature. --enable-scm-providers Enable retrieving information from SCM providers, used by the SCM and PR generators (Default: true) (default true) -h, --help help for argocd-applicationset-controller --insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure --kubeconfig string Path to a kube config. Only required if out-of-cluster --logformat string Set the logging format. One of: json|text (default "json") --loglevel string Set the logging level. One of: debug|info|warn|error (default "info") --max-resources-status-count int Max number of resources stored in appset status. --metrics-addr string The address the metric endpoint binds to. (default ":8080") --metrics-applicationset-labels strings List of Application labels that will be added to the argocd\_applicationset\_labels metric -n, --namespace string If present, the namespace scope for this CLI request --password string Password for basic authentication to the API server --policy string Modify how application is synced between the generator and the cluster. Default is '' (empty), which means AppSets default to 'sync', but they may override that default. Setting an explicit value prevents AppSet-level overrides, unless --allow-policy-override is enabled. Explicit options are: 'sync' (create & update & delete), 'create-only', 'create-update' (no deletion), 'create-delete' (no update) --preserved-annotations strings Sets global preserved field values for annotations --preserved-labels strings Sets global preserved field values for labels --probe-addr string The address the probe endpoint binds to. (default ":8081") --proxy-url string If provided, this URL will be used to connect via proxy --repo-server-plaintext Disable TLS on connections to repo server --repo-server-strict-tls Whether to use strict validation of the TLS cert presented by the repo server --repo-server-timeout-seconds int Repo server RPC call timeout seconds. (default 60) --request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0") --scm-root-ca-path string Provide Root CA Path for self-signed TLS Certificates --server string The address and port of the Kubernetes API server --tls-server-name string If provided, this name will be used to validate server certificate. If this is | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/server-commands/argocd-applicationset-controller.md | master | argo-cd | [
-0.04441690072417259,
-0.044097959995269775,
-0.1831330955028534,
-0.04348788410425186,
-0.037814218550920486,
-0.009565106593072414,
0.062405455857515335,
0.01999392732977867,
-0.049971289932727814,
0.07342693209648132,
0.0533936470746994,
-0.0246135126799345,
0.02411387301981449,
-0.0190... | 0.079621 |
1s, 2m, 3h). A value of zero means don't timeout requests. (default "0") --scm-root-ca-path string Provide Root CA Path for self-signed TLS Certificates --server string The address and port of the Kubernetes API server --tls-server-name string If provided, this name will be used to validate server certificate. If this is not provided, hostname used to contact the server is used. --token string Bearer token for authentication to the API server --token-ref-strict-mode Set to true to require secrets referenced by SCM providers to have the argocd.argoproj.io/secret-type=scm-creds label set (Default: false) --user string The name of the kubeconfig user to use --username string Username for basic authentication to the API server --webhook-addr string The address the webhook endpoint binds to. (default ":7000") --webhook-parallelism-limit int Number of webhook requests processed concurrently (default 50) ``` | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/server-commands/argocd-applicationset-controller.md | master | argo-cd | [
-0.012850790284574032,
0.03314219042658806,
-0.1069307029247284,
0.015289189293980598,
-0.06061508134007454,
-0.014680719934403896,
0.006672700867056847,
-0.03929469361901283,
0.059701137244701385,
0.058498989790678024,
-0.0064267925918102264,
-0.1086382120847702,
0.007725682109594345,
-0.... | 0.13632 |
# `argocd-dex rundex` Command Reference ## argocd-dex rundex Runs dex generating a config using settings from the Argo CD configmap and secret ``` argocd-dex rundex [flags] ``` ### Options ``` --as string Username to impersonate for the operation --as-group stringArray Group to impersonate for the operation, this flag can be repeated to specify multiple groups. --as-uid string UID to impersonate for the operation --certificate-authority string Path to a cert file for the certificate authority --client-certificate string Path to a client certificate file for TLS --client-key string Path to a client key file for TLS --cluster string The name of the kubeconfig cluster to use --context string The name of the kubeconfig context to use --disable-compression If true, opt-out of response compression for all requests to the server --disable-tls Disable TLS on the HTTP endpoint -h, --help help for rundex --insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure --kubeconfig string Path to a kube config. Only required if out-of-cluster --logformat string Set the logging format. One of: json|text (default "json") --loglevel string Set the logging level. One of: debug|info|warn|error (default "info") -n, --namespace string If present, the namespace scope for this CLI request --password string Password for basic authentication to the API server --proxy-url string If provided, this URL will be used to connect via proxy --request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0") --server string The address and port of the Kubernetes API server --tls-server-name string If provided, this name will be used to validate server certificate. If this is not provided, hostname used to contact the server is used. --token string Bearer token for authentication to the API server --user string The name of the kubeconfig user to use --username string Username for basic authentication to the API server ``` ### SEE ALSO \* [argocd-dex](argocd-dex.md) - argocd-dex tools used by Argo CD | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/server-commands/argocd-dex_rundex.md | master | argo-cd | [
-0.05392272397875786,
0.031913094222545624,
-0.07075169682502747,
-0.0641588568687439,
-0.06426306068897247,
-0.08592963218688965,
0.09237435460090637,
-0.02505267597734928,
-0.025265617296099663,
-0.01837853156030178,
0.01832834631204605,
-0.030788807198405266,
0.04195345938205719,
-0.043... | 0.116735 |
## Additional configuration methods Additional configuration methods for configuring commands `argocd-server`, `argocd-repo-server` and `argocd-application-controller`. ### Synopsis The commands can also be configured by setting the respective flag of the available options in `argocd-cmd-params-cm.yaml`. Each component has a specific prefix associated with it. ``` argocd-server --> server argocd-repo-server --> reposerver argocd-application-controller --> controller ``` The flags that do not have a prefix are shared across multiple components. One such flag is `repo.server` The list of flags that are available can be found in [argocd-cmd-params-cm.yaml](../argocd-cmd-params-cm.yaml) ### Example To set `logformat` of `argocd-application-controller`, add below entry to the config map `argocd-cmd-params-cm.yaml`. ``` data: controller.log.format: "json" ``` | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/server-commands/additional-configuration-method.md | master | argo-cd | [
0.003926862962543964,
-0.08144218474626541,
-0.17061208188533783,
-0.042456939816474915,
-0.04173991084098816,
-0.07278516888618469,
0.052009351551532745,
0.005417447071522474,
-0.010087808594107628,
0.09518551081418991,
0.08420932292938232,
0.019003678113222122,
-0.02595713548362255,
0.01... | 0.063978 |
# `argocd-dex gendexcfg` Command Reference ## argocd-dex gendexcfg Generates a dex config from Argo CD settings ``` argocd-dex gendexcfg [flags] ``` ### Options ``` --as string Username to impersonate for the operation --as-group stringArray Group to impersonate for the operation, this flag can be repeated to specify multiple groups. --as-uid string UID to impersonate for the operation --certificate-authority string Path to a cert file for the certificate authority --client-certificate string Path to a client certificate file for TLS --client-key string Path to a client key file for TLS --cluster string The name of the kubeconfig cluster to use --context string The name of the kubeconfig context to use --disable-compression If true, opt-out of response compression for all requests to the server --disable-tls Disable TLS on the HTTP endpoint -h, --help help for gendexcfg --insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure --kubeconfig string Path to a kube config. Only required if out-of-cluster --logformat string Set the logging format. One of: json|text (default "json") --loglevel string Set the logging level. One of: debug|info|warn|error (default "info") -n, --namespace string If present, the namespace scope for this CLI request -o, --out string Output to the specified file instead of stdout --password string Password for basic authentication to the API server --proxy-url string If provided, this URL will be used to connect via proxy --request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0") --server string The address and port of the Kubernetes API server --tls-server-name string If provided, this name will be used to validate server certificate. If this is not provided, hostname used to contact the server is used. --token string Bearer token for authentication to the API server --user string The name of the kubeconfig user to use --username string Username for basic authentication to the API server ``` ### SEE ALSO \* [argocd-dex](argocd-dex.md) - argocd-dex tools used by Argo CD | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/server-commands/argocd-dex_gendexcfg.md | master | argo-cd | [
-0.04840753972530365,
0.03991582989692688,
-0.06350752711296082,
-0.06001991033554077,
-0.06839630007743835,
-0.0688362792134285,
0.09708964824676514,
-0.023038361221551895,
-0.01709992252290249,
-0.024160470813512802,
0.018736235797405243,
-0.03921634331345558,
0.031152212992310524,
-0.03... | 0.098286 |
# `argocd-server` Command Reference ## argocd-server Run the ArgoCD API server ### Synopsis The API server is a gRPC/REST server which exposes the API consumed by the Web UI, CLI, and CI/CD systems. This command runs API server in the foreground. It can be configured by following options. ``` argocd-server [flags] ``` ### Examples ``` # Start the Argo CD API server with default settings $ argocd-server # Start the Argo CD API server on a custom port and enable tracing $ argocd-server --port 8888 --otlp-address localhost:4317 ``` ### Options ``` --address string Listen on given address (default "0.0.0.0") --api-content-types string Semicolon separated list of allowed content types for non GET api requests. Any content type is allowed if empty. (default "application/json") --app-state-cache-expiration duration Cache expiration for app state (default 1h0m0s) --application-namespaces strings List of additional namespaces where application resources can be managed in --appset-allowed-scm-providers strings The list of allowed custom SCM provider API URLs. This restriction does not apply to SCM or PR generators which do not accept a custom API URL. (Default: Empty = all) --appset-enable-github-api-metrics Enable GitHub API metrics for generators that use the GitHub API --appset-enable-new-git-file-globbing Enable new globbing in Git files generator. --appset-enable-scm-providers Enable retrieving information from SCM providers, used by the SCM and PR generators (Default: true) (default true) --appset-scm-root-ca-path string Provide Root CA Path for self-signed TLS Certificates --as string Username to impersonate for the operation --as-group stringArray Group to impersonate for the operation, this flag can be repeated to specify multiple groups. --as-uid string UID to impersonate for the operation --basehref string Value for base href in index.html. Used if Argo CD is running behind reverse proxy under subpath different from / (default "/") --certificate-authority string Path to a cert file for the certificate authority --client-certificate string Path to a client certificate file for TLS --client-key string Path to a client key file for TLS --cluster string The name of the kubeconfig cluster to use --connection-status-cache-expiration duration Cache expiration for cluster/repo connection status (default 1h0m0s) --content-security-policy value Set Content-Security-Policy header in HTTP responses to value. To disable, set to "". (default "frame-ancestors 'self';") --context string The name of the kubeconfig context to use --default-cache-expiration duration Cache expiration default (default 24h0m0s) --dex-server string Dex server address (default "argocd-dex-server:5556") --dex-server-plaintext Use a plaintext client (non-TLS) to connect to dex server --dex-server-strict-tls Perform strict validation of TLS certificates when connecting to dex server --disable-auth Disable client authentication --disable-compression If true, opt-out of response compression for all requests to the server --enable-gzip Enable GZIP compression (default true) --enable-k8s-event none Enable ArgoCD to use k8s event. For disabling all events, set the value as none. (e.g --enable-k8s-event=none), For enabling specific events, set the value as `event reason`. (e.g --enable-k8s-event=StatusRefreshed,ResourceCreated) (default [all]) --enable-proxy-extension Enable Proxy Extension feature --gloglevel int Set the glog logging level -h, --help help for argocd-server --hydrator-enabled Feature flag to enable Hydrator. Default ("false") --insecure Run server without TLS --insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure --kubeconfig string Path to a kube config. Only required if out-of-cluster --logformat string Set the logging format. One of: json|text (default "json") --login-attempts-expiration duration Cache expiration for failed login attempts. DEPRECATED: this flag is unused and will be removed in a future version. (default 24h0m0s) --loglevel string Set the logging level. One of: debug|info|warn|error (default "info") --metrics-address string Listen for metrics on given address (default "0.0.0.0") --metrics-port int Start metrics on given port (default 8083) -n, --namespace string If present, the namespace scope for this CLI request --oidc-cache-expiration duration Cache expiration for OIDC state (default 3m0s) --otlp-address | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/server-commands/argocd-server.md | master | argo-cd | [
0.0116841159760952,
0.024317465722560883,
-0.13277266919612885,
-0.04482925683259964,
-0.026877041906118393,
-0.10024899244308472,
0.006705587264150381,
-0.023011252284049988,
-0.0070274886675179005,
0.09446708858013153,
0.03555138781666756,
0.010100423358380795,
-0.06980253756046295,
-0.0... | 0.154978 |
Set the logging level. One of: debug|info|warn|error (default "info") --metrics-address string Listen for metrics on given address (default "0.0.0.0") --metrics-port int Start metrics on given port (default 8083) -n, --namespace string If present, the namespace scope for this CLI request --oidc-cache-expiration duration Cache expiration for OIDC state (default 3m0s) --otlp-address string OpenTelemetry collector address to send traces to --otlp-attrs strings List of OpenTelemetry collector extra attrs when send traces, each attribute is separated by a colon(e.g. key:value) --otlp-headers stringToString List of OpenTelemetry collector extra headers sent with traces, headers are comma-separated key-value pairs(e.g. key1=value1,key2=value2) (default []) --otlp-insecure OpenTelemetry collector insecure mode (default true) --password string Password for basic authentication to the API server --port int Listen on given port (default 8080) --proxy-url string If provided, this URL will be used to connect via proxy --redis string Redis server hostname and port (e.g. argocd-redis:6379). --redis-ca-certificate string Path to Redis server CA certificate (e.g. /etc/certs/redis/ca.crt). If not specified, system trusted CAs will be used for server certificate validation. --redis-client-certificate string Path to Redis client certificate (e.g. /etc/certs/redis/client.crt). --redis-client-key string Path to Redis client key (e.g. /etc/certs/redis/client.crt). --redis-compress string Enable compression for data sent to Redis with the required compression algorithm. (possible values: gzip, none) (default "gzip") --redis-insecure-skip-tls-verify Skip Redis server certificate validation. --redis-use-tls Use TLS when connecting to Redis. --redisdb int Redis database. --repo-cache-expiration duration Cache expiration for repo state, incl. app lists, app details, manifest generation, revision meta-data (default 24h0m0s) --repo-server string Repo server address (default "argocd-repo-server:8081") --repo-server-default-cache-expiration duration Cache expiration default (default 24h0m0s) --repo-server-plaintext Use a plaintext client (non-TLS) to connect to repository server --repo-server-redis string Redis server hostname and port (e.g. argocd-redis:6379). --repo-server-redis-ca-certificate string Path to Redis server CA certificate (e.g. /etc/certs/redis/ca.crt). If not specified, system trusted CAs will be used for server certificate validation. --repo-server-redis-client-certificate string Path to Redis client certificate (e.g. /etc/certs/redis/client.crt). --repo-server-redis-client-key string Path to Redis client key (e.g. /etc/certs/redis/client.crt). --repo-server-redis-compress string Enable compression for data sent to Redis with the required compression algorithm. (possible values: gzip, none) (default "gzip") --repo-server-redis-insecure-skip-tls-verify Skip Redis server certificate validation. --repo-server-redis-use-tls Use TLS when connecting to Redis. --repo-server-redisdb int Redis database. --repo-server-sentinel stringArray Redis sentinel hostname and port (e.g. argocd-redis-ha-announce-0:6379). --repo-server-sentinelmaster string Redis sentinel master group name. (default "master") --repo-server-strict-tls Perform strict validation of TLS certificates when connecting to repo server --repo-server-timeout-seconds int Repo server RPC call timeout seconds. (default 60) --request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0") --revision-cache-expiration duration Cache expiration for cached revision (default 3m0s) --revision-cache-lock-timeout duration Cache TTL for locks to prevent duplicate requests on revisions, set to 0 to disable (default 10s) --rootpath string Used if Argo CD is running behind reverse proxy under subpath different from / --sentinel stringArray Redis sentinel hostname and port (e.g. argocd-redis-ha-announce-0:6379). --sentinelmaster string Redis sentinel master group name. (default "master") --server string The address and port of the Kubernetes API server --staticassets string Directory path that contains additional static assets (default "/shared/app") --sync-with-replace-allowed Whether to allow users to select replace for syncs from UI/CLI (default true) --tls-server-name string If provided, this name will be used to validate server certificate. If this is not provided, hostname used to contact the server is used. --tlsciphers string The list of acceptable ciphers to be used when establishing TLS connections. Use 'list' to list available ciphers. (default "TLS\_ECDHE\_RSA\_WITH\_AES\_256\_GCM\_SHA384") --tlsmaxversion string The maximum SSL/TLS version that is acceptable (one of: 1.0|1.1|1.2|1.3) (default "1.3") --tlsminversion string The minimum SSL/TLS version that is acceptable (one of: | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/server-commands/argocd-server.md | master | argo-cd | [
-0.02396502159535885,
0.01011327188462019,
-0.0699586346745491,
0.0332077331840992,
0.002452009590342641,
-0.12745432555675507,
0.06679601967334747,
0.0018332523759454489,
-0.01750727742910385,
-0.016516169533133507,
0.011589204892516136,
-0.11466215550899506,
0.020561927929520607,
-0.0094... | 0.137991 |
server is used. --tlsciphers string The list of acceptable ciphers to be used when establishing TLS connections. Use 'list' to list available ciphers. (default "TLS\_ECDHE\_RSA\_WITH\_AES\_256\_GCM\_SHA384") --tlsmaxversion string The maximum SSL/TLS version that is acceptable (one of: 1.0|1.1|1.2|1.3) (default "1.3") --tlsminversion string The minimum SSL/TLS version that is acceptable (one of: 1.0|1.1|1.2|1.3) (default "1.2") --token string Bearer token for authentication to the API server --user string The name of the kubeconfig user to use --username string Username for basic authentication to the API server --webhook-parallelism-limit int Number of webhook requests processed concurrently (default 50) --x-frame-options value Set X-Frame-Options header in HTTP responses to value. To disable, set to "". (default "sameorigin") ``` ### SEE ALSO \* [argocd-server version](argocd-server\_version.md) - Print version information | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/server-commands/argocd-server.md | master | argo-cd | [
-0.01489882729947567,
0.08538146317005157,
-0.055153001099824905,
-0.07080098241567612,
-0.098579041659832,
-0.034318119287490845,
-0.02720668539404869,
-0.06289681047201157,
0.09397295862436295,
-0.025695009157061577,
-0.024607475847005844,
-0.11610939353704453,
0.03409605845808983,
-0.02... | 0.100327 |
# v3.1 to 3.2 > Users operating large monorepos may encounter repo-server lock contention requiring pod restarts. A [fix](https://github.com/argoproj/argo-cd/pull/25127) is under review and will be included in the next patch release. ## Breaking Changes ### Hydration paths must now be non-root Source hydration (with [Source Hydrator](../../../user-guide/source-hydrator/)) now requires that every application specify a non-root path. Using the repository root (for example, "" or ".") is no longer supported. This change ensures that hydration outputs are isolated to a dedicated subdirectory and prevents accidental overwrites or deletions of important files stored at the root, such as CI pipelines, documentation, or configuration files. Previously, it was possible for hydration to write manifests directly into the repository root. While convenient, this had two major drawbacks: 1. Hydration would wipe and replace files at the root on every run, which risked deleting important files such as CI/CD workflows, project-level READMEs, or other configuration. 2. It made it harder to clearly separate hydrated application outputs from unrelated repository content. To identify affected applications, review your Application manifests and look for `.spec.sourceHydrator.syncSource.path` values that are empty, missing, `"."`, or otherwise point to the repository root. These applications must be updated to use a subdirectory path, such as `apps/guestbook`. After migration, check your repository root for any stale hydration output from earlier versions. Common leftovers include files such as `manifest.yaml` or `README.md`. These will not be cleaned up automatically and should be deleted manually if no longer needed. ## Argo CD Now Respects Kustomize Version in `.argocd-source.yaml` Argo CD provides a way to [override Application `spec.source` values](../../user-guide/parameters.md#store-overrides-in-git) using the `.argocd-source.yaml` file. Before Argo CD v3.2, you could set the Kustomize version in the Application's `.spec.source.kustomize.version` field, but you could not set it in the `.argocd-source.yaml` file. Starting with Argo CD v3.2, you can now set the Kustomize version in the `.argocd-source.yaml` file like this: ```yaml kustomize: version: v4.5.7 ``` ## Deprecated fields in the repo-server GRPC service The repo-server's GRPC service is generally considered an internal API and is not recommended for use by external clients. No user-facing services or functionality have changed. However, if you are using the repo-server's GRPC service directly, please note field deprecations in the following messages. The `kustomizeOptions.binaryPath` field in the `ManifestRequest` and `RepoServerAppDetailsQuery` messages has been deprecated. Instead of calculating the correct binary path client-side, the client is expected to populate the `kustomizeOptions.versions` field with the [configured Kustomize binary paths](../../user-guide/kustomize.md#custom-kustomize-versions). This allows the repo-server to select the correct binary path based on the Kustomize version configured in the Application's source field as well as any [overrides configured via git](../../user-guide/parameters.md#store-overrides-in-git). The `kustomizeOptions.binaryPath` will continue to be respected when `kustomizeOptions.versions` is not set, but this is not recommended. It will prevent overrides configured via git from being respected. The `kustomizeOptions.binaryPath` field will be removed in a future release. If the repo-server encounters a request with the `kustomizeOptions.binaryPath` field set, it will log a warning message: > kustomizeOptions.binaryPath is deprecated, use KustomizeOptions.versions instead The `ManifestRequest` and `RepoServerAppDetailsQuery` messages are used by the following GRPC services: `GenerateManifest`, `GenerateManifestWithFiles`, and `GetAppDetails`. ## CronJob Health After the upgrade, Application's status may transition to `Degraded` depending on the CronJob health. > [!NOTE] > \*\*CronJob with running jobs\*\* > > If the CronJob is `Degraded` and a new job is scheduled, the health will change to `Healthy` until the active job completes. > This may cause your application to go from `Degraded` to `Healthy` to `Degraded` again. The CronJob status does not contain enough > information to infer the health of the last completed job if there are active jobs. > > If the CronJob constantly has active jobs, | https://github.com/argoproj/argo-cd/blob/master//docs/operator-manual/upgrading/3.1-3.2.md | master | argo-cd | [
-0.09702254086732864,
-0.026925114914774895,
0.018277384340763092,
0.0016095477622002363,
0.04179183393716812,
-0.09974426031112671,
0.012472893111407757,
0.0384400375187397,
0.03702501207590103,
0.04509146511554718,
-0.01976952515542507,
0.0054086800664663315,
-0.05277733877301216,
0.0264... | 0.073197 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.