blob: e2a46c1e4fbe0570207e18a92bd907e8407bcddb [file] [log] [blame]
Zack Williams41513bf2018-07-07 20:08:35 -07001# Copyright 2017-present Open Networking Foundation
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
Richard Jankowski8f52afb2018-03-29 14:19:11 -040014---
15kind: ClusterRole
16apiVersion: rbac.authorization.k8s.io/v1beta1
17metadata:
18 name: genie
19rules:
20 - apiGroups:
21 - ""
22 resources:
23 - pods
24 verbs:
25 - get
26 - patch
27---
28kind: ClusterRoleBinding
29apiVersion: rbac.authorization.k8s.io/v1beta1
30metadata:
31 name: genie
32roleRef:
33 apiGroup: rbac.authorization.k8s.io
34 kind: ClusterRole
35 name: genie
36subjects:
37- kind: ServiceAccount
38 name: genie
39 namespace: kube-system
40- kind: Group
41 name: system:authenticated
42 apiGroup: rbac.authorization.k8s.io
43---
44apiVersion: v1
45kind: ServiceAccount
46metadata:
47 name: genie
48 namespace: kube-system
49---
50# This ConfigMap can be used to configure a self-hosted CNI-Genie installation.
51kind: ConfigMap
52apiVersion: v1
53metadata:
54 name: genie-config
55 namespace: kube-system
56data:
57 # The CNI network configuration to install on each node.
58 cni_genie_network_config: |-
59 {
60 "name": "k8s-pod-network",
61 "type": "genie",
62 "log_level": "info",
63 "datastore_type": "kubernetes",
64 "hostname": "__KUBERNETES_NODE_NAME__",
65 "policy": {
66 "type": "k8s",
67 "k8s_auth_token": "__SERVICEACCOUNT_TOKEN__"
68 },
69 "kubernetes": {
70 "k8s_api_root": "https://__KUBERNETES_SERVICE_HOST__:__KUBERNETES_SERVICE_PORT__",
71 "kubeconfig": "/etc/cni/net.d/genie-kubeconfig"
72 },
73 "romana_root": "http://__ROMANA_SERVICE_HOST__:__ROMANA_SERVICE_PORT__",
74 "segment_label_name": "romanaSegment"
75 }
76
77---
78# Install CNI-Genie plugin on each slave node.
79kind: DaemonSet
80apiVersion: extensions/v1beta1
81metadata:
82 name: genie
83 namespace: kube-system
84 labels:
85 k8s-app: genie
86spec:
87 selector:
88 matchLabels:
89 k8s-app: genie
90 template:
91 metadata:
92 labels:
93 k8s-app: genie
94 annotations:
95 scheduler.alpha.kubernetes.io/critical-pod: ''
96 scheduler.alpha.kubernetes.io/tolerations: |
97 [
98 {
99 "key": "dedicated",
100 "value": "master",
101 "effect": "NoSchedule"
102 },
103 {
104 "key": "CriticalAddonsOnly",
105 "operator": "Exists"
106 }
107 ]
108 spec:
109 hostNetwork: true
110 hostPID: true
111 containers:
112 # Create a container with install.sh that
113 # Installs required 00-genie.conf and genie binary
114 # on slave node.
115 - name: install-cni
116 image: quay.io/cnigenie/v1.5:latest
117 command: ["/launch.sh"]
118 env:
119 - name: CNI_NETWORK_CONFIG
120 valueFrom:
121 configMapKeyRef:
122 name: genie-config
123 key: cni_genie_network_config
124 - name: KUBERNETES_NODE_NAME
125 valueFrom:
126 fieldRef:
127 fieldPath: spec.nodeName
128 volumeMounts:
129 - mountPath: /host/opt/cni/bin
130 name: cni-bin-dir
131 - mountPath: /host/etc/cni/net.d
132 name: cni-net-dir
133 volumes:
134 # Used by genie/node.
135 #- name: lib-modules
136 # hostPath:
137 # path: /lib/modules
138 #- name: var-run-genie
139 # hostPath:
140 # path: /var/run/genie
141 # Used to install CNI.
142 - name: cni-bin-dir
143 hostPath:
144 path: /opt/cni/bin
145 - name: cni-net-dir
146 hostPath:
147 path: /etc/cni/net.d