Richard Jankowski | 8f52afb | 2018-03-29 14:19:11 -0400 | [diff] [blame] | 1 | --- |
| 2 | kind: ClusterRole |
| 3 | apiVersion: rbac.authorization.k8s.io/v1beta1 |
| 4 | metadata: |
| 5 | name: genie |
| 6 | rules: |
| 7 | - apiGroups: |
| 8 | - "" |
| 9 | resources: |
| 10 | - pods |
| 11 | verbs: |
| 12 | - get |
| 13 | - patch |
| 14 | --- |
| 15 | kind: ClusterRoleBinding |
| 16 | apiVersion: rbac.authorization.k8s.io/v1beta1 |
| 17 | metadata: |
| 18 | name: genie |
| 19 | roleRef: |
| 20 | apiGroup: rbac.authorization.k8s.io |
| 21 | kind: ClusterRole |
| 22 | name: genie |
| 23 | subjects: |
| 24 | - kind: ServiceAccount |
| 25 | name: genie |
| 26 | namespace: kube-system |
| 27 | - kind: Group |
| 28 | name: system:authenticated |
| 29 | apiGroup: rbac.authorization.k8s.io |
| 30 | --- |
| 31 | apiVersion: v1 |
| 32 | kind: ServiceAccount |
| 33 | metadata: |
| 34 | name: genie |
| 35 | namespace: kube-system |
| 36 | --- |
| 37 | # This ConfigMap can be used to configure a self-hosted CNI-Genie installation. |
| 38 | kind: ConfigMap |
| 39 | apiVersion: v1 |
| 40 | metadata: |
| 41 | name: genie-config |
| 42 | namespace: kube-system |
| 43 | data: |
| 44 | # The CNI network configuration to install on each node. |
| 45 | cni_genie_network_config: |- |
| 46 | { |
| 47 | "name": "k8s-pod-network", |
| 48 | "type": "genie", |
| 49 | "log_level": "info", |
| 50 | "datastore_type": "kubernetes", |
| 51 | "hostname": "__KUBERNETES_NODE_NAME__", |
| 52 | "policy": { |
| 53 | "type": "k8s", |
| 54 | "k8s_auth_token": "__SERVICEACCOUNT_TOKEN__" |
| 55 | }, |
| 56 | "kubernetes": { |
| 57 | "k8s_api_root": "https://__KUBERNETES_SERVICE_HOST__:__KUBERNETES_SERVICE_PORT__", |
| 58 | "kubeconfig": "/etc/cni/net.d/genie-kubeconfig" |
| 59 | }, |
| 60 | "romana_root": "http://__ROMANA_SERVICE_HOST__:__ROMANA_SERVICE_PORT__", |
| 61 | "segment_label_name": "romanaSegment" |
| 62 | } |
| 63 | |
| 64 | --- |
| 65 | # Install CNI-Genie plugin on each slave node. |
| 66 | kind: DaemonSet |
| 67 | apiVersion: extensions/v1beta1 |
| 68 | metadata: |
| 69 | name: genie |
| 70 | namespace: kube-system |
| 71 | labels: |
| 72 | k8s-app: genie |
| 73 | spec: |
| 74 | selector: |
| 75 | matchLabels: |
| 76 | k8s-app: genie |
| 77 | template: |
| 78 | metadata: |
| 79 | labels: |
| 80 | k8s-app: genie |
| 81 | annotations: |
| 82 | scheduler.alpha.kubernetes.io/critical-pod: '' |
| 83 | scheduler.alpha.kubernetes.io/tolerations: | |
| 84 | [ |
| 85 | { |
| 86 | "key": "dedicated", |
| 87 | "value": "master", |
| 88 | "effect": "NoSchedule" |
| 89 | }, |
| 90 | { |
| 91 | "key": "CriticalAddonsOnly", |
| 92 | "operator": "Exists" |
| 93 | } |
| 94 | ] |
| 95 | spec: |
| 96 | hostNetwork: true |
| 97 | hostPID: true |
| 98 | containers: |
| 99 | # Create a container with install.sh that |
| 100 | # Installs required 00-genie.conf and genie binary |
| 101 | # on slave node. |
| 102 | - name: install-cni |
| 103 | image: quay.io/cnigenie/v1.5:latest |
| 104 | command: ["/launch.sh"] |
| 105 | env: |
| 106 | - name: CNI_NETWORK_CONFIG |
| 107 | valueFrom: |
| 108 | configMapKeyRef: |
| 109 | name: genie-config |
| 110 | key: cni_genie_network_config |
| 111 | - name: KUBERNETES_NODE_NAME |
| 112 | valueFrom: |
| 113 | fieldRef: |
| 114 | fieldPath: spec.nodeName |
| 115 | volumeMounts: |
| 116 | - mountPath: /host/opt/cni/bin |
| 117 | name: cni-bin-dir |
| 118 | - mountPath: /host/etc/cni/net.d |
| 119 | name: cni-net-dir |
| 120 | volumes: |
| 121 | # Used by genie/node. |
| 122 | #- name: lib-modules |
| 123 | # hostPath: |
| 124 | # path: /lib/modules |
| 125 | #- name: var-run-genie |
| 126 | # hostPath: |
| 127 | # path: /var/run/genie |
| 128 | # Used to install CNI. |
| 129 | - name: cni-bin-dir |
| 130 | hostPath: |
| 131 | path: /opt/cni/bin |
| 132 | - name: cni-net-dir |
| 133 | hostPath: |
| 134 | path: /etc/cni/net.d |