이 콘텐츠는 선택한 언어로 제공되지 않습니다.
Chapter 3. Configure webhook secrets for Git providers
You can configure webhook secrets for Git providers declaratively by using the Argo CD custom resource (CR). This allows you to manage webhook credentials alongside your GitOps configuration instead of manually updating the argocd-secret secret.
3.1. Declarative webhook secrets for Git providers 링크 복사링크가 클립보드에 복사되었습니다!
Argo CD uses webhook secrets to validate incoming webhook requests from Git providers. You can configure webhook secrets declaratively by using the spec.webhookSecrets field in the Argo CD custom resource (CR).
Using declarative webhook secrets provides the following benefits:
- Manage webhook secrets together with Argo CD configuration
- Integrate with Kubernetes secret management tools, such as Sealed Secrets or External Secrets Operator
-
Simplify operations by allowing the Red Hat OpenShift GitOps Operator to synchronize referenced secret values to the
argocd-secretsecret -
Configure webhook secrets for multiple Git providers in a single
ArgoCDCR
When you configure spec.webhookSecrets, the Red Hat OpenShift GitOps Operator automatically populates the required keys in the argocd-secret secret that Argo CD uses internally.
The referenced Secret resource must exist in the same namespace as the Argo CD CR. Cross-namespace secret references are not supported.
The following Git providers are supported for declarative webhook secret configuration:
| Provider | Field in spec.webhookSecrets | Required secret reference |
|---|---|---|
| GitHub |
|
|
| GitLab |
|
|
| Bitbucket Cloud |
|
|
| Bitbucket Server |
|
|
| Gogs |
|
|
| Azure DevOps |
|
|
When spec.webhookSecrets is configured, the Red Hat OpenShift GitOps Operator synchronizes webhook secret values only for the declared providers. Webhook keys for providers that are not declared in spec.webhookSecrets might be removed from the argocd-secret secret.
Do not store plain-text secrets in Git repositories. Use secret management solutions, such as sealed secrets or external secrets Operator, to manage sensitive data securely.
3.2. Create webhook secrets using the Argo CD CR 링크 복사링크가 클립보드에 복사되었습니다!
You can configure webhook secrets for Git providers by creating a Kubernetes Secret resource and referencing it in the Argo CD custom resource (CR).
Prerequisites
- You have installed the Red Hat OpenShift GitOps Operator.
-
You have created an
ArgoCDinstance. - You have configured a webhook in your Git provider.
Procedure
Create a
Secretresource in the same namespace as theArgoCDCR and configure thespec.webhookSecretsfield in theArgoCDCR.The following example configures a webhook secret for GitHub:
apiVersion: v1 kind: Secret metadata: name: github-webhook-credentials namespace: argocd labels: app.kubernetes.io/part-of: argocd app.kubernetes.io/component: webhook type: Opaque stringData: token: "your-github-webhook-secret" --- apiVersion: argoproj.io/v1beta1 kind: ArgoCD metadata: name: example-argocd namespace: argocd spec: webhookSecrets: github: webhookSecretRef: name: github-webhook-credentials key: tokenApply the configuration:
$ oc apply -f webhook-secret.yaml
3.3. Verify declarative webhook secret configuration 링크 복사링크가 클립보드에 복사되었습니다!
After configuring declarative webhook secrets, verify that the Red Hat OpenShift GitOps Operator synchronized the webhook secret values to the argocd-secret secret.
Procedure
Run the following command to verify the configured GitHub webhook secret:
$ oc get secret argocd-secret -n <namespace> -o jsonpath='{.data.webhook\.github\.secret}' | base64 -dwhere:
<namespace>-
Specifies the namespace where your Argo CD instance is installed, such as
openshift-gitopsfor the default instance.
-
Verify that the command output matches the value stored in the Secret referenced by
spec.webhookSecrets.github.webhookSecretRef.
After updating webhook secrets, the Argo CD server might need to restart to pick up the updated values.
Run the following command to restart the Argo CD server deployment:
$ oc rollout restart deployment/<argocd_cr_name>-server -n <namespace>
where:
<argocd_cr_name>- Specifies the name of your Argo CD custom resource.
<namespace>- Specifies the namespace where your Argo CD instance is installed.