Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade helm chart #299

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion chart/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ apiVersion: v1
appVersion: "3.x"
description: A Helm chart for Kafdrop
name: kafdrop
version: 0.1.0
version: 0.2.0
11 changes: 11 additions & 0 deletions chart/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,14 @@ Create chart name and version as used by the chart label.
{{- define "chart.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Create the name of the service account to use
*/}}
{{- define "chart.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "chart.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
26 changes: 16 additions & 10 deletions chart/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,32 @@ spec:
app.kubernetes.io/name: {{ include "chart.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
annotations:
checksum/secret: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }}
{{- if .Values.podAnnotations }}
{{ toYaml .Values.podAnnotations | indent 8 }}
{{- end }}
{{- end }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "chart.serviceAccountName" . }}
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 }}
{{- if or .Values.kafka.truststore .Values.kafka.keystore .Values.kafka.properties }}
envFrom:
- secretRef:
name: {{ include "chart.fullname" . }}
{{- end }}
env:
- name: KAFKA_BROKERCONNECT
value: "{{ .Values.kafka.brokerConnect }}"
- name: KAFKA_PROPERTIES
value: "{{ .Values.kafka.properties }}"
- name: KAFKA_TRUSTSTORE
value: "{{ .Values.kafka.truststore }}"
- name: KAFKA_KEYSTORE
value: "{{ .Values.kafka.keystore }}"
- name: JVM_OPTS
value: "{{ .Values.jvm.opts }}"
- name: JMX_PORT
Expand All @@ -58,7 +67,6 @@ spec:
{{- else }}
value: "{{ .Values.cmdArgs }}"
{{- end }}

ports:
- name: http
containerPort: 9000
Expand Down Expand Up @@ -101,5 +109,3 @@ spec:
path: {{ .Values.mountProtoDesc.hostPath }}
type: Directory
{{- end }}


4 changes: 4 additions & 0 deletions chart/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "chart.fullname" . -}}
{{- $ingressPath := .Values.ingress.path -}}
{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1beta1
{{- else -}}
apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress
metadata:
name: {{ $fullName }}
Expand Down
21 changes: 21 additions & 0 deletions chart/templates/secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{{- if or .Values.kafka.truststore .Values.kafka.keystore .Values.kafka.properties }}
apiVersion: v1
kind: Secret
metadata:
name: {{ include "chart.fullname" . }}
labels:
app.kubernetes.io/name: {{ include "chart.name" . }}
helm.sh/chart: {{ include "chart.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
data:
{{- if .Values.kafka.truststore }}
KAFKA_TRUSTSTORE: {{ .Values.kafka.truststore | b64enc }}
{{- end }}
{{- if .Values.kafka.keystore }}
KAFKA_KEYSTORE: {{ .Values.kafka.keystore | b64enc }}
{{- end }}
{{- if .Values.kafka.properties }}
KAFKA_PROPERTIES: {{ .Values.kafka.properties | b64enc }}
{{- end }}
{{- end }}
11 changes: 11 additions & 0 deletions chart/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "chart.serviceAccountName" . }}
labels:
app.kubernetes.io/name: {{ include "chart.name" . }}
helm.sh/chart: {{ include "chart.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
21 changes: 19 additions & 2 deletions chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,23 @@ affinity: {}

podAnnotations: {}

mountProtoDesc:
mountProtoDesc:
enabled: false
hostPath:
hostPath:

serviceAccount:
create: true
name:

podSecurityContext: {}
# fsGroup: 2000

securityContext: {}
# capabilities:
# drop:
# - ALL
# readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000

imagePullSecrets: []