You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

297 lines
8.4 KiB

  1. ---
  2. apiVersion: v1
  3. kind: List
  4. items:
  5. - apiVersion: v1
  6. kind: ServiceAccount
  7. metadata:
  8. name: weave-net
  9. labels:
  10. name: weave-net
  11. namespace: kube-system
  12. - apiVersion: rbac.authorization.k8s.io/v1
  13. kind: ClusterRole
  14. metadata:
  15. name: weave-net
  16. labels:
  17. name: weave-net
  18. rules:
  19. - apiGroups:
  20. - ''
  21. resources:
  22. - pods
  23. - namespaces
  24. - nodes
  25. verbs:
  26. - get
  27. - list
  28. - watch
  29. - apiGroups:
  30. - extensions
  31. resources:
  32. - networkpolicies
  33. verbs:
  34. - get
  35. - list
  36. - watch
  37. - apiGroups:
  38. - 'networking.k8s.io'
  39. resources:
  40. - networkpolicies
  41. verbs:
  42. - get
  43. - list
  44. - watch
  45. - apiGroups:
  46. - ''
  47. resources:
  48. - nodes/status
  49. verbs:
  50. - patch
  51. - update
  52. - apiVersion: rbac.authorization.k8s.io/v1
  53. kind: ClusterRoleBinding
  54. metadata:
  55. name: weave-net
  56. labels:
  57. name: weave-net
  58. roleRef:
  59. kind: ClusterRole
  60. name: weave-net
  61. apiGroup: rbac.authorization.k8s.io
  62. subjects:
  63. - kind: ServiceAccount
  64. name: weave-net
  65. namespace: kube-system
  66. - apiVersion: rbac.authorization.k8s.io/v1
  67. kind: Role
  68. metadata:
  69. name: weave-net
  70. namespace: kube-system
  71. labels:
  72. name: weave-net
  73. rules:
  74. - apiGroups:
  75. - ''
  76. resources:
  77. - configmaps
  78. resourceNames:
  79. - weave-net
  80. verbs:
  81. - get
  82. - update
  83. - apiGroups:
  84. - ''
  85. resources:
  86. - configmaps
  87. verbs:
  88. - create
  89. - apiVersion: rbac.authorization.k8s.io/v1
  90. kind: RoleBinding
  91. metadata:
  92. name: weave-net
  93. namespace: kube-system
  94. labels:
  95. name: weave-net
  96. roleRef:
  97. kind: Role
  98. name: weave-net
  99. apiGroup: rbac.authorization.k8s.io
  100. subjects:
  101. - kind: ServiceAccount
  102. name: weave-net
  103. namespace: kube-system
  104. - apiVersion: apps/v1
  105. kind: DaemonSet
  106. metadata:
  107. name: weave-net
  108. labels:
  109. name: weave-net
  110. namespace: kube-system
  111. spec:
  112. # Wait 5 seconds to let pod connect before rolling next pod
  113. selector:
  114. matchLabels:
  115. name: weave-net
  116. minReadySeconds: 5
  117. template:
  118. metadata:
  119. labels:
  120. name: weave-net
  121. spec:
  122. initContainers:
  123. - name: weave-init
  124. image: {{ weave_kube_image_repo }}:{{ weave_kube_image_tag }}
  125. imagePullPolicy: {{ k8s_image_pull_policy }}
  126. command:
  127. - /home/weave/init.sh
  128. env:
  129. securityContext:
  130. privileged: true
  131. volumeMounts:
  132. - name: cni-bin
  133. mountPath: /host/opt
  134. - name: cni-bin2
  135. mountPath: /host/home
  136. - name: cni-conf
  137. mountPath: /host/etc
  138. - name: lib-modules
  139. mountPath: /lib/modules
  140. - name: xtables-lock
  141. mountPath: /run/xtables.lock
  142. readOnly: false
  143. containers:
  144. - name: weave
  145. command:
  146. - /home/weave/launch.sh
  147. env:
  148. - name: INIT_CONTAINER
  149. value: "true"
  150. - name: HOSTNAME
  151. valueFrom:
  152. fieldRef:
  153. apiVersion: v1
  154. fieldPath: spec.nodeName
  155. - name: WEAVE_PASSWORD
  156. valueFrom:
  157. secretKeyRef:
  158. name: weave-net
  159. key: WEAVE_PASSWORD
  160. - name: CHECKPOINT_DISABLE
  161. value: "{{ weave_checkpoint_disable | bool | int }}"
  162. - name: CONN_LIMIT
  163. value: "{{ weave_conn_limit | int }}"
  164. - name: HAIRPIN_MODE
  165. value: "{{ weave_hairpin_mode | bool | lower }}"
  166. - name: IPALLOC_RANGE
  167. value: "{{ weave_ipalloc_range }}"
  168. - name: EXPECT_NPC
  169. value: "{{ weave_expect_npc | bool | int }}"
  170. {% if weave_kube_peers %}
  171. - name: KUBE_PEERS
  172. value: "{{ weave_kube_peers }}"
  173. {% endif %}
  174. {% if weave_ipalloc_init %}
  175. - name: IPALLOC_INIT
  176. value: "{{ weave_ipalloc_init }}"
  177. {% endif %}
  178. {% if weave_expose_ip %}
  179. - name: WEAVE_EXPOSE_IP
  180. value: "{{ weave_expose_ip }}"
  181. {% endif %}
  182. {% if weave_metrics_addr %}
  183. - name: WEAVE_METRICS_ADDR
  184. value: "{{ weave_metrics_addr }}"
  185. {% endif %}
  186. {% if weave_status_addr %}
  187. - name: WEAVE_STATUS_ADDR
  188. value: "{{ weave_status_addr }}"
  189. {% endif %}
  190. {% if weave_iptables_backend %}
  191. - name: IPTABLES_BACKEND
  192. value: "{{ weave_iptables_backend }}"
  193. {% endif %}
  194. - name: WEAVE_MTU
  195. value: "{{ weave_mtu | int }}"
  196. - name: NO_MASQ_LOCAL
  197. value: "{{ weave_no_masq_local | bool | int }}"
  198. {% if weave_extra_args %}
  199. - name: EXTRA_ARGS
  200. value: "{{ weave_extra_args }}"
  201. {% endif %}
  202. image: {{ weave_kube_image_repo }}:{{ weave_kube_image_tag }}
  203. imagePullPolicy: {{ k8s_image_pull_policy }}
  204. readinessProbe:
  205. httpGet:
  206. host: 127.0.0.1
  207. path: /status
  208. port: 6784
  209. resources:
  210. requests:
  211. cpu: 50m
  212. securityContext:
  213. privileged: true
  214. volumeMounts:
  215. - name: weavedb
  216. mountPath: /weavedb
  217. - name: dbus
  218. mountPath: /host/var/lib/dbus
  219. readOnly: true
  220. - mountPath: /host/etc/machine-id
  221. name: cni-machine-id
  222. readOnly: true
  223. - name: xtables-lock
  224. mountPath: /run/xtables.lock
  225. readOnly: false
  226. - name: weave-npc
  227. env:
  228. - name: HOSTNAME
  229. valueFrom:
  230. fieldRef:
  231. apiVersion: v1
  232. fieldPath: spec.nodeName
  233. {% if weave_npc_extra_args %}
  234. - name: EXTRA_ARGS
  235. value: "{{ weave_npc_extra_args }}"
  236. {% endif %}
  237. image: {{ weave_npc_image_repo }}:{{ weave_npc_image_tag }}
  238. imagePullPolicy: {{ k8s_image_pull_policy }}
  239. resources:
  240. requests:
  241. cpu: 50m
  242. securityContext:
  243. privileged: true
  244. volumeMounts:
  245. - name: xtables-lock
  246. mountPath: /run/xtables.lock
  247. readOnly: false
  248. hostNetwork: true
  249. dnsPolicy: ClusterFirstWithHostNet
  250. hostPID: false
  251. restartPolicy: Always
  252. securityContext:
  253. seLinuxOptions: {}
  254. serviceAccountName: weave-net
  255. tolerations:
  256. - effect: NoSchedule
  257. operator: Exists
  258. - effect: NoExecute
  259. operator: Exists
  260. volumes:
  261. - name: weavedb
  262. hostPath:
  263. path: /var/lib/weave
  264. - name: cni-bin
  265. hostPath:
  266. path: /opt
  267. - name: cni-bin2
  268. hostPath:
  269. path: /home
  270. - name: cni-conf
  271. hostPath:
  272. path: /etc
  273. - name: cni-machine-id
  274. hostPath:
  275. path: /etc/machine-id
  276. - name: dbus
  277. hostPath:
  278. path: /var/lib/dbus
  279. - name: lib-modules
  280. hostPath:
  281. path: /lib/modules
  282. - name: xtables-lock
  283. hostPath:
  284. path: /run/xtables.lock
  285. type: FileOrCreate
  286. priorityClassName: system-node-critical
  287. updateStrategy:
  288. rollingUpdate:
  289. maxUnavailable: {{ serial | default('20%') }}
  290. type: RollingUpdate
  291. - apiVersion: v1
  292. kind: Secret
  293. metadata:
  294. name: weave-net
  295. namespace: kube-system
  296. data:
  297. WEAVE_PASSWORD: "{{ weave_password | default("") | b64encode }}"