apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: kube-flannel
  namespace: kube-system
  labels:
    application: kubernetes
    component: flannel
    version: v0.15.1-14
spec:
  updateStrategy:
    type: OnDelete
  selector:
    matchLabels:
      daemonset: kube-flannel
  template:
    metadata:
      labels:
        daemonset: kube-flannel
        application: kubernetes
        component: flannel
        version: v0.15.1-14
      annotations:
        logging/destination: "{{.Cluster.ConfigItems.log_destination_infra}}"
    spec:
      priorityClassName: system-node-critical
      serviceAccountName: flannel
      initContainers:
      - name: ensure-apiserver
        image: registry.opensource.zalan.do/teapot/ensure-apiserver:master-2
        resources:
          requests:
            cpu: 1m
            memory: 50Mi
            ephemeral-storage: 256Mi
          limits:
            cpu: 1m
            memory: 50Mi
      containers:
      - name: delayed-install-cni
        image: registry.opensource.zalan.do/teapot/flannel-awaiter:master-4
        command:
        - /await-and-copy
        stdin: true
        volumeMounts:
        - name: cni
          mountPath: /etc/cni/net.d
        - name: flannel-cfg
          mountPath: /etc/kube-flannel/
        env:
          - name: CNI_CONFIG_SOURCE
            value: /etc/kube-flannel/cni-conf.json
          - name: CNI_CONFIG_TARGET
            value: /etc/cni/net.d/10-flannel.conflist
        resources:
          requests:
            cpu: 25m
            memory: 50Mi
            ephemeral-storage: 256Mi
          limits:
            cpu: 25m
            memory: 50Mi
      - name: kube-flannel
        image: registry.opensource.zalan.do/teapot/flannel:v0.15.1-14
        command:
        - /opt/bin/flanneld
        args:
        - --ip-masq
        - --kube-subnet-mgr
        - --healthz-ip=127.0.0.1
        - --healthz-port=10267
        - --v=2
        env:
        - name: POD_NAME
          valueFrom:
            fieldRef:
              fieldPath: metadata.name
        - name: POD_NAMESPACE
          valueFrom:
            fieldRef:
              fieldPath: metadata.namespace
        resources:
          requests:
            cpu: "{{ .Cluster.ConfigItems.flannel_cpu }}"
            memory: "{{ .Cluster.ConfigItems.flannel_memory }}"
            ephemeral-storage: 256Mi
          limits:
            cpu: "{{ .Cluster.ConfigItems.flannel_cpu }}"
            memory: "{{ .Cluster.ConfigItems.flannel_memory }}"
        readinessProbe:
          httpGet:
            host: 127.0.0.1
            port: 10267
            path: /healthz
        securityContext:
          privileged: true
        volumeMounts:
        - name: flannel-cfg
          mountPath: /etc/kube-flannel/
        - name: run
          mountPath: /run
      - args:
        - -c
        - /tc-flannel.sh
        command:
        - /bin/bash
        image: registry.opensource.zalan.do/teapot/flannel-tc:v0.0.3
        name: flannel-tc
        resources:
          requests:
            cpu: 1m
            memory: 25Mi
            ephemeral-storage: 256Mi
          limits:
            cpu: 1m
            memory: 25Mi
        securityContext:
          privileged: true
        stdin: true
        volumeMounts:
        - mountPath: /run
          name: run
        - mountPath: /lib/tc
          name: lib-tc
      hostNetwork: true
      tolerations:
      - operator: Exists
        effect: NoSchedule
      - operator: Exists
        effect: NoExecute
      volumes:
      - name: flannel-cfg
        configMap:
          name: kube-flannel-cfg
      - name: cni
        hostPath:
          path: /etc/kubernetes/cni/net.d
      - name: run
        hostPath:
          path: /run
      - hostPath:
          path: /lib/tc
          type: ""
        name: lib-tc
