Skip to content

Commit

Permalink
Add Sonarcloud exporter chart
Browse files Browse the repository at this point in the history
Tune gitlab exporter
  • Loading branch information
Whyeasy committed Jun 22, 2020
1 parent c796884 commit 26772b8
Show file tree
Hide file tree
Showing 15 changed files with 338 additions and 12 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,18 @@ This repository contains [Helm](https://helm.sh) charts for various projects
- [k8s Node Termination Handler](https://github.com/whyeasy/helm-charts/tree/master/charts/k8s-node-termination-handler)
- [Gitlab-extra-expoter](https://github.com/Whyeasy/helm-charts/tree/master/charts/gitlab-extra-exporter)
- [Stackdriver-exporter](https://github.com/Whyeasy/helm-charts/tree/master/charts/stackdriver-exporter)
- [Sonarcloud-exporter](https://github.com/Whyeasy/helm-charts/tree/master/charts/sonarcloud -exporter)

## Installing Charts from this Repository

Add the Repository to Helm:

```sh
$ helm repo add whyeasy-helm-charts https://whyeasy.github.io/helm-charts
helm repo add whyeasy-helm-charts https://whyeasy.github.io/helm-charts
```

Install a chart:

```sh
$ helm install whyeasy-helm-charts/[CHART_NAME]
helm install whyeasy-helm-charts/[CHART_NAME]
```
2 changes: 1 addition & 1 deletion charts/gitlab-extra-exporter/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ apiVersion: v2
name: gitlab-extra-exporter
description: A Helm chart to deploy [gitlab-extra-exporter](https://github.com/Whyeasy/gitlab-extra-exporter)
type: application
version: 0.1.6
version: 0.1.7
appVersion: 0.0.6
10 changes: 5 additions & 5 deletions charts/gitlab-extra-exporter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ Current chart version is `0.1.6`
| podSecurityContext | object | `{}` | |
| resources | object | `{}` | custom resource configuration |
| securityContext | object | `{}` | |
| service.port | int | `8080` | |
| service.type | string | `"ClusterIP"` | |
| serviceMonitor.enabled | bool | `true` | |
| serviceMonitor.interval | string | `"5m"` | |
| serviceMonitor.scrapeTimeout | string | `"30s"` | |
| service.port | int | `8080` | Service port for the exporter |
| service.type | string | `"ClusterIP"` | Serive type for the exporter |
| serviceMonitor.enabled | bool | `true` | Deploy a service monitor along with the exporter. |
| serviceMonitor.interval | string | `"5m"` | Set scraping interval for the service monitor. |
| serviceMonitor.scrapeTimeout | string | `"30s"` | Set scraping time out for the service monitor. |
| strategy.type | string | `"RollingUpdate"` | Strategy for deploying containers |
| tolerations | list | `[]` | tolerations for scheduler pod assignment |
| volumeMounts | list | `[]` | additional volume mounts |
Expand Down
2 changes: 1 addition & 1 deletion charts/gitlab-extra-exporter/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ spec:
{{- with .Values.env }}
env:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- end }}
{{- with .Values.envFrom }}
envFrom:
{{- toYaml . | nindent 12 }}
Expand Down
1 change: 1 addition & 0 deletions charts/gitlab-extra-exporter/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apiVersion: v1
kind: Service
metadata:
name: {{ include "gitlab-extra-exporter.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "gitlab-extra-exporter.labels" . | nindent 4 }}
spec:
Expand Down
5 changes: 5 additions & 0 deletions charts/gitlab-extra-exporter/templates/servicemonitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,16 @@ metadata:
name: {{ include "gitlab-extra-exporter.fullname" . }}
labels:
{{- include "gitlab-extra-exporter.labels" . | nindent 4 }}
namespace: {{ .Release.Namespace }}
spec:
endpoints:
- port: metrics
{{- if .Values.serviceMonitor.interval }}
interval: {{ .Values.serviceMonitor.interval }}
{{- end }}
{{- if .Values.serviceMonitor.scrapeTimeout }}
scrapeTimeout: {{ .Values.serviceMonitor.scrapeTimeout }}
{{- end }}
selector:
matchLabels:
{{- include "gitlab-extra-exporter.selectorLabels" . | nindent 6 }}
Expand Down
8 changes: 5 additions & 3 deletions charts/gitlab-extra-exporter/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,15 @@ strategy:
type: RollingUpdate

service:
# service.type - Serive type for the exporter
# service.type -- Serive type for the exporter
type: ClusterIP
# service.port - Service port for the exporter
# service.port -- Service port for the exporter
port: 8080

serviceMonitor:
# serviceMonitor.enabled - Deploy a service monitor along with the exporter.
# serviceMonitor.enabled -- Deploy a service monitor along with the exporter.
enabled: true
# serviceMonitor.interval -- Set scraping interval for the service monitor.
interval: 5m
# serviceMonitor.scrapeTimeout -- Set scraping time out for the service monitor.
scrapeTimeout: 30s
22 changes: 22 additions & 0 deletions charts/sonarcloud-exporter/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
6 changes: 6 additions & 0 deletions charts/sonarcloud-exporter/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v2
name: sonarcloud-exporter
description: A Helm chart to deploy [sonarcloud-exporter](https://github.com/Whyeasy/sonarcloud-exporter)
type: application
version: 0.1.0
appVersion: 0.0.1
36 changes: 36 additions & 0 deletions charts/sonarcloud-exporter/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
sonarcloud-exporter
===================
A Helm chart to deploy [sonarcloud-exporter](https://github.com/Whyeasy/sonarcloud-exporter)

Current chart version is `0.1.0`





## Chart Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| affinity | object | `{}` | affinity for scheduler pod assignment |
| env | list | `[]` | environment variables for the container |
| envFrom | list | `[]` | environment variable sources for the container |
| fullnameOverride | string | `""` | full name of the chart. |
| image.pullPolicy | string | `"IfNotPresent"` | image pull policy |
| image.repository | string | `"whyeasy/sonarcloud-exporter"` | image repository |
| image.tag | string | `"v0.0.1"` | image tag |
| imagePullSecrets | list | `[]` | image pull secret for private images |
| nameOverride | string | `""` | override name of the chart |
| nodeSelector | object | `{}` | node for scheduler pod assignment |
| podSecurityContext | object | `{}` | |
| resources | object | `{}` | custom resource configuration |
| securityContext | object | `{}` | |
| service.port | int | `8080` | Service port for the exporter |
| service.type | string | `"ClusterIP"` | Serive type for the exporter |
| serviceMonitor.enabled | bool | `false` | Deploy a service monitor along with the exporter. |
| serviceMonitor.interval | string | `""` | Set scraping interval for the service monitor. |
| serviceMonitor.scrapeTimeout | string | `""` | Set scraping time out for the service monitor. |
| strategy.type | string | `"RollingUpdate"` | Strategy for deploying containers |
| tolerations | list | `[]` | tolerations for scheduler pod assignment |
| volumeMounts | list | `[]` | additional volume mounts |
| volumes | list | `[]` | volumes |
63 changes: 63 additions & 0 deletions charts/sonarcloud-exporter/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "sonarcloud-exporter.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "sonarcloud-exporter.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "sonarcloud-exporter.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Common labels
*/}}
{{- define "sonarcloud-exporter.labels" -}}
helm.sh/chart: {{ include "sonarcloud-exporter.chart" . }}
{{ include "sonarcloud-exporter.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end -}}

{{/*
Selector labels
*/}}
{{- define "sonarcloud-exporter.selectorLabels" -}}
app.kubernetes.io/name: {{ include "sonarcloud-exporter.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end -}}

{{/*
Create the name of the service account to use
*/}}
{{- define "sonarcloud-exporter.serviceAccountName" -}}
{{- if .Values.serviceAccount.create -}}
{{ default (include "sonarcloud-exporter.fullname" .) .Values.serviceAccount.name }}
{{- else -}}
{{ default "default" .Values.serviceAccount.name }}
{{- end -}}
{{- end -}}
74 changes: 74 additions & 0 deletions charts/sonarcloud-exporter/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "sonarcloud-exporter.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "sonarcloud-exporter.labels" . | nindent 4 }}
spec:
replicas: 1
selector:
matchLabels:
{{- include "sonarcloud-exporter.selectorLabels" . | nindent 6 }}
{{- with .Values.strategy }}
strategy: {{ toYaml . | nindent 4 }}
{{- end }}
template:
metadata:
labels:
{{- include "sonarcloud-exporter.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: metrics
containerPort: 8080
protocol: TCP
livenessProbe:
httpGet:
path: /
port: metrics
readinessProbe:
httpGet:
path: /
port: metrics
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.env }}
env:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.envFrom }}
envFrom:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.volumeMounts }}
volumeMounts:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.volumes }}
volumes:
{{- toYaml . | nindent 8 }}
{{- end }}
16 changes: 16 additions & 0 deletions charts/sonarcloud-exporter/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "sonarcloud-exporter.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "sonarcloud-exporter.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: metrics
protocol: TCP
name: metrics
selector:
{{- include "sonarcloud-exporter.selectorLabels" . | nindent 4 }}
21 changes: 21 additions & 0 deletions charts/sonarcloud-exporter/templates/servicemonitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{{ if .Values.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ include "sonarcloud-exporter.fullname" . }}
labels:
{{- include "sonarcloud-exporter.labels" . | nindent 4 }}
namespace: {{ .Release.Namespace }}
spec:
endpoints:
- port: metrics
{{- if .Values.serviceMonitor.interval }}
interval: {{ .Values.serviceMonitor.interval }}
{{- end }}
{{- if .Values.serviceMonitor.scrapeTimeout }}
scrapeTimeout: {{ .Values.serviceMonitor.scrapeTimeout }}
{{- end }}
selector:
matchLabels:
{{- include "sonarcloud-exporter.selectorLabels" . | nindent 6 }}
{{- end }}
Loading

0 comments on commit 26772b8

Please sign in to comment.