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) 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