blob: a3cf4f8508652db6fca38b930a7d0bc9eb6ed4e1 [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:
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
63apiVersion: rbac.authorization.k8s.io/v1beta1
64metadata:
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:
Andy Baviere21a5f52019-05-28 15:39:52 -070093{{- range $i, $junk := until (.Values.numOlts|int) }}
94 pon{{ $i }}.conf: |
Andy Bavier2259a6b2018-07-12 15:27:48 -070095 {
Andy Baviere21a5f52019-05-28 15:39:52 -070096 "name": "pon{{ $i }}",
Andy Baviercb9b4782019-05-24 15:30:26 -070097 "type": "bridge",
Andy Baviere21a5f52019-05-28 15:39:52 -070098 "bridge": "pon{{ $i }}",
Andy Baviercb9b4782019-05-24 15:30:26 -070099 "isGateway": false,
100 "ipMask": false,
101 "ipam": {
Andy Bavier2259a6b2018-07-12 15:27:48 -0700102 "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 }
Andy Baviere21a5f52019-05-28 15:39:52 -0700106 nni{{ $i }}.conf: |
Andy Bavier2259a6b2018-07-12 15:27:48 -0700107 {
Andy Baviere21a5f52019-05-28 15:39:52 -0700108 "name": "nni{{ $i }}",
Andy Baviercb9b4782019-05-24 15:30:26 -0700109 "type": "bridge",
Andy Baviere21a5f52019-05-28 15:39:52 -0700110 "bridge": "nni{{ $i }}",
Andy Baviercb9b4782019-05-24 15:30:26 -0700111 "isGateway": false,
112 "ipMask": false,
113 "ipam": {
Andy Bavier2259a6b2018-07-12 15:27:48 -0700114 "type": "host-local",
Andy Baviercb9b4782019-05-24 15:30:26 -0700115 "subnet": "10.23.0.0/16"
Andy Bavier2259a6b2018-07-12 15:27:48 -0700116 }
117 }
Andy Baviere21a5f52019-05-28 15:39:52 -0700118{{- end }}
Andy Bavier2259a6b2018-07-12 15:27:48 -0700119
120---
Andy Baviercb9b4782019-05-24 15:30:26 -0700121# Install Ponnnet CNI conf on each slave node.
Andy Bavier2259a6b2018-07-12 15:27:48 -0700122kind: DaemonSet
123apiVersion: extensions/v1beta1
124metadata:
Andy Baviercb9b4782019-05-24 15:30:26 -0700125 name: ponnet-plugin
Andy Bavier2259a6b2018-07-12 15:27:48 -0700126 namespace: kube-system
127 labels:
Andy Baviercb9b4782019-05-24 15:30:26 -0700128 k8s-app: ponnet
Andy Bavier2259a6b2018-07-12 15:27:48 -0700129spec:
130 selector:
131 matchLabels:
Andy Baviercb9b4782019-05-24 15:30:26 -0700132 k8s-app: ponnet
Andy Bavier2259a6b2018-07-12 15:27:48 -0700133 template:
134 metadata:
135 labels:
Andy Baviercb9b4782019-05-24 15:30:26 -0700136 k8s-app: ponnet
Andy Bavier2259a6b2018-07-12 15:27:48 -0700137 annotations:
138 scheduler.alpha.kubernetes.io/critical-pod: ''
139 scheduler.alpha.kubernetes.io/tolerations: |
140 [
141 {
142 "key": "dedicated",
143 "value": "master",
144 "effect": "NoSchedule"
145 },
146 {
147 "key": "CriticalAddonsOnly",
148 "operator": "Exists"
149 }
150 ]
151 spec:
152 hostNetwork: true
153 hostPID: true
Andy Baviercb9b4782019-05-24 15:30:26 -0700154 serviceAccountName: ponnet-plugin
155 initContainers:
156 # Installs CNI config files on each node
Andy Bavier2259a6b2018-07-12 15:27:48 -0700157 - name: install-cni
Andy Baviercb9b4782019-05-24 15:30:26 -0700158 image: {{ .Values.pull_docker_registry }}{{ .Values.images.ponnet.repository }}:{{ .Values.images.ponnet.tag }}
159 imagePullPolicy: {{ .Values.images.ponnet.pullPolicy }}
160 command: ["/bin/sh", "-c", "cp /tmp/cni/* /host/etc/cni/net.d"]
Andy Bavier2259a6b2018-07-12 15:27:48 -0700161 env:
Andy Bavier2259a6b2018-07-12 15:27:48 -0700162 - name: KUBERNETES_NODE_NAME
163 valueFrom:
164 fieldRef:
165 fieldPath: spec.nodeName
166 volumeMounts:
167 - mountPath: /host/opt/cni/bin
168 name: cni-bin-dir
169 - mountPath: /host/etc/cni/net.d
170 name: cni-net-dir
Andy Baviercb9b4782019-05-24 15:30:26 -0700171 - mountPath: /tmp/cni
172 name: ponnet-config
Andy Bavier2259a6b2018-07-12 15:27:48 -0700173 volumes:
174 - name: cni-bin-dir
175 hostPath:
176 path: /opt/cni/bin
177 - name: cni-net-dir
178 hostPath:
179 path: /etc/cni/net.d
Andy Baviercb9b4782019-05-24 15:30:26 -0700180 - name: ponnet-config
181 configMap:
182 name: ponnet-config
183 containers:
184 - name: pause
185 image: gcr.io/google_containers/pause
186