diff --git a/charts/flagger/README.md b/charts/flagger/README.md index 3641cac2..12e91463 100644 --- a/charts/flagger/README.md +++ b/charts/flagger/README.md @@ -64,6 +64,8 @@ Parameter | Description | Default `slack.channel` | Slack channel | None `slack.user` | Slack username | `flagger` `msteams.url` | Microsoft Teams incoming webhook | None +`leaderElection.enabled` | leader election must be enabled when running more than one replica | `false` +`leaderElection.replicaCount` | number of replicas | `1` `rbac.create` | if `true`, create and use RBAC resources | `true` `rbac.pspEnabled` | If `true`, create and use a restricted pod security policy | `false` `crd.create` | if `true`, create Flagger's CRDs | `true` diff --git a/charts/flagger/templates/deployment.yaml b/charts/flagger/templates/deployment.yaml index 24f59b01..268224c8 100644 --- a/charts/flagger/templates/deployment.yaml +++ b/charts/flagger/templates/deployment.yaml @@ -8,7 +8,7 @@ metadata: app.kubernetes.io/managed-by: {{ .Release.Service }} app.kubernetes.io/instance: {{ .Release.Name }} spec: - replicas: 1 + replicas: {{ .Values.leaderElection.replicaCount }} strategy: type: Recreate selector: @@ -22,6 +22,16 @@ spec: app.kubernetes.io/instance: {{ .Release.Name }} spec: serviceAccountName: {{ template "flagger.serviceAccountName" . }} + affinity: + podAntiAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - weight: 100 + podAffinityTerm: + labelSelector: + matchLabels: + app.kubernetes.io/name: {{ template "flagger.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + topologyKey: kubernetes.io/hostname containers: - name: flagger securityContext: @@ -54,6 +64,10 @@ spec: {{- if .Values.msteams.url }} - -msteams-url={{ .Values.msteams.url }} {{- end }} + {{- if .Values.leaderElection.enabled }} + - -enable-leader-election=true + - -leader-election-namespace={{ .Release.Namespace }} + {{- end }} livenessProbe: exec: command: @@ -78,10 +92,6 @@ spec: {{ toYaml .Values.resources | indent 12 }} {{- with .Values.nodeSelector }} nodeSelector: -{{ toYaml . | indent 8 }} - {{- end }} - {{- with .Values.affinity }} - affinity: {{ toYaml . | indent 8 }} {{- end }} {{- with .Values.tolerations }} diff --git a/charts/flagger/values.yaml b/charts/flagger/values.yaml index d99717dd..185b0a53 100644 --- a/charts/flagger/values.yaml +++ b/charts/flagger/values.yaml @@ -23,6 +23,10 @@ msteams: # MS Teams incoming webhook URL url: +leaderElection: + enabled: false + replicaCount: 1 + serviceAccount: # serviceAccount.create: Whether to create a service account or not create: true @@ -54,8 +58,6 @@ nodeSelector: {} tolerations: [] -affinity: {} - prometheus: # to be used with AppMesh or nginx ingress install: false