From 1ebdbc78735553619b9280a1e2a76ce0457876f6 Mon Sep 17 00:00:00 2001 From: Staz Dx Date: Fri, 12 Oct 2018 18:14:26 -0500 Subject: [PATCH 1/3] Custom chart for running in AKS (recommended) --- aks-terraform/README.md | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/aks-terraform/README.md b/aks-terraform/README.md index 9e741b2..f112453 100644 --- a/aks-terraform/README.md +++ b/aks-terraform/README.md @@ -49,6 +49,15 @@ Terraform version >= v0.11.7 $ az aks get-credentials --resource-group docker-android --name k8s-docker-android ``` +## Running with custom K8s files (Recommended) + + - You can use this approach or Kompose (Next 2 steps) + + ```sh + $ kubectl create -f volumes.yaml + $ kubectl create -f services_deployments.yaml + ``` + ## Generate Kube files with Kompose - Install Kompose -> https://github.com/kubernetes/kompose @@ -62,7 +71,7 @@ Terraform version >= v0.11.7 $ kompose convert -f ../kompose.yml ``` -## Execute Kube files +## Execute Kube files (Kompose) - First create Persistent Volume Claims, then Services; finally Deployments files. For example: @@ -74,7 +83,4 @@ Terraform version >= v0.11.7 $ kubectl create -f nexus-7.1.1-deployment.yaml ``` -## Running with custom K8s files - - (To Do) From b518b38c35e928d4f5c631fb09043010283955ac Mon Sep 17 00:00:00 2001 From: Staz Dx Date: Fri, 12 Oct 2018 18:15:21 -0500 Subject: [PATCH 2/3] Custom chart for running in AKS (recommended) --- aks-terraform/kompose/volumes.yaml | 69 +++++++++++ aks-terraform/services_deployments.yaml | 147 ++++++++++++++++++++++++ aks-terraform/volumes.yaml | 69 +++++++++++ 3 files changed, 285 insertions(+) create mode 100644 aks-terraform/kompose/volumes.yaml create mode 100644 aks-terraform/services_deployments.yaml create mode 100644 aks-terraform/volumes.yaml diff --git a/aks-terraform/kompose/volumes.yaml b/aks-terraform/kompose/volumes.yaml new file mode 100644 index 0000000..7bf17f6 --- /dev/null +++ b/aks-terraform/kompose/volumes.yaml @@ -0,0 +1,69 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + creationTimestamp: null + labels: + app: real-device-claim0 + name: real-device-claim0 +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 100Mi +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + creationTimestamp: null + labels: + app: real-device-claim1 + name: real-device-claim1 +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 100Mi +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + creationTimestamp: null + labels: + app: real-device-claim2 + name: real-device-claim2 +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 100Mi +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + creationTimestamp: null + labels: + app: nexus-7.1.1-claim0 + name: nexus-7.1.1-claim0 +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 100Mi +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + creationTimestamp: null + labels: + app: nexus-7.1.1-claim1 + name: nexus-7.1.1-claim1 +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 100Mi diff --git a/aks-terraform/services_deployments.yaml b/aks-terraform/services_deployments.yaml new file mode 100644 index 0000000..45c788b --- /dev/null +++ b/aks-terraform/services_deployments.yaml @@ -0,0 +1,147 @@ +apiVersion: v1 +kind: Service +metadata: + name: selenium +spec: + ports: + - name: "4444" + port: 4444 + targetPort: 4444 + selector: + app: selenium + type: LoadBalancer +--- +apiVersion: v1 +kind: Deployment +metadata: + name: selenium-deployment + labels: + app: selenium +spec: + replicas: 1 + template: + metadata: + labels: + app: selenium + spec: + containers: + - image: selenium/hub:3.14.0-curium + name: selenium-hub + ports: + - containerPort: 4444 + resources: {} + restartPolicy: Always +--- +apiVersion: v1 +kind: Service +metadata: + name: real-device +spec: + clusterIP: None + ports: + - name: headless + port: 55555 + targetPort: 0 + selector: + app: real-device + type: LoadBalancer +--- +apiVersion: v1 +kind: Deployment +metadata: + labels: + app: real-device + name: real-device +spec: + replicas: 1 + template: + metadata: + labels: + app: real-device + spec: + containers: + - env: + - name: CONNECT_TO_GRID + value: "true" + - name: SELENIUM_HOST + value: selenium_hub + image: appium/appium + name: real-device + securityContext: + privileged: true + volumeMounts: + - mountPath: /dev/bus/usb + name: real-device-claim0 + - mountPath: /root/.android + name: real-device-claim1 + - mountPath: /root/tmp + name: real-device-claim2 + restartPolicy: Always + volumes: + - name: real-device-claim0 + persistentVolumeClaim: + claimName: real-device-claim0 + - name: real-device-claim1 + persistentVolumeClaim: + claimName: real-device-claim1 + - name: real-device-claim2 + persistentVolumeClaim: + claimName: real-device-claim2 +--- +apiVersion: v1 +kind: Service +metadata: + name: nexus-7.1.1 +spec: + ports: + - name: "6080" + port: 6080 + targetPort: 6080 + selector: + app: nexus-7.1.1 + type: LoadBalancer +--- +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + labels: + app: nexus-7.1.1 + name: nexus-7.1.1 +spec: + replicas: 1 + template: + metadata: + labels: + app: nexus-7.1.1 + spec: + containers: + - env: + - name: APPIUM + value: "true" + - name: AUTO_RECORD + value: "true" + - name: CONNECT_TO_GRID + value: "true" + - name: DEVICE + value: Nexus 5 + - name: SELENIUM_HOST + value: selenium_hub + image: butomo1989/docker-android-x86-7.1.1 + name: nexus-7.1.1 + ports: + - containerPort: 6080 + securityContext: + privileged: true + volumeMounts: + - mountPath: /root/tmp/sample_apk + name: nexus-7.1.1-claim0 + - mountPath: /tmp/video + name: nexus-7.1.1-claim1 + restartPolicy: Always + volumes: + - name: nexus-7.1.1-claim0 + persistentVolumeClaim: + claimName: nexus-7.1.1-claim0 + - name: nexus-7.1.1-claim1 + persistentVolumeClaim: + claimName: nexus-7.1.1-claim1 \ No newline at end of file diff --git a/aks-terraform/volumes.yaml b/aks-terraform/volumes.yaml new file mode 100644 index 0000000..7bf17f6 --- /dev/null +++ b/aks-terraform/volumes.yaml @@ -0,0 +1,69 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + creationTimestamp: null + labels: + app: real-device-claim0 + name: real-device-claim0 +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 100Mi +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + creationTimestamp: null + labels: + app: real-device-claim1 + name: real-device-claim1 +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 100Mi +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + creationTimestamp: null + labels: + app: real-device-claim2 + name: real-device-claim2 +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 100Mi +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + creationTimestamp: null + labels: + app: nexus-7.1.1-claim0 + name: nexus-7.1.1-claim0 +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 100Mi +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + creationTimestamp: null + labels: + app: nexus-7.1.1-claim1 + name: nexus-7.1.1-claim1 +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 100Mi From 85b2312b7ffe124c6a7a515c2cbb1fa143dea0d5 Mon Sep 17 00:00:00 2001 From: Staz Dx Date: Fri, 12 Oct 2018 18:17:12 -0500 Subject: [PATCH 3/3] Kompose/volumes.yaml deleted --- aks-terraform/kompose/volumes.yaml | 69 ------------------------------ 1 file changed, 69 deletions(-) delete mode 100644 aks-terraform/kompose/volumes.yaml diff --git a/aks-terraform/kompose/volumes.yaml b/aks-terraform/kompose/volumes.yaml deleted file mode 100644 index 7bf17f6..0000000 --- a/aks-terraform/kompose/volumes.yaml +++ /dev/null @@ -1,69 +0,0 @@ -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - creationTimestamp: null - labels: - app: real-device-claim0 - name: real-device-claim0 -spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 100Mi ---- -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - creationTimestamp: null - labels: - app: real-device-claim1 - name: real-device-claim1 -spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 100Mi ---- -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - creationTimestamp: null - labels: - app: real-device-claim2 - name: real-device-claim2 -spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 100Mi ---- -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - creationTimestamp: null - labels: - app: nexus-7.1.1-claim0 - name: nexus-7.1.1-claim0 -spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 100Mi ---- -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - creationTimestamp: null - labels: - app: nexus-7.1.1-claim1 - name: nexus-7.1.1-claim1 -spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 100Mi