From 3a2858aa98f607b495d34db0da2a7a3ecad3eaa0 Mon Sep 17 00:00:00 2001 From: ericpdurand Date: Fri, 18 Mar 2022 17:41:56 +0100 Subject: [PATCH] feat(argo-cd): Adding applicationSet.enable and notifications.enable (#1181) * feat(argo-cd) Adding applicationSet.enable and notifications.enable to allow to disable them Signed-off-by: Eric Durand * Fixing Chart version and redudant ifs Signed-off-by: Eric Durand eric_p_durand@yahoo.com Signed-off-by: Eric Durand * Detail the change Signed-off-by: Eric Durand * Drop one more redundant if Signed-off-by: Marco Kilchhofer Co-authored-by: Marco Kilchhofer --- charts/argo-cd/Chart.yaml | 4 ++-- charts/argo-cd/README.md | 2 ++ .../argo-cd/templates/argocd-applicationset/deployment.yaml | 2 ++ .../templates/argocd-applicationset/metrics-service.yaml | 2 +- charts/argo-cd/templates/argocd-applicationset/role.yaml | 2 ++ .../templates/argocd-applicationset/rolebinding.yaml | 2 ++ charts/argo-cd/templates/argocd-applicationset/service.yaml | 2 ++ .../templates/argocd-applicationset/serviceaccount.yaml | 2 +- .../templates/argocd-applicationset/servicemonitor.yaml | 2 ++ .../templates/argocd-applicationset/webhook-ingress.yaml | 2 +- .../argo-cd/templates/argocd-notifications/configmap.yaml | 2 +- .../argo-cd/templates/argocd-notifications/deployment.yaml | 2 ++ charts/argo-cd/templates/argocd-notifications/role.yaml | 2 ++ .../argo-cd/templates/argocd-notifications/rolebinding.yaml | 2 ++ charts/argo-cd/templates/argocd-notifications/secret.yaml | 2 +- .../templates/argocd-notifications/service-metrics.yaml | 2 +- .../templates/argocd-notifications/serviceaccount.yaml | 2 +- .../templates/argocd-notifications/servicemonitor.yaml | 2 +- charts/argo-cd/values.yaml | 6 ++++++ 19 files changed, 34 insertions(+), 10 deletions(-) diff --git a/charts/argo-cd/Chart.yaml b/charts/argo-cd/Chart.yaml index 89ee7bae..e9ef680c 100644 --- a/charts/argo-cd/Chart.yaml +++ b/charts/argo-cd/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 appVersion: v2.3.1 description: A Helm chart for Argo CD, a declarative, GitOps continuous delivery tool for Kubernetes. name: argo-cd -version: 4.1.0 +version: 4.2.0 home: https://github.com/argoproj/argo-helm icon: https://argo-cd.readthedocs.io/en/stable/assets/logo.png keywords: @@ -21,4 +21,4 @@ dependencies: condition: redis-ha.enabled annotations: artifacthub.io/changes: | - - "[Changed]: added notifications.metrics.serviceMonitor.selector value" + - "[Added]: added applicationSet.enabled and notifications.enabled to allow to disable them" diff --git a/charts/argo-cd/README.md b/charts/argo-cd/README.md index daa7e5c1..d2d61dec 100644 --- a/charts/argo-cd/README.md +++ b/charts/argo-cd/README.md @@ -658,6 +658,7 @@ NAME: my-release | applicationSet.args.metricsAddr | string | `":8080"` | The default metric address | | applicationSet.args.policy | string | `"sync"` | How application is synced between the generator and the cluster | | applicationSet.args.probeBindAddr | string | `":8081"` | The default health check port | +| applicationSet.enabled | bool | `true` | Enable Application Set controller | | applicationSet.extraArgs | list | `[]` | List of extra cli args to add | | applicationSet.extraContainers | list | `[]` | Additional containers to be added to the applicationset controller pod | | applicationSet.extraEnv | list | `[]` | Environment variables to pass to the controller | @@ -734,6 +735,7 @@ NAME: my-release | notifications.cm.name | string | `""` | The name of the config map to use. | | notifications.containerSecurityContext | object | `{}` | Container Security Context | | notifications.context | object | `{}` | Define user-defined context | +| notifications.enabled | bool | `true` | Enable Notifications controller | | notifications.extraArgs | list | `[]` | Extra arguments to provide to the controller | | notifications.extraEnv | list | `[]` | Additional container environment variables | | notifications.extraVolumeMounts | list | `[]` | List of extra mounts to add (normally used with extraVolumes) | diff --git a/charts/argo-cd/templates/argocd-applicationset/deployment.yaml b/charts/argo-cd/templates/argocd-applicationset/deployment.yaml index 83ad1834..80b0bf5a 100644 --- a/charts/argo-cd/templates/argocd-applicationset/deployment.yaml +++ b/charts/argo-cd/templates/argocd-applicationset/deployment.yaml @@ -1,3 +1,4 @@ +{{- if .Values.applicationSet.enabled }} apiVersion: apps/v1 kind: Deployment metadata: @@ -124,3 +125,4 @@ spec: {{- with .Values.applicationSet.priorityClassName }} priorityClassName: {{ . }} {{- end }} +{{- end }} diff --git a/charts/argo-cd/templates/argocd-applicationset/metrics-service.yaml b/charts/argo-cd/templates/argocd-applicationset/metrics-service.yaml index ba9a630a..bba26e4c 100644 --- a/charts/argo-cd/templates/argocd-applicationset/metrics-service.yaml +++ b/charts/argo-cd/templates/argocd-applicationset/metrics-service.yaml @@ -1,4 +1,4 @@ -{{- if .Values.applicationSet.metrics.enabled }} +{{- if and .Values.applicationSet.enabled .Values.applicationSet.metrics.enabled }} apiVersion: v1 kind: Service metadata: diff --git a/charts/argo-cd/templates/argocd-applicationset/role.yaml b/charts/argo-cd/templates/argocd-applicationset/role.yaml index 7e2a2c89..dc83f06a 100644 --- a/charts/argo-cd/templates/argocd-applicationset/role.yaml +++ b/charts/argo-cd/templates/argocd-applicationset/role.yaml @@ -1,3 +1,4 @@ +{{- if .Values.applicationSet.enabled }} apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: @@ -81,3 +82,4 @@ rules: - patch - update - watch +{{- end }} diff --git a/charts/argo-cd/templates/argocd-applicationset/rolebinding.yaml b/charts/argo-cd/templates/argocd-applicationset/rolebinding.yaml index 7bc5e055..91cddeae 100644 --- a/charts/argo-cd/templates/argocd-applicationset/rolebinding.yaml +++ b/charts/argo-cd/templates/argocd-applicationset/rolebinding.yaml @@ -1,3 +1,4 @@ +{{- if .Values.applicationSet.enabled }} apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: @@ -12,3 +13,4 @@ subjects: - kind: ServiceAccount name: {{ template "argo-cd.applicationSetServiceAccountName" . }} namespace: {{ .Release.Namespace }} +{{- end }} diff --git a/charts/argo-cd/templates/argocd-applicationset/service.yaml b/charts/argo-cd/templates/argocd-applicationset/service.yaml index fc116fb1..db836f04 100644 --- a/charts/argo-cd/templates/argocd-applicationset/service.yaml +++ b/charts/argo-cd/templates/argocd-applicationset/service.yaml @@ -1,3 +1,4 @@ +{{- if .Values.applicationSet.enabled }} apiVersion: v1 kind: Service metadata: @@ -17,3 +18,4 @@ spec: targetPort: {{ .Values.applicationSet.containerPort }} selector: {{- include "argo-cd.selectorLabels" (dict "context" . "name" .Values.applicationSet.name) | nindent 4 }} +{{- end }} diff --git a/charts/argo-cd/templates/argocd-applicationset/serviceaccount.yaml b/charts/argo-cd/templates/argocd-applicationset/serviceaccount.yaml index 9a690efe..4fafac8d 100644 --- a/charts/argo-cd/templates/argocd-applicationset/serviceaccount.yaml +++ b/charts/argo-cd/templates/argocd-applicationset/serviceaccount.yaml @@ -1,4 +1,4 @@ -{{- if .Values.applicationSet.serviceAccount.create }} +{{- if and .Values.applicationSet.enabled .Values.applicationSet.serviceAccount.create }} apiVersion: v1 kind: ServiceAccount automountServiceAccountToken: {{ .Values.applicationSet.serviceAccount.automountServiceAccountToken }} diff --git a/charts/argo-cd/templates/argocd-applicationset/servicemonitor.yaml b/charts/argo-cd/templates/argocd-applicationset/servicemonitor.yaml index 2e89c759..1ad3f765 100644 --- a/charts/argo-cd/templates/argocd-applicationset/servicemonitor.yaml +++ b/charts/argo-cd/templates/argocd-applicationset/servicemonitor.yaml @@ -1,3 +1,4 @@ +{{- if .Values.applicationSet.enabled }} {{- if and .Values.applicationSet.metrics.enabled .Values.applicationSet.metrics.serviceMonitor.enabled }} apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor @@ -36,3 +37,4 @@ spec: matchLabels: {{- include "argo-cd.selectorLabels" (dict "context" . "component" .Values.applicationSet.name "name" "metrics") | nindent 6 }} {{- end }} +{{- end }} diff --git a/charts/argo-cd/templates/argocd-applicationset/webhook-ingress.yaml b/charts/argo-cd/templates/argocd-applicationset/webhook-ingress.yaml index 3413a8f3..4d1291ba 100644 --- a/charts/argo-cd/templates/argocd-applicationset/webhook-ingress.yaml +++ b/charts/argo-cd/templates/argocd-applicationset/webhook-ingress.yaml @@ -1,4 +1,4 @@ -{{- if .Values.applicationSet.webhook.ingress.enabled -}} +{{- if and .Values.applicationSet.enabled .Values.applicationSet.webhook.ingress.enabled -}} {{- $serviceName := include "argo-cd.applicationSet.fullname" . -}} {{- $servicePort := .Values.applicationSet.service.portName -}} {{- $paths := .Values.applicationSet.webhook.ingress.paths -}} diff --git a/charts/argo-cd/templates/argocd-notifications/configmap.yaml b/charts/argo-cd/templates/argocd-notifications/configmap.yaml index 5806e54b..df1c9a6c 100644 --- a/charts/argo-cd/templates/argocd-notifications/configmap.yaml +++ b/charts/argo-cd/templates/argocd-notifications/configmap.yaml @@ -1,4 +1,4 @@ -{{ if .Values.notifications.cm.create }} +{{- if and .Values.notifications.enabled .Values.notifications.cm.create }} apiVersion: v1 kind: ConfigMap metadata: diff --git a/charts/argo-cd/templates/argocd-notifications/deployment.yaml b/charts/argo-cd/templates/argocd-notifications/deployment.yaml index 23354f89..a6371a66 100644 --- a/charts/argo-cd/templates/argocd-notifications/deployment.yaml +++ b/charts/argo-cd/templates/argocd-notifications/deployment.yaml @@ -1,3 +1,4 @@ +{{- if .Values.notifications.enabled }} apiVersion: apps/v1 kind: Deployment metadata: @@ -104,3 +105,4 @@ spec: tolerations: {{- toYaml . | nindent 8 }} {{- end }} +{{- end }} diff --git a/charts/argo-cd/templates/argocd-notifications/role.yaml b/charts/argo-cd/templates/argocd-notifications/role.yaml index 7e487309..75a88e5f 100644 --- a/charts/argo-cd/templates/argocd-notifications/role.yaml +++ b/charts/argo-cd/templates/argocd-notifications/role.yaml @@ -1,3 +1,4 @@ +{{- if .Values.notifications.enabled }} apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: @@ -40,3 +41,4 @@ rules: - secrets verbs: - get +{{- end }} diff --git a/charts/argo-cd/templates/argocd-notifications/rolebinding.yaml b/charts/argo-cd/templates/argocd-notifications/rolebinding.yaml index a7e81f6e..e78ac5c6 100644 --- a/charts/argo-cd/templates/argocd-notifications/rolebinding.yaml +++ b/charts/argo-cd/templates/argocd-notifications/rolebinding.yaml @@ -1,3 +1,4 @@ +{{- if .Values.notifications.enabled }} apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: @@ -12,3 +13,4 @@ subjects: - kind: ServiceAccount name: {{ template "argo-cd.notificationsServiceAccountName" . }} namespace: {{ .Release.Namespace }} +{{- end }} diff --git a/charts/argo-cd/templates/argocd-notifications/secret.yaml b/charts/argo-cd/templates/argocd-notifications/secret.yaml index c0b33e74..342bf79f 100644 --- a/charts/argo-cd/templates/argocd-notifications/secret.yaml +++ b/charts/argo-cd/templates/argocd-notifications/secret.yaml @@ -1,4 +1,4 @@ -{{ if .Values.notifications.secret.create }} +{{- if and .Values.notifications.enabled .Values.notifications.secret.create }} apiVersion: v1 kind: Secret metadata: diff --git a/charts/argo-cd/templates/argocd-notifications/service-metrics.yaml b/charts/argo-cd/templates/argocd-notifications/service-metrics.yaml index 89ccae39..cdae581c 100644 --- a/charts/argo-cd/templates/argocd-notifications/service-metrics.yaml +++ b/charts/argo-cd/templates/argocd-notifications/service-metrics.yaml @@ -1,4 +1,4 @@ -{{- if .Values.notifications.metrics.enabled }} +{{- if and .Values.notifications.enabled .Values.notifications.metrics.enabled }} apiVersion: v1 kind: Service metadata: diff --git a/charts/argo-cd/templates/argocd-notifications/serviceaccount.yaml b/charts/argo-cd/templates/argocd-notifications/serviceaccount.yaml index 6b573fd2..48c6967f 100644 --- a/charts/argo-cd/templates/argocd-notifications/serviceaccount.yaml +++ b/charts/argo-cd/templates/argocd-notifications/serviceaccount.yaml @@ -1,4 +1,4 @@ -{{- if .Values.notifications.serviceAccount.create }} +{{- if and .Values.notifications.enabled .Values.notifications.serviceAccount.create }} apiVersion: v1 kind: ServiceAccount automountServiceAccountToken: {{ .Values.notifications.serviceAccount.automountServiceAccountToken }} diff --git a/charts/argo-cd/templates/argocd-notifications/servicemonitor.yaml b/charts/argo-cd/templates/argocd-notifications/servicemonitor.yaml index d4554421..d61b3b56 100644 --- a/charts/argo-cd/templates/argocd-notifications/servicemonitor.yaml +++ b/charts/argo-cd/templates/argocd-notifications/servicemonitor.yaml @@ -1,4 +1,4 @@ -{{- if and .Values.notifications.metrics.enabled .Values.notifications.metrics.serviceMonitor.enabled }} +{{- if and .Values.notifications.enabled .Values.notifications.metrics.enabled .Values.notifications.metrics.serviceMonitor.enabled }} apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: diff --git a/charts/argo-cd/values.yaml b/charts/argo-cd/values.yaml index 3ebef289..8bc81b8c 100755 --- a/charts/argo-cd/values.yaml +++ b/charts/argo-cd/values.yaml @@ -1862,6 +1862,9 @@ openshift: enabled: false applicationSet: + # -- Enable Application Set controller + enabled: true + # -- Application Set controller name string name: applicationset-controller @@ -2062,6 +2065,9 @@ applicationSet: # - argocd-applicationset.example.com notifications: + # -- Enable Notifications controller + enabled: true + # -- Notifications controller name string name: notifications-controller