Skip to content

Commit

Permalink
rename startupConfig/runtimeConfig and provide extraArgs as start option
Browse files Browse the repository at this point in the history
Signed-off-by: Frank Kloeker <[email protected]>
  • Loading branch information
eumel8 committed Dec 3, 2023
1 parent 4668da0 commit 657cb7f
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 19 deletions.
4 changes: 2 additions & 2 deletions chart/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ Create the name of the service account to use
{{- end }}
{{- end }}

{{- define "sparrowConfig" -}}
{{- range $key, $value := .Values.sparrow }}
{{- define "startupConfig" -}}
{{- range $key, $value := .Values.startupConfig }}
{{ $key }}: {{ $value }}
{{- end }}
{{- end }}
17 changes: 13 additions & 4 deletions chart/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if .Values.sparrowConfig}}
{{- if .Values.runtimeConfig}}
apiVersion: v1
kind: ConfigMap
metadata:
Expand All @@ -11,10 +11,19 @@ data:
kind: Config
checks:
health:
enabled: {{ .Values.sparrowConfig.enabled }}
enabled: {{ .Values.runtimeConfig.enabled }}
targets:
{{- with .Values.sparrowConfig.targets }}
{{- with .Values.runtimeConfig.targets }}
{{- toYaml . | nindent 10 }}
{{- end }}
healthEndpoint: {{ .Values.sparrowConfig.healthEndpoint }}
healthEndpoint: {{ .Values.runtimeConfig.healthEndpoint }}
{{- if .Values.runtimeConfig.latency.enabled}}
latency:
enabled: true
interval: {{ .Values.runtimeConfig.latency.interval | default 1 }}
timeout: {{ .Values.runtimeConfig.latency.timeout | default 3 }}
retry:
count: {{ .Values.runtimeConfig.latency.retry.count | default 3 }}
delay: {{ .Values.runtimeConfig.latency.retry.delay | default 1 }}
{{- end }}
{{- end }}
36 changes: 29 additions & 7 deletions chart/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,32 +30,54 @@ spec:
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
{{- if or .Values.extraArgs .Values.startupConfig}}
- args:
{{- end }}
{{- if .Values.startupConfig}}
- --config
- "/config/.sparrow.yaml"
- /startconfig/.sparrow.yaml
{{- end }}
{{- range $key, $value := .Values.extraArgs }}
- --{{ $key }}
- {{ $value }}
{{- end }}
name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
containerPort: {{ .Values.service.port }}
containerPort: {{ .Values.service.port | default 8080 }}
protocol: TCP
{{- if .Values.resources }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- end }}
{{- if or .Values.runtimeConfig .Values.startupConfig}}
volumeMounts:
- name: sparrow
mountPath: /config
- name: run
{{- end }}
{{- if .Values.startupConfig}}
- name: startup
mountPath: /startconfig
{{- end }}
{{- if .Values.runtimeConfig}}
- name: runtime
mountPath: /runconfig
{{- end }}
{{- if or .Values.runtimeConfig .Values.startupConfig}}
volumes:
- name: sparrow
{{- end }}
{{- if .Values.startupConfig}}
- name: startup
secret:
secretName: {{ include "sparrow.fullname" . }}
- name: run
{{- end }}
{{- if .Values.runtimeConfig}}
- name: runtime
configMap:
name: {{ include "sparrow.fullname" . }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
Expand Down
4 changes: 2 additions & 2 deletions chart/templates/secret.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if .Values.sparrow}}
{{- if .Values.startupConfig}}
apiVersion: v1
kind: Secret
type: Opaque
Expand All @@ -7,5 +7,5 @@ metadata:
labels:
{{- include "sparrow.labels" . | nindent 4 }}
data:
.sparrow.yaml: {{ include "sparrowConfig" . | b64enc }}
.sparrow.yaml: {{ include "startupConfig" . | b64enc }}
{{- end }}
14 changes: 10 additions & 4 deletions chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,22 +78,28 @@ tolerations: []

affinity: {}

# extra command line start parameters
# see: https://github.com/caas-team/sparrow/blob/main/docs/sparrow_run.md
extraArgs:
loaderFilePath: /runconfig/checks.yaml
loaderType: file

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

# runtime configuration of the Sparrow
# see: https://github.com/caas-team/sparrow#runtime
sparrowConfig:
runtimeConfig:
enabled: true
healthEndpoint: false
latency:
Expand Down

0 comments on commit 657cb7f

Please sign in to comment.