Andy Bavier | 2259a6b | 2018-07-12 15:27:48 -0700 | [diff] [blame] | 1 | --- |
| 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 | |
| 16 | kind: ClusterRole |
| 17 | apiVersion: rbac.authorization.k8s.io/v1beta1 |
| 18 | metadata: |
Andy Bavier | cb9b478 | 2019-05-24 15:30:26 -0700 | [diff] [blame] | 19 | name: ponnet-plugin |
Andy Bavier | 2259a6b | 2018-07-12 15:27:48 -0700 | [diff] [blame] | 20 | rules: |
| 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 | --- |
| 62 | kind: ClusterRoleBinding |
| 63 | apiVersion: rbac.authorization.k8s.io/v1beta1 |
| 64 | metadata: |
Andy Bavier | cb9b478 | 2019-05-24 15:30:26 -0700 | [diff] [blame] | 65 | name: ponnet-plugin |
Andy Bavier | 2259a6b | 2018-07-12 15:27:48 -0700 | [diff] [blame] | 66 | roleRef: |
| 67 | apiGroup: rbac.authorization.k8s.io |
| 68 | kind: ClusterRole |
Andy Bavier | cb9b478 | 2019-05-24 15:30:26 -0700 | [diff] [blame] | 69 | name: ponnet-plugin |
Andy Bavier | 2259a6b | 2018-07-12 15:27:48 -0700 | [diff] [blame] | 70 | subjects: |
| 71 | - kind: ServiceAccount |
Andy Bavier | cb9b478 | 2019-05-24 15:30:26 -0700 | [diff] [blame] | 72 | name: ponnnet-plugin |
Andy Bavier | 2259a6b | 2018-07-12 15:27:48 -0700 | [diff] [blame] | 73 | namespace: kube-system |
| 74 | - kind: Group |
| 75 | name: system:authenticated |
| 76 | apiGroup: rbac.authorization.k8s.io |
| 77 | |
| 78 | --- |
| 79 | apiVersion: v1 |
| 80 | kind: ServiceAccount |
| 81 | metadata: |
Andy Bavier | cb9b478 | 2019-05-24 15:30:26 -0700 | [diff] [blame] | 82 | name: ponnet-plugin |
Andy Bavier | 2259a6b | 2018-07-12 15:27:48 -0700 | [diff] [blame] | 83 | namespace: kube-system |
| 84 | |
| 85 | --- |
Andy Bavier | cb9b478 | 2019-05-24 15:30:26 -0700 | [diff] [blame] | 86 | # This ConfigMap can be used to configure a self-hosted Ponnet installation. |
Andy Bavier | 2259a6b | 2018-07-12 15:27:48 -0700 | [diff] [blame] | 87 | kind: ConfigMap |
| 88 | apiVersion: v1 |
| 89 | metadata: |
Andy Bavier | cb9b478 | 2019-05-24 15:30:26 -0700 | [diff] [blame] | 90 | name: ponnet-config |
Andy Bavier | 2259a6b | 2018-07-12 15:27:48 -0700 | [diff] [blame] | 91 | namespace: kube-system |
| 92 | data: |
Sreeju | 7d7fc07 | 2019-06-13 12:03:00 -0600 | [diff] [blame] | 93 | {{- $onucount := (.Values.numOnus|int) -}} |
Andy Bavier | e21a5f5 | 2019-05-28 15:39:52 -0700 | [diff] [blame] | 94 | {{- range $i, $junk := until (.Values.numOlts|int) }} |
Andy Bavier | e21a5f5 | 2019-05-28 15:39:52 -0700 | [diff] [blame] | 95 | nni{{ $i }}.conf: | |
Andy Bavier | 2259a6b | 2018-07-12 15:27:48 -0700 | [diff] [blame] | 96 | { |
Andy Bavier | e21a5f5 | 2019-05-28 15:39:52 -0700 | [diff] [blame] | 97 | "name": "nni{{ $i }}", |
Andy Bavier | cb9b478 | 2019-05-24 15:30:26 -0700 | [diff] [blame] | 98 | "type": "bridge", |
Andy Bavier | e21a5f5 | 2019-05-28 15:39:52 -0700 | [diff] [blame] | 99 | "bridge": "nni{{ $i }}", |
Andy Bavier | cb9b478 | 2019-05-24 15:30:26 -0700 | [diff] [blame] | 100 | "isGateway": false, |
| 101 | "ipMask": false, |
| 102 | "ipam": { |
Andy Bavier | 2259a6b | 2018-07-12 15:27:48 -0700 | [diff] [blame] | 103 | "type": "host-local", |
Andy Bavier | cb9b478 | 2019-05-24 15:30:26 -0700 | [diff] [blame] | 104 | "subnet": "10.23.0.0/16" |
Andy Bavier | 2259a6b | 2018-07-12 15:27:48 -0700 | [diff] [blame] | 105 | } |
| 106 | } |
Sreeju | 7d7fc07 | 2019-06-13 12:03:00 -0600 | [diff] [blame] | 107 | {{- 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 Bavier | e21a5f5 | 2019-05-28 15:39:52 -0700 | [diff] [blame] | 120 | {{- end }} |
Sreeju | 7d7fc07 | 2019-06-13 12:03:00 -0600 | [diff] [blame] | 121 | {{- end }} |
Andy Bavier | 2259a6b | 2018-07-12 15:27:48 -0700 | [diff] [blame] | 122 | --- |
Andy Bavier | cb9b478 | 2019-05-24 15:30:26 -0700 | [diff] [blame] | 123 | # Install Ponnnet CNI conf on each slave node. |
Andy Bavier | 2259a6b | 2018-07-12 15:27:48 -0700 | [diff] [blame] | 124 | kind: DaemonSet |
| 125 | apiVersion: extensions/v1beta1 |
| 126 | metadata: |
Andy Bavier | cb9b478 | 2019-05-24 15:30:26 -0700 | [diff] [blame] | 127 | name: ponnet-plugin |
Andy Bavier | 2259a6b | 2018-07-12 15:27:48 -0700 | [diff] [blame] | 128 | namespace: kube-system |
| 129 | labels: |
Andy Bavier | cb9b478 | 2019-05-24 15:30:26 -0700 | [diff] [blame] | 130 | k8s-app: ponnet |
Andy Bavier | 2259a6b | 2018-07-12 15:27:48 -0700 | [diff] [blame] | 131 | spec: |
| 132 | selector: |
| 133 | matchLabels: |
Andy Bavier | cb9b478 | 2019-05-24 15:30:26 -0700 | [diff] [blame] | 134 | k8s-app: ponnet |
Andy Bavier | 2259a6b | 2018-07-12 15:27:48 -0700 | [diff] [blame] | 135 | template: |
| 136 | metadata: |
| 137 | labels: |
Andy Bavier | cb9b478 | 2019-05-24 15:30:26 -0700 | [diff] [blame] | 138 | k8s-app: ponnet |
Andy Bavier | 2259a6b | 2018-07-12 15:27:48 -0700 | [diff] [blame] | 139 | 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 Bavier | cb9b478 | 2019-05-24 15:30:26 -0700 | [diff] [blame] | 156 | serviceAccountName: ponnet-plugin |
| 157 | initContainers: |
| 158 | # Installs CNI config files on each node |
Andy Bavier | 2259a6b | 2018-07-12 15:27:48 -0700 | [diff] [blame] | 159 | - name: install-cni |
Andy Bavier | cb9b478 | 2019-05-24 15:30:26 -0700 | [diff] [blame] | 160 | 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 Bavier | 2259a6b | 2018-07-12 15:27:48 -0700 | [diff] [blame] | 163 | env: |
Andy Bavier | 2259a6b | 2018-07-12 15:27:48 -0700 | [diff] [blame] | 164 | - 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 Bavier | cb9b478 | 2019-05-24 15:30:26 -0700 | [diff] [blame] | 173 | - mountPath: /tmp/cni |
| 174 | name: ponnet-config |
Andy Bavier | 2259a6b | 2018-07-12 15:27:48 -0700 | [diff] [blame] | 175 | 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 Bavier | cb9b478 | 2019-05-24 15:30:26 -0700 | [diff] [blame] | 182 | - name: ponnet-config |
| 183 | configMap: |
| 184 | name: ponnet-config |
| 185 | containers: |
| 186 | - name: pause |
| 187 | image: gcr.io/google_containers/pause |
| 188 | |