c1d81d1a4f3caf003af0bdc120eb687bc400227c
[iec.git] / src / foundation / scripts / cni / ovn-kubernetes / templates / ovn-setup.yaml.j2
1 ---
2 # ovn-namespace.yaml
3 #
4 # Setup for Kubernetes to support the ovn-kubernetes plugin
5 #
6 # Create the namespace for ovn-kubernetes.
7 #
8 # This provisioning is done as part of installation after the cluster is
9 # up and before the ovn daemonsets are created.
10
11 apiVersion: v1
12 kind: Namespace
13 metadata:
14   annotations:
15     openshift.io/node-selector: "beta.kubernetes.io/os=linux"
16   name: ovn-kubernetes
17
18 ---
19 # ovn-policy.yaml
20 #
21 # Setup for Kubernetes to support the ovn-kubernetes plugin
22 #
23 # Create the service account and policies.
24 # ovnkube interacts with kubernetes and the environment
25 # must be properly set up.
26
27 # This provisioning is done as part of installation after the cluster is
28 # up and before the ovn daemonsets are created.
29
30 apiVersion: v1
31 kind: ServiceAccount
32 metadata:
33   name: ovn
34   namespace: ovn-kubernetes
35
36 ---
37 apiVersion: rbac.authorization.k8s.io/v1
38 kind: ClusterRole
39 metadata:
40   annotations:
41     rbac.authorization.k8s.io/system-only: "true"
42   name: system:ovn-reader
43 rules:
44 - apiGroups:
45   - ""
46   - extensions
47   resources:
48   - pods
49   - namespaces
50   - networkpolicies
51   - nodes
52   verbs:
53   - get
54   - list
55   - watch
56 - apiGroups:
57   - networking.k8s.io
58   resources:
59   - networkpolicies
60   verbs:
61   - get
62   - list
63   - watch
64 - apiGroups:
65   - ""
66   resources:
67   - events
68   verbs:
69   - create
70   - patch
71   - update
72
73 ---
74 apiVersion: rbac.authorization.k8s.io/v1
75 kind: ClusterRoleBinding
76 metadata:
77   name: ovn-reader
78 roleRef:
79   name: system:ovn-reader
80   kind: ClusterRole
81   apiGroup: rbac.authorization.k8s.io
82 subjects:
83 - kind: ServiceAccount
84   name: ovn
85   namespace: ovn-kubernetes
86
87 ---
88 apiVersion: rbac.authorization.k8s.io/v1
89 kind: ClusterRoleBinding
90 metadata:
91   name: cluster-admin-0
92 roleRef:
93   name: cluster-admin
94   kind: ClusterRole
95   apiGroup: rbac.authorization.k8s.io
96 subjects:
97 - kind: ServiceAccount
98   name: ovn
99   namespace: ovn-kubernetes
100
101 ---
102 # service to expose the ovnkube-db pod
103 apiVersion: v1
104 kind: Service
105 metadata:
106   name: ovnkube-db
107   namespace: ovn-kubernetes
108 spec:
109   ports:
110   - name: north
111     port: 6641
112     protocol: TCP
113     targetPort: 6641
114   - name: south
115     port: 6642
116     protocol: TCP
117     targetPort: 6642
118   sessionAffinity: None
119   clusterIP: None
120   type: ClusterIP
121
122 ---
123 # The network cidr and service cidr are set in the ovn-config configmap
124 kind: ConfigMap
125 apiVersion: v1
126 metadata:
127   name: ovn-config
128   namespace: ovn-kubernetes
129 data:
130   net_cidr:      "{{ net_cidr | default('10.128.0.0/14/23') }}"
131   svc_cidr:      "{{ svc_cidr | default('172.30.0.0/16') }}"
132   k8s_apiserver: "{{ k8s_apiserver.stdout }}"