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