Ce contenu n'est pas disponible dans la langue sélectionnée.
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 Copier lienLien copié sur presse-papiers!
The Argo CD Custom Resource consists of the following properties:
Name | Description | Default | Properties |
---|---|---|---|
| Use aggregated cluster roles for the Argo CD Application Controller component of a cluster-scoped instance. |
| |
|
The |
| |
| 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. |
| |
| Defines the initial SSH Known Hosts data for Argo CD to use at cluster creation to connect to Git repositories through SSH. |
|
|
|
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. |
| |
| Prometheus configuration options. |
|
|
| RBAC configuration options. |
|
|
| Redis configuration options. |
|
|
| Customize resource action behavior. |
| |
| Completely ignore entire classes of resource group. |
| |
| The configuration to identify which resource group/kinds are applied. |
| |
| Customize resource health check behavior. |
| |
| Customize resource ignore difference behavior. |
| |
| The field used by Argo CD to monitor its managed resources. |
| |
| Argo CD Server configuration options. |
|
|
| Specifies the namespaces within which you can create application resources. |
| |
| 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 Copier lienLien copié sur presse-papiers!
The following properties are available for configuring the repo server component:
Name | Default | Description |
---|---|---|
|
| List of custom annotations to add to pods deployed by the Operator. This field is optional. |
|
|
Provider to use to set up TLS for the repo-server’s gRPC TLS certificate. Currently, only the |
|
| The environment to set for the Repo server workloads. |
|
| Flag that enables the Repo server during Argo CD installation. |
|
| Execution timeout in seconds for rendering tools, for example, Helm or Kustomize. |
|
| 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 container image for Argo CD Repo server. This propery overrides the |
|
| List of custom labels to add to pods deployed by the Operator. This field is optional. |
|
|
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 |
|
|
Defines whether the |
|
| Specifies the remote URL of the Repo server container. |
|
|
The number of replicas for the Argo CD Repo server. Must be greater than or equal to |
|
| The container compute resources. |
|
|
The name of the |
|
|
The number of |
|
| Defines whether to enforce strict TLS checking on all components when communicating with repo server. |
|
same as | The tag to use with the Argo CD Repo server. |
|
| 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. |
2.3. Enabling notifications with an Argo CD instance Copier lienLien copié sur presse-papiers!
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
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 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}}}'
oc patch argocd openshift-gitops -n openshift-gitops --type merge --patch '{"spec": {"notifications": {"enabled": true}}}'
2.4. Enabling Config Management Plugins in an Argo CD CR Copier lienLien copié sur presse-papiers!
Argo CD provides support for Helm, Jsonnet, and Kustomize as built-in config management tools. To use a different config management tool, or to enable features not provided by the built-in config management tools, you can use the Config Management Plugin (CMP).
In Argo CD, the CMP is specified as a sidecar container for the Argo CD repo server container. For more information, see "Config Management Plugins".
In the Red Hat OpenShift GitOps Operator, you can configure the Config Management plugin as a sidecar container in the Argo CD custom resource (CR). When you configure the sidecar container, you either specify an off-the-shelf or a custom-built container image. If you do not specify an image, the system uses the same image as the repo server for the plugin.
To configure a sidecar container in the Red Hat OpenShift GitOps Operator, add the .spec.repo.sidecarContainers
key in the Argo CD CR.
Example Config Management Plugin configuration
2.5. NotificationsConfiguration custom resource properties Copier lienLien copié sur presse-papiers!
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
Example for triggers
Example for services
Example for subscriptions
You can configure the NotificationsConfiguration
CR by using the OpenShift Container Platform web console or the CLI (oc
).
2.5.1. Configuring the NotificationsConfiguration CR by using the web console Copier lienLien copié sur presse-papiers!
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}}.
template.my-custom-template: | message: | Application details: {{.context.argocdUrl}}/applications/{{.app.metadata.name}}.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 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.5.2. Configuring the NotificationsConfiguration CR by using the CLI Copier lienLien copié sur presse-papiers!
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>
$ oc edit notificationsconfiguration default-notifications-configuration -n <namespace>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 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}}.
template.my-custom-template: | message: | Application details: {{.context.argocdUrl}}/applications/{{.app.metadata.name}}.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Verify the contents of the
argocd-notifications-cm
config map by running the following command:oc edit cm argocd-notifications-cm -n <namespace>
$ oc edit cm argocd-notifications-cm -n <namespace>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The changes made in the existing configuration of the
NotificationsConfiguration
CR are reflected in theargocd-notifications-cm
config map.
2.6. Enabling annotation-based resource tracking in Argo CD Copier lienLien copié sur presse-papiers!
Red Hat OpenShift GitOps Operator enhances multi-instance support by improving annotation-based resource tracking in Argo CD. Previously, multiple Argo CD instances did not differentiate resources with identical application names properly, relying only on legacy label-based tracking. With this enhancement, you can fully leverage annotation-based tracking by assigning each instance a unique installationID
ID. This prevents resource conflicts, eliminates infinite sync loops, and enables safe parallel operation.
You can perform the following actions by using the OpenShift Container Platform web console:
- Set up multiple Argo CD instances
- Configure annotation-based tracking by associating them with namespaces
- Verify deployments
-
Each Argo CD instance must have a unique
installationID
ID to prevent resource tracking conflicts. - Ensure that namespaces are labelled accurately because it allows each Argo CD instance to manage only the intended resources.
-
If multiple instances have applications with the same name, set resource tracking to
annotation+label
. - If issues arise, check the Argo CD Application status and logs in the OpenShift Container Platform web console.
2.6.1. Configuring annotation-based tracking in multiple Argo CD instances Copier lienLien copié sur presse-papiers!
You can configure annotation-based tracking in multiple Argo CD instances.
This procedure uses the following example values:
-
repoURL
:https://github.com/redhat-developer/gitops-operator
-
server
:https://kubernetes.default.svc
When you follow these steps, replace the example values with the actual values.
Pre-requisites
- You have logged in to the OpenShift Container Platform cluster as an administrator.
- You have installed the Red Hat OpenShift GitOps Operator on your OpenShift Container Platform cluster.
Procedure
- Log in to the OpenShift Container Platform web console.
In the Administrator perspective of the web console, click Operators
Installed Operators. - In the Project list, create or select the project where you want to install the user-defined Argo CD instance.
- Select Red Hat OpenShift GitOps from the installed Operators list and click the Argo CD tab.
To create two Argo CD instances, click Create ArgoCD and create two YAML files similar to the following examples:
Example first Argo CD instance with an annotation label
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example second Argo CD instance with an annotation label
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Configure and label target namespaces to associate namespaces with their Argo CD instances.
-
Navigate to Administration
Namespaces. -
Create namespaces for application deployments,
app-ns-1
andapp-ns-2
. Associate each namespace with their respective Argo CD instance:
Associate the
app-ns-1
namespace with theargocd-test-demo-1
Argo CD instance by running the following command:Example command
oc label namespace app-ns-1 argocd.argoproj.io/managed-by=argocd-test-demo-1
$ oc label namespace app-ns-1 argocd.argoproj.io/managed-by=argocd-test-demo-1
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Associate the
app-ns-2
namespace with theargocd-test-demo-2
Argo CD instance by running the following command:Example command
oc label namespace app-ns-2 argocd.argoproj.io/managed-by=argocd-test-demo-2
$ oc label namespace app-ns-2 argocd.argoproj.io/managed-by=argocd-test-demo-2
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
-
Navigate to Administration
Create two applications in Argo CD.
-
In the OpenShift Container Platform web console, go to Operators
Installed Operators OpenShift GitOps Operator. - Select Argo CD and navigate to the Applications tab.
- Click Create Application.
Enter the following YAML snippet to create two applications in Argo CD.
Example first application using Argo CD
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example second application using Argo CD
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
-
In the OpenShift Container Platform web console, go to Operators
Verification
-
Navigate to Workloads
Pods in the OpenShift Container Platform web console. -
Ensure that the pods for Argo CD instances
argocd-instance-demo-1
andargocd-instance-demo-2
are running. - Check the application synchronization status in the Argo CD Applications YAML tab.
-
Navigate to the
argocd-cm
config map inargocd-test-demo-1
andargocd-test-demo-2
namespaces and verify that theinstallationID
object is configured successfully.