blob: b35815b333a41fc39400888724218bf9cdbb054d [file] [log] [blame]
Andy Bavier2259a6b2018-07-12 15:27:48 -07001---
2# Copyright 2017-present Open Networking Foundation
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16kind: ClusterRole
17apiVersion: rbac.authorization.k8s.io/v1beta1
18metadata:
19 name: pon0-plugin
20rules:
21 - apiGroups:
22 - ""
23 resources:
24 - pods
25 verbs:
26 - get
27 - update
28 - patch
29 - apiGroups:
30 - "alpha.network.k8s.io"
31 resources:
32 - logicalnetworks
33 verbs:
34 - get
35 - update
36 - patch
37 - apiGroups:
38 - "alpha.network.k8s.io"
39 resources:
40 - physicalnetworks
41 verbs:
42 - get
43 - update
44 - patch
45 - apiGroups:
46 - ""
47 resources:
48 - configmaps
49 verbs:
50 - get
51 - apiGroups:
52 - "admissionregistration.k8s.io"
53 resources:
54 - validatingwebhookconfigurations
55 verbs:
56 - get
57 - update
58 - create
59 - delete
60
61---
62kind: ClusterRoleBinding
63apiVersion: rbac.authorization.k8s.io/v1beta1
64metadata:
65 name: pon0-plugin
66roleRef:
67 apiGroup: rbac.authorization.k8s.io
68 kind: ClusterRole
69 name: pon0-plugin
70subjects:
71- kind: ServiceAccount
72 name: pon0-plugin
73 namespace: kube-system
74- kind: Group
75 name: system:authenticated
76 apiGroup: rbac.authorization.k8s.io
77
78---
79apiVersion: v1
80kind: ServiceAccount
81metadata:
82 name: pon0-plugin
83 namespace: kube-system
84
85---
86# This ConfigMap can be used to configure a self-hosted Pon0 installation.
87kind: ConfigMap
88apiVersion: v1
89metadata:
90 name: pon0-config
91 namespace: kube-system
92data:
93 # The CNI network configuration to install on each node.
94 cni_pon0_network_config: |-
95 {
96 "name": "pon0",
97 "type": "bridge",
98 "bridge": "pon0",
99 "isGateway": true,
100 "ipMask": true,
101 "ipam": {
102 "type": "host-local",
103 "subnet": "10.22.0.0/16",
104 "routes": [
105 { "dst": "0.0.0.0/0" }
106 ]
107 }
108 }
109
110---
111# This ConfigMap can be used to configure a self-hosted Pon0 installation.
112kind: ConfigMap
113apiVersion: v1
114metadata:
115 name: pon1-config
116 namespace: kube-system
117data:
118 # The CNI network configuration to install on each node.
119 cni_pon1_network_config: |-
120 {
121 "name": "pon1",
122 "type": "bridge",
123 "bridge": "pon1",
124 "isGateway": true,
125 "ipMask": true,
126 "ipam": {
127 "type": "host-local",
128 "subnet": "10.23.0.0/16",
129 "routes": [
130 { "dst": "0.0.0.0/0" }
131 ]
132 }
133 }
134
135---
136# Install Pon0 CNI conf on each slave node.
137kind: DaemonSet
138apiVersion: extensions/v1beta1
139metadata:
140 name: pon0-plugin
141 namespace: kube-system
142 labels:
143 k8s-app: pon0
144spec:
145 selector:
146 matchLabels:
147 k8s-app: pon0
148 template:
149 metadata:
150 labels:
151 k8s-app: pon0
152 annotations:
153 scheduler.alpha.kubernetes.io/critical-pod: ''
154 scheduler.alpha.kubernetes.io/tolerations: |
155 [
156 {
157 "key": "dedicated",
158 "value": "master",
159 "effect": "NoSchedule"
160 },
161 {
162 "key": "CriticalAddonsOnly",
163 "operator": "Exists"
164 }
165 ]
166 spec:
167 hostNetwork: true
168 hostPID: true
169 serviceAccountName: pon0-plugin
170 containers:
171 # Create a container with place_conf.sh that
172 # Installs required 20-pon0.conf on slave node.
173 - name: install-cni
174 image: {{ .Values.pull_docker_registry }}{{ .Values.images.pon0.repository }}:{{ .Values.images.pon0.tag }}
175 imagePullPolicy: {{ .Values.images.pon0.pullPolicy }}
176 command: ["/place_conf.sh"]
177 env:
178 - name: CNI_NETWORK_CONFIG
179 valueFrom:
180 configMapKeyRef:
181 name: pon0-config
182 key: cni_pon0_network_config
183 - name: CNI_PON1_NETWORK_CONFIG
184 valueFrom:
185 configMapKeyRef:
186 name: pon1-config
187 key: cni_pon1_network_config
188 - name: KUBERNETES_NODE_NAME
189 valueFrom:
190 fieldRef:
191 fieldPath: spec.nodeName
192 volumeMounts:
193 - mountPath: /host/opt/cni/bin
194 name: cni-bin-dir
195 - mountPath: /host/etc/cni/net.d
196 name: cni-net-dir
197 volumes:
198 - name: cni-bin-dir
199 hostPath:
200 path: /opt/cni/bin
201 - name: cni-net-dir
202 hostPath:
203 path: /etc/cni/net.d