Skip to content

Commit

Permalink
working helm version with example
Browse files Browse the repository at this point in the history
Signed-off-by: Frank Kloeker <[email protected]>
  • Loading branch information
eumel8 committed Dec 1, 2023
1 parent ada32b5 commit a9144ae
Show file tree
Hide file tree
Showing 7 changed files with 157 additions and 76 deletions.
2 changes: 1 addition & 1 deletion chart/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: A Helm chart to install Sparrow
type: application
keywords:
- monitoring
version: 0.0.1
version: 0.0.2
appVersion: "v0.0.0-SNAPSHOT-6477ffc"
sources:
- https://github.com/caas-team/sparrow
Expand Down
6 changes: 6 additions & 0 deletions chart/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,9 @@ Create the name of the service account to use
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

{{- define "sparrowConfig" -}}
{{- range $key, $value := .Values.sparrow }}
{{ $key }}: {{ $value }}
{{- end }}
{{- end }}
20 changes: 20 additions & 0 deletions chart/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{{- if .Values.sparrowConfig}}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "sparrow.fullname" . }}
labels:
{{- include "sparrow.labels" . | nindent 4 }}
data:
checks.yaml: |
apiVersion: 0.0.1
kind: Config
checks:
health:
enabled: {{ .Values.sparrowConfig.enabled }}
targets:
{{- with .Values.sparrowConfig.targets }}
{{- toYaml . | nindent 10 }}
{{- end }}
healthEndpoint: {{ .Values.sparrowConfig.healthEndpoint }}
{{- end }}
25 changes: 9 additions & 16 deletions chart/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ spec:
containers:
- args:
- --config
- "/.config.yaml"
#command:
#- sparrow
- "/config/.sparrow.yaml"
name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
Expand All @@ -44,25 +42,20 @@ spec:
- name: http
containerPort: {{ .Values.service.port }}
protocol: TCP
livenessProbe:
httpGet:
path: /
port: http
readinessProbe:
httpGet:
path: /
port: http
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.volumeMounts }}
volumeMounts:
- name: name
mountPath: /.config.yaml
{{- end }}
- name: sparrow
mountPath: /config
- name: run
mountPath: /runconfig
volumes:
- name: config
- name: sparrow
secret:
secretName: {{ include "sparrow.fullname" . }}
- name: run
configMap:
name: {{ include "sparrow.fullname" . }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
Expand Down
61 changes: 61 additions & 0 deletions chart/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "sparrow.fullname" . -}}
{{- $svcPort := .Values.service.port -}}
{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
{{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
{{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}}
{{- end }}
{{- end }}
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1beta1
{{- else -}}
apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress
metadata:
name: {{ $fullName }}
labels:
{{- include "sparrow.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
ingressClassName: {{ .Values.ingress.className }}
{{- end }}
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ .host | quote }}
http:
paths:
{{- range .paths }}
- path: {{ .path }}
{{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
pathType: {{ .pathType }}
{{- end }}
backend:
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
service:
name: {{ $fullName }}
port:
number: {{ $svcPort }}
{{- else }}
serviceName: {{ $fullName }}
servicePort: {{ $svcPort }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
14 changes: 1 addition & 13 deletions chart/templates/secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,5 @@ metadata:
labels:
{{- include "sparrow.labels" . | nindent 4 }}
data:
apiAddress: {{ .Values.sparrow.apiAddress | default ":8080" | b64enc | quote }}
loaderFilePath: {{ .Values.sparrow.loaderFilePath | default "config.yaml" | b64enc | quote }}
loaderHttpRetryCount: {{ .Values.sparrow.loaderHttpRetryCount | default "3" | b64enc | quote }}
loaderHttpRetryDelay: {{ .Values.sparrow.loaderHttpRetryDelay | default "1" | b64enc | quote }}
loaderHttpTimeout: {{ .Values.sparrow.loaderHttpTimeout | default "30" | b64enc | quote }}
{{- if .Values.sparrow.loaderHttpToken}}
loaderHttpToken: {{ .Values.sparrow.loaderHttpToken | b64enc | quote }}
{{- end }}
{{- if .Values.sparrow.loaderHttpUrl}}
loaderHttpUrl: {{ .Values.sparrow.loaderHttpUrl | b64enc | quote }}
{{- end }}
loaderInterval: {{ .Values.sparrow.loaderInterval | default "300" |b64enc | quote }}
loaderType: {{ .Values.sparrow.loaderType | default "http" |b64enc | quote }}
.sparrow.yaml: {{ include "sparrowConfig" . | b64enc }}
{{- end }}
105 changes: 59 additions & 46 deletions chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,63 +28,76 @@ serviceAccount:
podAnnotations: {}
podLabels: {}

# podSecurityContext: {}
podSecurityContext:
fsGroup: 1000
supplementalGroups:
- 1000
podSecurityContext: {}
# podSecurityContext:
# fsGroup: 1000
# supplementalGroups:
# - 1000

# securityContext: {}
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
privileged: false
readOnlyRootFilesystem: true
runAsUser: 1000
runAsGroup: 1000
securityContext: {}
# securityContext:
# allowPrivilegeEscalation: false
# capabilities:
# drop:
# - ALL
# privileged: false
# readOnlyRootFilesystem: true
# runAsUser: 1000
# runAsGroup: 1000

service:
type: ClusterIP
port: 80
port: 8080

# resources: {}
resources:
limits:
cpu: 500m
memory: 512Mi
requests:
cpu: 100m
memory: 128Mi

# Additional volumes on the output Deployment definition.
volumes: []
# - name: foo
# secret:
# secretName: mysecret
# optional: false
ingress:
enabled: false
className: ""
annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
hosts:
- host: chart-example.local
paths:
- path: /
pathType: ImplementationSpecific
tls: []
# - secretName: chart-example-tls
# hosts:
# - chart-example.local

# Additional volumeMounts on the output Deployment definition.
volumeMounts: []
# - name: foo
# mountPath: "/etc/foo"
# readOnly: true
resources: {}
# resources:
# limits:
# cpu: 500m
# memory: 512Mi
# requests:
# cpu: 100m
# memory: 128Mi

nodeSelector: {}

tolerations: []

affinity: {}

# configution of the Sparrow
# startup configution of the Sparrow
# see: https://github.com/caas-team/sparrow/blob/main/docs/sparrow_run.md
sparrow:
apiAddress:
loaderFilePath:
loaderHttpRetryCount:
loaderHttpRetryDelay:
loaderHttpTimeout:
loaderHttpToken:
loaderHttpUrl:
loaderInterval:
loaderType:
#apiAddress:
loaderFilePath: /runconfig/checks.yaml
#loaderHttpRetryCount:
#loaderHttpRetryDelay:
#loaderHttpTimeout:
#loaderHttpToken:
#loaderHttpUrl:
#loaderInterval:
loaderType: file

# runtime configution of the Sparrow
# see: https://github.com/caas-team/sparrow#runtime
sparrowConfig:
enabled: true
targets:
- "https://www.telekom.de"
- "https://gitlab.devops.telekom.de"
healthEndpoint: false

0 comments on commit a9144ae

Please sign in to comment.