From be9fabb6c074fb666c3929ee6860171e6367165f Mon Sep 17 00:00:00 2001 From: Tomofumi Hayashi Date: Thu, 27 Dec 2018 13:23:10 +0900 Subject: [PATCH] Simplify Multus install options To address #245 and #258, this change fixes followings: + rename multus_npwg_demo to multus-2nics + make multus_use_crd default + add multus_build flag (if no/false, use daemonset yaml in github/multus) + unsupport legacy multus version + add docker_install_suppress_newgrp for latest ansible + fix daemonset yaml to support latest k8s + fix several build script (e.g. sr-iov cni) Verified it under following combinations: + pod_network_type=none + pod_network_type=multus + pod_network_type=multus + multus_build=true + pod_network_type=none + multus_build=true + pod_network_type=multus-2nics + pod_network_type=multus-2nics + multus_build=true --- README.md | 2 +- inventory/examples/crio/crio.inventory | 3 + .../examples/multus-2nics/extra-vars.yml | 6 + .../examples/multus/multus-extravars.yml | 6 - .../examples/multus/v1.multus-extravars.yml | 28 ---- inventory/examples/npwg-demo-1/extra-vars.yml | 5 - playbooks/ka-init/group_vars/all.yml | 12 +- playbooks/ka-multus-cni/test-multus.yml | 4 - playbooks/kube-install.yml | 12 +- roles/kube-cni/tasks/main.yml | 22 ++- roles/kube-template-cni/tasks/main.yml | 8 +- .../templates/flannel.yaml.j2 | 5 +- .../templates/multus-crd.yaml.j2 | 17 +-- .../templates/multus.yaml.j2 | 131 ------------------ .../handlers/main.yml | 0 .../tasks/main.yml | 0 .../templates/ifcfg-eth1.1.j2 | 0 .../templates/ifcfg-eth1.j2 | 0 roles/multus-cni/tasks/main.yml | 11 +- roles/multus-crd/defaults/main.yml | 3 - roles/multus-crd/tasks/main.yml | 101 -------------- roles/multus-crd/templates/clusterrole.yml.j2 | 16 --- roles/multus-crd/templates/crd.yml.j2 | 22 --- roles/multus-crd/templates/flannel.yml.j2 | 14 -- .../templates/legacy.flannel.yml.j2 | 13 -- .../templates/legacy.macvlan.yml.j2 | 22 --- roles/multus-crd/templates/macvlan.yml.j2 | 22 --- 27 files changed, 50 insertions(+), 435 deletions(-) create mode 100644 inventory/examples/multus-2nics/extra-vars.yml delete mode 100644 inventory/examples/multus/v1.multus-extravars.yml delete mode 100644 inventory/examples/npwg-demo-1/extra-vars.yml delete mode 100644 playbooks/ka-multus-cni/test-multus.yml delete mode 100644 roles/kube-template-cni/templates/multus.yaml.j2 rename roles/{npwg-poc1-setup => multus-2nics-setup}/handlers/main.yml (100%) rename roles/{npwg-poc1-setup => multus-2nics-setup}/tasks/main.yml (100%) rename roles/{npwg-poc1-setup => multus-2nics-setup}/templates/ifcfg-eth1.1.j2 (100%) rename roles/{npwg-poc1-setup => multus-2nics-setup}/templates/ifcfg-eth1.j2 (100%) delete mode 100644 roles/multus-crd/defaults/main.yml delete mode 100644 roles/multus-crd/tasks/main.yml delete mode 100644 roles/multus-crd/templates/clusterrole.yml.j2 delete mode 100644 roles/multus-crd/templates/crd.yml.j2 delete mode 100644 roles/multus-crd/templates/flannel.yml.j2 delete mode 100644 roles/multus-crd/templates/legacy.flannel.yml.j2 delete mode 100644 roles/multus-crd/templates/legacy.macvlan.yml.j2 delete mode 100644 roles/multus-crd/templates/macvlan.yml.j2 diff --git a/README.md b/README.md index b0d3f19..5591708 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ Playbooks are located in the `playbooks/` directory. | `kube-install.yml` | `./inventory/vms.local.generated` | Install and configure a k8s cluster | | `kube-teardown.yml` | `./inventory/vms.local.generated` | Runs `kubeadm reset` on all nodes to tear down k8s | | `vm-teardown.yml` | `./inventory/virthost/` | Destroys VMs on the virtual machine host | -| `ka-multus-cni/multus-cni.yml` | `./inventory/vms.local.generated` | Compiles [multus-cni](https://github.com/Intel-Corp/multus-cni) | +| `ka-multus-cni/multus-cni.yml` | `./inventory/vms.local.generated` | Compiles [multus-cni](https://github.com/intel/multus-cni) | | `ka-gluster-install/gluster-install.yml` | `./inventory/vms.local.generated` | Install a GlusterFS cluster across VMs (requires vm-attach-disk) | | `fedora-python-bootstrapper.yml` | `./inventory/vms.local.generated` | Bootstrapping Python dependencies on cloud images | | `ka-builder/builder.yml` | `./inventory/vms.local.generated` | Build a Kubernetes release in a dedicated virtual machine | diff --git a/inventory/examples/crio/crio.inventory b/inventory/examples/crio/crio.inventory index bf46b96..e58d3c4 100644 --- a/inventory/examples/crio/crio.inventory +++ b/inventory/examples/crio/crio.inventory @@ -1,3 +1,4 @@ +# This file is used for build/install crio, with crio_build_install kube-master ansible_host=master.example.local kube-node-1 ansible_host=node.example.local vmhost ansible_host=virt-host.example.local ansible_ssh_user=root @@ -25,6 +26,7 @@ kubectl_home=/home/fedora kubectl_user=fedora kubectl_group=fedora # Using CRI-O (you must set this as an extra var, e.g. `-e "container_runtime=crio"`) +# crio_build_install=true # container_runtime=crio [nodes:vars] @@ -35,6 +37,7 @@ kubectl_home=/home/fedora kubectl_user=fedora kubectl_group=fedora # Using CRI-O (you must set this as an extra var, e.g. `-e "container_runtime=crio"`) +# crio_build_install=true # container_runtime=crio # Need to set crio_versions for installed kubernetes version, see following URL for details. diff --git a/inventory/examples/multus-2nics/extra-vars.yml b/inventory/examples/multus-2nics/extra-vars.yml new file mode 100644 index 0000000..e732c39 --- /dev/null +++ b/inventory/examples/multus-2nics/extra-vars.yml @@ -0,0 +1,6 @@ +# Note: +# You need to set -e 'network_type=multus-2nics' in case of playbooks/virthost-setup.yml +# to create 2nic environment. +--- +pod_network_type: "multus-2nics" +multus_version: "master" diff --git a/inventory/examples/multus/multus-extravars.yml b/inventory/examples/multus/multus-extravars.yml index d5c1ae5..21914ae 100644 --- a/inventory/examples/multus/multus-extravars.yml +++ b/inventory/examples/multus/multus-extravars.yml @@ -23,9 +23,3 @@ virtual_machines: optional_packages: - tcpdump - bind-utils -multus_use_crd: true -multus_ipam_subnet: "192.168.1.0/24" -multus_ipam_rangeStart: "192.168.1.200" -multus_ipam_rangeEnd: "192.168.1.216" -multus_ipam_gateway: "192.168.1.1" -multus_macvlan_master: "eth0" diff --git a/inventory/examples/multus/v1.multus-extravars.yml b/inventory/examples/multus/v1.multus-extravars.yml deleted file mode 100644 index 6cde874..0000000 --- a/inventory/examples/multus/v1.multus-extravars.yml +++ /dev/null @@ -1,28 +0,0 @@ ---- -# -------------------------------------------- -# This is used for Multus CNI prior to v2.0 -# -------------------------------------------- -# crd_namespace: "kubernetes.cni.cncf.io" -# multus_version: "master" -# multus_git_url: "https://github.com/intel/multus-cni.git" -bridge_networking: true -bridge_name: br0 -bridge_physical_nic: "enp1s0f1" -bridge_network_name: "br0" -bridge_network_cidr: 192.168.1.0/24 -pod_network_type: "multus" -virtual_machines: - - name: kube-multus-master - node_type: master - - name: kube-multus-node-1 - node_type: nodes -optional_packages: - - tcpdump - - bind-utils -multus_use_crd: true -multus_legacy: true -multus_ipam_subnet: "192.168.1.0/24" -multus_ipam_rangeStart: "192.168.1.200" -multus_ipam_rangeEnd: "192.168.1.216" -multus_ipam_gateway: "192.168.1.1" -multus_macvlan_master: "eth0" diff --git a/inventory/examples/npwg-demo-1/extra-vars.yml b/inventory/examples/npwg-demo-1/extra-vars.yml deleted file mode 100644 index 7421466..0000000 --- a/inventory/examples/npwg-demo-1/extra-vars.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -pod_network_type: "multus" -multus_use_crd: true -multus_npwg_demo: true -multus_version: "master" diff --git a/playbooks/ka-init/group_vars/all.yml b/playbooks/ka-init/group_vars/all.yml index 1540ec8..f596a6c 100644 --- a/playbooks/ka-init/group_vars/all.yml +++ b/playbooks/ka-init/group_vars/all.yml @@ -5,6 +5,11 @@ # - crio container_runtime: docker +# --------------------------- - +# docker vars - - +# --------------------------- - +docker_install_suppress_newgrp: true + # --------------------------- - # crio vars - - # --------------------------- - @@ -88,14 +93,9 @@ kubectl_proxy_port: 8088 # multus-cni vars - - # ------------------------- - # Usually use "master" for multus version, but, otherwise... +multus_build: false multus_version: master -multus_npwg_demo: false multus_git_url: "https://github.com/intel/multus-cni.git" -multus_use_crd: true -multus_ipam_subnet: "192.168.1.0/24" -multus_ipam_rangeStart: "192.168.1.200" -multus_ipam_rangeEnd: "192.168.1.216" -multus_ipam_gateway: "192.168.1.1" # ---------------------------- # glusterfs vars diff --git a/playbooks/ka-multus-cni/test-multus.yml b/playbooks/ka-multus-cni/test-multus.yml deleted file mode 100644 index b61b9b1..0000000 --- a/playbooks/ka-multus-cni/test-multus.yml +++ /dev/null @@ -1,4 +0,0 @@ -- hosts: master - tasks: [] - roles: - - { role: multus-crd, when: "pod_network_type == 'multus' and multus_use_crd"} diff --git a/playbooks/kube-install.yml b/playbooks/kube-install.yml index b115717..c7d4f10 100644 --- a/playbooks/kube-install.yml +++ b/playbooks/kube-install.yml @@ -6,7 +6,7 @@ become_user: root tasks: [] roles: - - { role: npwg-poc1-setup, when: pod_network_type == 'multus' and multus_npwg_demo } + - { role: multus-2nics-setup, when: pod_network_type == 'multus-2nics' } - { role: bridge-setup, when: pod_network_type == 'bridge' } - { role: optional-packages } # You can add "crio_force: true" if you need to run the builds again. @@ -14,7 +14,7 @@ - { role: buildah-install, when: buildah_install|bool } - { role: install-docker, when: container_runtime == 'docker' } - { role: kube-install } - - { role: multus-cni, when: pod_network_type == "multus" } + - { role: multus-cni, when: multus_build|bool } - hosts: master,nodes become: true @@ -41,15 +41,9 @@ - hosts: master tasks: [] roles: - - { role: kube-cni, when : "pod_network_type != 'none'"} + - { role: kube-cni, when : "pod_network_type != 'none'" } - { role: kube-niceties } - -- hosts: master - tasks: [] - roles: - - { role: multus-crd, when: "pod_network_type == 'multus' and multus_use_crd and not multus_npwg_demo"} - - hosts: nodes become: true become_user: root diff --git a/roles/kube-cni/tasks/main.yml b/roles/kube-cni/tasks/main.yml index e36ca96..6de5e9e 100644 --- a/roles/kube-cni/tasks/main.yml +++ b/roles/kube-cni/tasks/main.yml @@ -26,7 +26,8 @@ kubectl create -f /etc/flannel-rbac.yaml args: creates: "{{ kubectl_home }}/.kubeadm-podnetwork-complete" - when: pod_network_type == "flannel" or pod_network_type == "multus" + when: > + pod_network_type == "flannel" - name: Apply the flannel podnetwork shell: > @@ -45,19 +46,26 @@ when: pod_network_type == "weave" # ----------- multus -- name: Apply the multus podnetwork +- name: Apply the multus podnetwork from github shell: > - kubectl apply -f /etc/multus.yaml > /tmp/podnetwork-apply.log + kubectl apply -f https://raw.githubusercontent.com/intel/multus-cni/master/images/flannel-daemonset.yml > /tmp/podnetwork-apply.log && \ + kubectl apply -f https://raw.githubusercontent.com/intel/multus-cni/master/images/multus-daemonset.yml >> /tmp/podnetwork-apply.log args: creates: "{{ kubectl_home }}/.kubeadm-podnetwork-complete" - when: pod_network_type == "multus" and not multus_use_crd + when: + - pod_network_type == "multus" or pod_network_type == "multus-2nics" + - not (multus_build|bool) -- name: Apply the multus podnetwork (CRD style) +# ----------- multus +- name: Apply the multus podnetwork from local shell: > - kubectl apply -f /etc/multus-crd.yaml > /tmp/podnetwork-apply.log + kubectl create -f /etc/flannel-rbac.yaml > /tmp/podnetwork-apply.log && \ + kubectl apply -f /etc/multus-crd.yaml >> /tmp/podnetwork-apply.log args: creates: "{{ kubectl_home }}/.kubeadm-podnetwork-complete" - when: pod_network_type == "multus" and multus_use_crd + when: + - pod_network_type == "multus" or pod_network_type == "multus-2nics" + - multus_build|bool # ----------- calico diff --git a/roles/kube-template-cni/tasks/main.yml b/roles/kube-template-cni/tasks/main.yml index c593b8d..7ce70b7 100644 --- a/roles/kube-template-cni/tasks/main.yml +++ b/roles/kube-template-cni/tasks/main.yml @@ -1,16 +1,10 @@ --- -- name: Template multus.yaml - template: - src: multus.yaml.j2 - dest: /etc/multus.yaml - when: not multus_use_crd - - name: Template CRD flavored multus.yaml template: src: multus-crd.yaml.j2 dest: /etc/multus-crd.yaml - when: multus_use_crd + when: pod_network_type == 'multus' or pod_network_type == 'multus-2nics' - name: Template flannel.yaml template: diff --git a/roles/kube-template-cni/templates/flannel.yaml.j2 b/roles/kube-template-cni/templates/flannel.yaml.j2 index 1feee01..5f78941 100644 --- a/roles/kube-template-cni/templates/flannel.yaml.j2 +++ b/roles/kube-template-cni/templates/flannel.yaml.j2 @@ -62,8 +62,7 @@ spec: nodeSelector: beta.kubernetes.io/arch: amd64 tolerations: - - key: node-role.kubernetes.io/master - operator: Exists + - operator: Exists effect: NoSchedule serviceAccountName: flannel initContainers: @@ -120,4 +119,4 @@ spec: path: /etc/cni/net.d - name: flannel-cfg configMap: - name: kube-flannel-cfg \ No newline at end of file + name: kube-flannel-cfg diff --git a/roles/kube-template-cni/templates/multus-crd.yaml.j2 b/roles/kube-template-cni/templates/multus-crd.yaml.j2 index 622fddb..d2452cf 100644 --- a/roles/kube-template-cni/templates/multus-crd.yaml.j2 +++ b/roles/kube-template-cni/templates/multus-crd.yaml.j2 @@ -19,25 +19,19 @@ data: "name": "multus-cni-network", "type": "multus", "delegates": [ - {% if multus_npwg_demo %} { "type": "flannel", "name": "flannel.1", "delegate": { + {% if pod_network_type == "multus-2nics" %} "bridge": "kbr0", + {% endif %} "isDefaultGateway": true } } - {% else %} - { - "type": "flannel", - "name": "flannel.1", - "delegate": { - "isDefaultGateway": true - } - } - {% endif %} ], + "logFile": "/var/log/multus.log", + "logLevel": "debug", "kubeconfig": "/etc/kubernetes/kubelet.conf" } net-conf.json: | @@ -67,8 +61,7 @@ spec: nodeSelector: beta.kubernetes.io/arch: amd64 tolerations: - - key: node-role.kubernetes.io/master - operator: Exists + - operator: Exists effect: NoSchedule serviceAccountName: flannel initContainers: diff --git a/roles/kube-template-cni/templates/multus.yaml.j2 b/roles/kube-template-cni/templates/multus.yaml.j2 deleted file mode 100644 index b1fbe1f..0000000 --- a/roles/kube-template-cni/templates/multus.yaml.j2 +++ /dev/null @@ -1,131 +0,0 @@ ---- -apiVersion: v1 -kind: ServiceAccount -metadata: - name: flannel - namespace: kube-system ---- -kind: ConfigMap -apiVersion: v1 -metadata: - name: kube-multus-cfg - namespace: kube-system - labels: - tier: node - app: multus -data: - cni-conf.json: | - { - "name": "multus-demo", - "type": "multus", - "delegates": [ - { - "type": "macvlan", - "master": "eth0", - "mode": "bridge", - "ipam": { - "type": "host-local", - "subnet": "{{ multus_ipam_subnet }}", - "rangeStart": "{{ multus_ipam_rangeStart }}", - "rangeEnd": "{{ multus_ipam_rangeEnd }}", - "routes": [ - { "dst": "0.0.0.0/0" } - ], - "gateway": "{{ multus_ipam_gateway }}" - } - }, - { - "type": "flannel", - "masterplugin": true, - "delegate": { - "isDefaultGateway": true - } - } - ] - } - net-conf.json: | - { - "Network": "{{ pod_network_cidr }}/16", - "Backend": { - "Type": "vxlan" - } - } ---- -apiVersion: extensions/v1beta1 -kind: DaemonSet -metadata: - name: kube-multus-ds - namespace: kube-system - labels: - tier: node - app: multus -spec: - template: - metadata: - labels: - tier: node - app: multus - spec: - hostNetwork: true - nodeSelector: - beta.kubernetes.io/arch: amd64 - tolerations: - - key: node-role.kubernetes.io/master - operator: Exists - effect: NoSchedule - serviceAccountName: flannel - initContainers: - - name: install-cni - image: quay.io/coreos/flannel:v0.10.0-amd64 - command: - - cp - args: - - -f - - /etc/kube-flannel/cni-conf.json - - /etc/cni/net.d/10-flannel.conf - volumeMounts: - - name: cni - mountPath: /etc/cni/net.d - - name: multus-cfg - mountPath: /etc/kube-flannel/ - containers: - - name: kube-flannel - image: quay.io/coreos/flannel:v0.10.0-amd64 - command: - - /opt/bin/flanneld - args: - - --ip-masq - - --kube-subnet-mgr - resources: - requests: - cpu: "100m" - memory: "50Mi" - limits: - cpu: "100m" - memory: "50Mi" - securityContext: - privileged: true - env: - - name: POD_NAME - valueFrom: - fieldRef: - fieldPath: metadata.name - - name: POD_NAMESPACE - valueFrom: - fieldRef: - fieldPath: metadata.namespace - volumeMounts: - - name: run - mountPath: /run - - name: multus-cfg - mountPath: /etc/kube-flannel/ - volumes: - - name: run - hostPath: - path: /run - - name: cni - hostPath: - path: /etc/cni/net.d - - name: multus-cfg - configMap: - name: kube-multus-cfg \ No newline at end of file diff --git a/roles/npwg-poc1-setup/handlers/main.yml b/roles/multus-2nics-setup/handlers/main.yml similarity index 100% rename from roles/npwg-poc1-setup/handlers/main.yml rename to roles/multus-2nics-setup/handlers/main.yml diff --git a/roles/npwg-poc1-setup/tasks/main.yml b/roles/multus-2nics-setup/tasks/main.yml similarity index 100% rename from roles/npwg-poc1-setup/tasks/main.yml rename to roles/multus-2nics-setup/tasks/main.yml diff --git a/roles/npwg-poc1-setup/templates/ifcfg-eth1.1.j2 b/roles/multus-2nics-setup/templates/ifcfg-eth1.1.j2 similarity index 100% rename from roles/npwg-poc1-setup/templates/ifcfg-eth1.1.j2 rename to roles/multus-2nics-setup/templates/ifcfg-eth1.1.j2 diff --git a/roles/npwg-poc1-setup/templates/ifcfg-eth1.j2 b/roles/multus-2nics-setup/templates/ifcfg-eth1.j2 similarity index 100% rename from roles/npwg-poc1-setup/templates/ifcfg-eth1.j2 rename to roles/multus-2nics-setup/templates/ifcfg-eth1.j2 diff --git a/roles/multus-cni/tasks/main.yml b/roles/multus-cni/tasks/main.yml index ef26561..9bfee21 100644 --- a/roles/multus-cni/tasks/main.yml +++ b/roles/multus-cni/tasks/main.yml @@ -15,7 +15,7 @@ - name: Compile cni-plugins shell: > - ./build.sh + ./build_linux.sh args: chdir: /usr/src/cni-plugins when: cni_clone.changed @@ -35,16 +35,21 @@ chdir: /usr/src/multus-cni when: multus_clone.changed or force_multus_rebuild is defined +- name: Install required packages for sriov-cni + shell: > + go get github.com/Masterminds/glide && \ + go install github.com/Masterminds/glide + - name: Clone sriov-cni git: - repo: https://github.com/Intel-Corp/sriov-cni.git + repo: https://github.com/intel/sriov-cni.git dest: /usr/src/sriov-cni version: master register: sriov_clone - name: Compile sriov-cni shell: > - ./build + PATH=${PATH}:${GOPATH}/bin make args: chdir: /usr/src/sriov-cni when: sriov_clone.changed diff --git a/roles/multus-crd/defaults/main.yml b/roles/multus-crd/defaults/main.yml deleted file mode 100644 index b5ad19a..0000000 --- a/roles/multus-crd/defaults/main.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- -crd_namespace: "kubernetes.com" -multus_legacy: false \ No newline at end of file diff --git a/roles/multus-crd/tasks/main.yml b/roles/multus-crd/tasks/main.yml deleted file mode 100644 index 8f5e118..0000000 --- a/roles/multus-crd/tasks/main.yml +++ /dev/null @@ -1,101 +0,0 @@ ---- - -- name: Create folder for Multus resource defs - file: - path: "{{ ansible_env.HOME }}/multus-resources" - state: directory - -- name: Default legacy prefix for Multus - set_fact: - multus_legacy_prefix: "" - -- name: Set legacy prefix when using legacy version of Multus - set_fact: - multus_legacy_prefix: "legacy." - when: "multus_legacy" - -- name: Set Multus template items - set_fact: - multus_template_items: - - src: crd.yml.j2 - dest: "multus-crd.yml" - - src: "{{ multus_legacy_prefix }}flannel.yml.j2" - dest: "flannel.yml" - - src: "{{ multus_legacy_prefix }}macvlan.yml.j2" - dest: "macvlan.yml" - - src: clusterrole.yml.j2 - dest: "clusterrole.yml" - -- name: Template multus resources - template: - src: "{{ item.src }}" - dest: "{{ ansible_env.HOME }}/multus-resources/{{ item.dest }}" - with_items: "{{ multus_template_items }}" - -- name: Check to see if CRD is present - shell: > - kubectl get crd - register: check_crd - -- name: Create network namespace - set_fact: - use_network_namespace: "network.{{ crd_namespace }}" - -- name: Create base CRD - shell: > - kubectl create -f {{ ansible_env.HOME }}/multus-resources/multus-crd.yml - when: "use_network_namespace not in check_crd.stdout" - -- name: Check to see which network CRD definitions are present - shell: > - kubectl get network - register: check_network_crds - -- name: Create flannel network CRD - shell: > - kubectl create -f {{ ansible_env.HOME }}/multus-resources/flannel.yml - when: "'flannel-conf' not in check_network_crds.stdout" - -- name: Create macvlan network CRD - shell: > - kubectl create -f {{ ansible_env.HOME }}/multus-resources/macvlan.yml - when: "'macvlan-conf' not in check_network_crds.stdout" - -- name: Check to see which CRDs are present, for validation - shell: > - kubectl get network - register: verify_network_crd - -- name: Verify which network CRD definitions are present - fail: - msg: "The {{ item }} CRD was not present." - when: "item not in verify_network_crd.stdout" - with_items: - - 'macvlan-conf' - - 'flannel-conf' - -- name: Get the clusteroles - shell: > - kubectl get clusterroles - register: output_clusterroles - -- name: Create clusterrole - shell: > - kubectl create -f {{ ansible_env.HOME }}/multus-resources/clusterrole.yml - when: > - "multus-crd-overpowered" not in output_clusterroles.stdout - -- name: Get the clusterrolebindings - shell: > - kubectl get clusterrolebindings - register: output_crb - -- name: Create clusterrolebindings for each machine - shell: > - kubectl create clusterrolebinding multus-node-{{ hostvars[item]['inventory_hostname'] }} - --clusterrole=multus-crd-overpowered - --user=system:node:{{ hostvars[item]['inventory_hostname'] }} - with_items: - - "{{ groups['nodes'] + groups['master'] }}" - when: > - "hostvars[item]['inventory_hostname']" not in output_crb.stdout \ No newline at end of file diff --git a/roles/multus-crd/templates/clusterrole.yml.j2 b/roles/multus-crd/templates/clusterrole.yml.j2 deleted file mode 100644 index 635ba0c..0000000 --- a/roles/multus-crd/templates/clusterrole.yml.j2 +++ /dev/null @@ -1,16 +0,0 @@ ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - name: multus-crd-overpowered -rules: -- apiGroups: - - '*' - resources: - - '*' - verbs: - - '*' -- nonResourceURLs: - - '*' - verbs: - - '*' diff --git a/roles/multus-crd/templates/crd.yml.j2 b/roles/multus-crd/templates/crd.yml.j2 deleted file mode 100644 index 16b2410..0000000 --- a/roles/multus-crd/templates/crd.yml.j2 +++ /dev/null @@ -1,22 +0,0 @@ -apiVersion: apiextensions.k8s.io/v1beta1 -kind: CustomResourceDefinition -metadata: - # name must match the spec fields below, and be in the form: . - name: networks.{{ crd_namespace }} -spec: - # group name to use for REST API: /apis// - group: {{ crd_namespace }} - # version name to use for REST API: /apis// - version: v1 - # either Namespaced or Cluster - scope: Namespaced - names: - # plural name to be used in the URL: /apis/// - plural: networks - # singular name to be used as an alias on the CLI and for display - singular: network - # kind is normally the CamelCased singular type. Your resource manifests use this. - kind: Network - # shortNames allow shorter string to match your resource on the CLI - shortNames: - - net diff --git a/roles/multus-crd/templates/flannel.yml.j2 b/roles/multus-crd/templates/flannel.yml.j2 deleted file mode 100644 index 6700396..0000000 --- a/roles/multus-crd/templates/flannel.yml.j2 +++ /dev/null @@ -1,14 +0,0 @@ -apiVersion: "kubernetes.cni.cncf.io/v1" -kind: Network -metadata: - name: flannel-conf -plugin: flannel -spec: - config: '[ - { - "name": "flannel.1", - "delegate": { - "isDefaultGateway": true - } - } -]' diff --git a/roles/multus-crd/templates/legacy.flannel.yml.j2 b/roles/multus-crd/templates/legacy.flannel.yml.j2 deleted file mode 100644 index 1f6b82b..0000000 --- a/roles/multus-crd/templates/legacy.flannel.yml.j2 +++ /dev/null @@ -1,13 +0,0 @@ -apiVersion: "{{ crd_namespace }}/v1" -kind: Network -metadata: - name: flannel-conf -plugin: flannel -args: '[ - { - "name": "flannel.1", - "delegate": { - "isDefaultGateway": true - } - } -]' diff --git a/roles/multus-crd/templates/legacy.macvlan.yml.j2 b/roles/multus-crd/templates/legacy.macvlan.yml.j2 deleted file mode 100644 index 25b5136..0000000 --- a/roles/multus-crd/templates/legacy.macvlan.yml.j2 +++ /dev/null @@ -1,22 +0,0 @@ -apiVersion: "{{ crd_namespace }}/v1" -kind: Network -metadata: - name: macvlan-conf -plugin: macvlan -args: '[ - { - "master": "{{ multus_macvlan_master }}", - "mode": "bridge", - "name": "macvlan.1", - "ipam": { - "type": "host-local", - "subnet": "{{ multus_ipam_subnet }}", - "rangeStart": "{{ multus_ipam_rangeStart }}", - "rangeEnd": "{{ multus_ipam_rangeEnd }}", - "routes": [ - { "dst": "0.0.0.0/0" } - ], - "gateway": "{{ multus_ipam_gateway }}" - } - } -]' diff --git a/roles/multus-crd/templates/macvlan.yml.j2 b/roles/multus-crd/templates/macvlan.yml.j2 deleted file mode 100644 index f03b4bb..0000000 --- a/roles/multus-crd/templates/macvlan.yml.j2 +++ /dev/null @@ -1,22 +0,0 @@ -apiVersion: "kubernetes.cni.cncf.io/v1" -kind: Network -metadata: - name: macvlan-conf -spec: - config: '{ - "cniVersion": "0.3.0", - "type": "macvlan", - "master": "{{ multus_macvlan_master }}", - "name": "macvlan.1", - "mode": "bridge", - "ipam": { - "type": "host-local", - "subnet": "{{ multus_ipam_subnet }}", - "rangeStart": "{{ multus_ipam_rangeStart }}", - "rangeEnd": "{{ multus_ipam_rangeEnd }}", - "routes": [ - { "dst": "0.0.0.0/0" } - ], - "gateway": "{{ multus_ipam_gateway }}" - } - }'