diff --git a/charts/sonarqube/Chart.yaml b/charts/sonarqube/Chart.yaml index df51107..a9696d2 100644 --- a/charts/sonarqube/Chart.yaml +++ b/charts/sonarqube/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v1 name: sonarqube description: SonarQube is an open sourced code quality scanning tool -version: 5.0.0 +version: 5.1.0 appVersion: 8.2-community keywords: - coverage diff --git a/charts/sonarqube/README.md b/charts/sonarqube/README.md index b23be5f..00a9072 100644 --- a/charts/sonarqube/README.md +++ b/charts/sonarqube/README.md @@ -72,6 +72,9 @@ The following table lists the configurable parameters of the Sonarqube chart and | `persistence.size` | Size of the volume | 10Gi | | `persistence.volumes` | Specify extra volumes. Refer to ".spec.volumes" specification | [] | | `persistence.mounts` | Specify extra mounts. Refer to ".spec.containers.volumeMounts" specification | [] | +| `serviceAccount.create` | If set to true, create a serviceAccount | false | +| `serviceAccount.name` | Name of the serviceAccount to create/use | `sonarqube-sonarqube` | +| `serviceAccount.annotations` | Additional serviceAccount annotations | `{}` | | `sonarProperties` | Custom `sonar.properties` file | None | | `sonarSecretProperties` | Additional `sonar.properties` file to load from a secret | None | | `caCerts.secret` | Name of the secret containing additional CA certificates | `nil` | diff --git a/charts/sonarqube/templates/deployment.yaml b/charts/sonarqube/templates/deployment.yaml index eefe8ac..d99cf9c 100644 --- a/charts/sonarqube/templates/deployment.yaml +++ b/charts/sonarqube/templates/deployment.yaml @@ -32,6 +32,13 @@ spec: {{- end }} {{- end }} spec: + {{- if .Values.serviceAccount.create }} + {{- if .Values.serviceAccount.name }} + serviceAccountName: {{ .Values.serviceAccount.name }} + {{- else }} + serviceAccountName: {{ include "sonarqube.fullname" . }} + {{- end }} + {{- end }} securityContext: {{ toYaml .Values.securityContext | indent 8 }} {{- if .Values.image.pullSecret }} diff --git a/charts/sonarqube/templates/serviceaccount.yaml b/charts/sonarqube/templates/serviceaccount.yaml new file mode 100644 index 0000000..a4103db --- /dev/null +++ b/charts/sonarqube/templates/serviceaccount.yaml @@ -0,0 +1,15 @@ +{{- if .Values.serviceAccount.create -}} +--- +apiVersion: v1 +kind: ServiceAccount +metadata: +{{- if .Values.serviceAccount.name }} + name: {{ .Values.serviceAccount.name }} +{{- else }} + name: {{ include "sonarqube.fullname" . }} +{{- end }} +{{- if .Values.serviceAccount.annotations }} + annotations: +{{ toYaml .Values.serviceAccount.annotations | indent 4 }} +{{- end }} +{{- end -}} diff --git a/charts/sonarqube/values.yaml b/charts/sonarqube/values.yaml index b90aed2..b8a2794 100644 --- a/charts/sonarqube/values.yaml +++ b/charts/sonarqube/values.yaml @@ -218,3 +218,9 @@ podLabels: {} sonarqubeFolder: /opt/sonarqube enableTests: true + +serviceAccount: + create: false + # name: + ## Annotations for the Service Account + annotations: {}