73881e669c380e10fb0361f706828563b95883f8
[ta/caas-danm.git] / ansible / roles / flannel / templates / flannel-ds.yaml
1 #jinja2: lstrip_blocks: True
2 {#
3 Copyright 2019 Nokia
4
5 Licensed under the Apache License, Version 2.0 (the "License");
6 you may not use this file except in compliance with the License.
7 You may obtain a copy of the License at
8
9     http://www.apache.org/licenses/LICENSE-2.0
10
11 Unless required by applicable law or agreed to in writing, software
12 distributed under the License is distributed on an "AS IS" BASIS,
13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 See the License for the specific language governing permissions and
15 limitations under the License.
16 #}
17 ---
18 apiVersion: apps/v1
19 kind: DaemonSet
20 metadata:
21   name: flannel-ds
22   namespace: kube-system
23   labels:
24     tier: node
25     {{ caas.kubernetes_component_label }}: flannel
26 spec:
27   selector:
28     matchLabels:
29       {{ caas.kubernetes_component_label }}: flannel
30   template:
31     metadata:
32       labels:
33         tier: node
34         {{ caas.kubernetes_component_label }}: flannel
35     spec:
36       priorityClassName: "system-node-critical"
37       hostNetwork: true
38       dnsPolicy: ClusterFirstWithHostNet
39      # TODO: figure out why privileged mode is also not enough for flannel to modify network settings on the host (same problem as watcher)
40      #securityContext:
41      #     runAsUser: {{ caas.uid.flannel }}
42       tolerations:
43       - key: node.kubernetes.io/master
44         operator: Exists
45         effect: NoSchedule
46       containers:
47       - name: kube-flannel
48         image: {{ container_image_names | select('search', '/flannel') | list | last }}
49         command:
50         - /opt/bin/flanneld
51         args:
52         - --ip-masq
53         - --kube-subnet-mgr
54         {% for interface in flannel_interfaces | default([]) %}
55         - --iface={{ interface }}
56         {% endfor %}
57         securityContext:
58           privileged: true
59         env:
60         - name: POD_NAME
61           valueFrom:
62             fieldRef:
63               fieldPath: metadata.name
64         - name: POD_NAMESPACE
65           valueFrom:
66             fieldRef:
67               fieldPath: metadata.namespace
68         resources:
69           requests:
70             cpu: "10m"
71         volumeMounts:
72         - name: time-mount
73           mountPath: /etc/localtime
74           readOnly: true
75         - name: run
76           mountPath: /run
77         - name: flannel-cfg
78           mountPath: /etc/kube-flannel/
79       volumes:
80         - name: time-mount
81           hostPath:
82              path: /etc/localtime
83         - name: run
84           hostPath:
85             path: /run
86         - name: flannel-cfg
87           configMap:
88             name: flannel-cm
89       serviceAccountName: flannel