From c8f0471bd0a68c2eaac3115a4aa57d3bb4966bc8 Mon Sep 17 00:00:00 2001 From: Ian Muge <13362741+ianmuge@users.noreply.github.com> Date: Mon, 14 Mar 2022 22:12:41 +0100 Subject: [PATCH] feat(argo-rollouts): Add notification secret and configmap (#1163) * fixing the error on the argo rollouts controller needing the notifications configmap and rollout Signed-off-by: Ian Muge * bump chart version Signed-off-by: Ian Muge * updating changelog Signed-off-by: Ian Muge * fix structure to be simialr to argocd-notification as suggested Signed-off-by: Ian Muge * Bump Minor version as we are adding a new feature Signed-off-by: Ian Muge * Updated helm docs, all tests are green, locally Signed-off-by: Ian Muge * Apply changes from code review Signed-off-by: Marco Kilchhofer Co-authored-by: Marco Kilchhofer --- charts/argo-rollouts/Chart.yaml | 4 +-- charts/argo-rollouts/README.md | 7 ++++- .../controller/notifcations-configmap.yaml | 17 ++++++++++ .../controller/notifications-secret.yaml | 14 +++++++++ charts/argo-rollouts/values.yaml | 31 +++++++++++++++++++ 5 files changed, 70 insertions(+), 3 deletions(-) create mode 100644 charts/argo-rollouts/templates/controller/notifcations-configmap.yaml create mode 100644 charts/argo-rollouts/templates/controller/notifications-secret.yaml diff --git a/charts/argo-rollouts/Chart.yaml b/charts/argo-rollouts/Chart.yaml index 9acbdbd5..21275d94 100644 --- a/charts/argo-rollouts/Chart.yaml +++ b/charts/argo-rollouts/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 appVersion: "v1.1.1" description: A Helm chart for Argo Rollouts name: argo-rollouts -version: 2.10.0 +version: 2.11.0 icon: https://argoproj.github.io/argo-rollouts/assets/logo.png home: https://github.com/argoproj/argo-helm maintainers: @@ -11,4 +11,4 @@ maintainers: - name: jessesuen annotations: artifacthub.io/changes: | - - "[Added]: Ability to define dashboard service node port" + - "[Added]: Argo rollouts notification secret and configmap" diff --git a/charts/argo-rollouts/README.md b/charts/argo-rollouts/README.md index 4230a3f8..b8aa2b95 100644 --- a/charts/argo-rollouts/README.md +++ b/charts/argo-rollouts/README.md @@ -48,6 +48,11 @@ If dashboard is installed by `--set dashboard.enabled=true`, checkout the argo-r | keepCRDs | bool | `true` | Keep CRD's on helm uninstall | | kubeVersionOverride | string | `""` | Override the Kubernetes version, which is used to evaluate certain manifests | | nameOverride | string | `nil` | String to partially override "argo-rollouts.fullname" template | +| notifications.notifiers | object | `{}` | Configures notification services | +| notifications.secret.create | bool | `false` | Whether to create notifications secret | +| notifications.secret.items | object | `{}` | Generic key:value pairs to be inserted into the notifications secret | +| notifications.templates | object | `{}` | Notification templates | +| notifications.triggers | object | `{}` | The trigger defines the condition when the notification should be sent | ### Controller @@ -148,4 +153,4 @@ Autogenerated from chart metadata using [helm-docs](https://github.com/norwoodj/ [Node selector]: https://kubernetes.io/docs/user-guide/node-selection/ [probe]: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#container-probes [Tolerations]: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ -[values.yaml]: https://github.com/argoproj/argo-helm/blob/argo-rollouts-2.10.0/charts/argo-rollouts/values.yaml +[values.yaml]: https://github.com/argoproj/argo-helm/blob/argo-rollouts-2.11.0/charts/argo-rollouts/values.yaml diff --git a/charts/argo-rollouts/templates/controller/notifcations-configmap.yaml b/charts/argo-rollouts/templates/controller/notifcations-configmap.yaml new file mode 100644 index 00000000..3008b327 --- /dev/null +++ b/charts/argo-rollouts/templates/controller/notifcations-configmap.yaml @@ -0,0 +1,17 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: argo-rollouts-notification-configmap + labels: + app.kubernetes.io/component: {{ .Values.controller.component }} + {{- include "argo-rollouts.labels" . | nindent 4 }} +data: + {{- with .Values.notifications.notifiers }} + {{- toYaml . | nindent 2 }} + {{- end }} + {{- with .Values.notifications.templates }} + {{- toYaml . | nindent 2 }} + {{- end }} + {{- with .Values.notifications.triggers }} + {{- toYaml . | nindent 2 }} + {{- end }} diff --git a/charts/argo-rollouts/templates/controller/notifications-secret.yaml b/charts/argo-rollouts/templates/controller/notifications-secret.yaml new file mode 100644 index 00000000..4e9cc64c --- /dev/null +++ b/charts/argo-rollouts/templates/controller/notifications-secret.yaml @@ -0,0 +1,14 @@ +{{ if .Values.notifications.secret.create }} +apiVersion: v1 +kind: Secret +metadata: + name: argo-rollouts-notification-secret + labels: + app.kubernetes.io/component: {{ .Values.controller.component }} + {{- include "argo-rollouts.labels" . | nindent 4 }} +type: Opaque +stringData: + {{- with .Values.notifications.secret.items }} + {{- toYaml . | nindent 2 }} + {{- end }} +{{- end }} diff --git a/charts/argo-rollouts/values.yaml b/charts/argo-rollouts/values.yaml index 94e80379..42d32de0 100644 --- a/charts/argo-rollouts/values.yaml +++ b/charts/argo-rollouts/values.yaml @@ -237,3 +237,34 @@ dashboard: # - secretName: argorollouts-example-tls # hosts: # - argorollouts.example.com + +notifications: + secret: + # -- Whether to create notifications secret + create: false + # -- Generic key:value pairs to be inserted into the notifications secret + items: {} + # slack-token: + + # -- Configures notification services + notifiers: {} + # service.slack: | + # token: $slack-token + + # -- Notification templates + templates: {} + # template.my-purple-template: | + # message: | + # Rollout {{.rollout.metadata.name}} has purple image + # slack: + # attachments: | + # [{ + # "title": "{{ .rollout.metadata.name}}", + # "color": "#800080" + # }] + + # -- The trigger defines the condition when the notification should be sent + triggers: {} + # trigger.on-purple: | + # - send: [my-purple-template] + # when: rollout.spec.template.spec.containers[0].image == 'argoproj/rollouts-demo:purple'