blob: 8d8a25f84a01fc7fa63e08d1b97f45e6d8dc13b1 [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
Matteo Scandolo5628d4b2021-01-11 11:46:12 -080017apiVersion: rbac.authorization.k8s.io/v1
Andy Bavier2259a6b2018-07-12 15:27:48 -070018metadata:
Andy Baviercb9b4782019-05-24 15:30:26 -070019 name: ponnet-plugin
Andy Bavier2259a6b2018-07-12 15:27:48 -070020rules:
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
Matteo Scandolo5628d4b2021-01-11 11:46:12 -080063apiVersion: rbac.authorization.k8s.io/v1
Andy Bavier2259a6b2018-07-12 15:27:48 -070064metadata:
Andy Baviercb9b4782019-05-24 15:30:26 -070065 name: ponnet-plugin
Andy Bavier2259a6b2018-07-12 15:27:48 -070066roleRef:
67 apiGroup: rbac.authorization.k8s.io
68 kind: ClusterRole
Andy Baviercb9b4782019-05-24 15:30:26 -070069 name: ponnet-plugin
Andy Bavier2259a6b2018-07-12 15:27:48 -070070subjects:
71- kind: ServiceAccount
Andy Baviercb9b4782019-05-24 15:30:26 -070072 name: ponnnet-plugin
Andy Bavier2259a6b2018-07-12 15:27:48 -070073 namespace: kube-system
74- kind: Group
75 name: system:authenticated
76 apiGroup: rbac.authorization.k8s.io
77
78---
79apiVersion: v1
80kind: ServiceAccount
81metadata:
Andy Baviercb9b4782019-05-24 15:30:26 -070082 name: ponnet-plugin
Andy Bavier2259a6b2018-07-12 15:27:48 -070083 namespace: kube-system
84
85---
Andy Baviercb9b4782019-05-24 15:30:26 -070086# This ConfigMap can be used to configure a self-hosted Ponnet installation.
Andy Bavier2259a6b2018-07-12 15:27:48 -070087kind: ConfigMap
88apiVersion: v1
89metadata:
Andy Baviercb9b4782019-05-24 15:30:26 -070090 name: ponnet-config
Andy Bavier2259a6b2018-07-12 15:27:48 -070091 namespace: kube-system
92data:
Sreeju7d7fc072019-06-13 12:03:00 -060093{{- $onucount := (.Values.numOnus|int) -}}
Andy Baviere21a5f52019-05-28 15:39:52 -070094{{- range $i, $junk := until (.Values.numOlts|int) }}
Andy Baviere21a5f52019-05-28 15:39:52 -070095 nni{{ $i }}.conf: |
Andy Bavier2259a6b2018-07-12 15:27:48 -070096 {
Andy Baviere21a5f52019-05-28 15:39:52 -070097 "name": "nni{{ $i }}",
Andy Baviercb9b4782019-05-24 15:30:26 -070098 "type": "bridge",
Andy Baviere21a5f52019-05-28 15:39:52 -070099 "bridge": "nni{{ $i }}",
Andy Baviercb9b4782019-05-24 15:30:26 -0700100 "isGateway": false,
101 "ipMask": false,
102 "ipam": {
Andy Bavier2259a6b2018-07-12 15:27:48 -0700103 "type": "host-local",
Andy Baviercb9b4782019-05-24 15:30:26 -0700104 "subnet": "10.23.0.0/16"
Andy Bavier2259a6b2018-07-12 15:27:48 -0700105 }
106 }
Sreeju7d7fc072019-06-13 12:03:00 -0600107{{- range $j, $junk1 := until ($onucount) }}
108 pon{{ $i }}.{{ $j }}.conf: |
109 {
110 "name": "pon{{ $i }}.{{ $j }}",
111 "type": "bridge",
112 "bridge": "pon{{ $i }}.{{ $j }}",
113 "isGateway": false,
114 "ipMask": false,
115 "ipam": {
116 "type": "host-local",
117 "subnet": "10.22.0.0/16"
118 }
119 }
Andy Baviere21a5f52019-05-28 15:39:52 -0700120{{- end }}
Sreeju7d7fc072019-06-13 12:03:00 -0600121{{- end }}
Andy Bavier2259a6b2018-07-12 15:27:48 -0700122---
Andy Baviercb9b4782019-05-24 15:30:26 -0700123# Install Ponnnet CNI conf on each slave node.
Andy Bavier2259a6b2018-07-12 15:27:48 -0700124kind: DaemonSet
Matteo Scandolo5628d4b2021-01-11 11:46:12 -0800125apiVersion: apps/v1
Andy Bavier2259a6b2018-07-12 15:27:48 -0700126metadata:
Andy Baviercb9b4782019-05-24 15:30:26 -0700127 name: ponnet-plugin
Andy Bavier2259a6b2018-07-12 15:27:48 -0700128 namespace: kube-system
129 labels:
Andy Baviercb9b4782019-05-24 15:30:26 -0700130 k8s-app: ponnet
Andy Bavier2259a6b2018-07-12 15:27:48 -0700131spec:
132 selector:
133 matchLabels:
Andy Baviercb9b4782019-05-24 15:30:26 -0700134 k8s-app: ponnet
Andy Bavier2259a6b2018-07-12 15:27:48 -0700135 template:
136 metadata:
137 labels:
Andy Baviercb9b4782019-05-24 15:30:26 -0700138 k8s-app: ponnet
Andy Bavier2259a6b2018-07-12 15:27:48 -0700139 annotations:
140 scheduler.alpha.kubernetes.io/critical-pod: ''
141 scheduler.alpha.kubernetes.io/tolerations: |
142 [
143 {
144 "key": "dedicated",
145 "value": "master",
146 "effect": "NoSchedule"
147 },
148 {
149 "key": "CriticalAddonsOnly",
150 "operator": "Exists"
151 }
152 ]
153 spec:
154 hostNetwork: true
155 hostPID: true
Andy Baviercb9b4782019-05-24 15:30:26 -0700156 serviceAccountName: ponnet-plugin
157 initContainers:
158 # Installs CNI config files on each node
Andy Bavier2259a6b2018-07-12 15:27:48 -0700159 - name: install-cni
Andy Baviercb9b4782019-05-24 15:30:26 -0700160 image: {{ .Values.pull_docker_registry }}{{ .Values.images.ponnet.repository }}:{{ .Values.images.ponnet.tag }}
161 imagePullPolicy: {{ .Values.images.ponnet.pullPolicy }}
162 command: ["/bin/sh", "-c", "cp /tmp/cni/* /host/etc/cni/net.d"]
Andy Bavier2259a6b2018-07-12 15:27:48 -0700163 env:
Andy Bavier2259a6b2018-07-12 15:27:48 -0700164 - name: KUBERNETES_NODE_NAME
165 valueFrom:
166 fieldRef:
167 fieldPath: spec.nodeName
168 volumeMounts:
169 - mountPath: /host/opt/cni/bin
170 name: cni-bin-dir
171 - mountPath: /host/etc/cni/net.d
172 name: cni-net-dir
Andy Baviercb9b4782019-05-24 15:30:26 -0700173 - mountPath: /tmp/cni
174 name: ponnet-config
Andy Bavier2259a6b2018-07-12 15:27:48 -0700175 volumes:
176 - name: cni-bin-dir
177 hostPath:
178 path: /opt/cni/bin
179 - name: cni-net-dir
180 hostPath:
181 path: /etc/cni/net.d
Andy Baviercb9b4782019-05-24 15:30:26 -0700182 - name: ponnet-config
183 configMap:
184 name: ponnet-config
185 containers:
186 - name: pause
187 image: gcr.io/google_containers/pause
188