From cf5878d6c2c3d87aa9dece3679b2ffbe7be17a60 Mon Sep 17 00:00:00 2001 From: Emanuele Massara Date: Wed, 29 Jan 2020 20:48:15 +0000 Subject: [PATCH] [stable/sonatype-nexus]: added support for service account (#20032) * feat(sonatype-nexus): added support for service account Signed-off-by: Emanuele Massara * [stable/sonatype-nexus]: added support for service account Signed-off-by: Emanuele Massara --- stable/sonatype-nexus/Chart.yaml | 2 +- stable/sonatype-nexus/README.md | 3 +++ .../sonatype-nexus/templates/deployment-statefulset.yaml | 5 +++++ stable/sonatype-nexus/templates/serviceaccount.yaml | 9 +++++++++ stable/sonatype-nexus/values.yaml | 8 ++++++++ 5 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 stable/sonatype-nexus/templates/serviceaccount.yaml diff --git a/stable/sonatype-nexus/Chart.yaml b/stable/sonatype-nexus/Chart.yaml index dc2bc4a202..95323c9545 100644 --- a/stable/sonatype-nexus/Chart.yaml +++ b/stable/sonatype-nexus/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v1 name: sonatype-nexus -version: 1.21.4 +version: 1.22.0 appVersion: 3.20.1-01 description: Sonatype Nexus is an open source repository manager keywords: diff --git a/stable/sonatype-nexus/README.md b/stable/sonatype-nexus/README.md index 386ba9c1fb..cf64e02f1a 100644 --- a/stable/sonatype-nexus/README.md +++ b/stable/sonatype-nexus/README.md @@ -150,6 +150,9 @@ The following table lists the configurable parameters of the Nexus chart and the | `service.loadBalancerSourceRanges` | Service LoadBalancer source IP whitelist | `nil` | | `service.targetPort` | Service port | `nil` | | `service.port` | Port for exposing service | `nil` | +| `serviceAccount.create` | Automatically create a service account | `true` | +| `serviceAccount.name` | Service account to use | `nil` | +| `serviceAccount.annotations` | Service account annotations | `nil` | | `route.enabled` | Set to true to create route for additional service | `false` | | `route.name` | Name of route | `docker` | | `route.portName` | Target port name of service | `docker` | diff --git a/stable/sonatype-nexus/templates/deployment-statefulset.yaml b/stable/sonatype-nexus/templates/deployment-statefulset.yaml index 1c3028a0e8..8eca07bb15 100644 --- a/stable/sonatype-nexus/templates/deployment-statefulset.yaml +++ b/stable/sonatype-nexus/templates/deployment-statefulset.yaml @@ -59,6 +59,11 @@ spec: imagePullSecrets: - name: {{ .Values.nexus.imagePullSecret }} {{- end }} + {{- if .Values.serviceAccount.create }} + serviceAccountName: {{ template "nexus.fullname" . }} + {{- else }} + serviceAccountName: {{ .Values.serviceAccount.name | quote }} + {{- end }} containers: - name: nexus image: {{ .Values.nexus.imageName }}:{{ .Values.nexus.imageTag }} diff --git a/stable/sonatype-nexus/templates/serviceaccount.yaml b/stable/sonatype-nexus/templates/serviceaccount.yaml new file mode 100644 index 0000000000..72dc7b5661 --- /dev/null +++ b/stable/sonatype-nexus/templates/serviceaccount.yaml @@ -0,0 +1,9 @@ +{{- if .Values.serviceAccount.create }} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ template "nexus.fullname" . }} + {{- if .Values.serviceAccount.annotations }} + annotations: {{ toYaml .Values.serviceAccount.annotations | nindent 4 }} + {{- end }} +{{- end }} diff --git a/stable/sonatype-nexus/values.yaml b/stable/sonatype-nexus/values.yaml index 15c2d994a4..67def8b0e0 100644 --- a/stable/sonatype-nexus/values.yaml +++ b/stable/sonatype-nexus/values.yaml @@ -154,6 +154,14 @@ nexusBackup: # pdName: nexus-backup-disk # fsType: ext4 +serviceAccount: + # Specifies whether a service account should be created + create: true + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: + annotations: {} + ingress: enabled: false path: /