blob: 8b23d5a4ed4dc753ad3b373597010a62b4f0aa27 [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",
Andy Bavier33efb822018-08-24 12:47:49 -070099 "isGateway": false,
100 "ipMask": false,
Andy Bavier2259a6b2018-07-12 15:27:48 -0700101 "ipam": {
102 "type": "host-local",
Andy Bavier33efb822018-08-24 12:47:49 -0700103 "subnet": "10.22.0.0/16"
Andy Bavier2259a6b2018-07-12 15:27:48 -0700104 }
105 }
106
107---
108# This ConfigMap can be used to configure a self-hosted Pon0 installation.
109kind: ConfigMap
110apiVersion: v1
111metadata:
112 name: pon1-config
113 namespace: kube-system
114data:
115 # The CNI network configuration to install on each node.
116 cni_pon1_network_config: |-
117 {
118 "name": "pon1",
119 "type": "bridge",
120 "bridge": "pon1",
121 "isGateway": true,
122 "ipMask": true,
123 "ipam": {
124 "type": "host-local",
125 "subnet": "10.23.0.0/16",
126 "routes": [
127 { "dst": "0.0.0.0/0" }
128 ]
129 }
130 }
131
132---
133# Install Pon0 CNI conf on each slave node.
134kind: DaemonSet
135apiVersion: extensions/v1beta1
136metadata:
137 name: pon0-plugin
138 namespace: kube-system
139 labels:
140 k8s-app: pon0
141spec:
142 selector:
143 matchLabels:
144 k8s-app: pon0
145 template:
146 metadata:
147 labels:
148 k8s-app: pon0
149 annotations:
150 scheduler.alpha.kubernetes.io/critical-pod: ''
151 scheduler.alpha.kubernetes.io/tolerations: |
152 [
153 {
154 "key": "dedicated",
155 "value": "master",
156 "effect": "NoSchedule"
157 },
158 {
159 "key": "CriticalAddonsOnly",
160 "operator": "Exists"
161 }
162 ]
163 spec:
164 hostNetwork: true
165 hostPID: true
166 serviceAccountName: pon0-plugin
167 containers:
168 # Create a container with place_conf.sh that
169 # Installs required 20-pon0.conf on slave node.
170 - name: install-cni
171 image: {{ .Values.pull_docker_registry }}{{ .Values.images.pon0.repository }}:{{ .Values.images.pon0.tag }}
172 imagePullPolicy: {{ .Values.images.pon0.pullPolicy }}
173 command: ["/place_conf.sh"]
174 env:
175 - name: CNI_NETWORK_CONFIG
176 valueFrom:
177 configMapKeyRef:
178 name: pon0-config
179 key: cni_pon0_network_config
180 - name: CNI_PON1_NETWORK_CONFIG
181 valueFrom:
182 configMapKeyRef:
183 name: pon1-config
184 key: cni_pon1_network_config
185 - name: KUBERNETES_NODE_NAME
186 valueFrom:
187 fieldRef:
188 fieldPath: spec.nodeName
189 volumeMounts:
190 - mountPath: /host/opt/cni/bin
191 name: cni-bin-dir
192 - mountPath: /host/etc/cni/net.d
193 name: cni-net-dir
194 volumes:
195 - name: cni-bin-dir
196 hostPath:
197 path: /opt/cni/bin
198 - name: cni-net-dir
199 hostPath:
200 path: /etc/cni/net.d