Skip to content

Commit

Permalink
Issue 6773: Added support to pass multiple imagePullSecrets as array …
Browse files Browse the repository at this point in the history
…of string / maps (dapr#6793)

* Issue 6773: Added support to pass multiple imagePullSecrets as array of string / maps

Signed-off-by: mustaFAB53 <mustafa.bhabhrawala@infracloud.io>

* Issue 6773: Updated default for imagepullsecret

Signed-off-by: mustaFAB53 <mustafa.bhabhrawala@infracloud.io>

* Issue 6773: Added suggested changes

Co-authored-by: Alessandro (Ale) Segala <43508+ItalyPaleAle@users.noreply.github.com>
Signed-off-by: Mustafa Bhabhrawala <38005442+mustaFAB53@users.noreply.github.com>

---------

Signed-off-by: mustaFAB53 <mustafa.bhabhrawala@infracloud.io>
Signed-off-by: Mustafa Bhabhrawala <38005442+mustaFAB53@users.noreply.github.com>
Co-authored-by: Alessandro (Ale) Segala <43508+ItalyPaleAle@users.noreply.github.com>
Co-authored-by: Yaron Schneider <schneider.yaron@live.com>
  • Loading branch information
3 people authored Sep 5, 2023
1 parent f2f23c9 commit f16bba6
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 5 deletions.
2 changes: 1 addition & 1 deletion charts/dapr/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ The Helm chart has the follow configuration options that can be supplied:
| `global.tag` | Docker image version tag | latest release |
| `global.logAsJson` | Json log format for control plane services | `false` |
| `global.imagePullPolicy` | Global Control plane service imagePullPolicy | `IfNotPresent` |
| `global.imagePullSecrets` | Control plane service images pull secrets for docker registry | `""` |
| `global.imagePullSecrets` | Control plane service images pull secrets for docker registry. Its value can be: a string with single imagePullSecret, an array of `{name: pullSecret}` maps (Kubernetes-style), or an array of strings | `[]` |
| `global.ha.enabled` | Highly Availability mode enabled for control plane | `false` |
| `global.ha.replicaCount` | Number of replicas of control plane services in Highly Availability mode<br>Note that in HA mode, Dapr Placement has 3 replicas and that cannot be configured. | `3` |
| `global.ha.disruption.minimumAvailable` | Minimum amount of available instances for control plane. This can either be effective count or %. | `` |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ spec:
{{- end }}
{{- if .Values.global.imagePullSecrets }}
imagePullSecrets:
- name: {{ .Values.global.imagePullSecrets }}
{{- include "dapr.imagePullSecrets" (dict "imagePullSecrets" .Values.global.imagePullSecrets) | nindent 8 }}
{{- end }}
{{- if .Values.global.nodeSelector }}
nodeSelector:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ spec:
{{- end }}
{{- if .Values.global.imagePullSecrets }}
imagePullSecrets:
- name: {{ .Values.global.imagePullSecrets }}
{{- include "dapr.imagePullSecrets" (dict "imagePullSecrets" .Values.global.imagePullSecrets) | nindent 8 }}
{{- end }}
{{- if .Values.global.nodeSelector }}
nodeSelector:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ spec:
{{- end }}
{{- if .Values.global.imagePullSecrets }}
imagePullSecrets:
- name: {{ .Values.global.imagePullSecrets }}
{{- include "dapr.imagePullSecrets" (dict "imagePullSecrets" .Values.global.imagePullSecrets) | nindent 8 }}
{{- end }}
{{- if .Values.global.nodeSelector }}
nodeSelector:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ spec:
{{- end }}
{{- if .Values.global.imagePullSecrets }}
imagePullSecrets:
- name: {{ .Values.global.imagePullSecrets }}
{{- include "dapr.imagePullSecrets" (dict "imagePullSecrets" .Values.global.imagePullSecrets) | nindent 8 }}
{{- end }}
{{- if .Values.global.nodeSelector }}
nodeSelector:
Expand Down
17 changes: 17 additions & 0 deletions charts/dapr/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,20 @@ Create chart name and version as used by the chart label.
{{- define "k8s_operator.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Formats imagePullSecrets. Input is dict( "imagePullSecrets" .{specific imagePullSecrets}).
*/}}
{{- define "dapr.imagePullSecrets" -}}
{{- if eq (typeOf .imagePullSecrets) "string" }}
- name: {{ .imagePullSecrets }}
{{- else }}
{{- range .imagePullSecrets }}
{{- if eq (typeOf .) "map[string]interface {}" }}
- {{ toYaml (dict "name" .name) | trim }}
{{- else }}
- name: {{ . }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
16 changes: 16 additions & 0 deletions charts/dapr/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,23 @@ global:
dnsSuffix: ".cluster.local"
logAsJson: false
imagePullPolicy: IfNotPresent

# To help compatibility with other charts which use global.imagePullSecrets.
# Allow either a string with single imagepullsecret or an array of {name: pullSecret} maps (k8s-style) or an array of strings (more common helm-style).
# global:
# imagePullSecrets: "pullSecret"
# or
# global:
# imagePullSecrets:
# - name: pullSecret1
# - name: pullSecret2
# or
# global:
# imagePullSecrets:
# - pullSecret1
# - pullSecret2
imagePullSecrets: ""

nodeSelector: {}
tolerations: []
rbac:
Expand Down

0 comments on commit f16bba6

Please sign in to comment.