Skip to content

Commit

Permalink
DOCKER-80 add the possibility of using a secret for customizing the a…
Browse files Browse the repository at this point in the history
…dmin password (#251)
  • Loading branch information
carminevassallo authored Aug 26, 2022
1 parent c2f4120 commit 2a3bed2
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 4 deletions.
3 changes: 3 additions & 0 deletions charts/sonarqube-dce/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# SonarQube Chart Changelog
All changes to this chart will be documented in this file.

## [4.0.5]
* Add the possibility of using a secret for customizing the admin password

## [4.0.4]
* Remove unreachable condition and fix the right values for sonarProperties and sonarSecretProperties

Expand Down
2 changes: 1 addition & 1 deletion charts/sonarqube-dce/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: sonarqube-dce
description: SonarQube offers Code Quality and Code Security analysis for up to 27 languages. Find Bugs, Vulnerabilities, Security Hotspots and Code Smells throughout your workflow.
type: application
version: 4.0.4
version: 4.0.5
appVersion: 9.6.0
keywords:
- coverage
Expand Down
1 change: 1 addition & 0 deletions charts/sonarqube-dce/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,7 @@ The following table lists the configurable parameters of the Sonarqube chart and
| `logging.jsonOutput` | Enable/Disable logging in JSON format | `false` |
| `account.adminPassword` | Custom new admin password | `admin` |
| `account.currentAdminPassword` | Current admin password | `admin` |
| `account.adminPasswordSecretName` | Secret containing `password` (custom password) and `currentPassword` (current password) keys for admin | `None` |
| `account.resources.requests.memory` | Memory request for Admin hook | `128Mi` |
| `account.resources.requests.cpu` | CPU request for Admin hook | `100m` |
| `account.resources.limits.memory` | Memory limit for Admin hook | `128Mi` |
Expand Down
10 changes: 9 additions & 1 deletion charts/sonarqube-dce/templates/change-admin-password-hook.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- if .Values.account }}
{{- if .Values.account.adminPassword }}
{{- if or .Values.account.adminPassword .Values.account.adminPasswordSecretName}}
apiVersion: batch/v1
kind: Job
metadata:
Expand Down Expand Up @@ -57,12 +57,20 @@ spec:
- name: ADMIN_PASSWORD
valueFrom:
secretKeyRef:
{{- if .Values.account.adminPassword }}
name: {{ template "sonarqube.fullname" . }}-admin-password
{{- else }}
name: {{ .Values.account.adminPasswordSecretName }}
{{- end }}
key: password
- name: CURRENT_ADMIN_PASSWORD
valueFrom:
secretKeyRef:
{{- if .Values.account.adminPassword }}
name: {{ template "sonarqube.fullname" . }}-admin-password
{{- else }}
name: {{ .Values.account.adminPasswordSecretName }}
{{- end }}
key: currentPassword
resources:
{{ toYaml (default .Values.resources .Values.account.resources) | indent 10 }}
Expand Down
4 changes: 4 additions & 0 deletions charts/sonarqube-dce/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -549,8 +549,12 @@ extraConfig:
configmaps: []

# account:
# The values can be set to define the current and the (new) custom admin passwords at the startup (the username will remain "admin")
# adminPassword: admin
# currentAdminPassword: admin
# The above values can be also provided by a secret that contains "password" and "currentPassword" as keys. You can generate such a secret in your cluster
# using "kubectl create secret generic admin-password-secret-name --from-literal=password=admin --from-literal=currentPassword=admin"
# adminPasswordSecretName: ""
# resources:
# limits:
# cpu: 100m
Expand Down
3 changes: 3 additions & 0 deletions charts/sonarqube/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# SonarQube Chart Changelog
All changes to this chart will be documented in this file.

## [5.0.5]
* Add the possibility of using a secret for customizing the admin password

## [5.0.4]
* Add documentation for sonarProperties and sonarSecretProperties

Expand Down
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 offers Code Quality and Code Security analysis for up to 27 languages. Find Bugs, Vulnerabilities, Security Hotspots and Code Smells throughout your workflow.
type: application
version: 5.0.4
version: 5.0.5
appVersion: 9.6.0
keywords:
- coverage
Expand Down
1 change: 1 addition & 0 deletions charts/sonarqube/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,7 @@ The following table lists the configurable parameters of the Sonarqube chart and
| --------- | ----------- | ------- |
| `account.adminPassword` | Custom admin password | `admin` |
| `account.currentAdminPassword` | Current admin password | `admin` |
| `account.adminPasswordSecretName` | Secret containing `password` (custom password) and `currentPassword` (current password) keys for admin | `None` |
| `account.resources.requests.memory` | Memory request for Admin hook | `128Mi` |
| `account.resources.requests.cpu` | CPU request for Admin hook | `100m` |
| `account.resources.limits.memory` | Memory limit for Admin hook | `128Mi` |
Expand Down
10 changes: 9 additions & 1 deletion charts/sonarqube/templates/change-admin-password-hook.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- if .Values.account }}
{{- if .Values.account.adminPassword }}
{{- if or .Values.account.adminPassword .Values.account.adminPasswordSecretName}}
apiVersion: batch/v1
kind: Job
metadata:
Expand Down Expand Up @@ -61,12 +61,20 @@ spec:
- name: ADMIN_PASSWORD
valueFrom:
secretKeyRef:
{{- if .Values.account.adminPassword }}
name: {{ template "sonarqube.fullname" . }}-admin-password
{{- else }}
name: {{ .Values.account.adminPasswordSecretName }}
{{- end }}
key: password
- name: CURRENT_ADMIN_PASSWORD
valueFrom:
secretKeyRef:
{{- if .Values.account.adminPassword }}
name: {{ template "sonarqube.fullname" . }}-admin-password
{{- else }}
name: {{ .Values.account.adminPasswordSecretName }}
{{- end }}
key: currentPassword
resources:
{{ toYaml (default .Values.resources .Values.account.resources) | indent 10 }}
Expand Down
4 changes: 4 additions & 0 deletions charts/sonarqube/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -498,8 +498,12 @@ extraConfig:
configmaps: []

# account:
# The values can be set to define the current and the (new) custom admin passwords at the startup (the username will remain "admin")
# adminPassword: admin
# currentAdminPassword: admin
# The above values can be also provided by a secret that contains "password" and "currentPassword" as keys. You can generate such a secret in your cluster
# using "kubectl create secret generic admin-password-secret-name --from-literal=password=admin --from-literal=currentPassword=admin"
# adminPasswordSecretName: ""
# securityContext: {}
# resources:
# limits:
Expand Down

0 comments on commit 2a3bed2

Please sign in to comment.