Skip to content
This repository has been archived by the owner on Aug 22, 2022. It is now read-only.

Commit

Permalink
Initial daemonset support
Browse files Browse the repository at this point in the history
  • Loading branch information
bjw-s committed Nov 19, 2020
1 parent d2d5916 commit 34df5b8
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 6 deletions.
8 changes: 5 additions & 3 deletions charts/common/templates/_all.tpl
Expand Up @@ -10,10 +10,12 @@
{{- /* Build the templates */ -}}
{{- include "common.pvc" . }}
{{- print "---" | nindent 0 -}}
{{- if eq .Values.controllerType "statefulset" }}
{{- include "common.statefulset" . | nindent 0 }}
{{ else }}
{{- if eq .Values.controllerType "deployment" }}
{{- include "common.deployment" . | nindent 0 }}
{{ else if eq .Values.controllerType "daemonset" }}
{{- include "common.daemonset" . | nindent 0 }}
{{ else if eq .Values.controllerType "statefulset" }}
{{- include "common.statefulset" . | nindent 0 }}
{{- end -}}
{{- print "---" | nindent 0 -}}
{{ include "common.service" . | nindent 0 }}
Expand Down
69 changes: 69 additions & 0 deletions charts/common/templates/_daemonset.tpl
@@ -0,0 +1,69 @@
{{- define "common.daemonset" -}}
apiVersion: {{ include "common.capabilities.daemonset.apiVersion" . }}
kind: DaemonSet
metadata:
name: {{ include "common.names.fullname" . }}
labels:
{{- include "common.labels" . | nindent 4 }}
{{- with .Values.controllerLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.controllerAnnotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
selector:
matchLabels:
{{- include "common.labels.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "common.labels.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.podSecurityContext }}
securityContext:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.hostNetwork }}
hostNetwork: {{ . }}
{{- end }}
{{- with .Values.dnsPolicy }}
dnsPolicy: {{ . }}
{{- end }}
{{- with .Values.initContainers }}
initContainers:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
{{- include "common.controller.mainContainer" . | nindent 6 }}
{{- with .Values.additionalContainers }}
{{- toYaml . | nindent 6 }}
{{- end }}
volumes:
{{- include "common.controller.volumes" . | trim | nindent 6 }}
{{- with .Values.hostAliases }}
hostAliases:
{{- toYaml . | nindent 8 }}
{{- 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 }}
{{- end }}
11 changes: 11 additions & 0 deletions charts/common/templates/lib/chart/_capabilities.tpl
@@ -1,3 +1,14 @@
{{/*
Return the appropriate apiVersion for daemonset.
*/}}
{{- define "common.capabilities.daemonset.apiVersion" -}}
{{- if semverCompare "<1.14-0" .Capabilities.KubeVersion.GitVersion -}}
{{- print "extensions/v1beta1" -}}
{{- else -}}
{{- print "apps/v1" -}}
{{- end -}}
{{- end -}}

{{/*
Return the appropriate apiVersion for deployment.
*/}}
Expand Down
6 changes: 3 additions & 3 deletions charts/common/values.yaml
@@ -1,8 +1,8 @@
# type: options are statefulset or deployment
# type: options are deployment, daemonset or statefulset
controllerType: deployment
# Set annotations on the deployment/statefulset
# Set annotations on the deployment/statefulset/daemonset
controllerAnnotations: {}
# Set labels on the deployment/statefulset
# Set labels on the deployment/statefulset/daemonset
controllerLabels: {}

replicas: 1
Expand Down

0 comments on commit 34df5b8

Please sign in to comment.