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.

413 lines
9.7 KiB

  1. apiVersion: policy/v1beta1
  2. kind: PodSecurityPolicy
  3. metadata:
  4. name: kube-ovn
  5. annotations:
  6. seccomp.security.alpha.kubernetes.io/allowedProfileNames: '*'
  7. spec:
  8. privileged: true
  9. allowPrivilegeEscalation: true
  10. allowedCapabilities:
  11. - '*'
  12. volumes:
  13. - '*'
  14. hostNetwork: true
  15. hostPorts:
  16. - min: 0
  17. max: 65535
  18. hostIPC: true
  19. hostPID: true
  20. runAsUser:
  21. rule: 'RunAsAny'
  22. seLinux:
  23. rule: 'RunAsAny'
  24. supplementalGroups:
  25. rule: 'RunAsAny'
  26. fsGroup:
  27. rule: 'RunAsAny'
  28. ---
  29. apiVersion: v1
  30. kind: ConfigMap
  31. metadata:
  32. name: ovn-config
  33. namespace: kube-system
  34. ---
  35. apiVersion: v1
  36. kind: ServiceAccount
  37. metadata:
  38. name: ovn
  39. namespace: kube-system
  40. ---
  41. apiVersion: rbac.authorization.k8s.io/v1
  42. kind: ClusterRole
  43. metadata:
  44. annotations:
  45. rbac.authorization.k8s.io/system-only: "true"
  46. name: system:ovn
  47. rules:
  48. - apiGroups:
  49. - policy
  50. resources:
  51. - podsecuritypolicies
  52. verbs:
  53. - use
  54. resourceNames:
  55. - kube-ovn
  56. - apiGroups:
  57. - "kubeovn.io"
  58. resources:
  59. - subnets
  60. - subnets/status
  61. - vpcs
  62. - vpcs/status
  63. - ips
  64. - vlans
  65. - networks
  66. verbs:
  67. - "*"
  68. - apiGroups:
  69. - ""
  70. resources:
  71. - pods
  72. - namespaces
  73. - nodes
  74. - configmaps
  75. verbs:
  76. - create
  77. - get
  78. - list
  79. - watch
  80. - patch
  81. - update
  82. - apiGroups:
  83. - ""
  84. - networking.k8s.io
  85. - apps
  86. - extensions
  87. resources:
  88. - networkpolicies
  89. - services
  90. - endpoints
  91. - statefulsets
  92. - daemonsets
  93. - deployments
  94. verbs:
  95. - get
  96. - list
  97. - watch
  98. - apiGroups:
  99. - ""
  100. resources:
  101. - events
  102. verbs:
  103. - create
  104. - patch
  105. - update
  106. ---
  107. apiVersion: rbac.authorization.k8s.io/v1
  108. kind: ClusterRoleBinding
  109. metadata:
  110. name: ovn
  111. roleRef:
  112. name: system:ovn
  113. kind: ClusterRole
  114. apiGroup: rbac.authorization.k8s.io
  115. subjects:
  116. - kind: ServiceAccount
  117. name: ovn
  118. namespace: kube-system
  119. ---
  120. kind: Service
  121. apiVersion: v1
  122. metadata:
  123. name: ovn-nb
  124. namespace: kube-system
  125. spec:
  126. ports:
  127. - name: ovn-nb
  128. protocol: TCP
  129. port: 6641
  130. targetPort: 6641
  131. type: ClusterIP
  132. selector:
  133. app: ovn-central
  134. ovn-nb-leader: "true"
  135. sessionAffinity: None
  136. ---
  137. kind: Service
  138. apiVersion: v1
  139. metadata:
  140. name: ovn-sb
  141. namespace: kube-system
  142. spec:
  143. ports:
  144. - name: ovn-sb
  145. protocol: TCP
  146. port: 6642
  147. targetPort: 6642
  148. type: ClusterIP
  149. selector:
  150. app: ovn-central
  151. ovn-sb-leader: "true"
  152. sessionAffinity: None
  153. ---
  154. kind: Deployment
  155. apiVersion: apps/v1
  156. metadata:
  157. name: ovn-central
  158. namespace: kube-system
  159. annotations:
  160. kubernetes.io/description: |
  161. OVN components: northd, nb and sb.
  162. spec:
  163. replicas: 1
  164. strategy:
  165. rollingUpdate:
  166. maxSurge: 0
  167. maxUnavailable: 1
  168. type: RollingUpdate
  169. selector:
  170. matchLabels:
  171. app: ovn-central
  172. template:
  173. metadata:
  174. labels:
  175. app: ovn-central
  176. component: network
  177. type: infra
  178. spec:
  179. tolerations:
  180. - operator: Exists
  181. effect: NoSchedule
  182. affinity:
  183. podAntiAffinity:
  184. requiredDuringSchedulingIgnoredDuringExecution:
  185. - labelSelector:
  186. matchLabels:
  187. app: ovn-central
  188. topologyKey: kubernetes.io/hostname
  189. priorityClassName: system-cluster-critical
  190. serviceAccountName: ovn
  191. hostNetwork: true
  192. containers:
  193. - name: ovn-central
  194. image: {{ kube_ovn_container_image_repo }}:{{ kube_ovn_container_image_tag }}
  195. imagePullPolicy: {{ k8s_image_pull_policy }}
  196. command: ["/kube-ovn/start-db.sh"]
  197. securityContext:
  198. capabilities:
  199. add: ["SYS_NICE"]
  200. env:
  201. - name: ENABLE_SSL
  202. value: "false"
  203. - name: POD_IP
  204. valueFrom:
  205. fieldRef:
  206. fieldPath: status.podIP
  207. - name: POD_NAME
  208. valueFrom:
  209. fieldRef:
  210. fieldPath: metadata.name
  211. - name: POD_NAMESPACE
  212. valueFrom:
  213. fieldRef:
  214. fieldPath: metadata.namespace
  215. resources:
  216. requests:
  217. cpu: {{ kube_ovn_db_cpu_request }}
  218. memory: {{ kube_ovn_db_memory_request }}
  219. limits:
  220. cpu: {{ kube_ovn_db_cpu_limit }}
  221. memory: {{ kube_ovn_db_memory_limit }}
  222. volumeMounts:
  223. - mountPath: /var/run/openvswitch
  224. name: host-run-ovs
  225. - mountPath: /var/run/ovn
  226. name: host-run-ovn
  227. - mountPath: /sys
  228. name: host-sys
  229. readOnly: true
  230. - mountPath: /etc/openvswitch
  231. name: host-config-openvswitch
  232. - mountPath: /etc/ovn
  233. name: host-config-ovn
  234. - mountPath: /var/log/openvswitch
  235. name: host-log-ovs
  236. - mountPath: /var/log/ovn
  237. name: host-log-ovn
  238. - mountPath: /var/run/tls
  239. name: kube-ovn-tls
  240. readinessProbe:
  241. exec:
  242. command:
  243. - bash
  244. - /kube-ovn/ovn-is-leader.sh
  245. periodSeconds: 3
  246. timeoutSeconds: 45
  247. livenessProbe:
  248. exec:
  249. command:
  250. - bash
  251. - /kube-ovn/ovn-healthcheck.sh
  252. initialDelaySeconds: 30
  253. periodSeconds: 7
  254. failureThreshold: 5
  255. timeoutSeconds: 45
  256. nodeSelector:
  257. kubernetes.io/os: "linux"
  258. kube-ovn/role: "master"
  259. volumes:
  260. - name: host-run-ovs
  261. hostPath:
  262. path: /run/openvswitch
  263. - name: host-run-ovn
  264. hostPath:
  265. path: /run/ovn
  266. - name: host-sys
  267. hostPath:
  268. path: /sys
  269. - name: host-config-openvswitch
  270. hostPath:
  271. path: /etc/origin/openvswitch
  272. - name: host-config-ovn
  273. hostPath:
  274. path: /etc/origin/ovn
  275. - name: host-log-ovs
  276. hostPath:
  277. path: /var/log/openvswitch
  278. - name: host-log-ovn
  279. hostPath:
  280. path: /var/log/ovn
  281. - name: kube-ovn-tls
  282. secret:
  283. optional: true
  284. secretName: kube-ovn-tls
  285. ---
  286. kind: DaemonSet
  287. apiVersion: apps/v1
  288. metadata:
  289. name: ovs-ovn
  290. namespace: kube-system
  291. annotations:
  292. kubernetes.io/description: |
  293. This daemon set launches the openvswitch daemon.
  294. spec:
  295. selector:
  296. matchLabels:
  297. app: ovs
  298. updateStrategy:
  299. type: OnDelete
  300. template:
  301. metadata:
  302. labels:
  303. app: ovs
  304. component: network
  305. type: infra
  306. spec:
  307. tolerations:
  308. - operator: Exists
  309. effect: NoSchedule
  310. priorityClassName: system-cluster-critical
  311. serviceAccountName: ovn
  312. hostNetwork: true
  313. hostPID: true
  314. containers:
  315. - name: openvswitch
  316. image: {{ kube_ovn_container_image_repo }}:{{ kube_ovn_container_image_tag }}
  317. imagePullPolicy: {{ k8s_image_pull_policy }}
  318. command: ["/kube-ovn/start-ovs.sh"]
  319. securityContext:
  320. runAsUser: 0
  321. privileged: true
  322. env:
  323. - name: ENABLE_SSL
  324. value: "false"
  325. - name: POD_IP
  326. valueFrom:
  327. fieldRef:
  328. fieldPath: status.podIP
  329. - name: HW_OFFLOAD
  330. value: "false"
  331. - name: KUBE_NODE_NAME
  332. valueFrom:
  333. fieldRef:
  334. fieldPath: spec.nodeName
  335. volumeMounts:
  336. - mountPath: /lib/modules
  337. name: host-modules
  338. readOnly: true
  339. - mountPath: /var/run/openvswitch
  340. name: host-run-ovs
  341. - mountPath: /var/run/ovn
  342. name: host-run-ovn
  343. - mountPath: /sys
  344. name: host-sys
  345. readOnly: true
  346. - mountPath: /etc/openvswitch
  347. name: host-config-openvswitch
  348. - mountPath: /etc/ovn
  349. name: host-config-ovn
  350. - mountPath: /var/log/openvswitch
  351. name: host-log-ovs
  352. - mountPath: /var/log/ovn
  353. name: host-log-ovn
  354. - mountPath: /var/run/tls
  355. name: kube-ovn-tls
  356. readinessProbe:
  357. exec:
  358. command:
  359. - bash
  360. - /kube-ovn/ovs-healthcheck.sh
  361. periodSeconds: 5
  362. timeoutSeconds: 45
  363. livenessProbe:
  364. exec:
  365. command:
  366. - bash
  367. - /kube-ovn/ovs-healthcheck.sh
  368. initialDelaySeconds: 10
  369. periodSeconds: 5
  370. failureThreshold: 5
  371. timeoutSeconds: 45
  372. resources:
  373. requests:
  374. cpu: {{ kube_ovn_node_cpu_request }}
  375. memory: {{ kube_ovn_node_memory_request }}
  376. limits:
  377. cpu: {{ kube_ovn_node_cpu_limit }}
  378. memory: {{ kube_ovn_node_memory_limit }}
  379. nodeSelector:
  380. kubernetes.io/os: "linux"
  381. volumes:
  382. - name: host-modules
  383. hostPath:
  384. path: /lib/modules
  385. - name: host-run-ovs
  386. hostPath:
  387. path: /run/openvswitch
  388. - name: host-run-ovn
  389. hostPath:
  390. path: /run/ovn
  391. - name: host-sys
  392. hostPath:
  393. path: /sys
  394. - name: host-config-openvswitch
  395. hostPath:
  396. path: /etc/origin/openvswitch
  397. - name: host-config-ovn
  398. hostPath:
  399. path: /etc/origin/ovn
  400. - name: host-log-ovs
  401. hostPath:
  402. path: /var/log/openvswitch
  403. - name: host-log-ovn
  404. hostPath:
  405. path: /var/log/ovn
  406. - name: kube-ovn-tls
  407. secret:
  408. optional: true
  409. secretName: kube-ovn-tls