|
| 1 | +kind: DaemonSet |
| 2 | +apiVersion: extensions/v1beta1 |
| 3 | +metadata: |
| 4 | + name: sdn |
| 5 | + annotations: |
| 6 | + kubernetes.io/description: | |
| 7 | + This daemon set launches the OpenShift networking components (kube-proxy, DNS, and openshift-sdn). |
| 8 | + It expects that OVS is running on the node. |
| 9 | +spec: |
| 10 | + updateStrategy: |
| 11 | + type: RollingUpdate |
| 12 | + template: |
| 13 | + metadata: |
| 14 | + labels: |
| 15 | + component: network |
| 16 | + type: infra |
| 17 | + openshift.io/role: network |
| 18 | + annotations: |
| 19 | + scheduler.alpha.kubernetes.io/critical-pod: '' |
| 20 | + spec: |
| 21 | + # Requires fairly broad permissions - ability to read all services and network functions as well |
| 22 | + # as all pods. |
| 23 | + serviceAccountName: sdn |
| 24 | + hostNetwork: true |
| 25 | + hostPID: true |
| 26 | + containers: |
| 27 | + - name: network |
| 28 | + image: openshift/node:v3.7.0-alpha.1 |
| 29 | + command: |
| 30 | + - /bin/bash |
| 31 | + - -c |
| 32 | + - | |
| 33 | + #!/bin/sh |
| 34 | + set -o errexit |
| 35 | + # Take over network functions on the node |
| 36 | + rm -Rf /etc/cni/net.d/* |
| 37 | + rm -Rf /host/opt/cni/bin/* |
| 38 | + cp -Rf /opt/cni/bin/* /host/opt/cni/bin/ |
| 39 | + # Use whichever node-config exists |
| 40 | + cfg=/etc/openshift/node |
| 41 | + if [[ ! -f "${cfg}/node-config.yaml" ]]; then |
| 42 | + cfg=/etc/origin/node |
| 43 | + fi |
| 44 | + # Use the same config as the node, but with the service account token |
| 45 | + openshift cli config "--config=${cfg}/node.kubeconfig" view --flatten > /tmp/kubeconfig |
| 46 | + openshift cli config --config=/tmp/kubeconfig set-credentials sa "--token=$( cat /var/run/secrets/kubernetes.io/serviceaccount/token )" |
| 47 | + openshift cli config --config=/tmp/kubeconfig set-context "$( openshift cli config current-context)" --user=sa |
| 48 | + # Launch the network process |
| 49 | + exec openshift start network "--config=${cfg}/node-config.yaml" --kubeconfig=/tmp/kubeconfig --loglevel=5 |
| 50 | +
|
| 51 | + securityContext: |
| 52 | + runAsUser: 0 |
| 53 | + # Permission could be reduced by selecting an appropriate SELinux policy |
| 54 | + privileged: true |
| 55 | + # TODO: debugging only |
| 56 | + imagePullPolicy: Never |
| 57 | + volumeMounts: |
| 58 | + # Directory which contains the host configuration. We look at both locations |
| 59 | + # to simplify setup. |
| 60 | + - mountPath: /etc/origin/node/ |
| 61 | + name: host-config |
| 62 | + readOnly: true |
| 63 | + - mountPath: /etc/openshift/node/ |
| 64 | + name: host-config-alt |
| 65 | + readOnly: true |
| 66 | + # Run directories where we need to be able to access sockets |
| 67 | + - mountPath: /var/run/dbus/ |
| 68 | + name: host-var-run-dbus |
| 69 | + readOnly: true |
| 70 | + - mountPath: /var/run/openvswitch/ |
| 71 | + name: host-var-run-ovs |
| 72 | + readOnly: true |
| 73 | + - mountPath: /var/run/kubernetes/ |
| 74 | + name: host-var-run-kubernetes |
| 75 | + readOnly: true |
| 76 | + # We mount our socket here |
| 77 | + - mountPath: /var/run/openshift-sdn |
| 78 | + name: host-var-run-openshift-sdn |
| 79 | + # CNI related mounts which we take over |
| 80 | + - mountPath: /host/opt/cni/bin |
| 81 | + name: host-opt-cni-bin |
| 82 | + - mountPath: /etc/cni/net.d |
| 83 | + name: host-etc-cni-netd |
| 84 | + - mountPath: /var/lib/cni/networks/openshift-sdn |
| 85 | + name: host-var-lib-cni-networks-openshift-sdn |
| 86 | + |
| 87 | + resources: |
| 88 | + requests: |
| 89 | + cpu: 100m |
| 90 | + memory: 200Mi |
| 91 | + env: |
| 92 | + - name: OPENSHIFT_DNS_DOMAIN |
| 93 | + value: cluster.local |
| 94 | + ports: |
| 95 | + - name: healthz |
| 96 | + containerPort: 10256 |
| 97 | + livenessProbe: |
| 98 | + initialDelaySeconds: 10 |
| 99 | + httpGet: |
| 100 | + path: /healthz |
| 101 | + port: 10256 |
| 102 | + scheme: HTTP |
| 103 | + lifecycle: |
| 104 | + # postStart: |
| 105 | + # exec: |
| 106 | + # command: |
| 107 | + # - /usr/bin/dbus-send |
| 108 | + # - --system |
| 109 | + # - --dest=uk.org.thekelleys.dnsmasq |
| 110 | + # - /uk/org/thekelleys/dnsmasq |
| 111 | + # - uk.org.thekelleys.SetDomainServers |
| 112 | + # - array:string:/in-addr.arpa/127.0.0.1,/$(OPENSHIFT_DNS_DOMAIN)/127.0.0.1 |
| 113 | + # preStop: |
| 114 | + # exec: |
| 115 | + # command: |
| 116 | + # - /usr/bin/dbus-send |
| 117 | + # - --system |
| 118 | + # - --dest=uk.org.thekelleys.dnsmasq |
| 119 | + # - /uk/org/thekelleys/dnsmasq |
| 120 | + # - uk.org.thekelleys.SetDomainServers |
| 121 | + # - "array:string:" |
| 122 | + |
| 123 | + volumes: |
| 124 | + # In bootstrap mode, the host config contains information not easily available |
| 125 | + # from other locations. |
| 126 | + - name: host-config |
| 127 | + hostPath: |
| 128 | + path: /etc/origin/node |
| 129 | + - name: host-config-alt |
| 130 | + hostPath: |
| 131 | + path: /etc/openshift/node |
| 132 | + - name: host-modules |
| 133 | + hostPath: |
| 134 | + path: /lib/modules |
| 135 | + |
| 136 | + - name: host-var-run-ovs |
| 137 | + hostPath: |
| 138 | + path: /var/run/openvswitch |
| 139 | + - name: host-var-run-kubernetes |
| 140 | + hostPath: |
| 141 | + path: /var/run/kubernetes |
| 142 | + - name: host-var-run-dbus |
| 143 | + hostPath: |
| 144 | + path: /var/run/dbus |
| 145 | + - name: host-var-run-openshift-sdn |
| 146 | + hostPath: |
| 147 | + path: /var/run/openshift-sdn |
| 148 | + |
| 149 | + - name: host-opt-cni-bin |
| 150 | + hostPath: |
| 151 | + path: /opt/cni/bin |
| 152 | + - name: host-etc-cni-netd |
| 153 | + hostPath: |
| 154 | + path: /etc/cni/net.d |
| 155 | + - name: host-var-lib-cni-networks-openshift-sdn |
| 156 | + hostPath: |
| 157 | + path: /var/lib/cni/networks/openshift-sdn |
0 commit comments