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.

611 lines
16 KiB

  1. ---
  2. apiVersion: apiextensions.k8s.io/v1beta1
  3. kind: CustomResourceDefinition
  4. metadata:
  5. name: networks.k8s.plugin.opnfv.org
  6. spec:
  7. group: k8s.plugin.opnfv.org
  8. names:
  9. kind: Network
  10. listKind: NetworkList
  11. plural: networks
  12. singular: network
  13. scope: Namespaced
  14. subresources:
  15. status: {}
  16. validation:
  17. openAPIV3Schema:
  18. properties:
  19. apiVersion:
  20. description: 'APIVersion defines the versioned schema of this representation
  21. of an object. Servers should convert recognized schemas to the latest
  22. internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources'
  23. type: string
  24. kind:
  25. description: 'Kind is a string value representing the REST resource this
  26. object represents. Servers may infer this from the endpoint the client
  27. submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds'
  28. type: string
  29. metadata:
  30. type: object
  31. spec:
  32. properties:
  33. cniType:
  34. description: 'INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
  35. Important: Run "operator-sdk generate k8s" to regenerate code after
  36. modifying this file Add custom validation using kubebuilder tags:
  37. https://book-v1.book.kubebuilder.io/beyond_basics/generating_crd.html'
  38. type: string
  39. dns:
  40. properties:
  41. domain:
  42. type: string
  43. nameservers:
  44. items:
  45. type: string
  46. type: array
  47. options:
  48. items:
  49. type: string
  50. type: array
  51. search:
  52. items:
  53. type: string
  54. type: array
  55. type: object
  56. ipv4Subnets:
  57. items:
  58. properties:
  59. excludeIps:
  60. type: string
  61. gateway:
  62. type: string
  63. name:
  64. type: string
  65. subnet:
  66. type: string
  67. required:
  68. - name
  69. - subnet
  70. type: object
  71. type: array
  72. ipv6Subnets:
  73. items:
  74. properties:
  75. excludeIps:
  76. type: string
  77. gateway:
  78. type: string
  79. name:
  80. type: string
  81. subnet:
  82. type: string
  83. required:
  84. - name
  85. - subnet
  86. type: object
  87. type: array
  88. routes:
  89. items:
  90. properties:
  91. dst:
  92. type: string
  93. gw:
  94. type: string
  95. required:
  96. - dst
  97. type: object
  98. type: array
  99. required:
  100. - cniType
  101. - ipv4Subnets
  102. type: object
  103. status:
  104. properties:
  105. state:
  106. description: 'INSERT ADDITIONAL STATUS FIELD - define observed state
  107. of cluster Important: Run "operator-sdk generate k8s" to regenerate
  108. code after modifying this file Add custom validation using kubebuilder
  109. tags: https://book-v1.book.kubebuilder.io/beyond_basics/generating_crd.html'
  110. type: string
  111. required:
  112. - state
  113. type: object
  114. version: v1alpha1
  115. versions:
  116. - name: v1alpha1
  117. served: true
  118. storage: true
  119. ---
  120. apiVersion: apiextensions.k8s.io/v1beta1
  121. kind: CustomResourceDefinition
  122. metadata:
  123. name: providernetworks.k8s.plugin.opnfv.org
  124. spec:
  125. group: k8s.plugin.opnfv.org
  126. names:
  127. kind: ProviderNetwork
  128. listKind: ProviderNetworkList
  129. plural: providernetworks
  130. singular: providernetwork
  131. scope: Namespaced
  132. subresources:
  133. status: {}
  134. validation:
  135. openAPIV3Schema:
  136. description: ProviderNetwork is the Schema for the providernetworks API
  137. properties:
  138. apiVersion:
  139. description: 'APIVersion defines the versioned schema of this representation
  140. of an object. Servers should convert recognized schemas to the latest
  141. internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
  142. type: string
  143. kind:
  144. description: 'Kind is a string value representing the REST resource this
  145. object represents. Servers may infer this from the endpoint the client
  146. submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
  147. type: string
  148. metadata:
  149. type: object
  150. spec:
  151. description: ProviderNetworkSpec defines the desired state of ProviderNetwork
  152. properties:
  153. cniType:
  154. description: 'INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
  155. Important: Run "operator-sdk generate k8s" to regenerate code after
  156. modifying this file Add custom validation using kubebuilder tags:
  157. https://book-v1.book.kubebuilder.io/beyond_basics/generating_crd.html'
  158. type: string
  159. direct:
  160. properties:
  161. directNodeSelector:
  162. type: string
  163. nodeLabelList:
  164. items:
  165. type: string
  166. type: array
  167. providerInterfaceName:
  168. type: string
  169. required:
  170. - directNodeSelector
  171. - providerInterfaceName
  172. type: object
  173. dns:
  174. properties:
  175. domain:
  176. type: string
  177. nameservers:
  178. items:
  179. type: string
  180. type: array
  181. options:
  182. items:
  183. type: string
  184. type: array
  185. search:
  186. items:
  187. type: string
  188. type: array
  189. type: object
  190. ipv4Subnets:
  191. items:
  192. properties:
  193. excludeIps:
  194. type: string
  195. gateway:
  196. type: string
  197. name:
  198. type: string
  199. subnet:
  200. type: string
  201. required:
  202. - name
  203. - subnet
  204. type: object
  205. type: array
  206. ipv6Subnets:
  207. items:
  208. properties:
  209. excludeIps:
  210. type: string
  211. gateway:
  212. type: string
  213. name:
  214. type: string
  215. subnet:
  216. type: string
  217. required:
  218. - name
  219. - subnet
  220. type: object
  221. type: array
  222. providerNetType:
  223. type: string
  224. routes:
  225. items:
  226. properties:
  227. dst:
  228. type: string
  229. gw:
  230. type: string
  231. required:
  232. - dst
  233. type: object
  234. type: array
  235. vlan:
  236. properties:
  237. logicalInterfaceName:
  238. type: string
  239. nodeLabelList:
  240. items:
  241. type: string
  242. type: array
  243. providerInterfaceName:
  244. type: string
  245. vlanId:
  246. type: string
  247. vlanNodeSelector:
  248. type: string
  249. required:
  250. - providerInterfaceName
  251. - vlanId
  252. - vlanNodeSelector
  253. type: object
  254. required:
  255. - cniType
  256. - ipv4Subnets
  257. - providerNetType
  258. type: object
  259. status:
  260. description: ProviderNetworkStatus defines the observed state of ProviderNetwork
  261. properties:
  262. state:
  263. description: 'INSERT ADDITIONAL STATUS FIELD - define observed state
  264. of cluster Important: Run "operator-sdk generate k8s" to regenerate
  265. code after modifying this file Add custom validation using kubebuilder
  266. tags: https://book-v1.book.kubebuilder.io/beyond_basics/generating_crd.html'
  267. type: string
  268. required:
  269. - state
  270. type: object
  271. type: object
  272. version: v1alpha1
  273. versions:
  274. - name: v1alpha1
  275. served: true
  276. storage: true
  277. ---
  278. apiVersion: v1
  279. kind: ServiceAccount
  280. metadata:
  281. name: k8s-nfn-sa
  282. namespace: kube-system
  283. ---
  284. apiVersion: rbac.authorization.k8s.io/v1
  285. kind: ClusterRole
  286. metadata:
  287. creationTimestamp: null
  288. name: k8s-nfn-cr
  289. rules:
  290. - apiGroups:
  291. - ""
  292. resources:
  293. - pods
  294. - pods/status
  295. - services
  296. - endpoints
  297. - persistentvolumeclaims
  298. - events
  299. - configmaps
  300. - secrets
  301. - nodes
  302. verbs:
  303. - '*'
  304. - apiGroups:
  305. - apps
  306. resources:
  307. - deployments
  308. - daemonsets
  309. - replicasets
  310. - statefulsets
  311. verbs:
  312. - '*'
  313. - apiGroups:
  314. - monitoring.coreos.com
  315. resources:
  316. - servicemonitors
  317. verbs:
  318. - get
  319. - create
  320. - apiGroups:
  321. - apps
  322. resourceNames:
  323. - nfn-operator
  324. resources:
  325. - deployments/finalizers
  326. verbs:
  327. - update
  328. - apiGroups:
  329. - k8s.plugin.opnfv.org
  330. resources:
  331. - '*'
  332. - providernetworks
  333. verbs:
  334. - '*'
  335. ---
  336. kind: ClusterRoleBinding
  337. apiVersion: rbac.authorization.k8s.io/v1
  338. metadata:
  339. name: k8s-nfn-crb
  340. subjects:
  341. - kind: Group
  342. name: system:serviceaccounts
  343. apiGroup: rbac.authorization.k8s.io
  344. roleRef:
  345. kind: ClusterRole
  346. name: k8s-nfn-cr
  347. apiGroup: rbac.authorization.k8s.io
  348. ---
  349. apiVersion: v1
  350. kind: Service
  351. metadata:
  352. name: nfn-operator
  353. namespace: kube-system
  354. spec:
  355. type: NodePort
  356. ports:
  357. - port: 50000
  358. protocol: TCP
  359. targetPort: 50000
  360. selector:
  361. name: nfn-operator
  362. ---
  363. apiVersion: v1
  364. kind: ConfigMap
  365. metadata:
  366. name: ovn-controller-network
  367. namespace: kube-system
  368. data:
  369. OVN_SUBNET: "{{ kube_pods_subnet }}"
  370. OVN_GATEWAYIP: "{{ kube_pods_subnet|ipaddr('net')|ipaddr(1) }}"
  371. ---
  372. apiVersion: apps/v1
  373. kind: Deployment
  374. metadata:
  375. name: nfn-operator
  376. namespace: kube-system
  377. spec:
  378. replicas: 1
  379. selector:
  380. matchLabels:
  381. name: nfn-operator
  382. template:
  383. metadata:
  384. labels:
  385. name: nfn-operator
  386. spec:
  387. hostNetwork: true
  388. affinity:
  389. nodeAffinity:
  390. requiredDuringSchedulingIgnoredDuringExecution:
  391. nodeSelectorTerms:
  392. - matchExpressions:
  393. - key: ovn4nfv-k8s-plugin
  394. operator: In
  395. values:
  396. - ovn-control-plane
  397. tolerations:
  398. - key: "node-role.kubernetes.io/master"
  399. effect: "NoSchedule"
  400. operator: "Exists"
  401. - key: "node-role.kubernetes.io/control-plane"
  402. effect: "NoSchedule"
  403. operator: "Exists"
  404. serviceAccountName: k8s-nfn-sa
  405. containers:
  406. - name: nfn-operator
  407. image: {{ ovn4nfv_k8s_plugin_image_repo }}:{{ ovn4nfv_k8s_plugin_image_tag }}
  408. command: ["/usr/local/bin/entrypoint", "operator"]
  409. imagePullPolicy: {{ k8s_image_pull_policy }}
  410. envFrom:
  411. - configMapRef:
  412. name: ovn-controller-network
  413. ports:
  414. - containerPort: 50000
  415. protocol: TCP
  416. env:
  417. - name: POD_NAME
  418. valueFrom:
  419. fieldRef:
  420. fieldPath: metadata.name
  421. - name: OPERATOR_NAME
  422. value: "nfn-operator"
  423. ---
  424. kind: ConfigMap
  425. apiVersion: v1
  426. metadata:
  427. name: ovn4nfv-cni-config
  428. namespace: kube-system
  429. labels:
  430. app: ovn4nfv
  431. data:
  432. ovn4nfv_k8s.conf: |
  433. [logging]
  434. loglevel=5
  435. logfile=/var/log/openvswitch/ovn4k8s.log
  436. [cni]
  437. conf-dir=/etc/cni/net.d
  438. plugin=ovn4nfvk8s-cni
  439. [kubernetes]
  440. kubeconfig=/etc/cni/net.d/ovn4nfv-k8s.d/ovn4nfv-k8s.kubeconfig
  441. 00-network.conf: |
  442. {
  443. "name": "ovn4nfv-k8s-plugin",
  444. "type": "ovn4nfvk8s-cni",
  445. "cniVersion": "0.3.1"
  446. }
  447. ---
  448. apiVersion: apps/v1
  449. kind: DaemonSet
  450. metadata:
  451. name: ovn4nfv-cni
  452. namespace: kube-system
  453. labels:
  454. app: ovn4nfv
  455. spec:
  456. updateStrategy:
  457. type: RollingUpdate
  458. selector:
  459. matchLabels:
  460. app: ovn4nfv
  461. template:
  462. metadata:
  463. labels:
  464. app: ovn4nfv
  465. spec:
  466. hostNetwork: true
  467. nodeSelector:
  468. kubernetes.io/arch: amd64
  469. tolerations:
  470. - operator: Exists
  471. effect: NoSchedule
  472. serviceAccountName: k8s-nfn-sa
  473. containers:
  474. - name: ovn4nfv
  475. image: {{ ovn4nfv_k8s_plugin_image_repo }}:{{ ovn4nfv_k8s_plugin_image_tag }}
  476. command: ["/usr/local/bin/entrypoint", "cni"]
  477. imagePullPolicy: {{ k8s_image_pull_policy }}
  478. resources:
  479. requests:
  480. cpu: {{ ovn4nfv_cni_cpu_request }}
  481. memory: {{ ovn4nfv_cni_memory_request }}
  482. limits:
  483. cpu: {{ ovn4nfv_cni_cpu_limit }}
  484. memory: {{ ovn4nfv_cni_memory_limit }}
  485. securityContext:
  486. privileged: true
  487. volumeMounts:
  488. - name: cni
  489. mountPath: /host/etc/cni/net.d
  490. - name: cnibin
  491. mountPath: /host/opt/cni/bin
  492. - name: cniconf
  493. mountPath: /host/etc/openvswitch
  494. - name: ovn4nfv-cfg
  495. mountPath: /tmp/ovn4nfv-conf
  496. - name: ovn4nfv-cni-net-conf
  497. mountPath: /tmp/ovn4nfv-cni
  498. volumes:
  499. - name: cni
  500. hostPath:
  501. path: /etc/cni/net.d
  502. - name: cnibin
  503. hostPath:
  504. path: /opt/cni/bin
  505. - name: cniconf
  506. hostPath:
  507. path: /etc/openvswitch
  508. - name: ovn4nfv-cfg
  509. configMap:
  510. name: ovn4nfv-cni-config
  511. items:
  512. - key: ovn4nfv_k8s.conf
  513. path: ovn4nfv_k8s.conf
  514. - name: ovn4nfv-cni-net-conf
  515. configMap:
  516. name: ovn4nfv-cni-config
  517. items:
  518. - key: 00-network.conf
  519. path: 00-network.conf
  520. ---
  521. apiVersion: apps/v1
  522. kind: DaemonSet
  523. metadata:
  524. name: nfn-agent
  525. namespace: kube-system
  526. labels:
  527. app: nfn-agent
  528. spec:
  529. selector:
  530. matchLabels:
  531. app: nfn-agent
  532. updateStrategy:
  533. type: RollingUpdate
  534. template:
  535. metadata:
  536. labels:
  537. app: nfn-agent
  538. spec:
  539. hostNetwork: true
  540. hostPID: true
  541. nodeSelector:
  542. kubernetes.io/arch: amd64
  543. tolerations:
  544. - operator: Exists
  545. effect: NoSchedule
  546. serviceAccountName: k8s-nfn-sa
  547. containers:
  548. - name: nfn-agent
  549. image: {{ ovn4nfv_k8s_plugin_image_repo }}:{{ ovn4nfv_k8s_plugin_image_tag }}
  550. command: ["/usr/local/bin/entrypoint", "agent"]
  551. imagePullPolicy: {{ k8s_image_pull_policy }}
  552. resources:
  553. requests:
  554. cpu: {{ nfn_agent_cpu_request }}
  555. memory: {{ nfn_agent_memory_request }}
  556. limits:
  557. cpu: {{ nfn_agent_cpu_limit }}
  558. memory: {{ nfn_agent_memory_limit }}
  559. env:
  560. - name: NFN_NODE_NAME
  561. valueFrom:
  562. fieldRef:
  563. fieldPath: spec.nodeName
  564. securityContext:
  565. runAsUser: 0
  566. capabilities:
  567. add: ["NET_ADMIN", "SYS_ADMIN", "SYS_PTRACE"]
  568. privileged: true
  569. volumeMounts:
  570. - mountPath: /var/run/dbus/
  571. name: host-var-run-dbus
  572. readOnly: true
  573. - mountPath: /run/openvswitch
  574. name: host-run-ovs
  575. - mountPath: /var/run/openvswitch
  576. name: host-var-run-ovs
  577. - mountPath: /var/run/ovn4nfv-k8s-plugin
  578. name: host-var-cniserver-socket-dir
  579. volumes:
  580. - name: host-run-ovs
  581. hostPath:
  582. path: /run/openvswitch
  583. - name: host-var-run-ovs
  584. hostPath:
  585. path: /var/run/openvswitch
  586. - name: host-var-run-dbus
  587. hostPath:
  588. path: /var/run/dbus
  589. - name: host-var-cniserver-socket-dir
  590. hostPath:
  591. path: /var/run/ovn4nfv-k8s-plugin