blob: 1e15e3daa265874ccb735908ddc2a5a86a2c4d37 [file] [log] [blame]
Zack Williams618ab862018-08-03 10:12:54 -07001---
2# Copyright 2018-present Open Networking Foundation
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16apiVersion: v1
17kind: ConfigMap
18metadata:
19 name: {{ .Values.common.configMapName }}
20 namespace: {{ .Values.common.namespace }}
21data:
22{{- if .Values.daemonset.nodeLabels }}
23 nodeLabelsForPV: |
24 {{- range $label := .Values.daemonset.nodeLabels }}
25 - {{$label}}
26 {{- end }}
27{{- end }}
28{{- if .Values.common.useAlphaAPI }}
29 useAlphaAPI: "true"
30{{- end }}
31{{- if .Values.common.useJobForCleaning }}
32 useJobForCleaning: "yes"
33{{- end}}
34{{- if .Values.common.minResyncPeriod }}
35 minResyncPeriod: {{ .Values.common.minResyncPeriod | quote }}
36{{- end}}
37 storageClassMap: |
38 {{- range $classConfig := .Values.classes }}
39 {{ $classConfig.name }}:
40 hostDir: {{ $classConfig.hostDir }}
41 mountDir: {{ if $classConfig.mountDir }} {{- $classConfig.mountDir -}} {{ else }} {{- $classConfig.hostDir -}} {{ end }}
42 {{- if $classConfig.blockCleanerCommand }}
43 blockCleanerCommand:
44 {{- range $val := $classConfig.blockCleanerCommand }}
45 - "{{ $val -}}"{{- end}}
46 {{- end }}
47 {{- end }}
48---
49apiVersion: extensions/v1beta1
50kind: DaemonSet
51metadata:
52 name: {{ .Values.daemonset.name }}
53 namespace: {{ .Values.common.namespace }}
54 labels:
55 app: local-volume-provisioner
56spec:
57 selector:
58 matchLabels:
59 app: local-volume-provisioner
60 template:
61 metadata:
62 labels:
63 app: local-volume-provisioner
64 spec:
65 serviceAccountName: {{.Values.daemonset.serviceAccount}}
66{{- if .Values.daemonset.tolerations }}
67 tolerations:
68{{ .Values.daemonset.tolerations | toYaml | trim | indent 8 }}
69{{- end }}
70 containers:
71 - image: "{{ .Values.daemonset.image }}"
72 {{- if .Values.daemonset.imagePullPolicy }}
73 imagePullPolicy: {{ .Values.daemonset.imagePullPolicy | quote }}
74 {{- end }}
75 name: provisioner
76 securityContext:
77 privileged: true
78{{- if .Values.daemonset.resources }}
79 resources:
80{{ .Values.daemonset.resources | toYaml | trim | indent 12 }}
81{{- end }}
82 env:
83 - name: MY_NODE_NAME
84 valueFrom:
85 fieldRef:
86 fieldPath: spec.nodeName
87 - name: MY_NAMESPACE
88 valueFrom:
89 fieldRef:
90 fieldPath: metadata.namespace
91 - name: JOB_CONTAINER_IMAGE
92 value: "{{ .Values.daemonset.image }}"
93 {{- if .Values.daemonset.kubeConfigEnv }}
94 - name: KUBECONFIG
95 value: {{.Values.daemonset.kubeConfigEnv}}
96 {{- end }}
97 volumeMounts:
98 - mountPath: /etc/provisioner/config
99 name: provisioner-config
100 readOnly: true
101 - mountPath: /dev
102 name: provisioner-dev
103 {{- range $classConfig := .Values.classes }}
104 - mountPath: {{ if $classConfig.mountDir }} {{- $classConfig.mountDir -}} {{ else }} {{- $classConfig.hostDir -}} {{ end }}
105 name: {{ $classConfig.name }}
106 mountPropagation: "HostToContainer"
107 {{- end }}
108 volumes:
109 - name: provisioner-config
110 configMap:
111 name: {{ .Values.common.configMapName }}
112 - name: provisioner-dev
113 hostPath:
114 path: /dev
115 {{- range $classConfig := .Values.classes }}
116 - name: {{ $classConfig.name }}
117 hostPath:
118 path: {{ $classConfig.hostDir }}
119 {{- end }}
120
121{{- range $val := .Values.classes }}
122{{- if $val.storageClass }}
123{{- $reclaimPolicy := $val.reclaimPolicy | default "Delete" }}
124---
125apiVersion: storage.k8s.io/v1
126kind: StorageClass
127metadata:
128 name: {{ $val.name }}
129provisioner: kubernetes.io/no-provisioner
130volumeBindingMode: WaitForFirstConsumer
131reclaimPolicy: {{ $reclaimPolicy }}
132{{- end }}
133{{- end }}