28c2dfb77e4380ecb362cd6ad469b6e2d0c76b4f
[iec.git] / src / foundation / scripts / cni / ovn-kubernetes / yaml / ovn-setup.yaml
1 # yamllint disable rule:hyphens rule:commas rule:indentation
2 ---
3 # ovn-namespace.yaml
4 #
5 # Setup for Kubernetes to support the ovn-kubernetes plugin
6 #
7 # Create the namespace for ovn-kubernetes.
8 #
9 # This provisioning is done as part of installation after the cluster is
10 # up and before the ovn daemonsets are created.
11
12 apiVersion: v1
13 kind: Namespace
14 metadata:
15   name: ovn-kubernetes
16
17 ---
18 # ovn-policy.yaml
19 #
20 # Setup for Kubernetes to support the ovn-kubernetes plugin
21 #
22 # Create the service account and policies.
23 # ovnkube interacts with kubernetes and the environment
24 # must be properly set up.
25
26 # This provisioning is done as part of installation after the cluster is
27 # up and before the ovn daemonsets are created.
28
29 apiVersion: v1
30 kind: ServiceAccount
31 metadata:
32   name: ovn
33   namespace: ovn-kubernetes
34
35 ---
36 # for now throw in all the privileges to run a pod. we can fine grain it further later.
37
38 apiVersion: policy/v1beta1
39 kind: PodSecurityPolicy
40 metadata:
41   name: ovn-kubernetes
42   annotations:
43     seccomp.security.alpha.kubernetes.io/allowedProfileNames: '*'
44 spec:
45   allowPrivilegeEscalation: true
46   allowedCapabilities:
47   - '*'
48   fsGroup:
49     rule: RunAsAny
50   privileged: true
51   runAsUser:
52     rule: RunAsAny
53   seLinux:
54     rule: RunAsAny
55   supplementalGroups:
56     rule: RunAsAny
57   volumes:
58   - '*'
59   hostPID: true
60   hostIPC: true
61   hostNetwork: true
62   hostPorts:
63   - min: 0
64     max: 65536
65
66 ---
67 apiVersion: rbac.authorization.k8s.io/v1
68 kind: ClusterRole
69 metadata:
70   name: ovn-kubernetes
71 rules:
72 - apiGroups:
73   - ""
74   resources:
75   - pods
76   - namespaces
77   - nodes
78   - endpoints
79   - services
80   - configmaps
81   verbs: ["get", "list", "watch"]
82 - apiGroups:
83   - extensions
84   - networking.k8s.io
85   - apps
86   resources:
87   - networkpolicies
88   - statefulsets
89   verbs: ["get", "list", "watch"]
90 - apiGroups:
91   - ""
92   resources:
93   - events
94   - endpoints
95   - configmaps
96   verbs: ["create", "patch", "update"]
97 - apiGroups:
98   - ""
99   resources:
100   - nodes
101   - pods
102   verbs: ["patch", "update"]
103 - apiGroups:
104   - extensions
105   - policy
106   resources:
107   - podsecuritypolicies
108   resourceNames:
109   - ovn-kubernetes
110   verbs: ["use"]
111
112 ---
113 apiVersion: rbac.authorization.k8s.io/v1
114 kind: ClusterRoleBinding
115 metadata:
116   name: ovn-kubernetes
117 roleRef:
118   name: ovn-kubernetes
119   kind: ClusterRole
120   apiGroup: rbac.authorization.k8s.io
121 subjects:
122 - kind: ServiceAccount
123   name: ovn
124   namespace: ovn-kubernetes
125
126 ---
127 # The network cidr and service cidr are set in the ovn-config configmap
128 kind: ConfigMap
129 apiVersion: v1
130 metadata:
131   name: ovn-config
132   namespace: ovn-kubernetes
133 data:
134   net_cidr:      "192.168.0.0/16"
135   svc_cidr:      "172.16.1.0/24"
136   k8s_apiserver: "https://10.169.41.225:6443"
137   mtu:           "1400"