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.

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