Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.
Chapter 2. Argo CD custom resource and component properties
The ArgoCD
custom resource is a Kubernetes Custom Resource (CRD) that describes the desired state for a given Argo CD cluster that allows you to configure the components which make up an Argo CD cluster.
2.1. Argo CD custom resource properties
The Argo CD Custom Resource consists of the following properties:
Name | Description | Default | Properties |
---|---|---|---|
|
The |
| |
| Use aggregated cluster roles for the Argo CD Application Controller component of a cluster-scoped instance. |
| |
| The ApplicationSet Controller configuration options. |
|
|
| Adds a UI banner message. |
|
|
| Adds a configuration management plugin. |
| |
| Argo CD Application Controller options. |
|
|
| Disables the built-in admin user. |
| |
| Disables the creation of default cluster roles for a cluster-scoped instance. |
| |
|
Add any supplementary Argo CD settings to the |
| |
| Use a Google Analytics tracking ID. |
| |
| Enable hashed usernames sent to Google Analytics. |
| |
| High-availability options. |
|
|
| URL for getting chat help (this is typically your Slack channel for support). | ||
| The text that appears in a text box for getting chat help. |
| |
|
The container image for all Argo CD components. This overrides the |
| |
| Import configuration options for Argo CD. |
|
|
| Ingress configuration options. |
| |
| Initial Git repositories to configure Argo CD to use upon creation of the cluster. |
| |
| Defines the initial SSH Known Hosts data for Argo CD to use at cluster creation to connect to Git repositories through SSH. | `<default_Argo_CD_Known_Hosts> |
|
|
The build options and parameters to use with |
| |
|
Defines a list of |
|
|
| Defines the workload status monitoring configuration for your instance. |
|
|
| Notifications Controller configuration options. |
|
|
|
Defines |
|
|
| The OIDC configuration as an alternative to Dex. |
| |
| Git repository credential templates to configure Argo CD to use at cluster creation. |
| |
| Prometheus configuration options. |
|
|
| RBAC configuration options. |
|
|
| Redis configuration options. |
|
|
| Customize resource health check behavior. |
| |
| Customize resource ignore difference behavior. |
| |
| Customize resource action behavior. |
| |
| Completely ignore entire classes of resource group. |
| |
| The configuration to identify which resource group/kinds are applied. |
| |
| The field used by Argo CD to monitor its managed resources. |
| |
| Argo CD Server configuration options. |
|
|
| Single Sign-on options. |
|
|
| Enable application status badge. |
| |
| TLS configuration options. |
|
|
| Enables anonymous user access. |
| |
| The tag to use with the container image for all Argo CD components. | Latest Argo CD version |
2.2. Repo server properties
The following properties are available for configuring the repo server component:
Name | Default | Description |
---|---|---|
|
| The container compute resources. |
|
|
Defines whether the |
|
|
The name of the |
|
| Defines whether to enforce strict TLS checking on all components when communicating with repo server. |
|
|
Provider to use to set up TLS for the repo-server’s gRPC TLS certificate. Currently, only the |
|
|
The container image for Argo CD Repo server. This propery overrides the |
|
same as | The tag to use with the Argo CD Repo server. |
|
|
The log level used by the Argo CD Repo server. Valid options are |
|
|
The log format to be used by the Argo CD repo server. Valid options are |
|
| Execution timeout in seconds for rendering tools, for example, Helm or Kustomize. |
|
| The environment to set for the Repo server workloads. |
|
| Flag that enables the Repo server during Argo CD installation. |
|
| Passes command-line arguments to the Repo server workload. The command-line arguments are added to the list of arguments set by the Operator. |
|
|
The number of |
|
|
The number of |
|
| Configures additional volumes used for the Repo server deployment. This field is optional. |
|
| Configures additional volume mounts used for the Repo server deployment. This field is optional. |
|
|
The number of replicas for the Argo CD Repo server. Must be greater than or equal to |
|
| Specifies the remote URL of the Repo server container. |
|
| List of custom annotations to add to pods deployed by the Operator. This field is optional. |
|
| List of custom labels to add to pods deployed by the Operator. This field is optional. |
2.3. Enabling notifications with an Argo CD instance
Argo CD notifications allow you to send notifications to external services when events occur in your Argo CD instance. For example, you can send notifications to Slack or email when a sync operation fails. By default, notifications are disabled in Argo CD instances.
Prerequisites
-
You have access to an OpenShift Container Platform cluster with
cluster-admin
privileges and are logged in to the web console. - You have installed the Red Hat OpenShift GitOps Operator on your cluster.
Procedure
To enable notifications for an Argo CD instance using the OpenShift Container Platform web console, complete the following steps:
-
Navigate to the Operators
Installed Operators page. - From the list of Installed Operators, select the Red Hat OpenShift GitOps Operator, and then click on the ArgoCD tab.
-
Select the Argo CD instance name you want to enable notifications. For example,
openshift-gitops
. Click on the YAML tab, and then edit and set the
spec.notifications.enabled
parameter totrue
:Example
apiVersion: argoproj.io/v1beta1 kind: ArgoCD metadata: name: openshift-gitops spec: notifications: enabled: true #....
- Click Save.
Alternatively, you can enable notifications by using the oc patch
command in the Openshift CLI. For example:
oc patch argocd openshift-gitops -n openshift-gitops --type merge --patch '{"spec": {"notifications": {"enabled": true}}}'
Additional resources
2.4. NotificationsConfiguration custom resource properties
The NotificationsConfiguration
resource is a Kubernetes custom resource (CR) that manages notifications in a Kubernetes cluster. In Red Hat OpenShift GitOps, you can add templates, triggers, services, and subscription resources to an Argo CD Notifications
config map by using the NotificationsConfiguration
CR.
When you create a cluster in Red Hat OpenShift GitOps with notifications enabled, a NotificationsConfiguration
CR is created by default with the name default-notifications-configuration
.
Any change made in the existing configuration of the NotificationsConfiguration
CR is replicated in the Argo CD Notifications
config map. For example, if the user adds trigger configuration in the NotificationsConfiguration
resource, this configuration is read, processed, and updated in the Argo CD Notifications
config map.
Any configuration changes must be updated in the default-notifications-configuration
CR. Custom resources created by the users for NotificationsConfiguration
resource are not supported.
Any modification to the Argo CD argocd-notifications-cm
config map is overridden by the changes made in the NotificationsConfiguration
CR.
Properties | Default | Description |
---|---|---|
Templates |
| Templates are used to generate the notification template message. |
Triggers |
| Triggers are used to define the condition when a notification is sent to the user and the list of templates required to generate the message. |
Services |
| Services are used to deliver a message. |
Subscriptions |
| Subscriptions contain centrally-managed global application subscriptions. |
The following examples define how to add templates, triggers, services, and subscription resources to the Argo CD argocd-notification-cm
config map by using the default-notifications-configuration
custom resource.
Example for templates
apiVersion: argoproj.io/v1alpha1 kind: NotificationsConfiguration metadata: name: default-notifications-configuration 1 spec: templates: template.my-custom-template: | 2 message: | Application details: {{.context.argocdUrl}}/applications/{{.app.metadata.name}}.
Example for triggers
apiVersion: argoproj.io/v1alpha1 kind: NotificationsConfiguration metadata: name: default-notifications-configuration 1 spec: triggers: trigger.on-sync-status-unknown: | 2 - when: app.status.sync.status == 'Unknown' send: [my-custom-template]
Example for services
apiVersion: argoproj.io/v1alpha1 kind: NotificationsConfiguration metadata: name: default-notifications-configuration 1 spec: Services: service.slack: | token: $slack-token 2 username: <override-username> # optional username icon: <override-icon> # optional icon for the message (supports both emoji and url notation)
Example for subscriptions
apiVersion: argoproj.io/v1alpha1 kind: NotificationsConfiguration metadata: name: default-notifications-configuration 1 spec: Subscriptions: | subscriptions: | 2 # subscription for on-sync-status-unknown trigger notifications - recipients: - slack:test2 - email:test@gmail.com triggers: - on-sync-status-unknown # subscription restricted to applications with matching labels only - recipients: - slack:test3 selector: test=true triggers: - on-sync-status-unknown icon: <override-icon> # optional icon for the message (supports both emoji and url notation)
You can configure the NotificationsConfiguration
CR by using the OpenShift Container Platform web console or the CLI (oc
).
2.4.1. Configuring the NotificationsConfiguration CR by using the web console
You can configure the NotificationsConfiguration
custom resource (CR) by using the web console.
Prerequisites
-
You have access to an OpenShift Container Platform cluster with
cluster-admin
privileges and are logged in to the web console. - You have installed the Red Hat OpenShift GitOps Operator on your cluster.
- You have enabled notifications for the Argo CD instance. For more information, see "Enabling notifications with an Argo CD instance".
Procedure
-
In the Administrator perspective of the OpenShift Container Platform web console, expand Operators
Installed Operators. - From the list of Installed Operators, select the Red Hat OpenShift GitOps Operator, and then click on the NotificationsConfiguration tab.
-
On the NotificationsConfigurations page, click
default-notifications-configuration
. On the default-notifications-configuration page, click YAML and add the configuration for any supported resources such as
templates
,triggers
,services
, andsubscriptions
. For example, undertemplates
in the code, add the following sample configuration:Example template configuration
template.my-custom-template: | message: | Application details: {{.context.argocdUrl}}/applications/{{.app.metadata.name}}.
- Click Save.
Verify that the configuration changes made in the
NotificationsConfiguration
CR are reflected in theargocd-notifications-cm
config map:-
Go to Workloads
ConfigMaps. - Click argocd-notifications-cm and select the YAML tab.
- Scroll through the page in the YAML tab to verify the sample configuration added for the supported resources.
-
Go to Workloads
2.4.2. Configuring the NotificationsConfiguration CR by using the CLI
You can configure the NotificationsConfiguration
custom resource (CR) by using the CLI (oc
).
Prerequisites
-
You have access to an OpenShift Container Platform cluster with
cluster-admin
privileges. - You have installed the Red Hat OpenShift GitOps Operator on your cluster.
- You have enabled notifications for the Argo CD instance. For more information, see "Enabling notifications with an Argo CD instance".
Procedure
Edit the default
NotificationsConfiguration
CR in the cluster by running the following command:$ oc edit notificationsconfiguration default-notifications-configuration -n <namespace>
where:
default-notifications-configuration
-
Specifies the name of the default
NotificationsConfiguration
CR. <namespace>
- Specifies the name of the namespace.
Under the
templates
section of the CR, add a configuration similar to the following example:Example template configuration
template.my-custom-template: | message: | Application details: {{.context.argocdUrl}}/applications/{{.app.metadata.name}}.
Verify the contents of the
argocd-notifications-cm
config map by running the following command:$ oc edit cm argocd-notifications-cm -n <namespace>
The changes made in the existing configuration of the
NotificationsConfiguration
CR are reflected in theargocd-notifications-cm
config map.