Updating sriov playbook to meet requirements of updated device
[multicloud/k8s.git] / kud / deployment_infra / images / nfn.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: v1
125 kind: ServiceAccount
126 metadata:
127   name: k8s-nfn-sa
128   namespace: operator
129
130 ---
131
132 apiVersion: rbac.authorization.k8s.io/v1
133 kind: ClusterRole
134 metadata:
135   creationTimestamp: null
136   name: k8s-nfn-cr
137 rules:
138 - apiGroups:
139   - ""
140   resources:
141   - pods
142   - services
143   - endpoints
144   - persistentvolumeclaims
145   - events
146   - configmaps
147   - secrets
148   verbs:
149   - '*'
150 - apiGroups:
151   - apps
152   resources:
153   - deployments
154   - daemonsets
155   - replicasets
156   - statefulsets
157   verbs:
158   - '*'
159 - apiGroups:
160   - monitoring.coreos.com
161   resources:
162   - servicemonitors
163   verbs:
164   - get
165   - create
166 - apiGroups:
167   - apps
168   resourceNames:
169   - nfn-operator
170   resources:
171   - deployments/finalizers
172   verbs:
173   - update
174 - apiGroups:
175   - k8s.plugin.opnfv.org
176   resources:
177   - '*'
178   - providernetworks
179   verbs:
180   - '*'
181
182 ---
183
184 kind: ClusterRoleBinding
185 apiVersion: rbac.authorization.k8s.io/v1
186 metadata:
187   name: k8s-nfn-crb
188 subjects:
189 - kind: Group
190   name: system:serviceaccounts
191   apiGroup: rbac.authorization.k8s.io
192 roleRef:
193   kind: ClusterRole
194   name: k8s-nfn-cr
195   apiGroup: rbac.authorization.k8s.io
196
197 ---
198
199 apiVersion: apps/v1
200 kind: Deployment
201 metadata:
202   name: nfn-operator
203   namespace: operator
204 spec:
205   replicas: 1
206   selector:
207     matchLabels:
208       name: nfn-operator
209   template:
210     metadata:
211       labels:
212         name: nfn-operator
213     spec:
214       affinity:
215         nodeAffinity:
216           requiredDuringSchedulingIgnoredDuringExecution:
217             nodeSelectorTerms:
218             - matchExpressions:
219               - key: nfnType
220                 operator: In
221                 values:
222                 - operator
223       tolerations:
224        - key: "node-role.kubernetes.io/master"
225          effect: "NoSchedule"
226          operator: "Exists"
227       serviceAccountName: k8s-nfn-sa
228       containers:
229         - name: nfn-operator
230           image: rtsood/nfn-operator:latest
231           command: ["/usr/local/bin/entrypoint", "operator"]
232           imagePullPolicy: IfNotPresent
233           env:
234             - name: HOST_IP
235               valueFrom:
236                 fieldRef:
237                   fieldPath: status.hostIP
238             - name: POD_NAME
239               valueFrom:
240                 fieldRef:
241                   fieldPath: metadata.name
242             - name: OPERATOR_NAME
243               value: "nfn-operator"
244
245 ---
246 kind: ConfigMap
247 apiVersion: v1
248 metadata:
249   name: ovn4nfv-cni-config
250   namespace: operator
251   labels:
252     app: ovn4nfv
253 data:
254   ovn4nfv_k8s.conf: |
255           [logging]
256           loglevel=5
257           logfile=/var/log/openvswitch/ovn4k8s.log
258
259           [cni]
260           conf-dir=/etc/cni/net.d
261           plugin=ovn4nfvk8s-cni
262
263           [kubernetes]
264           kubeconfig=/etc/kubernetes/admin.conf
265
266 ---
267 apiVersion: extensions/v1beta1
268 kind: DaemonSet
269 metadata:
270   name: ovn4nfv-cni
271   namespace: operator
272   labels:
273     app: ovn4nfv
274 spec:
275   updateStrategy:
276     type: RollingUpdate
277   template:
278     metadata:
279       labels:
280         app: ovn4nfv
281     spec:
282       hostNetwork: true
283       nodeSelector:
284         beta.kubernetes.io/arch: amd64
285       tolerations:
286       - operator: Exists
287         effect: NoSchedule
288       containers:
289       - name: ovn4nfv
290         image: rtsood/nfn-operator:latest
291         command: ["/usr/local/bin/entrypoint", "cni"]
292         resources:
293           requests:
294             cpu: "100m"
295             memory: "50Mi"
296           limits:
297             cpu: "100m"
298             memory: "50Mi"
299         securityContext:
300           privileged: true
301         volumeMounts:
302         - name: cnibin
303           mountPath: /host/opt/cni/bin
304         - name: cniconf
305           mountPath: /host/etc/openvswitch
306         - name: ovn4nfv-cfg
307           mountPath: /tmp/ovn4nfv-conf
308       volumes:
309         - name: cnibin
310           hostPath:
311             path: /opt/cni/bin
312         - name: cniconf
313           hostPath:
314             path: /etc/openvswitch
315         - name: ovn4nfv-cfg
316           configMap:
317             name: ovn4nfv-cni-config
318             items:
319             - key: ovn4nfv_k8s.conf
320               path: ovn4nfv_k8s.conf
321
322