Skip to content

Commit

Permalink
SONAR-23558 Introduce the SonarQube Community Build support
Browse files Browse the repository at this point in the history
  • Loading branch information
carminevassallo committed Nov 8, 2024
1 parent 3ada60e commit 4548c13
Show file tree
Hide file tree
Showing 7 changed files with 75 additions and 30 deletions.
3 changes: 3 additions & 0 deletions charts/sonarqube/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ All changes to this chart will be documented in this file.
* Update Chart's version to 10.8.0
* Support the installation of the Oracle JDBC Driver
* Support Kubernetes v1.31
* Deprecate the `community` value for the `edition` parameter
* Introduce the `community.enabled` and `community.buildNumber` parameters for SonarQube Community Build
* Deprecate the default value of `image.tag` in favor of an empty string

## [10.7.0]
* Update Chart's version to 10.7.0
Expand Down
6 changes: 6 additions & 0 deletions charts/sonarqube/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ annotations:
description: "Support the installation of the Oracle JDBC Driver"
- kind: changed
description: "Support Kubernetes v1.31"
- kind: deprecated
description: "Deprecate the "community" value for the "edition" parameter"
- kind: deprecated
description: "Deprecate the default value of "image.tag" in favor of an empty string"
- kind: added
description: "Introduce the "community.enabled" and "community.buildNumber" parameters for SonarQube Community Build"
artifacthub.io/containsSecurityUpdates: "false"
artifacthub.io/images: |
- name: sonarqube
Expand Down
63 changes: 36 additions & 27 deletions charts/sonarqube/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ The [configuration](#configuration) section lists the parameters that can be con

The default login is admin/admin.

## Installing the SonarQube Community Build chart

The SonarQube Community Edition has been replaced by the SonarQube Community Build.
If you want to install the SonarQube Community Build chart, please set `community.enabled` to `true`.
The `community.buildNumber` parameter will be set to the latest Community Build.
The `community` value is deprecated and won't be supported for `edition` anymore.

## Installing the SonarQube 9.9 LTA chart

The version of the chart for the SonarQube 9.9 LTA is being distributed as the `8.x.x` version of this chart.
Expand Down Expand Up @@ -227,26 +234,28 @@ The following table lists the configurable parameters of the SonarQube chart and

### Global

| Parameter | Description | Default |
| -------------------- | --------------------------------------------------------------------------------------------------------------------- | ------------- |
| `deploymentType` | Deployment Type (supported values are `StatefulSet` or `Deployment`) | `StatefulSet` |
| `replicaCount` | Number of replicas deployed (supported values are 0 and 1) | `1` |
| `deploymentStrategy` | Deployment strategy | `{}` |
| `priorityClassName` | Schedule pods on priority (e.g. `high-priority`) | `None` |
| `schedulerName` | Kubernetes scheduler name | `None` |
| `affinity` | Node / Pod affinities | `{}` |
| `tolerations` | List of node taints to tolerate | `[]` |
| `nodeSelector` | Node labels for pod assignment | `{}` |
| `hostAliases` | Aliases for IPs in /etc/hosts | `[]` |
| `podLabels` | Map of labels to add to the pods | `{}` |
| `env` | Environment variables to attach to the pods | `{}` |
| `annotations` | SonarQube Pod annotations | `{}` |
| `edition` | SonarQube Edition to use (e.g. `community`, `developer` or `enterprise`) | `community` |
| `sonarWebContext` | SonarQube web context, also serve as default value for `ingress.path`, `account.sonarWebContext` and probes path. | `` |
| `httpProxySecret` | Should contain `http_proxy`, `https_proxy` and `no_proxy` keys, will superseed every other proxy variables | `` |
| `httpProxy` | HTTP proxy for downloading JMX agent and install plugins, will superseed initContainer specific http proxy variables | `` |
| `httpsProxy` | HTTPS proxy for downloading JMX agent and install plugins, will superseed initContainer specific https proxy variable | `` |
| `noProxy` | No proxy for downloading JMX agent and install plugins, will superseed initContainer specific no proxy variables | `` |
| Parameter | Description | Default |
| ----------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | ------------- |
| `deploymentType` | Deployment Type (supported values are `StatefulSet` or `Deployment`) | `StatefulSet` |
| `replicaCount` | Number of replicas deployed (supported values are 0 and 1) | `1` |
| `deploymentStrategy` | Deployment strategy | `{}` |
| `priorityClassName` | Schedule pods on priority (e.g. `high-priority`) | `None` |
| `schedulerName` | Kubernetes scheduler name | `None` |
| `affinity` | Node / Pod affinities | `{}` |
| `tolerations` | List of node taints to tolerate | `[]` |
| `nodeSelector` | Node labels for pod assignment | `{}` |
| `hostAliases` | Aliases for IPs in /etc/hosts | `[]` |
| `podLabels` | Map of labels to add to the pods | `{}` |
| `env` | Environment variables to attach to the pods | `{}` |
| `annotations` | SonarQube Pod annotations | `{}` |
| `edition` | SonarQube Edition to use (e.g. `community`, `developer` or `enterprise`). Please note that the default `community` value is deprecated. | `community` |
| `community.enabled` | Install SonarQube Community Build | `false` |
| `community.buildNumber` | The SonarQube Community Build number to install | `10.7.0` |
| `sonarWebContext` | SonarQube web context, also serve as default value for `ingress.path`, `account.sonarWebContext` and probes path. | `` |
| `httpProxySecret` | Should contain `http_proxy`, `https_proxy` and `no_proxy` keys, will superseed every other proxy variables | `` |
| `httpProxy` | HTTP proxy for downloading JMX agent and install plugins, will superseed initContainer specific http proxy variables | `` |
| `httpsProxy` | HTTPS proxy for downloading JMX agent and install plugins, will superseed initContainer specific https proxy variable | `` |
| `noProxy` | No proxy for downloading JMX agent and install plugins, will superseed initContainer specific no proxy variables | `` |

### NetworkPolicies

Expand All @@ -273,13 +282,13 @@ The following table lists the configurable parameters of the SonarQube chart and

### Image

| Parameter | Description | Default |
| ------------------- | ---------------------------------------------------------- | ------------------------------ |
| `image.repository` | image repository | `sonarqube` |
| `image.tag` | `sonarqube` image tag. | `10.7.0-{{ .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` |
| Parameter | Description | Default |
| ------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------ |
| `image.repository` | image repository | `sonarqube` |
| `image.tag` | `sonarqube` image tag. Please note that the default `10.7.0-{{ .Values.edition }}` is deprecated. | `10.7.0-{{ .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 Down
5 changes: 5 additions & 0 deletions charts/sonarqube/templates/NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl port-forward $POD_NAME 8080:{{ .Values.service.externalPort }} -n {{ .Release.Namespace }}
{{- end }}
{{- if eq .Values.edition "community" }}
DEPRECATION NOTICE: The SonarQube Community Edition has been replaced by the SonarQube Community Build.
Please use "community.enabled=true" to use the latest SonarQube Community Build.
The "community" value is deprecated and won't be supported for "edition" anymore.
{{- end }}
WARNING:
Please note that the SonarQube image runs with a non-root user (uid=1000) belonging to the root group (guid=0). In this way, the chart can support arbitrary user ids as recommended in OpenShift.
Please visit https://docs.openshift.com/container-platform/4.14/openshift_images/create-images.html#use-uid_create-images for more information.
Expand Down
19 changes: 17 additions & 2 deletions charts/sonarqube/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,29 @@ app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/part-of: sonarqube
app.kubernetes.io/component: {{ include "sonarqube.fullname" . }}
app.kubernetes.io/version: {{ (tpl .Values.image.tag .) | trunc 63 | trimSuffix "-" | quote }}
app.kubernetes.io/version: {{ (tpl (include "image.tag" .) . ) | trunc 63 | trimSuffix "-" | quote }}
{{- end -}}

{{/*
Expand the Application Image name.
*/}}
{{- define "sonarqube.image" -}}
{{- printf "%s:%s" .Values.image.repository (tpl .Values.image.tag .) }}
{{- printf "%s:%s" .Values.image.repository (tpl (include "image.tag" .) .) }}
{{- end -}}

{{/*
Define the image.tag value that computes the right tag to be used as `sonarqube.image`
*/}}
{{- define "image.tag" -}}
{{- if or (not (hasKey .Values.image "tag")) (empty .Values.image.tag) -}}
{{- if or (.Values.community.enabled) (and (not (empty .Values.edition)) (eq .Values.edition "community")) -}}
{{- printf "%s-%s" .Values.community.buildNumber "community" -}}
{{- else if and (not (empty .Values.edition)) (ne .Values.edition "community") -}}
{{- printf "%s-%s" .Chart.AppVersion .Values.edition -}}
{{- end -}}
{{- else -}}
{{- .Values.image.tag -}}
{{- end -}}
{{- end -}}

{{/*
Expand Down
2 changes: 1 addition & 1 deletion charts/sonarqube/templates/tests/sonarqube-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ spec:
{{- end }}
containers:
- name: {{ .Release.Name }}-ui-test
image: {{ .Values.tests.image | default (printf "%s:%s" .Values.image.repository (tpl .Values.image.tag .)) | quote }}
image: {{ .Values.tests.image | default (include "sonarqube.image" .) | quote }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
command: ['wget']
args: [
Expand Down
7 changes: 7 additions & 0 deletions charts/sonarqube/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,17 @@ OpenShift:
# labels:
# external: 'true'

# (DEPRECATED) The "community" value as the default of "edition" is deprecated and will be removed in the next release (in favor of an empty value). Please set "community" to "true", if you want to use SonarQube Community Build.
edition: "community"

# Set the chart to use the latest released SonarQube Community Build
community:
enabled: true
buildNumber: "10.7.0"

image:
repository: sonarqube
# (DEPRECATED) The "image.tag" parameter will be set to be empty as default.
tag: 10.7.0-{{ .Values.edition }}
pullPolicy: IfNotPresent
# If using a private repository, the imagePullSecrets to use
Expand Down

0 comments on commit 4548c13

Please sign in to comment.