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

SONAR-24105 remove 9.9 deprecated feature #616

Closed
Closed
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
1 change: 1 addition & 0 deletions charts/sonarqube-dce/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ All changes to this chart will be documented in this file.
* Update ingress-nginx subchart to 4.11.3
* Support Kubernetes v1.32
* Remove the default passcode provided with `monitoringPasscode`
* Remove deprecated `ApplicationNodes.image.pullSecret`, `searchNodes.image.pullSecret` and `postgresql.postgresqlServer`

## [10.8.1]
* Update Chart's version to 10.8.1
Expand Down
2 changes: 2 additions & 0 deletions charts/sonarqube-dce/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ annotations:
description: "Support Kubernetes v1.32"
- kind: changed
description: "Remove the default passcode provided with 'monitoringPasscode'"
- kind: removed
description: "Remove deprecated `ApplicationNodes.image.pullSecret`, `searchNodes.image.pullSecret` and `postgresql.postgresqlServer`"
artifacthub.io/links: |
- name: support
url: https://community.sonarsource.com/
Expand Down
4 changes: 1 addition & 3 deletions charts/sonarqube-dce/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,6 @@ The following table lists the configurable parameters of the SonarQube chart and
| `searchNodes.image.repository` | search image repository | `sonarqube` |
| `searchNodes.image.tag` | search image tag | `10.8.1-datacenter-search` |
| `searchNodes.image.pullPolicy` | search image pull policy | `IfNotPresent` |
| `searchNodes.image.pullSecret` | (DEPRECATED) search imagePullSecret to use for private repository | `nil` |
| `searchNodes.image.pullSecrets` | search imagePullSecrets to use for private repository | `nil` |
| `searchNodes.annotations` | Map of annotations to add to the search pods | `{}` |
| `searchNodes.env` | Environment variables to attach to the search pods | `nil` |
Expand Down Expand Up @@ -341,7 +340,6 @@ The following table lists the configurable parameters of the SonarQube chart and
| `applicationNodes.image.repository` | app image repository | `sonarqube` |
| `applicationNodes.image.tag` | app image tag | `10.8.1-datacenter-app` |
| `applicationNodes.image.pullPolicy` | app image pull policy | `IfNotPresent` |
| `applicationNodes.image.pullSecret` | (DEPRECATED) app imagePullSecret to use for private repository | `nil` |
| `applicationNodes.image.pullSecrets` | app imagePullSecrets to use for private repository | `nil` |
| `applicationNodes.annotations` | Map of annotations to add to the app pods | `{}` |
| `applicationNodes.env` | Environment variables to attach to the app pods | `nil` |
Expand Down Expand Up @@ -683,7 +681,7 @@ Since SonarQube needs Elasticsearch, some [bootstrap checks](https://www.elastic

This chart offers the option to use an initContainer in privilaged mode to automatically set certain kernel settings on the kube worker. While this can ensure proper functionality of Elasticsearch, modifying the underlying kernel settings on the Kubernetes node can impact other users. It may be best to work with your cluster administrator to either provide specific nodes with the proper kernel settings, or ensure they are set cluster wide.

To enable auto-configuration of the kube worker node, set `elasticsearch.configureNode` to `true`. This is the default behavior, so you do not need to explicitly set this.
To enable auto-configuration of the kube worker node, set `initSysctl.enabled` to `true`. This is the default behavior, so you do not need to explicitly set this.

This will run `sysctl -w vm.max_map_count=262144` on the worker where the sonarqube pod(s) get scheduled. This needs to be set to `262144` but normally defaults to `65530`. Other kernel settings are recommended by the [docker image](https://hub.docker.com/_/sonarqube/#requirements), but the defaults work fine in most cases.

Expand Down
2 changes: 0 additions & 2 deletions charts/sonarqube-dce/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,6 @@ Expand the Application Image name.
{{- define "postgresql.hostname" -}}
{{- if .Values.postgresql.enabled -}}
{{- printf "%s-%s" .Release.Name "postgresql" | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s" .Values.postgresql.postgresqlServer -}}
{{- end -}}
{{- end -}}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,9 @@ spec:
{{- end }}
spec:
restartPolicy: OnFailure
{{- if or .Values.ApplicationNodes.image.pullSecrets .Values.ApplicationNodes.image.pullSecret }}
{{- if .Values.ApplicationNodes.image.pullSecrets }}
imagePullSecrets:
{{- if .Values.ApplicationNodes.image.pullSecret }}
- name: {{ .Values.ApplicationNodes.image.pullSecret }}
{{- end }}
{{- if .Values.ApplicationNodes.image.pullSecrets }}
{{ toYaml .Values.ApplicationNodes.image.pullSecrets | indent 8 }}
{{- end }}
{{- end }}
serviceAccountName: {{ template "sonarqube.serviceAccountName" . }}
{{- if .Values.tolerations }}
Expand Down
7 changes: 1 addition & 6 deletions charts/sonarqube-dce/templates/sonarqube-application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,9 @@ spec:
{{- end }}
spec:
automountServiceAccountToken: {{ .Values.serviceAccount.automountToken }}
{{- if or .Values.ApplicationNodes.image.pullSecrets .Values.ApplicationNodes.image.pullSecret }}
{{- if .Values.ApplicationNodes.image.pullSecrets }}
imagePullSecrets:
{{- if .Values.ApplicationNodes.image.pullSecret }}
- name: {{ .Values.ApplicationNodes.image.pullSecret }}
{{- end }}
{{- if .Values.ApplicationNodes.image.pullSecrets }}
{{ toYaml .Values.ApplicationNodes.image.pullSecrets | indent 8 }}
{{- end }}
{{- end }}
initContainers:
{{- if .Values.ApplicationNodes.extraInitContainers }}
Expand Down
7 changes: 1 addition & 6 deletions charts/sonarqube-dce/templates/sonarqube-search.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,9 @@ spec:
{{- end }}
spec:
automountServiceAccountToken: {{ .Values.serviceAccount.automountToken }}
{{- if or .Values.searchNodes.image.pullSecrets .Values.searchNodes.image.pullSecret }}
{{- if .Values.searchNodes.image.pullSecrets }}
imagePullSecrets:
{{- if .Values.searchNodes.image.pullSecret }}
- name: {{ .Values.searchNodes.image.pullSecret }}
{{- end }}
{{- if .Values.searchNodes.image.pullSecrets }}
{{ toYaml .Values.searchNodes.image.pullSecrets | indent 8 }}
{{- end }}
{{- end }}
initContainers:
{{- if .Values.extraInitContainers }}
Expand Down
7 changes: 1 addition & 6 deletions charts/sonarqube-dce/templates/tests/sonarqube-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,9 @@ metadata:
heritage: {{ .Release.Service }}
spec:
automountServiceAccountToken: false
{{- if or .Values.ApplicationNodes.image.pullSecrets .Values.ApplicationNodes.image.pullSecret }}
{{- if .Values.ApplicationNodes.image.pullSecrets }}
imagePullSecrets:
{{- if .Values.ApplicationNodes.image.pullSecret }}
- name: {{ .Values.ApplicationNodes.image.pullSecret }}
{{- end }}
{{- if .Values.ApplicationNodes.image.pullSecrets }}
{{ toYaml .Values.ApplicationNodes.image.pullSecrets | indent 4 }}
{{- end }}
{{- end }}
containers:
- name: {{ .Release.Name }}-ui-test
Expand Down
1 change: 1 addition & 0 deletions charts/sonarqube/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ All changes to this chart will be documented in this file.
* Update ingress-nginx subchart to 4.11.3
* Support Kubernetes v1.32
* Remove the default passcode provided with `monitoringPasscode`
* Remove deprecated `elasticsearch.configureNode`, `image.pullSecret` and `postgresql.postgresqlServer`

## [10.8.1]
* Update Chart's version to 10.8.1
Expand Down
2 changes: 2 additions & 0 deletions charts/sonarqube/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ annotations:
description: "Support Kubernetes v1.32"
- kind: changed
description: "Remove the default passcode provided with 'monitoringPasscode'"
- kind: removed
description: "Remove deprecated `elasticsearch.configureNode`, `image.pullSecret` and `postgresql.postgresqlServer`"
artifacthub.io/containsSecurityUpdates: "false"
artifacthub.io/images: |
- name: sonarqube
Expand Down
7 changes: 2 additions & 5 deletions charts/sonarqube/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,6 @@ The following table lists the configurable parameters of the SonarQube chart and
| `image.repository` | image repository | `sonarqube` |
| `image.tag` | `sonarqube` image tag. Please note that the default `10.8.1-{{ .Values.edition }}` is deprecated. | `10.8.1-{{ .Values.edition }}` |
| `image.pullPolicy` | Image pull policy | `IfNotPresent` |
| `image.pullSecret` | (DEPRECATED) imagePullSecret to use for private repository | `None` |
| `image.pullSecrets` | imagePullSecrets to use for private repository | `None` |

### Security
Expand All @@ -308,7 +307,6 @@ The following table lists the configurable parameters of the SonarQube chart and

| Parameter | Description | Default |
| ------------------------------- | ----------------------------------------------- | ------- |
| `elasticsearch.configureNode` | [DEPRECATED] Use initSysctl.enabled instead. | `false` |
| `elasticsearch.bootstrapChecks` | Enables/disables Elasticsearch bootstrap checks | `true` |

### Service
Expand Down Expand Up @@ -506,7 +504,6 @@ The bundled PostgreSQL Chart is deprecated. Please see <https://artifacthub.io/p
| -------------------------------------------------------- | ---------------------------------------------------------------------- | --------------- |
| `postgresql.enabled` | Set to `false` to use external server | `true` |
| `postgresql.existingSecret` | existingSecret Name of existing secret to use for PostgreSQL passwords | `nil` |
| `postgresql.postgresqlServer` | (DEPRECATED) Hostname of the external PostgreSQL server | `nil` |
| `postgresql.postgresqlUsername` | PostgreSQL database user | `sonarUser` |
| `postgresql.postgresqlPassword` | PostgreSQL database password | `sonarPass` |
| `postgresql.postgresqlDatabase` | PostgreSQL database name | `sonarDB` |
Expand Down Expand Up @@ -624,11 +621,11 @@ Since SonarQube comes bundled with an Elasticsearch instance, some [bootstrap ch

This chart offers the option to use an initContainer in privileged mode to automatically set certain kernel settings on the kube worker. While this can ensure proper functionality of Elasticsearch, modifying the underlying kernel settings on the Kubernetes node can impact other users. It may be best to work with your cluster administrator to either provide specific nodes with the proper kernel settings, or ensure they are set cluster wide.

To enable auto-configuration of the kube worker node, set `elasticsearch.configureNode` to `true`. This is the default behavior, so you do not need to explicitly set this.
To enable auto-configuration of the kube worker node, set `initSysctl.enabled` to `true`. This is the default behavior, so you do not need to explicitly set this.

This will run `sysctl -w vm.max_map_count=262144` on the worker where the sonarqube pod(s) get scheduled. This needs to be set to `262144` but normally defaults to `65530`. Other kernel settings are recommended by the [docker image](https://hub.docker.com/_/sonarqube/#requirements), but the defaults work fine in most cases.

To disable worker node configuration, set `elasticsearch.configureNode` to `false`. Note that if node configuration is not enabled, then you will likely need to also disable the Elasticsearch bootstrap checks. These can be explicitly disabled by setting `elasticsearch.bootstrapChecks` to `false`.
To disable worker node configuration, set `initSysctl.enabled` to `false`. Note that if node configuration is not enabled, then you will likely need to also disable the Elasticsearch bootstrap checks. These can be explicitly disabled by setting `elasticsearch.bootstrapChecks` to `false`.

### Extra Config

Expand Down
2 changes: 0 additions & 2 deletions charts/sonarqube/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,6 @@ Expand the Application Image name.
{{- define "postgresql.hostname" -}}
{{- if .Values.postgresql.enabled -}}
{{- printf "%s-%s" .Release.Name "postgresql" | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s" .Values.postgresql.postgresqlServer -}}
{{- end -}}
{{- end -}}

Expand Down
7 changes: 2 additions & 5 deletions charts/sonarqube/templates/_pod.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,8 @@ spec:
{{- with (include "sonarqube.securityContext" .) }}
securityContext: {{- . | nindent 4 }}
{{- end }}
{{- if or .Values.image.pullSecrets .Values.image.pullSecret }}
{{- if .Values.image.pullSecrets }}
imagePullSecrets:
{{- if .Values.image.pullSecret }}
- name: {{ .Values.image.pullSecret }}
{{- end }}
{{- with .Values.image.pullSecrets }}
{{- toYaml . | nindent 4 }}
{{- end }}
Expand Down Expand Up @@ -77,7 +74,7 @@ spec:
env:
{{- (include "sonarqube.combined_env" . | fromJsonArray) | toYaml | trim | nindent 8 }}
{{- end }}
{{- if and (or .Values.initSysctl.enabled .Values.elasticsearch.configureNode) (not .Values.OpenShift.enabled) }}
{{- if and .Values.initSysctl.enabled (not .Values.OpenShift.enabled) }}
- name: init-sysctl
image: {{ default (include "sonarqube.image" $) .Values.initSysctl.image }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
Expand Down
5 changes: 1 addition & 4 deletions charts/sonarqube/templates/change-admin-password-hook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,8 @@ spec:
labels: {{- include "sonarqube.labels" . | nindent 8 }}
spec:
restartPolicy: OnFailure
{{- if or .Values.image.pullSecrets .Values.image.pullSecret }}
{{- if .Values.image.pullSecrets }}
imagePullSecrets:
{{- if .Values.image.pullSecret }}
- name: {{ .Values.image.pullSecret }}
{{- end }}
{{- with .Values.image.pullSecrets }}
{{- toYaml . | nindent 8 }}
{{- end }}
Expand Down
5 changes: 1 addition & 4 deletions charts/sonarqube/templates/tests/sonarqube-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,8 @@ metadata:
labels: {{- include "sonarqube.labels" . | nindent 4 }}
spec:
automountServiceAccountToken: false
{{- if or .Values.image.pullSecrets .Values.image.pullSecret }}
{{- if .Values.image.pullSecrets }}
imagePullSecrets:
{{- if .Values.image.pullSecret }}
- name: {{ .Values.image.pullSecret }}
{{- end }}
{{- with .Values.image.pullSecrets }}
{{- toYaml . | nindent 4 }}
{{- end }}
Expand Down
2 changes: 0 additions & 2 deletions charts/sonarqube/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,6 @@ containerSecurityContext:

# Settings to configure elasticsearch host requirements
elasticsearch:
# (DEPRECATED) Use initSysctl.enabled instead
configureNode: false
bootstrapChecks: true

service:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,8 @@ spec:
checksum/secret: c953abbc65dd935f1e5118b3efb1e082374ad203eba24a98829fead12e401630
spec:
automountServiceAccountToken: false
imagePullSecrets:
- name: mypullsecret
initContainers:
- name: "wait-for-db"
image: sonarqube:lts-community@sha256:3596d14feb065a31ce84cef60cc3ecfb7b47233ef860fd85c0d4e465f676c9f7
Expand Down Expand Up @@ -774,6 +776,8 @@ spec:
checksum/secret: c953abbc65dd935f1e5118b3efb1e082374ad203eba24a98829fead12e401630
spec:
automountServiceAccountToken: false
imagePullSecrets:
- name: mypullsecret
initContainers:
- name: init-sysctl
image: sonarqube:lts-community@sha256:3596d14feb065a31ce84cef60cc3ecfb7b47233ef860fd85c0d4e465f676c9f7
Expand Down Expand Up @@ -972,6 +976,8 @@ metadata:
heritage: Helm
spec:
automountServiceAccountToken: false
imagePullSecrets:
- name: mypullsecret
containers:
- name: custom-image-values.yaml-ui-test
image: "sonarqube:lts-community@sha256:3596d14feb065a31ce84cef60cc3ecfb7b47233ef860fd85c0d4e465f676c9f7"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ metadata:
heritage: Helm
data:
SONAR_JDBC_USERNAME: sonarUser
SONAR_JDBC_URL: "jdbc:postgresql://%!s(<nil>):5432/sonarDB"
SONAR_JDBC_URL: "jdbc:postgresql://:5432/sonarDB"
Copy link
Collaborator Author

@jCOTINEAU jCOTINEAU Jan 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here this highlight a problem we had before, in this test case we have no jdbcoverwrite as well as postgresql.enabled=false.

Hence the default data in the configmap does not make sense as no database as been configured.

i am creating a hardening ticket to ensure all our files, config map, secret and so on, are created only when it make sense.

Here for example the configmap should exist only if jdbcoverwrite or postgresql.enabled, and should fail fast in dce

---
# Source: sonarqube-dce/templates/service.yaml
apiVersion: v1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,8 @@ spec:
automountServiceAccountToken: false
securityContext:
fsGroup: 0
imagePullSecrets:
- name: mypullsecret
initContainers:
- name: "wait-for-db"
image: sonarqube:lts-community@sha256:3596d14feb065a31ce84cef60cc3ecfb7b47233ef860fd85c0d4e465f676c9f7
Expand Down Expand Up @@ -577,6 +579,8 @@ metadata:
heritage: Helm
spec:
automountServiceAccountToken: false
imagePullSecrets:
- name: mypullsecret
containers:
- name: custom-image-values.yaml-ui-test
image: "sonarqube:lts-community@sha256:3596d14feb065a31ce84cef60cc3ecfb7b47233ef860fd85c0d4e465f676c9f7"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ metadata:
heritage: Helm
data:
SONAR_JDBC_USERNAME: sonarUser
SONAR_JDBC_URL: "jdbc:postgresql://%!s(<nil>):5432/sonarDB"
SONAR_JDBC_URL: "jdbc:postgresql://:5432/sonarDB"
---
# Source: sonarqube/templates/service.yaml
apiVersion: v1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ ApplicationNodes:
image:
#Value comming from the user issue
tag: lts-community@sha256:3596d14feb065a31ce84cef60cc3ecfb7b47233ef860fd85c0d4e465f676c9f7
pullSecrets:
- name: mypullsecret
searchNodes:
image:
#Value comming from the user issue
tag: lts-community@sha256:3596d14feb065a31ce84cef60cc3ecfb7b47233ef860fd85c0d4e465f676c9f7
tag: lts-community@sha256:3596d14feb065a31ce84cef60cc3ecfb7b47233ef860fd85c0d4e465f676c9f7
pullSecrets:
- name: mypullsecret
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
image:
#Value comming from the user issue
tag: lts-community@sha256:3596d14feb065a31ce84cef60cc3ecfb7b47233ef860fd85c0d4e465f676c9f7
tag: lts-community@sha256:3596d14feb065a31ce84cef60cc3ecfb7b47233ef860fd85c0d4e465f676c9f7
pullSecrets:
- name: mypullsecret
Loading