Skip to content

Commit

Permalink
SONAR-23726 Deprecate logging.jsonOutput in sonarqube-dce chart
Browse files Browse the repository at this point in the history
  • Loading branch information
davividal authored Nov 26, 2024
1 parent 9c75a03 commit 16f49f6
Show file tree
Hide file tree
Showing 44 changed files with 1,174 additions and 102 deletions.
1 change: 1 addition & 0 deletions charts/sonarqube-dce/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ All changes to this chart will be documented in this file.
* Replace helm top level '$' by '.' when not necessary
* Deprecate `elasticsearch.bootstrapchecks`, `sonarqubeFolder`, `jdbcOverwrite.jdbcPassword` and `terminationGracePeriodSeconds`
* Deprecate `account`, `curlContainerImage`, `adminJobAnnotations`
* Deprecate `logging.jsonOutput` in favor of the ENV var SONAR_LOG_JSONOUTPUT or the sonar.properties's sonar.log.jsonOutput

## [10.7.0]
* Update Chart's version to 10.7.0
Expand Down
12 changes: 7 additions & 5 deletions charts/sonarqube-dce/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,23 +40,25 @@ annotations:
- kind: added
description: "Support Gateway on different namespace in HTTPRoute"
- kind: changed
description: "Change `ingress.ingressClassName` default, set it to `nginx` if `nginx.enabled` or `ingress-nginx.enabled`"
description: "Change 'ingress.ingressClassName' default, set it to 'nginx' if 'nginx.enabled' or 'ingress-nginx.enabled'"
- kind: changed
description: "Ensure that ConfigMap resources are not created for `initFS` and `initSysctl` if not needed"
description: "Ensure that ConfigMap resources are not created for 'initFS' and 'initSysctl' if not needed"
- kind: changed
description: "Ensure the Pod will stop at `init` stage if init_sysctl.sh failed to modify kernel parameters"
description: "Ensure the Pod will stop at 'init' stage if init_sysctl.sh failed to modify kernel parameters"
- kind: changed
description: "Replace the example images in initContainers, initSysctl and initFs from 'busybox:1.36' to 'ubuntu:24.04', which are commented out by default"
- kind: fixed
description: "Make the 'automountServiceAccountToken' configurable with 'serviceAccount.automountToken' in PodSpec"
- kind: changed
description: "Deprecate `ApplicationNodes` in favor of `applicationNodes`, fixing naming convention typo"
description: "Deprecate 'ApplicationNodes' in favor of 'applicationNodes', fixing naming convention typo"
- kind: changed
description: "Replace helm top level '$' by '.' when not necessary"
- kind: deprecated
description: "Deprecate elasticsearch.bootstrapcheck, `sonarqubeFolder`, `jdbcOverwrite.jdbcPassword` and `terminationGracePeriodSeconds`"
description: "Deprecate elasticsearch.bootstrapcheck, 'sonarqubeFolder', 'jdbcOverwrite.jdbcPassword' and 'terminationGracePeriodSeconds'"
- kind: deprecated
description: "Deprecate 'account', 'curlContainerImage', 'adminJobAnnotation'"
- kind: deprecated
description: "Deprecate 'logging.jsonOutput' in favor of the ENV var SONAR_LOG_JSONOUTPUT or the sonar.properties's 'sonar.log.jsonOutput'"
artifacthub.io/links: |
- name: support
url: https://community.sonarsource.com/
Expand Down
38 changes: 19 additions & 19 deletions charts/sonarqube-dce/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -528,27 +528,27 @@ The following table lists the configurable parameters of the SonarQube chart and
### SonarQube Specific
| Parameter | Description | Default |
| ------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------- | ---------------- |
| `sonarqubeFolder` | (DEPRECATED) Directory name of SonarQube, Due to 1-1 mapping between helm version and docker version, there is no need for configuration | `/opt/sonarqube` |
| `monitoringPasscode` | Value for sonar.web.systemPasscode needed for LivenessProbes (encoded to Base64 format) | `define_it` |
| `monitoringPasscodeSecretName` | Name of the secret where to load `monitoringPasscode` | `None` |
| `monitoringPasscodeSecretKey` | Key of an existing secret containing `monitoringPasscode` | `None` |
| `extraContainers` | Array of extra containers to run alongside the `sonarqube` container (aka. Sidecars) | `[]` |
| Parameter | Description | Default |
| ------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------- |
| `sonarqubeFolder` | (DEPRECATED) Directory name of SonarQube, Due to 1-1 mapping between helm version and docker version, there is no need for configuration | `/opt/sonarqube` |
| `monitoringPasscode` | Value for sonar.web.systemPasscode needed for LivenessProbes (encoded to Base64 format) | `define_it` |
| `monitoringPasscodeSecretName` | Name of the secret where to load `monitoringPasscode` | `None` |
| `monitoringPasscodeSecretKey` | Key of an existing secret containing `monitoringPasscode` | `None` |
| `extraContainers` | Array of extra containers to run alongside the `sonarqube` container (aka. Sidecars) | `[]` |
### JDBC Overwrite
| Parameter | Description | Default |
| ------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ |
| `jdbcOverwrite.enable` | (DEPRECATED) Enable JDBC overwrites for external Databases (disables `postgresql.enabled`) ,Please use jdbcOverwrite.enabled instead | `false` |
| `jdbcOverwrite.enabled` | Enable JDBC overwrites for external Databases (disable `postgresql.enabled`) | `false` |
| `jdbcOverwrite.jdbcUrl` | The JDBC url to connect the external DB | `jdbc:postgresql://myPostgress/myDatabase` |
| `jdbcOverwrite.jdbcUsername` | The DB user that should be used for the JDBC connection | `sonarUser` |
| Parameter | Description | Default |
| ------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ |
| `jdbcOverwrite.enable` | (DEPRECATED) Enable JDBC overwrites for external Databases (disables `postgresql.enabled`) ,Please use jdbcOverwrite.enabled instead | `false` |
| `jdbcOverwrite.enabled` | Enable JDBC overwrites for external Databases (disable `postgresql.enabled`) | `false` |
| `jdbcOverwrite.jdbcUrl` | The JDBC url to connect the external DB | `jdbc:postgresql://myPostgress/myDatabase` |
| `jdbcOverwrite.jdbcUsername` | The DB user that should be used for the JDBC connection | `sonarUser` |
| `jdbcOverwrite.jdbcPassword` | (DEPRECATED) The DB password that should be used for the JDBC connection, please use `jdbcOverwrite.jdbcSecretName` and `jdbcOverwrite.jdbcSecretPasswordKey` | `sonarPass` |
| `jdbcOverwrite.jdbcSecretName` | Alternatively, use a pre-existing k8s secret containing the DB password | `None` |
| `jdbcOverwrite.jdbcSecretPasswordKey` | If the pre-existing k8s secret is used this allows the user to overwrite the 'key' of the password property in the secret | `None` |
| `jdbcOverwrite.oracleJdbcDriver.url` | The URL of the Oracle JDBC driver to be downloaded | `None` |
| `jdbcOverwrite.oracleJdbcDriver.netrcCreds` | Name of the secret containing .netrc file to use creds when downloading the Oracle JDBC driver | `None` |
| `jdbcOverwrite.jdbcSecretName` | Alternatively, use a pre-existing k8s secret containing the DB password | `None` |
| `jdbcOverwrite.jdbcSecretPasswordKey` | If the pre-existing k8s secret is used this allows the user to overwrite the 'key' of the password property in the secret | `None` |
| `jdbcOverwrite.oracleJdbcDriver.url` | The URL of the Oracle JDBC driver to be downloaded | `None` |
| `jdbcOverwrite.oracleJdbcDriver.netrcCreds` | Name of the secret containing .netrc file to use creds when downloading the Oracle JDBC driver | `None` |
### Bundled PostgreSQL Chart (DEPRECATED)
Expand Down Expand Up @@ -625,7 +625,7 @@ The bundled PostgreSQL Chart is deprecated. Please see <https://artifacthub.io/p
| Parameter | Description | Default |
| ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------- |
| `logging.jsonOutput` | Enable/Disable logging in JSON format | `false` |
| `logging.jsonOutput` | (DEPRECATED) Enable/Disable logging in JSON format. Deprecated in favor of the ENV var SONAR_LOG_JSONOUTPUT or the `sonar.properties`'s `sonar.log.jsonOutput` | `false` |
| `account.adminPassword` | (DEPRECATED) Custom admin password. Please use `setAdminPassword.newPassword` instead. | `AdminAdmin_12$` |
| `account.currentAdminPassword` | (DEPRECATED) Current admin password. Please use `setAdminPassword.currentPassword` instead. | `admin` |
| `account.adminPasswordSecretName` | (DEPRECATED) Secret containing `password` (custom password) and `currentPassword` (current password) keys for admin. Please use `setAdminPassword.passwordSecretName` instead. | `None` |
Expand All @@ -637,7 +637,7 @@ The bundled PostgreSQL Chart is deprecated. Please see <https://artifacthub.io/p
| `account.securityContext` | (DEPRECATED) SecurityContext for change-password-hook. Please use `setAdminPassword.securityContext` instead. | [Restricted podSecurityStandard](#kubernetes---pod-security-standards) |
| `curlContainerImage` | (DEPRECATED) Curl container image. Please use `setAdminPassword.image` instead. | `"image.repository":"image.tag"` |
| `adminJobAnnotations` | (DEPRECATED) Custom annotations for admin hook Job. Please use `setAdminPassword.annotations` instead. | `{}` |
| `terminationGracePeriodSeconds` | (DEPRECATED) this field is not used in the templates | `60` |
| `terminationGracePeriodSeconds` | (DEPRECATED) this field is not used in the templates | `60` |
You can also configure values for the PostgreSQL database via the PostgreSQL [Chart](https://hub.helm.sh/charts/bitnami/postgresql)
Expand Down
5 changes: 4 additions & 1 deletion charts/sonarqube-dce/templates/NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,8 @@ WARNING: The embedded PostgreSQL is intended for evaluation only, it is DEPRECAT
WARNING: The ingress nginx controller dependency has been upgraded to a major version (4.x), please carefully read the changelogs at https://github.com/kubernetes/ingress-nginx/releases and refer to the documentation at https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/annotations/.
Please also visit https://artifacthub.io/packages/helm/sonarqube/sonarqube-dce#production-use-case for more information.
{{- end }}
{{ if hasKey .Values.logging "jsonOutput" }}
WARNING: The logging.jsonOutput value is deprecated in favor of the ENV var SONAR_LOG_JSONOUTPUT or the sonar.properties's sonar.log.jsonOutput.
{{ end }}
WARNING: If your values' file contains values under "ApplicationNodes", please note that this key is DEPRECATED and should be renamed to "applicationNodes".
Please visit https://artifacthub.io/packages/helm/sonarqube/sonarqube-dce#applicationnodes-renamed-to-applicationnodes for more information.
Please visit https://artifacthub.io/packages/helm/sonarqube/sonarqube-dce#applicationnodes-renamed-to-applicationnodes for more information.
49 changes: 47 additions & 2 deletions charts/sonarqube-dce/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,35 @@ Set sonarqube.jvmCEOpts
{{- end -}}
{{- end -}}

{{/*
Set sonarqube.log.jsonoutput
Parameters:
- ctx: The context to use (required, normally should be '.')
- node: The node to use (required, ApplicationNodes or searchNodes)
*/}}
{{- define "sonarqube.log.jsonoutput" -}}
{{- $node := (get .ctx.Values .node) }}
{{- $tempJsonOutput := default "false" (get .ctx.Values.logging "jsonOutput") -}}
{{- if and $node.sonarProperties (hasKey $node.sonarProperties "sonar.log.jsonOutput") -}}
{{- $tempJsonOutput = (get $node.sonarProperties "sonar.log.jsonOutput") -}}
{{- end -}}
{{- if .ctx.Values.env -}}
{{- range $index, $val := .ctx.Values.env -}}
{{- if eq $val.name "SONAR_LOG_JSONOUTPUT" -}}
{{- $tempJsonOutput = $val.value -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- if $node.env -}}
{{- range $index, $val := $node.env -}}
{{- if eq $val.name "SONAR_LOG_JSONOUTPUT" -}}
{{- $tempJsonOutput = $val.value -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- printf "%s" ($tempJsonOutput | toString) -}}
{{- end -}}

{{/*
Set prometheusExporter.downloadURL
*/}}
Expand Down Expand Up @@ -357,18 +386,34 @@ Set sonarqube.webcontext, ensuring it starts and ends with a slash, in order to


{{/*
Set combined_app_env, ensuring we dont have any duplicates with our features and some of the user provided env vars
Set combined_app_env, ensuring we don't have any duplicates with our features and some of the user provided env vars
*/}}
{{- define "sonarqube.combined_app_env" -}}
{{- $filteredEnv := list -}}
{{- range $index,$val := .Values.ApplicationNodes.env -}}
{{- if not (has $val.name (list "SONAR_WEB_CONTEXT" "SONAR_WEB_JAVAOPTS" "SONAR_CE_JAVAOPTS")) -}}
{{- if not (has $val.name (list "SONAR_WEB_CONTEXT" "SONAR_WEB_JAVAOPTS" "SONAR_CE_JAVAOPTS" "SONAR_LOG_JSONOUTPUT")) -}}
{{- $filteredEnv = append $filteredEnv $val -}}
{{- end -}}
{{- end -}}
{{- $filteredEnv = append $filteredEnv (dict "name" "SONAR_WEB_CONTEXT" "value" (include "sonarqube.webcontext" .)) -}}
{{- $filteredEnv = append $filteredEnv (dict "name" "SONAR_WEB_JAVAOPTS" "value" (include "sonarqube.jvmOpts" .)) -}}
{{- $filteredEnv = append $filteredEnv (dict "name" "SONAR_CE_JAVAOPTS" "value" (include "sonarqube.jvmCEOpts" .)) -}}
{{- $filteredEnv = append $filteredEnv (dict "name" "SONAR_LOG_JSONOUTPUT" "value" (include "sonarqube.log.jsonoutput" (dict "ctx" . "node" "ApplicationNodes"))) -}}
{{- toJson $filteredEnv -}}
{{- end -}}
{{/*
Set combined_search_env, ensuring we don't have any duplicates with our features and some of the user provided env vars
*/}}
{{- define "sonarqube.combined_search_env" -}}
{{- $filteredEnv := list -}}
{{- range $index,$val := .Values.searchNodes.env -}}
{{- if not (has $val.name (list "SONAR_LOG_JSONOUTPUT")) -}}
{{- $filteredEnv = append $filteredEnv $val -}}
{{- end -}}
{{- end -}}
{{- $filteredEnv = append $filteredEnv (dict "name" "SONAR_LOG_JSONOUTPUT" "value" (include "sonarqube.log.jsonoutput" (dict "ctx" . "node" "searchNodes"))) -}}
{{- toJson $filteredEnv -}}
{{- end -}}

Expand Down
2 changes: 0 additions & 2 deletions charts/sonarqube-dce/templates/sonarqube-application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,6 @@ spec:
- name: IS_HELM_AUTOSCALING_ENABLED
value: "true"
{{- end }}
- name: SONAR_LOG_JSONOUTPUT
value: "{{ .Values.logging.jsonOutput }}"
- name: SONAR_CLUSTER_SEARCH_HOSTS
value: "{{ template "sonarqube.fullname" . }}-search"
- name: SONAR_CLUSTER_KUBERNETES
Expand Down
Loading

0 comments on commit 16f49f6

Please sign in to comment.