Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1st attempt to add pvct #6

Merged
merged 6 commits into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion charts/sonarqube/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: sonarqube
description: SonarQube is a self-managed, automatic code review tool that systematically helps you deliver clean code. As a core element of our Sonar solution, SonarQube integrates into your existing workflow and detects issues in your code to help you perform continuous code inspections of your projects. The tool analyses 30+ different programming languages and integrates into your CI pipeline and DevOps platform to ensure that your code meets high-quality standards.
type: application
version: 10.2.3
version: 10.2.4
appVersion: 10.1.0
keywords:
- coverage
Expand Down
30 changes: 0 additions & 30 deletions charts/sonarqube/templates/pvc.yaml

This file was deleted.

66 changes: 44 additions & 22 deletions charts/sonarqube/templates/sonarqube-sts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,32 @@ spec:
matchLabels:
app: {{ template "sonarqube.name" . }}
release: {{ .Release.Name }}
{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }}
volumeClaimTemplates:
- metadata:
name: {{ template "sonarqube.fullname" . }}
labels:
release: {{ .Release.Name }}
chart: "{{ .Chart.Name }}"
app: "{{ template "sonarqube.fullname" . }}"
{{- with .Values.persistence.annotations }}
annotations:
{{ toYaml . | indent 8 }}
{{- end }}
spec:
accessModes:
- {{ .Values.persistence.accessMode | quote }}
resources:
requests:
storage: {{ .Values.persistence.size | quote }}
{{- if .Values.persistence.storageClass }}
{{- if (eq "-" .Values.persistence.storageClass) }}
storageClassName: ""
{{- else }}
storageClassName: "{{ .Values.persistence.storageClass }}"
{{- end }}
{{- end }}
{{- end }}
template:
metadata:
labels:
Expand Down Expand Up @@ -98,7 +124,7 @@ spec:
{{ toYaml .Values.initContainers.resources | indent 12 }}
volumeMounts:
- mountPath: /tmp/certs
name: sonarqube
name: "{{ template "sonarqube.fullname" . }}"
subPath: certs
- mountPath: /tmp/secrets/ca-certs
name: ca-certs
Expand Down Expand Up @@ -139,7 +165,7 @@ spec:
- |
#!/bin/sh
if [ -f /tmp/props/sonar.properties ]; then
cat /tmp/props/sonar.properties > /tmp/result/sonar.properties
cat /tmp/props/sonar.properties > /tmp/result/sonar.properties
fi
if [ -f /tmp/props/secret.properties ]; then
cat /tmp/props/secret.properties > /tmp/result/sonar.properties
Expand Down Expand Up @@ -186,7 +212,7 @@ spec:
args: ["curl -s '{{ template "prometheusExporter.downloadURL" . }}' {{ if $.Values.prometheusExporter.noCheckCertificate }}--insecure{{ end }} --output /data/jmx_prometheus_javaagent.jar -v"]
volumeMounts:
- mountPath: /data
name: sonarqube
name: "{{ template "sonarqube.fullname" . }}"
subPath: data
env:
- name: http_proxy
Expand Down Expand Up @@ -220,11 +246,11 @@ spec:
{{- end }}
{{- if .Values.caCerts.enabled }}
- mountPath: {{ .Values.sonarqubeFolder }}/certs
name: sonarqube
name: "{{ template "sonarqube.fullname" . }}"
subPath: certs
{{- end }}
- mountPath: {{ .Values.sonarqubeFolder }}/data
name: sonarqube
name: "{{ template "sonarqube.fullname" . }}"
subPath: data
{{- if .Values.persistence.enabled }}
- mountPath: {{ .Values.sonarqubeFolder }}/extensions
Expand All @@ -236,10 +262,10 @@ spec:
subPath: extensions/plugins
{{- end }}
- mountPath: {{ .Values.sonarqubeFolder }}/temp
name: sonarqube
name: "{{ template "sonarqube.fullname" . }}"
subPath: temp
- mountPath: {{ .Values.sonarqubeFolder }}/logs
name: sonarqube
name: "{{ template "sonarqube.fullname" . }}"
subPath: logs
- mountPath: /tmp
name: tmp-dir
Expand All @@ -253,7 +279,7 @@ spec:
"/tmp/scripts/install_plugins.sh"]
volumeMounts:
- mountPath: {{ .Values.sonarqubeFolder }}/extensions/plugins
name: sonarqube
name: "{{ template "sonarqube.fullname" . }}"
subPath: extensions/plugins
- name: install-plugins
mountPath: /tmp/scripts/
Expand Down Expand Up @@ -360,7 +386,7 @@ spec:
# status about migration are added to prevent the node to be kill while sonarqube is upgrading the database.
host="$(hostname -i || echo '127.0.0.1')"
if wget --no-proxy -qO- http://${host}:{{ .Values.service.internalPort }}{{ .Values.readinessProbe.sonarWebContext | default (include "sonarqube.webcontext" .) }}api/system/status | grep -q -e '"status":"UP"' -e '"status":"DB_MIGRATION_NEEDED"' -e '"status":"DB_MIGRATION_RUNNING"'; then
exit 0
exit 0
fi
exit 1
initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
Expand Down Expand Up @@ -397,26 +423,26 @@ spec:
{{- end }}
{{- if .Values.caCerts.enabled }}
- mountPath: {{ .Values.sonarqubeFolder }}/certs
name: sonarqube
name: "{{ template "sonarqube.fullname" . }}"
subPath: certs
{{- end }}
- mountPath: {{ .Values.sonarqubeFolder }}/data
name: sonarqube
name: "{{ template "sonarqube.fullname" . }}"
subPath: data
{{- if .Values.persistence.enabled }}
- mountPath: {{ .Values.sonarqubeFolder }}/extensions
name: sonarqube
name: "{{ template "sonarqube.fullname" . }}"
subPath: extensions
{{- else if .Values.plugins.install }}
- mountPath: {{ .Values.sonarqubeFolder }}/extensions/plugins
name: sonarqube
name: "{{ template "sonarqube.fullname" . }}"
subPath: extensions/plugins
{{- end }}
- mountPath: {{ .Values.sonarqubeFolder }}/temp
name: sonarqube
name: "{{ template "sonarqube.fullname" . }}"
subPath: temp
- mountPath: {{ .Values.sonarqubeFolder }}/logs
name: sonarqube
name: "{{ template "sonarqube.fullname" . }}"
subPath: logs
- mountPath: /tmp
name: tmp-dir
Expand Down Expand Up @@ -524,13 +550,9 @@ spec:
- key: prometheus-ce-config.yaml
path: prometheus-ce-config.yaml
{{- end }}
- name: sonarqube
{{- if .Values.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ if .Values.persistence.existingClaim }}{{ .Values.persistence.existingClaim }}{{- else }}{{ template "sonarqube.fullname" . }}{{- end }}
{{- else }}
emptyDir: {{- toYaml .Values.emptyDir | nindent 10 }}
{{- end }}
{{- if .Values.persistence.enabled }}
- name: "{{ template "sonarqube.fullname" . }}"
{{- end }}
- name : tmp-dir
emptyDir: {{- toYaml .Values.emptyDir | nindent 10 }}
{{- if or .Values.sonarProperties .Values.sonarSecretProperties .Values.sonarSecretKey ( not .Values.elasticsearch.bootstrapChecks) }}
Expand Down