Update deploy/crds for provisioning Virtlet VMs 36/1836/1
authorramamani yeleswarapu <ramamani.yeleswarapu@intel.com>
Tue, 15 Oct 2019 23:20:10 +0000 (16:20 -0700)
committerr.kuralamudhan <kuralamudhan.ramakrishnan@intel.com>
Thu, 24 Oct 2019 05:28:33 +0000 (22:28 -0700)
Updates deploy/crds with sample provisioning CRs for Virtlet VMs.

Adds a Flannel network attachment definition for VMs and
a sample virtlet deployment yaml to deploy.

Signed-off-by: Ramamani Yeleswarapu <ramamani.yeleswarapu@intel.com>
Change-Id: I17eed203b0bdc6cda80d6a3f6e9782079a0000d5

cmd/bpa-operator/bpa_operator_launch.sh
cmd/bpa-operator/deploy/crds/provisioning-crd/bpa_v1alpha1_provisioning_cr_vm_multiple.yaml [new file with mode: 0644]
cmd/bpa-operator/deploy/crds/provisioning-crd/bpa_v1alpha1_provisioning_cr_vm_single.yaml [new file with mode: 0644]
cmd/bpa-operator/deploy/netattachdef-flannel-vm.yaml [new file with mode: 0644]
cmd/bpa-operator/deploy/virtlet-deployment-sample.yaml [new file with mode: 0644]

index b0b7ea1..d1f1448 100755 (executable)
@@ -12,10 +12,10 @@ make install
 popd
 
 #Copy bpa operator directory to the right path
-kubectl create -f $PWD/deploy/crds/bpa_v1alpha1_provisioning_crd.yaml
+kubectl create -f $PWD/deploy/crds/provisioning-crd/bpa_v1alpha1_provisioning_crd.yaml
+kubectl create -f $PWD/deploy/crds/software-crd/bpa_v1alpha1_software_crd.yaml
 echo $GOPATH
-mkdir -p $GOPATH/src/github.com/ && \
-cp -r $PWD $GOPATH/src/github.com/bpa-operator
+mkdir -p $GOPATH/src/github.com/ && cp -r $PWD $GOPATH/src/github.com/bpa-operator
 pushd $GOPATH/src/github.com/bpa-operator
 operator-sdk up local --kubeconfig $HOME/.kube/config
 popd
diff --git a/cmd/bpa-operator/deploy/crds/provisioning-crd/bpa_v1alpha1_provisioning_cr_vm_multiple.yaml b/cmd/bpa-operator/deploy/crds/provisioning-crd/bpa_v1alpha1_provisioning_cr_vm_multiple.yaml
new file mode 100644 (file)
index 0000000..be026f8
--- /dev/null
@@ -0,0 +1,15 @@
+apiVersion: bpa.akraino.org/v1alpha1
+kind: Provisioning
+metadata:
+  name: provisioning-test-vm-2
+  labels:
+    cluster: vm-cluster-2
+    cluster-type: virtlet-vm
+    owner: c1
+spec:
+  masters:
+    - master-1:
+        mac-address: 00:c6:14:04:61:b2
+  workers:
+    - worker-1:
+         mac-address: 00:c4:13:04:62:b5
diff --git a/cmd/bpa-operator/deploy/crds/provisioning-crd/bpa_v1alpha1_provisioning_cr_vm_single.yaml b/cmd/bpa-operator/deploy/crds/provisioning-crd/bpa_v1alpha1_provisioning_cr_vm_single.yaml
new file mode 100644 (file)
index 0000000..a780297
--- /dev/null
@@ -0,0 +1,12 @@
+apiVersion: bpa.akraino.org/v1alpha1
+kind: Provisioning
+metadata:
+  name: provisioning-test-vm-1
+  labels:
+    cluster: vm-cluster-1
+    cluster-type: virtlet-vm
+    owner: c1
+spec:
+  masters:
+    - master-1:
+        mac-address: c2:b4:57:49:47:f1
diff --git a/cmd/bpa-operator/deploy/netattachdef-flannel-vm.yaml b/cmd/bpa-operator/deploy/netattachdef-flannel-vm.yaml
new file mode 100644 (file)
index 0000000..4cdf089
--- /dev/null
@@ -0,0 +1,20 @@
+apiVersion: "k8s.cni.cncf.io/v1"
+kind: NetworkAttachmentDefinition
+metadata:
+  name: flannel-vm
+spec:
+  config: '{
+            "cniVersion": "0.3.1",
+            "name" : "flannel-vm",
+            "plugins": [ {
+              "type": "flannel",
+              "cniVersion": "0.3.1",
+              "masterplugin": true,
+              "delegate": {
+                  "isDefaultGateway": true
+              }
+            },
+            {
+              "type": "tuning"
+            }]
+          }'
diff --git a/cmd/bpa-operator/deploy/virtlet-deployment-sample.yaml b/cmd/bpa-operator/deploy/virtlet-deployment-sample.yaml
new file mode 100644 (file)
index 0000000..cbd0122
--- /dev/null
@@ -0,0 +1,68 @@
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: virtlet-deployment
+  labels:
+    app: virtlet
+spec:
+  replicas: 1
+  selector:
+    matchLabels:
+      app: virtlet
+  template:
+    metadata:
+      labels:
+        app: virtlet
+      annotations:
+        VirtletLibvirtCPUSetting: |
+          mode: host-passthrough
+        # This tells CRI Proxy that this pod belongs to Virtlet runtime
+        kubernetes.io/target-runtime: virtlet.cloud
+        VirtletCloudInitUserData: |
+          ssh_pwauth: True
+          disable_root: false
+          chpasswd: {expire: False}
+          users:
+          - name: root
+            gecos: User
+            primary-group: root
+            groups: users
+            lock_passwd: false
+            shell: /bin/bash
+            sudo: ALL=(ALL) NOPASSWD:ALL
+            ssh_authorized_keys:
+            # SSH key goes here
+          runcmd:
+            - echo hello world
+        v1.multus-cni.io/default-network: '[
+            { "name": "flannel-vm",
+              "mac": "c2:b4:57:49:47:f1" }]'
+        VirtletRootVolumeSize: 12Gi
+    spec:
+      affinity:
+        nodeAffinity:
+          requiredDuringSchedulingIgnoredDuringExecution:
+            nodeSelectorTerms:
+            - matchExpressions:
+              - key: extraRuntime
+                operator: In
+                values:
+                - virtlet
+      containers:
+      - name: virtlet-deployment
+        # This specifies the image to use.
+        # virtlet.cloud/ prefix is used by CRI proxy, the remaining part
+        # of the image name is prepended with https:// and used to download the image
+        image: virtlet.cloud/ubuntu/18.04
+        imagePullPolicy: IfNotPresent
+        # tty and stdin required for "kubectl attach -t" to work
+        tty: true
+        stdin: true
+        resources:
+          requests:
+            cpu: 2
+            memory: 12Gi
+          limits:
+            # This memory limit is applied to the libvirt domain definition
+            cpu: 2
+            memory: 12Gi