Helm/SonarQube: Difference between revisions

From Chorke Wiki
Jump to navigation Jump to search
No edit summary
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
  helm repo add sonarqube https://SonarSource.github.io/helm-chart-sonarqube
  helm repo add sonarqube https://SonarSource.github.io/helm-chart-sonarqube
  helm repo update && helm repo list
  helm repo update && helm repo list
kubectl config get-contexts


==Config==
==Config==
Line 11: Line 12:
==Install==
==Install==
{|
{|
|colspan="2"|
<syntaxhighlight lang="sql">
cat << DDL | psql -U ${USER}
CREATE DATABASE sonarqube;
CREATE USER sonarqube WITH ENCRYPTED PASSWORD 'sadaqah!';
GRANT ALL PRIVILEGES ON DATABASE  sonarqube TO sonarqube;
DDL
</syntaxhighlight>
|-
|colspan="2"|
----
|-
|colspan="2"|
|colspan="2"|
<syntaxhighlight lang="yaml">
<syntaxhighlight lang="yaml">
Line 145: Line 159:
| valign="top" |
| valign="top" |
* [https://stackoverflow.com/questions/75596795/ Helm » Pass YAML/JSON using <code>stdin</code>]
* [https://stackoverflow.com/questions/75596795/ Helm » Pass YAML/JSON using <code>stdin</code>]
* [[Helm/Prometheus Stack|Helm » Prometheus Stack]]
* [[Helm/Cert Manager|Helm » Cert Manager]]
* [https://artifacthub.io/packages/helm/sonarqube/sonarqube Helm » SonarQube]
* [https://artifacthub.io/packages/helm/sonarqube/sonarqube Helm » SonarQube]
* [[Helm/Keycloak|Helm » Keycloak]]
* [[Helm]]
* [[Helm]]


Line 157: Line 174:
|-
|-
| valign="top" |
| valign="top" |
* [https://docs.sonarsource.com/sonarqube/9.9/setup-and-upgrade/deploy-on-kubernetes/deploy-sonarqube-on-kubernetes/ SonarQube » Deploy on Kubernetes]
* [https://github.com/SonarSource/helm-chart-sonarqube/tree/master/examples/grafana SonarQube » Grafana]
* [https://github.com/SonarSource/helm-chart-sonarqube/tree/master/examples/grafana SonarQube » Grafana]


Line 182: Line 200:
* [https://docs.openshift.com/container-platform/4.16/openshift_images/create-images.html#use-uid_create-images K8s » OpenShift » Arbitrary User Ids]
* [https://docs.openshift.com/container-platform/4.16/openshift_images/create-images.html#use-uid_create-images K8s » OpenShift » Arbitrary User Ids]
* [https://kubernetes.io/docs/reference/kubectl/generated/kubectl_rollout/ K8s » <code>kubectl rollout</code>]
* [https://kubernetes.io/docs/reference/kubectl/generated/kubectl_rollout/ K8s » <code>kubectl rollout</code>]
* [[K8s/CSI Hostpath Driver|K8s » CSI Hostpath Driver]]


| valign="top" |
| valign="top" |


|}
|}

Latest revision as of 13:14, 22 August 2024

helm repo add sonarqube https://SonarSource.github.io/helm-chart-sonarqube
helm repo update && helm repo list
kubectl config get-contexts

Config

export KUBECONFIG="${HOME}/.kube/dev-kubeconfig.yaml"
export KUBECONFIG="${HOME}/.kube/gcp-kubeconfig.yaml"
export KUBECONFIG="${HOME}/.kube/config"

Install

cat << DDL | psql -U ${USER}
CREATE DATABASE sonarqube;
CREATE USER sonarqube WITH ENCRYPTED PASSWORD 'sadaqah!';
GRANT ALL PRIVILEGES ON DATABASE  sonarqube TO sonarqube;
DDL

kubectl create namespace sonarqube
helm show values sonarqube/sonarqube --version 10.6.1+3163|less
cat <<YML | helm install -n sonarqube sonarqube sonarqube/sonarqube --version 10.6.1+3163 -f -
ingress:
  enabled: true
  hosts:
    - name: sonarqube.k8s.local
      path: /
  annotations: 
    ingressClassName: nginx
    nginx.ingress.kubernetes.io/proxy-body-size: 64m
initFs:
  enabled: true
initSysctl:
  enabled: true
elasticsearch:
  configureNode: false
  bootstrapChecks: true
postgresql:
  enabled: true
  postgresqlDatabase: sonarqube
  postgresqlUsername: sonarqube
  postgresqlPassword: "sadaqah!"
  persistence:
    storageClass: standard
account:
  adminPassword: admin
  currentAdminPassword: "sadaqah!"
YML

  xdg-open http://sonarqube.k8s.local &>/dev/null &
gnome-open http://sonarqube.k8s.local &>/dev/null &
   x-www-browser http://sonarqube.k8s.local &>/dev/null &
sensible-browser http://sonarqube.k8s.local &>/dev/null &

Uninstall

helm uninstall -n sonarqube sonarqube
kubectl delete namespace sonarqube

Playground

helm install -n sonarqube    sonarqube sonarqube/sonarqube --version 10.5.1+2816
helm upgrade -n sonarqube -i sonarqube sonarqube/sonarqube --version 10.6.1+3163
helm show values sonarqube/sonarqube --version 10.5.1+2816|less

kubectl exec -n sonarqube -it svc/sonarqube-postgresql -c sonarqube-postgresql -- psql -Usonarqube
kubectl exec -n sonarqube -it svc/sonarqube-postgresql -c sonarqube-postgresql -- bash
kubectl exec -n sonarqube -it svc/sonarqube-sonarqube  -c sonarqube -- bash
kubectl exec -n sonarqube -it sonarqube-postgresql-0 -- bash
kubectl exec -n sonarqube -it sonarqube-sonarqube-0  -- bash

kubectl config --kubeconfig=${HOME}/.kube/aws-kubeconfig.yaml view --flatten
kubectl config --kubeconfig=${HOME}/.kube/dev-kubeconfig.yaml view --flatten
kubectl config --kubeconfig=${HOME}/.kube/gcp-kubeconfig.yaml view --flatten
kubectl config --kubeconfig=${HOME}/.kube/config view --flatten

kubectl delete all --all -n sonarqube
kubectl delete ing --all -n sonarqube
kubectl delete sts --all -n sonarqube
kubectl delete svc --all -n sonarqube
kubectl delete pvc --all -n sonarqube
kubectl delete pv  --all -n sonarqube

kubectl rollout -n sonarqube history sts sonarqube-sonarqube
kubectl rollout -n sonarqube restart sts sonarqube-sonarqube
kubectl rollout -n sonarqube status  sts sonarqube-sonarqube
kubectl exec -n sonarqube -it sonarqube-postgresql-0 -- psql -Usonarqube
kubectl logs -n sonarqube -f  sonarqube-postgresql-0
kubectl logs -n sonarqube -f  sonarqube-sonarqube-0

References