https://github.com/epam/edp-sonar-operator
It installs the Sonar EDP Component on a cluster for continuous inspection of a codebase code quality
https://github.com/epam/edp-sonar-operator
cd ci cicd custom-resource edp k8s kubernetes kuberocketci operator quality-gate sonar sonar-operator sonar-scanner-cli sonarqube sonarqube-plugin
Last synced: 11 months ago
JSON representation
It installs the Sonar EDP Component on a cluster for continuous inspection of a codebase code quality
- Host: GitHub
- URL: https://github.com/epam/edp-sonar-operator
- Owner: epam
- License: apache-2.0
- Created: 2020-12-24T00:49:25.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2025-05-16T15:08:15.000Z (about 1 year ago)
- Last Synced: 2025-06-09T17:07:21.934Z (12 months ago)
- Topics: cd, ci, cicd, custom-resource, edp, k8s, kubernetes, kuberocketci, operator, quality-gate, sonar, sonar-operator, sonar-scanner-cli, sonarqube, sonarqube-plugin
- Language: Go
- Homepage: https://docs.kuberocketci.io
- Size: 1.31 MB
- Stars: 8
- Watchers: 6
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG-pre-2.14.1.md
- Contributing: CONTRIBUTING.md
- License: LICENSE-2.0
- Code of conduct: CODE_OF_CONDUCT.md
- Codeowners: CODEOWNERS
- Security: SECURITY.md
Awesome Lists containing this project
README
[](https://codecov.io/gh/epam/edp-sonar-operator)
# Sonar Operator
| :heavy_exclamation_mark: Please refer to [KubeRocketCI documentation](https://docs.kuberocketci.io/) to get the notion of the main concepts and guidelines. |
| --- |
Get acquainted with the Sonar Operator and the installation process as well as the local development, and architecture scheme.
## Overview
Sonar Operator is a KubeRocketCI operator that is responsible for configuring SonarQube.
_**NOTE:** Operator is platform-independent, that is why there is a unified instruction for deploying._
## Prerequisites
1. Linux machine or Windows Subsystem for Linux instance with [Helm 3](https://helm.sh/docs/intro/install/) installed;
2. Cluster admin access to the cluster;
## Installation
In order to install the KubeRocketCI Sonar Operator, follow the steps below:
1. To add the Helm EPAMEDP Charts for local client, run "helm repo add":
```bash
helm repo add epamedp https://epam.github.io/edp-helm-charts/stable
```
2. Choose available Helm chart version:
```bash
helm search repo epamedp/sonar-operator -l
NAME CHART VERSION APP VERSION DESCRIPTION
epamedp/sonar-operator 3.1.1 3.1.1 A Helm chart for KRCI Sonar Operator
```
_**NOTE:** It is highly recommended to use the latest released version._
3. Deploy operator:
Full available chart parameters available in [deploy-templates/README.md](deploy-templates/README.md):
4. Install operator in the arbitrary (`sonar-operator`) namespace with the helm command; find below the installation command example:
```bash
helm install sonar-operator epamedp/sonar-operator --version --namespace sonar
```
5. Check the `sonar` namespace that should contain operator deployment with your operator in a running status.
## Quick Start
1. Login into Sonarqube and create user. Attach permissions to user such as quality gates, profiles, user managment etc. Insert user credentials into Kubernetes secret.
```yaml
apiVersion: v1
kind: Secret
metadata:
name: sonar-access
type: Opaque
data:
username: dXNlcg== # base64-encoded value of "user"
password: cGFzcw== # base64-encoded value of "pass"
```
2. Create Custom Resource `kind: Sonar` with Sonar instance URL and secret created on the previous step:
```yaml
apiVersion: edp.epam.com/v1alpha1
kind: Sonar
metadata:
name: sonar-sample
spec:
url: https://sonar.example.com # Sonar URL
secret: sonar-access # Secret name
```
Wait for the `.status` field with `status.connected: true`
4. Create Quality Gate using Custom Resources SonarQualityGate:
```yaml
apiVersion: edp.epam.com/v1alpha1
kind: SonarQualityGate
metadata:
name: qualityGate-sample
spec:
sonarRef:
name: sonar-sample # the name of `kind: Sonar`
name: qualityGate-sample
default: true
conditions:
new_coverage:
op: LT
error: "80"
```
```yaml
apiVersion: edp.epam.com/v1alpha1
kind: SonarQualityProfile
metadata:
name: qualityProfile-sample
spec:
sonarRef:
name: sonar-sample # the name of `kind: Sonar`
name: qualityProfile-sample
language: java
default: true
rules:
checkstyle:com.puppycrawl.tools.checkstyle.checks.OuterTypeFilenameCheck:
severity: 'MAJOR'
```
Inspect [CR templates folder](./deploy-templates/_crd_examples/) for more examples
## Local Development
In order to develop the operator, first set up a local environment. For details, please refer to the [Local Development](https://docs.kuberocketci.io/docs/developer-guide/local-development) page.
Development versions are also available, please refer to the [snapshot helm chart repository](https://epam.github.io/edp-helm-charts/snapshot/) page.
### Related Articles
- [Install KubeRocketCI](https://docs.kuberocketci.io/docs/operator-guide/install-kuberocketci)