blob: 0241df67a5ed023802ae02fd4e14b292cb4499a1 [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 Baviercb9b4782019-05-24 15:30:26 -070093 pon0.conf: |
Andy Bavier2259a6b2018-07-12 15:27:48 -070094 {
Andy Baviercb9b4782019-05-24 15:30:26 -070095 "name": "pon0",
96 "type": "bridge",
97 "bridge": "pon0",
98 "isGateway": false,
99 "ipMask": false,
100 "ipam": {
Andy Bavier2259a6b2018-07-12 15:27:48 -0700101 "type": "host-local",
Andy Bavier33efb822018-08-24 12:47:49 -0700102 "subnet": "10.22.0.0/16"
Andy Bavier2259a6b2018-07-12 15:27:48 -0700103 }
104 }
Andy Baviercb9b4782019-05-24 15:30:26 -0700105 pon1.conf: |
Andy Bavier2259a6b2018-07-12 15:27:48 -0700106 {
Andy Baviercb9b4782019-05-24 15:30:26 -0700107 "name": "pon1",
108 "type": "bridge",
109 "bridge": "pon1",
110 "isGateway": false,
111 "ipMask": false,
112 "ipam": {
Andy Bavier2259a6b2018-07-12 15:27:48 -0700113 "type": "host-local",
Andy Baviercb9b4782019-05-24 15:30:26 -0700114 "subnet": "10.23.0.0/16"
Andy Bavier2259a6b2018-07-12 15:27:48 -0700115 }
116 }
117
118---
Andy Baviercb9b4782019-05-24 15:30:26 -0700119# Install Ponnnet CNI conf on each slave node.
Andy Bavier2259a6b2018-07-12 15:27:48 -0700120kind: DaemonSet
121apiVersion: extensions/v1beta1
122metadata:
Andy Baviercb9b4782019-05-24 15:30:26 -0700123 name: ponnet-plugin
Andy Bavier2259a6b2018-07-12 15:27:48 -0700124 namespace: kube-system
125 labels:
Andy Baviercb9b4782019-05-24 15:30:26 -0700126 k8s-app: ponnet
Andy Bavier2259a6b2018-07-12 15:27:48 -0700127spec:
128 selector:
129 matchLabels:
Andy Baviercb9b4782019-05-24 15:30:26 -0700130 k8s-app: ponnet
Andy Bavier2259a6b2018-07-12 15:27:48 -0700131 template:
132 metadata:
133 labels:
Andy Baviercb9b4782019-05-24 15:30:26 -0700134 k8s-app: ponnet
Andy Bavier2259a6b2018-07-12 15:27:48 -0700135 annotations:
136 scheduler.alpha.kubernetes.io/critical-pod: ''
137 scheduler.alpha.kubernetes.io/tolerations: |
138 [
139 {
140 "key": "dedicated",
141 "value": "master",
142 "effect": "NoSchedule"
143 },
144 {
145 "key": "CriticalAddonsOnly",
146 "operator": "Exists"
147 }
148 ]
149 spec:
150 hostNetwork: true
151 hostPID: true
Andy Baviercb9b4782019-05-24 15:30:26 -0700152 serviceAccountName: ponnet-plugin
153 initContainers:
154 # Installs CNI config files on each node
Andy Bavier2259a6b2018-07-12 15:27:48 -0700155 - name: install-cni
Andy Baviercb9b4782019-05-24 15:30:26 -0700156 image: {{ .Values.pull_docker_registry }}{{ .Values.images.ponnet.repository }}:{{ .Values.images.ponnet.tag }}
157 imagePullPolicy: {{ .Values.images.ponnet.pullPolicy }}
158 command: ["/bin/sh", "-c", "cp /tmp/cni/* /host/etc/cni/net.d"]
Andy Bavier2259a6b2018-07-12 15:27:48 -0700159 env:
Andy Bavier2259a6b2018-07-12 15:27:48 -0700160 - name: KUBERNETES_NODE_NAME
161 valueFrom:
162 fieldRef:
163 fieldPath: spec.nodeName
164 volumeMounts:
165 - mountPath: /host/opt/cni/bin
166 name: cni-bin-dir
167 - mountPath: /host/etc/cni/net.d
168 name: cni-net-dir
Andy Baviercb9b4782019-05-24 15:30:26 -0700169 - mountPath: /tmp/cni
170 name: ponnet-config
Andy Bavier2259a6b2018-07-12 15:27:48 -0700171 volumes:
172 - name: cni-bin-dir
173 hostPath:
174 path: /opt/cni/bin
175 - name: cni-net-dir
176 hostPath:
177 path: /etc/cni/net.d
Andy Baviercb9b4782019-05-24 15:30:26 -0700178 - name: ponnet-config
179 configMap:
180 name: ponnet-config
181 containers:
182 - name: pause
183 image: gcr.io/google_containers/pause
184