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.

497 lines
12 KiB

  1. apiVersion: v1
  2. kind: ConfigMap
  3. metadata:
  4. name: ovn-config
  5. namespace: kube-system
  6. data:
  7. defaultNetworkType: '{{ kube_ovn_network_type }}'
  8. ---
  9. apiVersion: v1
  10. kind: ServiceAccount
  11. metadata:
  12. name: ovn
  13. namespace: kube-system
  14. ---
  15. apiVersion: rbac.authorization.k8s.io/v1
  16. kind: ClusterRole
  17. metadata:
  18. annotations:
  19. rbac.authorization.k8s.io/system-only: "true"
  20. name: system:ovn
  21. rules:
  22. - apiGroups: ['policy']
  23. resources: ['podsecuritypolicies']
  24. verbs: ['use']
  25. resourceNames:
  26. - kube-ovn
  27. - apiGroups:
  28. - "kubeovn.io"
  29. resources:
  30. - vpcs
  31. - vpcs/status
  32. - vpc-nat-gateways
  33. - subnets
  34. - subnets/status
  35. - ips
  36. - vlans
  37. - vlans/status
  38. - provider-networks
  39. - provider-networks/status
  40. - security-groups
  41. - security-groups/status
  42. - htbqoses
  43. verbs:
  44. - "*"
  45. - apiGroups:
  46. - ""
  47. resources:
  48. - pods
  49. - pods/exec
  50. - namespaces
  51. - nodes
  52. - configmaps
  53. verbs:
  54. - create
  55. - get
  56. - list
  57. - watch
  58. - patch
  59. - update
  60. - apiGroups:
  61. - "k8s.cni.cncf.io"
  62. resources:
  63. - network-attachment-definitions
  64. verbs:
  65. - create
  66. - delete
  67. - get
  68. - list
  69. - update
  70. - apiGroups:
  71. - ""
  72. - networking.k8s.io
  73. - apps
  74. - extensions
  75. resources:
  76. - networkpolicies
  77. - services
  78. - endpoints
  79. - statefulsets
  80. - daemonsets
  81. - deployments
  82. - deployments/scale
  83. verbs:
  84. - create
  85. - delete
  86. - update
  87. - patch
  88. - get
  89. - list
  90. - watch
  91. - apiGroups:
  92. - ""
  93. resources:
  94. - events
  95. verbs:
  96. - create
  97. - patch
  98. - update
  99. - apiGroups:
  100. - "k8s.cni.cncf.io"
  101. resources:
  102. - network-attachment-definitions
  103. verbs:
  104. - create
  105. - delete
  106. - get
  107. - list
  108. - update
  109. - apiGroups:
  110. - "kubevirt.io"
  111. resources:
  112. - virtualmachines
  113. - virtualmachineinstances
  114. verbs:
  115. - get
  116. - list
  117. ---
  118. apiVersion: rbac.authorization.k8s.io/v1
  119. kind: ClusterRoleBinding
  120. metadata:
  121. name: ovn
  122. roleRef:
  123. name: system:ovn
  124. kind: ClusterRole
  125. apiGroup: rbac.authorization.k8s.io
  126. subjects:
  127. - kind: ServiceAccount
  128. name: ovn
  129. namespace: kube-system
  130. ---
  131. kind: Service
  132. apiVersion: v1
  133. metadata:
  134. name: ovn-nb
  135. namespace: kube-system
  136. spec:
  137. ports:
  138. - name: ovn-nb
  139. protocol: TCP
  140. port: 6641
  141. targetPort: 6641
  142. type: ClusterIP
  143. {% if enable_dual_stack_networks %}
  144. ipFamilyPolicy: PreferDualStack
  145. {% endif %}
  146. selector:
  147. app: ovn-central
  148. ovn-nb-leader: "true"
  149. sessionAffinity: None
  150. ---
  151. kind: Service
  152. apiVersion: v1
  153. metadata:
  154. name: ovn-sb
  155. namespace: kube-system
  156. spec:
  157. ports:
  158. - name: ovn-sb
  159. protocol: TCP
  160. port: 6642
  161. targetPort: 6642
  162. type: ClusterIP
  163. {% if enable_dual_stack_networks %}
  164. ipFamilyPolicy: PreferDualStack
  165. {% endif %}
  166. selector:
  167. app: ovn-central
  168. ovn-sb-leader: "true"
  169. sessionAffinity: None
  170. ---
  171. kind: Service
  172. apiVersion: v1
  173. metadata:
  174. name: ovn-northd
  175. namespace: kube-system
  176. spec:
  177. ports:
  178. - name: ovn-northd
  179. protocol: TCP
  180. port: 6643
  181. targetPort: 6643
  182. type: ClusterIP
  183. {% if enable_dual_stack_networks %}
  184. ipFamilyPolicy: PreferDualStack
  185. {% endif %}
  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: {{ kube_ovn_central_replics }}
  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: "{{ kube_ovn_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: 15
  284. timeoutSeconds: 45
  285. livenessProbe:
  286. exec:
  287. command:
  288. - bash
  289. - /kube-ovn/ovn-healthcheck.sh
  290. initialDelaySeconds: 30
  291. periodSeconds: 15
  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: {% if kube_ovn_dpdk_enabled %}{{ kube_ovn_dpdk_container_image_repo }}:{{ kube_ovn_dpdk_container_image_tag }}{% else %}{{ kube_ovn_container_image_repo }}:{{ kube_ovn_container_image_tag }}{% endif %}
  357. imagePullPolicy: {{ k8s_image_pull_policy }}
  358. command: [{% if kube_ovn_dpdk_enabled %}"/kube-ovn/start-ovs-dpdk.sh"{% else %}"/kube-ovn/start-ovs.sh"{% endif %}]
  359. securityContext:
  360. runAsUser: 0
  361. privileged: true
  362. env:
  363. - name: ENABLE_SSL
  364. value: "{{ kube_ovn_enable_ssl | lower }}"
  365. - name: POD_IP
  366. valueFrom:
  367. fieldRef:
  368. fieldPath: status.podIP
  369. {% if not kube_ovn_dpdk_enabled %}
  370. - name: HW_OFFLOAD
  371. value: "{{ kube_ovn_hw_offload }}"
  372. - name: TUNNEL_TYPE
  373. value: "{{ kube_ovn_tunnel_type }}"
  374. {% endif %}
  375. - name: KUBE_NODE_NAME
  376. valueFrom:
  377. fieldRef:
  378. fieldPath: spec.nodeName
  379. volumeMounts:
  380. - mountPath: /lib/modules
  381. name: host-modules
  382. readOnly: true
  383. - mountPath: /var/run/openvswitch
  384. name: host-run-ovs
  385. - mountPath: /var/run/ovn
  386. name: host-run-ovn
  387. - mountPath: /sys
  388. name: host-sys
  389. readOnly: true
  390. - mountPath: /etc/cni/net.d
  391. name: cni-conf
  392. - mountPath: /etc/openvswitch
  393. name: host-config-openvswitch
  394. - mountPath: /etc/ovn
  395. name: host-config-ovn
  396. - mountPath: /var/log/openvswitch
  397. name: host-log-ovs
  398. - mountPath: /var/log/ovn
  399. name: host-log-ovn
  400. {% if kube_ovn_dpdk_enabled %}
  401. - mountPath: /opt/ovs-config
  402. name: host-config-ovs
  403. - mountPath: /dev/hugepages
  404. name: hugepage
  405. {% endif %}
  406. - mountPath: /etc/localtime
  407. name: localtime
  408. - mountPath: /var/run/tls
  409. name: kube-ovn-tls
  410. readinessProbe:
  411. exec:
  412. command:
  413. - bash
  414. {% if kube_ovn_dpdk_enabled %}
  415. - /kube-ovn/ovs-dpdk-healthcheck.sh
  416. {% else %}
  417. - /kube-ovn/ovs-healthcheck.sh
  418. {% endif %}
  419. periodSeconds: 5
  420. timeoutSeconds: 45
  421. livenessProbe:
  422. exec:
  423. command:
  424. - bash
  425. {% if kube_ovn_dpdk_enabled %}
  426. - /kube-ovn/ovs-dpdk-healthcheck.sh
  427. {% else %}
  428. - /kube-ovn/ovs-healthcheck.sh
  429. {% endif %}
  430. initialDelaySeconds: 10
  431. periodSeconds: 5
  432. failureThreshold: 5
  433. timeoutSeconds: 45
  434. resources:
  435. {% if kube_ovn_dpdk_enabled %}
  436. requests:
  437. cpu: {{ kube_ovn_dpdk_node_cpu_request }}
  438. memory: {{ kube_ovn_dpdk_node_memory_request }}
  439. limits:
  440. cpu: {{ kube_ovn_dpdk_node_cpu_limit }}
  441. memory: {{ kube_ovn_dpdk_node_memory_limit }}
  442. hugepages-1Gi: 1Gi
  443. {% else %}
  444. requests:
  445. cpu: {{ kube_ovn_node_cpu_request }}
  446. memory: {{ kube_ovn_node_memory_request }}
  447. limits:
  448. cpu: {{ kube_ovn_node_cpu_limit }}
  449. memory: {{ kube_ovn_node_memory_limit }}
  450. {% endif %}
  451. nodeSelector:
  452. kubernetes.io/os: "linux"
  453. volumes:
  454. - name: host-modules
  455. hostPath:
  456. path: /lib/modules
  457. - name: host-run-ovs
  458. hostPath:
  459. path: /run/openvswitch
  460. - name: host-run-ovn
  461. hostPath:
  462. path: /run/ovn
  463. - name: host-sys
  464. hostPath:
  465. path: /sys
  466. - name: cni-conf
  467. hostPath:
  468. path: /etc/cni/net.d
  469. - name: host-config-openvswitch
  470. hostPath:
  471. path: /etc/origin/openvswitch
  472. - name: host-config-ovn
  473. hostPath:
  474. path: /etc/origin/ovn
  475. - name: host-log-ovs
  476. hostPath:
  477. path: /var/log/openvswitch
  478. - name: host-log-ovn
  479. hostPath:
  480. path: /var/log/ovn
  481. {% if kube_ovn_dpdk_enabled %}
  482. - name: host-config-ovs
  483. hostPath:
  484. path: /opt/ovs-config
  485. type: DirectoryOrCreate
  486. - name: hugepage
  487. emptyDir:
  488. medium: HugePages
  489. {% endif %}
  490. - name: localtime
  491. hostPath:
  492. path: /etc/localtime
  493. - name: kube-ovn-tls
  494. secret:
  495. optional: true
  496. secretName: kube-ovn-tls