Skip to content
This repository has been archived by the owner on Mar 17, 2024. It is now read-only.

Commit

Permalink
Support init containers in helm chart (#135)
Browse files Browse the repository at this point in the history
  • Loading branch information
terjesannum committed May 26, 2020
1 parent b48d5ba commit f5e3318
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 2 deletions.
6 changes: 5 additions & 1 deletion charts/kafka-lag-exporter/templates/000-ServiceAccount.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@
apiVersion: v1
kind: ServiceAccount
metadata:
{{- if .Values.serviceAccount.nameOverride }}
name: {{ .Values.serviceAccount.nameOverride }}
{{- else }}
name: {{ include "kafka-lag-exporter.fullname" . }}-serviceaccount
{{- end }}
labels:
app.kubernetes.io/name: {{ include "kafka-lag-exporter.name" . }}
helm.sh/chart: {{ include "kafka-lag-exporter.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{- end }}
20 changes: 19 additions & 1 deletion charts/kafka-lag-exporter/templates/040-Deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,12 @@ spec:
{{- end }}
spec:
{{- if or .Values.watchers.strimzi .Values.serviceAccount.create }}
{{- if .Values.serviceAccount.nameOverride }}
serviceAccountName: {{ .Values.serviceAccount.nameOverride }}
{{- else }}
serviceAccountName: {{ include "kafka-lag-exporter.fullname" . }}-serviceaccount
{{- end }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
{{- if .Values.image.digest }}
Expand All @@ -34,7 +38,10 @@ spec:
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
{{- end }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
env: []
{{- if .Values.env }}
env:
{{ toYaml .Values.env | indent 10 }}
{{- end }}
ports:
- name: http
containerPort: {{ .Values.service.port }}
Expand All @@ -60,8 +67,15 @@ spec:
subPath: {{ .subPath }}
readOnly: {{ .readOnly }}
{{- end }}
{{- range .Values.extraMounts }}
- name: {{ .name }}
mountPath: {{ .mountPath }}
{{- end }}
resources:
{{ toYaml .Values.resources | indent 12 }}
{{- with .Values.initContainers }}
initContainers: {{ toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{ toYaml . | indent 8 }}
Expand All @@ -83,3 +97,7 @@ spec:
configMap:
name: {{ .configMap }}
{{- end }}
{{- range .Values.extraMounts }}
- name: {{ .name }}
{{ toYaml .mount | indent 10 }}
{{- end }}
17 changes: 17 additions & 0 deletions charts/kafka-lag-exporter/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ watchers:
## Otherwise, the default service account for the namespace will be used.
serviceAccount:
create: false
## The name of the service account will be generated based on the release name, use nameOverride to override
## with a static name.
# nameOverride: my-serviceaccount

## You can use regex to control the metrics exposed by Prometheus endpoint.
## Any metric that matches one of the regex in the whitelist will be exposed.
Expand Down Expand Up @@ -80,6 +83,11 @@ securityContext: {}
# runAsNonRoot: true
# capabilities:
# drop: ["all"]
initContainers: []
## Init containers to be added to the pod.
# - name: my-init-container
# image: busybox:latest
# command: ['sh', '-c', 'echo hello']
service:
type: ClusterIP
port: 8000
Expand All @@ -99,6 +107,15 @@ extraConfigmapMounts: []
# mountPath: /etc/pki/ca-trust/extracted/java/cacerts
# subPath: ca-bundle.jks
# readOnly: true
extraMounts: []
# - name: my-secrets
# mount:
# emptyDir:
# medium: Memory
# mountPath: /var/run/my-secrets
env: {}
# - name: JAVA_OPTS
# value: "-Djava.security.auth.login.config=/var/run/my-secrets/jaasConfig"
podAnnotations: {}
# foo: bar

Expand Down

0 comments on commit f5e3318

Please sign in to comment.