[stable/Sonarqube] Config map and plugin installation (#2781)

* Created a configmap for sonar properties. Created a install plugin init container to install plugins specified in the values. Fixed static port number in test-config

* Set version to 0.3.0 in sonarqube chart

* Set default persistence from postgres to false

* Fix wrong init container docker image

* fix missing spaces in comments

* Removed persistence false on Postgres DB

* Fix new line error in config, deployment has existingClaim support

* add basic labels to config and install-plugins. fixed storage class value.
This commit is contained in:
Joost Hofman
2017-12-09 21:30:19 +01:00
committed by Reinhard Nägele
parent 1bb66957dc
commit 38608b8dd9
7 changed files with 99 additions and 4 deletions
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
+15
View File
@@ -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}}
+43 -1
View File
@@ -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 }}
@@ -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 }}
+1 -1
View File
@@ -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 }}
}
+21
View File
@@ -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
##