sonarqube

by joaquinito2051

Helm chartv0.1.13App 9.9.1-community

SonarQube is an open sourced code quality scanning tool

About this chart

SonarQube

SonarQube is an open sourced code quality scanning tool.

Introduction

This chart bootstraps a SonarQube instance with a PostgreSQL database.

Attribution: A Fork of this code was taken from here and customized for OpenShift

https://github.com/Oteemo/charts/tree/master/charts/sonarqube

WIP: Not all configuration options have been checked against openshift yet

Installing the chart

To install the chart:

$ helm repo add rht-labs-charts https://rht-labs.github.io/charts
$ helm install rht-labs-charts/sonarqube

The above command deploys Sonarqube on the Kubernetes cluster in the default configuration. The configuration section lists the parameters that can be configured during installation.

The default login is admin/admin, but can be overridden.

Uninstalling the chart

To uninstall/delete the deployment:

$ helm delete <name of chart>

Configuration

The following table lists the configurable parameters of the Sonarqube chart and their default values.

ParameterDescriptionDefault
admin.adminPasswordSet Admin Password, also refer "admin.currentAdminPassword"admin
replicaCountNumber of replicas deployed1
deploymentStrategyDeployment strategy{}
image.repositoryimage repositorysonarqube
image.tagsonarqube image tag.8.2-community
image.pullPolicyImage pull policyIfNotPresent
image.pullSecretimagePullSecret to use for private repository
commandcommand to run in the containernil (need to be set prior to 6.7.6, and 7.4)
elasticsearch.configureNodeModify k8s worker to conform to system requirementsfalse
elasticsearch.bootstrapChecksEnables/disables Elasticsearch bootstrap checksfalse
initContainersEnable or Disable the running of all initContainersfalse (not needed on OpenShift)
ingress.enabledFlag for enabling ingressfalse
ingress.labelsIngress additional labels{}
ingress.hosts[0].nameHostname to your SonarQube installationsonar.organization.com
ingress.hosts[0].pathPath within the URL structure/
ingress.tlsIngress secrets for TLS certificates[]
livenessProbe.sonarWebContextSonarQube web context for livenessProbe/
readinessProbe.sonarWebContextSonarQube web context for readinessProbe/
service.typeKubernetes service typeClusterIP
service.externalPortKubernetes service port9000
service.internalPortKubernetes container port9000
service.labelsKubernetes service labelsNone
service.annotationsKubernetes service annotationsNone
service.loadBalancerSourceRangesKubernetes service LB Allowed inbound IP addressesNone
service.loadBalancerIPKubernetes service LB Optional fixed external IPNone
persistence.enabledFlag for enabling persistent storagefalse
persistence.annotationsKubernetes pvc annotations{}
persistence.existingClaimDo not create a new PVC but use this oneNone
persistence.storageClassStorage class to be used""
persistence.accessModeVolumes access mode to be setReadWriteOnce
persistence.sizeSize of the volume10Gi
persistence.volumesSpecify extra volumes. Refer to ".spec.volumes" specification[]
persistence.mountsSpecify extra mounts. Refer to ".spec.containers.volumeMounts" specification[]
serviceAccount.createIf set to true, create a serviceAccountfalse
serviceAccount.nameName of the serviceAccount to create/usesonarqube-sonarqube
serviceAccount.annotationsAdditional serviceAccount annotations{}
sonarPropertiesCustom sonar.properties fileNone
sonarSecretPropertiesAdditional sonar.properties file to load from a secretNone
caCerts.secretName of the secret containing additional CA certificatesnil
jvmOptsValues to add to SONARQUBE_WEB_JVM_OPTS""
envEnvironment variables to attach to the podsnil
sonarSecretKeyName of existing secret used for settings encryptionNone
sonarPropertiesCustom sonar.properties file{}
postgresql.enabledSet to false to use external servertrue
postgresql.existingSecretSecret containing the password of the external Postgresql servernull
postgresql.postgresqlServerHostname of the external Postgresql servernull
postgresql.postgresqlUsernamePostgresql database usersonarUser
postgresql.postgresqlPasswordPostgresql database passwordsonarPass
postgresql.postgresqlDatabasePostgresql database namesonarDB
postgresql.service.portPostgresql port5432
annotationsSonarqube Pod annotations{}
resourcesSonarqube Pod resource requests & limits{}
affinityNode / Pod affinities{}
nodeSelectorNode labels for pod assignment{}
hostAliasesAliases for IPs in /etc/hosts[]
tolerationsList of node taints to tolerate[]
plugins.installList of plugins to install[]
plugins.libList of plugins to install to lib/common[]
plugins.resourcesPlugin Pod resource requests & limits{}
plugins.initContainerImageChange init container imagealpine:3.10.3
plugins.initSysctlContainerImageChange init sysctl container imagebusybox:1.31
plugins.initVolumesContainerImageChange init volumes container imagebusybox:1.31
plugins.initCertsContainerImageChange init ca certs container imageadoptopenjdk/openjdk11:alpine
plugins.initTestContainerImageChange init test container imagedduportal/bats:0.4.0
plugins.deleteDefaultPluginsRemove default plugins and use plugins.install list[]
plugins.httpProxyFor use behind a corporate proxy when downloading plugins""
plugins.httpsProxyFor use behind a corporate proxy when downloading plugins""
podLabelsMap of labels to add to the pods{}
sonarqubeFolderDirectory name of Sonarqube/opt/sonarqube
enableTestsFlag that allows tests to be excluded from generated yamltrue

For overriding variables see: Customizing the chart

Use custom cacerts

In environments with air-gapped setup, especially with internal tooling (repos) and self-signed certificates it is required to provide an adequate cacerts which overrides the default one:

  1. Create a yaml file cacerts.yaml with a secret that contains one or more keys to represent the certificates that you want including

    apiVersion: v1
    kind: Secret
    metadata:
      name: my-cacerts
    data:
      cert-1.crt: |
        xxxxxxxxxxxxxxxxxxxxxxx
    
  2. Upload your cacerts.yaml to a secret in the cluster

Deploy sonarqube with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has sonarqube on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartsonarqube is pinned at v0.1.13 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply