summaryrefslogtreecommitdiffstats
path: root/kud/deployment_infra
diff options
context:
space:
mode:
authorAkhila Kishore <akhila.kishore@intel.com>2019-08-26 15:33:09 -0700
committerAkhila Kishore <akhila.kishore@intel.com>2019-09-03 09:10:07 -0700
commit9c3ebc3d2eaaffe986ca8f689f79a2c7e8f96389 (patch)
treef97f2f2fdebcd83ee5f9c59d16c00ec2995e4e52 /kud/deployment_infra
parentdcace0784979890bb986fb078348b4b3ceef146c (diff)
Use Multus Daemonset for installing Multus in KuD
Currently KuD uses Ansible scripts for installing Multus. Multus has a daemonset that should be used for installing the multus as part of an add-on. This is also helpful for KuD offline deployment in the future. Removed the comment. Updated the images path and removed error supression addressed by comments. Signed-off-by: Akhila Kishore <akhila.kishore@intel.com> Issue-ID: MULTICLOUD-681 Change-Id: Id3702a2b5bd18804c2d7e4d063eba656202cb840
Diffstat (limited to 'kud/deployment_infra')
-rw-r--r--kud/deployment_infra/images/multus-daemonset.yml162
-rw-r--r--kud/deployment_infra/playbooks/configure-multus.yml111
-rw-r--r--kud/deployment_infra/playbooks/kud-vars.yml8
3 files changed, 164 insertions, 117 deletions
diff --git a/kud/deployment_infra/images/multus-daemonset.yml b/kud/deployment_infra/images/multus-daemonset.yml
new file mode 100644
index 00000000..ff44a217
--- /dev/null
+++ b/kud/deployment_infra/images/multus-daemonset.yml
@@ -0,0 +1,162 @@
+---
+apiVersion: apiextensions.k8s.io/v1beta1
+kind: CustomResourceDefinition
+metadata:
+ name: network-attachment-definitions.k8s.cni.cncf.io
+spec:
+ group: k8s.cni.cncf.io
+ version: v1
+ scope: Namespaced
+ names:
+ plural: network-attachment-definitions
+ singular: network-attachment-definition
+ kind: NetworkAttachmentDefinition
+ shortNames:
+ - net-attach-def
+ validation:
+ openAPIV3Schema:
+ properties:
+ spec:
+ properties:
+ config:
+ type: string
+---
+kind: ClusterRole
+apiVersion: rbac.authorization.k8s.io/v1beta1
+metadata:
+ name: multus
+rules:
+ - apiGroups: ["k8s.cni.cncf.io"]
+ resources:
+ - '*'
+ verbs:
+ - '*'
+ - apiGroups:
+ - ""
+ resources:
+ - pods
+ - pods/status
+ verbs:
+ - get
+ - update
+---
+kind: ClusterRoleBinding
+apiVersion: rbac.authorization.k8s.io/v1beta1
+metadata:
+ name: multus
+roleRef:
+ apiGroup: rbac.authorization.k8s.io
+ kind: ClusterRole
+ name: multus
+subjects:
+- kind: ServiceAccount
+ name: multus
+ namespace: kube-system
+---
+apiVersion: v1
+kind: ServiceAccount
+metadata:
+ name: multus
+ namespace: kube-system
+---
+kind: ConfigMap
+apiVersion: v1
+metadata:
+ name: multus-cni-config
+ namespace: kube-system
+ labels:
+ tier: node
+ app: multus
+data:
+ cni-conf.json: |
+ {
+ "name": "multus-cni-network",
+ "type": "multus",
+ "cniVersion": "0.3.1",
+ "capabilities": {
+ "portMappings": true
+ },
+ "delegates": [
+ {
+ "cniVersion": "0.3.1",
+ "name": "default-cni-network",
+ "plugins": [
+ {
+ "type": "flannel",
+ "name": "flannel.1",
+ "delegate": {
+ "isDefaultGateway": true,
+ "hairpinMode": true
+ }
+ },
+ {
+ "type": "portmap",
+ "capabilities": {
+ "portMappings": true
+ }
+ }
+ ]
+ }
+ ],
+ "kubeconfig": "/etc/cni/net.d/multus.d/multus.kubeconfig"
+ }
+---
+apiVersion: extensions/v1beta1
+kind: DaemonSet
+metadata:
+ name: kube-multus-ds-amd64
+ namespace: kube-system
+ labels:
+ tier: node
+ app: multus
+spec:
+ updateStrategy:
+ type: RollingUpdate
+ template:
+ metadata:
+ labels:
+ tier: node
+ app: multus
+ spec:
+ hostNetwork: true
+ nodeSelector:
+ beta.kubernetes.io/arch: amd64
+ tolerations:
+ - operator: Exists
+ effect: NoSchedule
+ serviceAccountName: multus
+ containers:
+ - name: kube-multus
+ image: nfvpe/multus:v3.3-tp
+ command: ["/entrypoint.sh"]
+ args:
+ - "--multus-conf-file=/tmp/multus-conf/00-multus.conf"
+ resources:
+ requests:
+ cpu: "100m"
+ memory: "50Mi"
+ limits:
+ cpu: "100m"
+ memory: "50Mi"
+ securityContext:
+ privileged: true
+ volumeMounts:
+ - name: cni
+ mountPath: /host/etc/cni/net.d
+ - name: cnibin
+ mountPath: /host/opt/cni/bin
+ - name: multus-cfg
+ mountPath: /tmp/multus-conf
+ volumes:
+ - name: cni
+ hostPath:
+ path: /etc/cni/net.d
+ - name: cnibin
+ hostPath:
+ path: /opt/cni/bin
+ - name: multus-cfg
+ configMap:
+ name: multus-cni-config
+ items:
+ - key: cni-conf.json
+ path: 00-multus.conf
diff --git a/kud/deployment_infra/playbooks/configure-multus.yml b/kud/deployment_infra/playbooks/configure-multus.yml
index 47109162..ff459c43 100644
--- a/kud/deployment_infra/playbooks/configure-multus.yml
+++ b/kud/deployment_infra/playbooks/configure-multus.yml
@@ -7,114 +7,7 @@
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
-- hosts: kube-node
- become: yes
- pre_tasks:
- - name: Load kud variables
- include_vars:
- file: kud-vars.yml
- roles:
- - role: andrewrothstein.go
- go_ver: "{{ go_version }}"
- when: multus_source_type == "source"
- environment:
- PATH: "{{ ansible_env.PATH }}:/usr/local/go/bin/"
- tasks:
- - name: create multus binary folder
- file:
- state: directory
- path: "{{ item }}"
- with_items:
- - /opt/cni/bin
- - "{{ multus_dest }}"
- - name: getting source code
- block:
- - name: clone Multus repo
- git:
- repo: "{{ multus_url }}"
- dest: "{{ multus_dest }}"
- version: "{{ multus_version }}"
- force: yes
- - name: build multus source code
- command: ./build
- args:
- chdir: "{{ multus_dest }}"
- - name: copy multus binary to opt folder
- command: "mv {{ multus_dest }}/bin/multus /opt/cni/bin/multus"
- when: multus_source_type == "source"
- - name: getting binary
- block:
- - name: download Multus tarball
- get_url:
- url: "{{ multus_url }}"
- dest: "/tmp/multus.tar.gz"
- - name: extract multus source code
- unarchive:
- src: "/tmp/multus.tar.gz"
- dest: "{{ multus_dest }}"
- remote_src: yes
- - name: copy multus binary to opt folder
- command: "mv {{ multus_dest }}/multus-cni_{{ multus_version }}_linux_amd64/multus-cni /opt/cni/bin/multus"
- - file:
- path: /opt/cni/bin/multus
- owner: root
- group: root
- mode: 0755
- when: multus_source_type == "tarball"
- - name: create multus configuration file
- copy:
- dest: /etc/cni/net.d/00-multus.conf
- content: |
- {
- "type": "multus",
- "name": "multus-cni",
- "cniVersion": "0.3.1",
- "kubeconfig": "/etc/kubernetes/admin.conf",
- "delegates": [
- {
- "type": "flannel",
- "cniVersion": "0.3.1",
- "masterplugin": true,
- "delegate": {
- "isDefaultGateway": true
- }
- }
- ]
- }
-
- hosts: localhost
- pre_tasks:
- - name: Load kud variables
- include_vars:
- file: kud-vars.yml
tasks:
- - name: define a CRD network object specification
- blockinfile:
- path: /tmp/crdnetwork.yml
- create: yes
- block: |
- apiVersion: apiextensions.k8s.io/v1beta1
- kind: CustomResourceDefinition
- metadata:
- name: network-attachment-definitions.k8s.cni.cncf.io
- spec:
- group: k8s.cni.cncf.io
- version: v1
- scope: Namespaced
- names:
- plural: network-attachment-definitions
- singular: network-attachment-definition
- kind: NetworkAttachmentDefinition
- shortNames:
- - net-attach-def
- validation:
- openAPIV3Schema:
- properties:
- spec:
- properties:
- config:
- type: string
-
- - name: create network objects
- shell: "/usr/local/bin/kubectl apply -f /tmp/crdnetwork.yml"
- ignore_errors: True
+ - name: Apply Multus Daemonset
+ shell: "/usr/local/bin/kubectl apply -f {{ playbook_dir }}/../images/multus-daemonset.yml"
diff --git a/kud/deployment_infra/playbooks/kud-vars.yml b/kud/deployment_infra/playbooks/kud-vars.yml
index c2bd2c84..52910cc5 100644
--- a/kud/deployment_infra/playbooks/kud-vars.yml
+++ b/kud/deployment_infra/playbooks/kud-vars.yml
@@ -10,14 +10,6 @@
base_dest: /tmp
-multus_dest: "{{ base_dest }}/multus-cni"
-multus_source_type: "tarball"
-multus_version: 3.3-tp
-multus_url: "https://github.com/intel/multus-cni/releases/download/v{{ multus_version }}/multus-cni_{{ multus_version }}_linux_amd64.tar.gz"
-#multus_source_type: "source"
-#multus_version: 366f2120cb88c85deab6343b7062fd38fdb0ece9
-#multus_url: "https://github.com/ritusood/multus-cni"
-
ovn_kubernetes_dest: "{{ base_dest }}/ovn-kubernetes"
ovn_kubernetes_source_type: "tarball"
ovn_kubernetes_version: 0.3.0