diff --git a/README.md b/README.md index 80f8f15..13f8eb8 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,9 @@ their default values. | `persistence.size` | Amount of space to claim for PVC | `10Gi` | | `persistence.storageClass` | Storage Class to use for PVC | `-` | | `persistence.existingClaim` | Name of an existing PVC to use for config | `nil` | +| `serviceAccount.create` | Create ServiceAccount | `false` | +| `serviceAccount.name` | ServiceAccount name | `nil` | +| `serviceAccount.annotations` | Annotations to add to the ServiceAccount | `{}` | | `service.port` | TCP port on which the service is exposed | `5000` | | `service.type` | service type | `ClusterIP` | | `service.clusterIP` | if `service.type` is `ClusterIP` and this is non-empty, sets the cluster IP of the service | `nil` | diff --git a/templates/deployment.yaml b/templates/deployment.yaml index 1a25c05..ecc98e2 100644 --- a/templates/deployment.yaml +++ b/templates/deployment.yaml @@ -33,6 +33,9 @@ spec: {{ toYaml $.Values.podAnnotations | indent 8 }} {{- end }} spec: +{{- if or (eq .Values.serviceAccount.create true) (ne .Values.serviceAccount.name "") }} + serviceAccountName: {{ .Values.serviceAccount.name | default (include "docker-registry.fullname" .) }} +{{- end }} {{- if .Values.imagePullSecrets }} imagePullSecrets: {{ toYaml .Values.imagePullSecrets | indent 8 }} diff --git a/templates/serviceaccount.yaml b/templates/serviceaccount.yaml new file mode 100644 index 0000000..054ef1a --- /dev/null +++ b/templates/serviceaccount.yaml @@ -0,0 +1,19 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + labels: + app: {{ template "docker-registry.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version }} + heritage: {{ .Release.Service }} + release: {{ .Release.Name }} +{{- if .Values.serviceAccount.name }} + name: {{ .Values.serviceAccount.name }} +{{- else }} + name: {{ include "docker-registry.fullname" . }} +{{- end }} +{{- if .Values.serviceAccount.annotations }} + annotations: +{{ toYaml .Values.serviceAccount.annotations | indent 4 }} +{{- end }} +{{- end -}} diff --git a/values.yaml b/values.yaml index f27686e..ad49095 100644 --- a/values.yaml +++ b/values.yaml @@ -12,6 +12,11 @@ updateStrategy: {} podAnnotations: {} podLabels: {} +serviceAccount: + create: false + name: "" + annotations: {} + image: repository: registry tag: 2.7.1