Wei-Yu Chen | 450a98a | 2019-01-15 16:56:30 -0800 | [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 | --- |
| 17 | kind: ConfigMap |
| 18 | apiVersion: v1 |
| 19 | metadata: |
Wei-Yu Chen | b92af45 | 2019-01-31 12:08:19 -0800 | [diff] [blame] | 20 | name: multus-scripts |
Wei-Yu Chen | 450a98a | 2019-01-15 16:56:30 -0800 | [diff] [blame] | 21 | namespace: kube-system |
| 22 | data: |
| 23 | install-certs.sh: | |
| 24 | # Copied from Calico |
| 25 | # https://github.com/projectcalico/cni-plugin/blob/master/k8s-install/scripts/install-cni.sh |
| 26 | touch /host/etc/cni/net.d/multus-kubeconfig |
| 27 | chmod 600 /host/etc/cni/net.d/multus-kubeconfig |
| 28 | SERVICE_ACCOUNT_PATH=/var/run/secrets/kubernetes.io/serviceaccount |
| 29 | KUBE_CA_FILE=$SERVICE_ACCOUNT_PATH/ca.crt |
| 30 | TLS_CFG="certificate-authority-data: $(cat $KUBE_CA_FILE | base64 | tr -d '\n')" |
| 31 | SERVICEACCOUNT_TOKEN=$(cat $SERVICE_ACCOUNT_PATH/token) |
Wei-Yu Chen | b92af45 | 2019-01-31 12:08:19 -0800 | [diff] [blame] | 32 | cat > /host/etc/cni/net.d/multus-kubeconfig <<EOF |
Wei-Yu Chen | 450a98a | 2019-01-15 16:56:30 -0800 | [diff] [blame] | 33 | # Kubeconfig file for Multus CNI plugin. |
| 34 | apiVersion: v1 |
| 35 | kind: Config |
| 36 | clusters: |
| 37 | - name: local |
| 38 | cluster: |
| 39 | server: https://${KUBERNETES_SERVICE_HOST}:${KUBERNETES_SERVICE_PORT} |
| 40 | $TLS_CFG |
| 41 | users: |
| 42 | - name: multus |
| 43 | user: |
| 44 | token: "${SERVICEACCOUNT_TOKEN}" |
| 45 | contexts: |
| 46 | - name: multus-context |
| 47 | context: |
| 48 | cluster: local |
| 49 | user: multus |
| 50 | current-context: multus-context |
| 51 | EOF |
Wei-Yu Chen | b92af45 | 2019-01-31 12:08:19 -0800 | [diff] [blame] | 52 | install-multus-conf.sh: | |
| 53 | # copied from https://github.com/intel/multus-cni/blob/master/images/entrypoint.sh |
| 54 | rm -f /host/etc/cni/net.d/00-multus.conf |
| 55 | MASTER_PLUGIN="$(ls /host/etc/cni/net.d | grep -E '\.conf(list)?$' | head -1)" |
| 56 | MASTER_PLUGIN_JSON="$(cat /host/etc/cni/net.d/$MASTER_PLUGIN)" |
| 57 | cat > /host/etc/cni/net.d/00-multus.conf <<EOF |
| 58 | { |
| 59 | "name": "multus-cni-network", |
| 60 | "type": "multus", |
| 61 | "logFile": "/var/log/multus.log", |
| 62 | "logLevel": "debug", |
| 63 | "kubeconfig": "/etc/cni/net.d/multus-kubeconfig", |
| 64 | "delegates": [ |
| 65 | $MASTER_PLUGIN_JSON |
| 66 | ] |
| 67 | } |
| 68 | EOF |
Wei-Yu Chen | 450a98a | 2019-01-15 16:56:30 -0800 | [diff] [blame] | 69 | --- |
| 70 | kind: ConfigMap |
| 71 | apiVersion: v1 |
| 72 | metadata: |
| 73 | name: sriov-config |
| 74 | namespace: kube-system |
| 75 | data: |
| 76 | config.json: | |
| 77 | { |
| 78 | "resourceList": |
| 79 | [ |
| 80 | { |
| 81 | "resourceName": "sriov", |
| 82 | "rootDevices": ["04:00.0"], |
| 83 | "sriovMode": true, |
| 84 | "deviceType": "netdevice" |
| 85 | } |
| 86 | ] |
| 87 | } |