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