diff --git a/stable/sonarqube/Chart.yaml b/stable/sonarqube/Chart.yaml index 6481267205..7b78cffabf 100644 --- a/stable/sonarqube/Chart.yaml +++ b/stable/sonarqube/Chart.yaml @@ -1,6 +1,6 @@ name: sonarqube description: Sonarqube is an open sourced code quality scanning tool -version: 0.2.0 +version: 0.3.1 appVersion: 6.5 keywords: - coverage diff --git a/stable/sonarqube/requirements.lock b/stable/sonarqube/requirements.lock index 081470b7c9..c5d6a82ea0 100644 --- a/stable/sonarqube/requirements.lock +++ b/stable/sonarqube/requirements.lock @@ -3,4 +3,4 @@ dependencies: repository: https://kubernetes-charts.storage.googleapis.com/ version: 0.8.3 digest: sha256:b67c843d95aa0a2e7684abb787b22913e54baa92f45a450a3c3bcb7f3e068748 -generated: 2017-10-02T11:44:34.540107846-04:00 +generated: 2017-11-15T14:43:21.132299+01:00 diff --git a/stable/sonarqube/templates/config.yaml b/stable/sonarqube/templates/config.yaml new file mode 100644 index 0000000000..3a956191eb --- /dev/null +++ b/stable/sonarqube/templates/config.yaml @@ -0,0 +1,15 @@ + +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ template "sonarqube.fullname" . }}-config + labels: + app: {{ template "sonarqube.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +data: + {{- if .Values.sonarProperties }} + sonar.properties: + {{ toYaml .Values.sonarProperties | indent 4}} + {{- end}} diff --git a/stable/sonarqube/templates/deployment.yaml b/stable/sonarqube/templates/deployment.yaml index 1c905eb5c7..f194e6e472 100644 --- a/stable/sonarqube/templates/deployment.yaml +++ b/stable/sonarqube/templates/deployment.yaml @@ -15,6 +15,24 @@ spec: app: {{ template "sonarqube.name" . }} release: {{ .Release.Name }} spec: + {{- if .Values.plugins.install }} + initContainers: + - name: install-plugins + image: joosthofman/wget:1.0 + env: + {{- range $key, $value := .Values.extraEnv }} + - name: {{ $key }} + value: {{ $value }} + {{- end }} + command: ["sh", "-c", "'/opt/sonarqube/extensions/plugins/install_plugins.sh'"] + volumeMounts: + - mountPath: /opt/sonarqube/extensions + name: sonarqube + subPath: extensions + - name: install-plugins + mountPath: /opt/sonarqube/extensions/plugins/install_plugins.sh + subPath: install_plugins.sh + {{- end }} containers: - name: {{ .Chart.Name }} image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" @@ -22,6 +40,10 @@ spec: ports: - containerPort: {{ .Values.service.internalPort }} env: + {{- range $key, $value := .Values.extraEnv }} + - name: {{ $key }} + value: {{ $value }} + {{- end }} - name: SONARQUBE_JDBC_USERNAME value: {{.Values.postgresql.postgresUser | quote }} - name: SONARQUBE_JDBC_PASSWORD @@ -35,20 +57,33 @@ spec: httpGet: path: / port: {{ .Values.service.internalPort }} + initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.livenessProbe.periodSeconds }} readinessProbe: httpGet: path: / port: {{ .Values.service.internalPort }} + initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.readinessProbe.periodSeconds }} + failureThreshold: {{ .Values.readinessProbe.failureThreshold }} volumeMounts: - mountPath: /opt/sonarqube/conf name: sonarqube subPath: conf + {{- if .Values.sonarProperties }} + - name: config + mountPath: /opt/sonarqube/conf/sonar.properties + subPath: sonar.properties + {{- end}} - mountPath: /opt/sonarqube/data name: sonarqube subPath: data - mountPath: /opt/sonarqube/extensions name: sonarqube subPath: extensions + - name: install-plugins + mountPath: /opt/sonarqube/extensions/plugins/install_plugins.sh + subPath: install_plugins.sh resources: {{ toYaml .Values.resources | indent 12 }} {{- if .Values.nodeSelector }} @@ -56,10 +91,17 @@ spec: {{ toYaml .Values.nodeSelector | indent 8 }} {{- end }} volumes: + - name: config + configMap: + name: {{ template "sonarqube.fullname" . }}-config + - name: install-plugins + configMap: + name: {{ template "sonarqube.fullname" . }}-install-plugins + defaultMode: 0775 - name: sonarqube {{- if .Values.persistence.enabled }} persistentVolumeClaim: - claimName: {{ template "sonarqube.fullname" . }} + claimName: {{ if .Values.persistence.existingClaim }}{{ .Values.persistence.existingClaim }}{{- else }}{{ template "sonarqube.fullname" . }}{{- end }} {{- else }} emptyDir: {} {{- end }} diff --git a/stable/sonarqube/templates/install-plugins.yaml b/stable/sonarqube/templates/install-plugins.yaml new file mode 100644 index 0000000000..d09373580b --- /dev/null +++ b/stable/sonarqube/templates/install-plugins.yaml @@ -0,0 +1,17 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ template "sonarqube.fullname" . }}-install-plugins + labels: + app: {{ template "sonarqube.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +data: + install_plugins.sh: |- + cd /opt/sonarqube/extensions/plugins + {{- if .Values.plugins.install }} + {{- range $index, $val := .Values.plugins.install }} + wget {{ $val }} --no-check-certificate + {{- end }} + {{- end }} diff --git a/stable/sonarqube/templates/test-config.yaml b/stable/sonarqube/templates/test-config.yaml index 7c9ea9f313..fe86ff6694 100644 --- a/stable/sonarqube/templates/test-config.yaml +++ b/stable/sonarqube/templates/test-config.yaml @@ -10,5 +10,5 @@ metadata: data: run.sh: |- @test "Testing Sonarqube UI is accessible" { - curl --connect-timeout 5 --retry 12 --retry-delay 1 --retry-max-time 60 {{ .Release.Name }}-sonarqube:9000 + curl --connect-timeout 5 --retry 12 --retry-delay 1 --retry-max-time 60 {{ .Release.Name }}-sonarqube:{{ .Values.service.internalPort }} } diff --git a/stable/sonarqube/values.yaml b/stable/sonarqube/values.yaml index 6acd0935bc..08b596b4f8 100644 --- a/stable/sonarqube/values.yaml +++ b/stable/sonarqube/values.yaml @@ -23,6 +23,18 @@ ingress: # - secretName: chart-example-tls # hosts: # - chart-example.local + +readinessProbe: + initialDelaySeconds: 30 + periodSeconds: 30 + failureThreshold: 6 +livenessProbe: + initialDelaySeconds: 30 + periodSeconds: 30 + +# Set extra env variables. Like proxy settings. +extraEnv: {} + resources: {} # We usually recommend not to specify default resources and to leave this as a conscious # choice for the user. This also increases chances charts run on environments with little @@ -46,6 +58,15 @@ persistence: # accessMode: ReadWriteOnce # size: 10Gi +# List of plugins to install. +# For example: +# plugins: +# install: +# - "https://github.com/AmadeusITGroup/sonar-stash/releases/download/1.3.0/sonar-stash-plugin-1.3.0.jar" +# - "https://github.com/SonarSource/sonar-ldap/releases/download/2.2-RC3/sonar-ldap-plugin-2.2.0.601.jar" +plugins: + install: [] + ## Configuration values for the postgresql dependency ## ref: https://github.com/kubernetes/charts/blob/master/stable/postgressql/README.md ##