ansible/roles/ocp-workload-file-uploader/defaults/main.yml
@@ -1,2 +1,2 @@ file_uploader_app_manifest: https://raw.githubusercontent.com/fusor/mig-demo-apps/master/apps/file-uploader/manifest.yaml file_uploader_app_manifest: https://raw.githubusercontent.com/konveyor/mig-demo-apps/master/apps/file-uploader/manifest.yaml silent: false ansible/roles/ocp-workload-mig-verification/README.adoc
New file @@ -0,0 +1,3 @@ = Cluster Application Migration Workload - OCP 3 Verification This workload is not intended to be deployed or used stand-alone. It can only be deployed after `ocp-workload-migration` is deployed on an OCP 3 cluster with Gluster storage enabled. It only verifies whether all components in Migration Tool are healthy. ansible/roles/ocp-workload-mig-verification/defaults/main.yml
New file @@ -0,0 +1,12 @@ mig_verify_expected_ns: - openshift-migration - openshift-storage mig_namespace: openshift-migration mig_demo_apps_ns: - mssql-persistent - sock-shop - robot-shop silent: false ansible/roles/ocp-workload-mig-verification/tasks/main.yml
New file @@ -0,0 +1,16 @@ --- - name: Running Pre Workload Tasks import_tasks: ./pre_workload.yml when: ACTION == "create" or ACTION == "provision" - name: Running Workload Tasks import_tasks: ./workload.yml when: ACTION == "create" or ACTION == "provision" - name: Running Post Workload Tasks import_tasks: ./post_workload.yml when: ACTION == "create" or ACTION == "provision" - name: Running Remove Workload Tasks import_tasks: ./remove_workload.yml when: ACTION == "remove" ansible/roles/ocp-workload-mig-verification/tasks/post_workload.yml
New file @@ -0,0 +1,6 @@ --- # Leave this as the last task in the playbook. - name: post_workload tasks complete debug: msg: "Post-Workload Tasks completed successfully." when: not silent|bool ansible/roles/ocp-workload-mig-verification/tasks/pre_workload.yml
New file @@ -0,0 +1,26 @@ --- - pause: minutes: 3 when: mig_verify_wait|d('true') - set_fact: ansible_python_interpreter: "/opt/virtualenvs/k8s/bin/python" - debug: msg: "{{ ansible_python_interpreter }}" - name: "Verifying namespaces" k8s_info: kind: Namespace register: mig_verify_ns - fail: msg: "Expected namespaces not found" when: item not in (mig_verify_ns | json_query('resources[*].metadata.name')) loop: "{{ mig_verify_expected_ns + mig_demo_apps_ns }}" # Leave this as the last task in the playbook. - name: pre_workload tasks complete debug: msg: "Pre-Workload tasks completed successfully." when: not silent|bool ansible/roles/ocp-workload-mig-verification/tasks/remove_workload.yml
New file @@ -0,0 +1,16 @@ --- - name: "Removing workload" include_tasks: "{{ item }}" with_items: - './pre_workload.yml' - './workload.yml' - './post_workload.yml' vars: migration_workload_destroy: yes # Leave this as the last task in the playbook. - name: remove_workload tasks complete debug: msg: "Remove Workload tasks completed successfully." when: not silent|bool ansible/roles/ocp-workload-mig-verification/tasks/workload.yml
New file @@ -0,0 +1,84 @@ --- # verify velero + operator in mig_namespace - block: - name: "[{{ mig_namespace }}] Reading deployments" k8s_info: api_version: v1 kind: Deployment namespace: "{{ mig_namespace }}" register: mig_verify_dc - fail: msg: "[{{ mig_namespace }}] Some/all deployments are not ready" when: item.replicas != item.readyReplicas loop: "{{ mig_verify_dc|json_query('resources[*].status') }}" # verify restic in mig_namespace - block: - name: "[{{ mig_namespace }}] Reading statefulsets" k8s_info: api_version: v1 kind: DaemonSet namespace: "{{ mig_namespace }}" register: mig_verify_ds - fail: msg: "[{{ mig_namespace }}] Some/all daemonsets are not ready" when: item.desiredNumberScheduled != item.numberReady loop: "{{ mig_verify_ds|json_query('resources[*].status') }}" # verify sample apps are running - block: - name: "Discover demo apps' routes" k8s_info: api_version: route.openshift.io/v1 kind: Route namespace: "{{ item }}" register: mig_demo_apps_routes loop: "{{ mig_demo_apps_ns }}" - name: "Probing demo apps' routes" uri: url: "http://{{ item | json_query('resources[*].spec.host') | first }}" validate_certs: false register: result failed_when: result.status != 200 and result.status != 302 loop: "{{ mig_demo_apps_routes.results }}" # Test Gluster and NFS - block: - name: "Create test pod" k8s: state: present definition: "{{ lookup('template', 'storage-test.yml.j2') }}" - name: "Waiting for the pod to come up" k8s_info: api_version: v1 kind: Pod name: storage-test namespace: "{{ mig_namespace }}" retries: 20 delay: 10 register: pod_stat ignore_errors: true until: pod_stat.resources|length > 0 and pod_stat.resources[0].status is defined and pod_stat.resources[0].status.phase == 'Running' - name: "Cleaning up test pod" k8s: state: absent definition: "{{ lookup('template', 'storage-test.yml.j2') }}" - fail: msg: "Storage tests failed..." when: pod_stat.resources[0] is not defined or pod_stat.resources[0].status is not defined or pod_stat.resources[0].status.phase != 'Running' # Leave this as the last task in the playbook. - name: workload tasks complete debug: msg: "Workload Tasks completed successfully." when: not silent|bool ansible/roles/ocp-workload-mig-verification/templates/storage-test.yml.j2
New file @@ -0,0 +1,49 @@ --- apiVersion: v1 kind: PersistentVolumeClaim metadata: name: gluster-test-0 namespace: {{ mig_namespace }} spec: storageClassName: glusterfs-storage accessModes: - ReadWriteOnce resources: requests: storage: 20Gi --- apiVersion: v1 kind: PersistentVolumeClaim metadata: name: gluster-test-1 namespace: {{ mig_namespace }} spec: storageClassName: glusterfs-storage-block accessModes: - ReadWriteOnce resources: requests: storage: 20Gi --- apiVersion: v1 kind: Pod metadata: name: storage-test namespace: {{ mig_namespace }} spec: containers: - name: storage-test-container image: centos command: ["/bin/sh", "-c", "sleep 100000"] volumeMounts: - mountPath: "/tmp/gluster-vol-00" name: gluster-vol-00 - mountPath: "/tmp/gluster-vol-01" name: gluster-vol-01 volumes: - name: gluster-vol-00 persistentVolumeClaim: claimName: gluster-test-0 - name: gluster-vol-01 persistentVolumeClaim: claimName: gluster-test-1 ansible/roles/ocp-workload-migration/tasks/pre_workload.yml
@@ -47,7 +47,7 @@ - name: "Downloading lab scripts [2]" git: repo: "https://github.com/fusor/mig-agnosticd" repo: "https://github.com/konveyor/mig-agnosticd" dest: "{{ scripts_dir.path }}" - name: "Downloading lab scripts [3]" ansible/roles/ocp-workload-parks-app/defaults/main.yml
@@ -1,2 +1,2 @@ parks_app_manifest: https://raw.githubusercontent.com/fusor/mig-demo-apps/master/apps/parks-app/manifest.yaml parks_app_manifest: https://raw.githubusercontent.com/konveyor/mig-demo-apps/master/apps/parks-app/manifest.yaml silent: false ansible/roles/ocp-workload-robot-shop/defaults/main.yml
@@ -1,2 +1,2 @@ robot_shop_manifest: https://raw.githubusercontent.com/fusor/mig-demo-apps/master/apps/robot-shop/manifest.yaml robot_shop_manifest: https://raw.githubusercontent.com/konveyor/mig-demo-apps/master/apps/robot-shop/manifest.yaml silent: false ansible/roles/ocp-workload-sock-shop/defaults/main.yml
@@ -1,2 +1,2 @@ sock_shop_manifest: https://raw.githubusercontent.com/fusor/mig-demo-apps/master/apps/sock-shop/manifest.yaml sock_shop_manifest: https://raw.githubusercontent.com/konveyor/mig-demo-apps/master/apps/sock-shop/manifest.yaml silent: false ansible/roles/ocp4-workload-mig-verification/README.adoc
New file @@ -0,0 +1,3 @@ = Cluster Application Migration Workload - OCP 4 Verification This workload is not intended to be deployed or used stand-alone. It can only be deployed after `ocp4-workload-migration` and `ocp4-workload-ocs-operator` are deployed on an OCP 4 cluster. It only verifies whether all components in Migration Tool are healthy. ansible/roles/ocp4-workload-mig-verification/defaults/main.yml
New file @@ -0,0 +1,7 @@ mig_verify_expected_ns: - openshift-migration - openshift-storage mig_namespace: openshift-migration silent: false ansible/roles/ocp4-workload-mig-verification/tasks/main.yml
New file @@ -0,0 +1,16 @@ --- - name: Running Pre Workload Tasks import_tasks: ./pre_workload.yml when: ACTION == "create" or ACTION == "provision" - name: Running Workload Tasks import_tasks: ./workload.yml when: ACTION == "create" or ACTION == "provision" - name: Running Post Workload Tasks import_tasks: ./post_workload.yml when: ACTION == "create" or ACTION == "provision" - name: Running Remove Workload Tasks import_tasks: ./remove_workload.yml when: ACTION == "remove" ansible/roles/ocp4-workload-mig-verification/tasks/post_workload.yml
New file @@ -0,0 +1,6 @@ --- # Leave this as the last task in the playbook. - name: post_workload tasks complete debug: msg: "Post-Workload Tasks completed successfully." when: not silent|bool ansible/roles/ocp4-workload-mig-verification/tasks/pre_workload.yml
New file @@ -0,0 +1,26 @@ --- - pause: minutes: 3 when: mig_verify_wait|d('true') - set_fact: ansible_python_interpreter: "/opt/virtualenvs/k8s/bin/python" - debug: msg: "{{ ansible_python_interpreter }}" - name: "Verifying namespaces" k8s_info: kind: Namespace register: mig_verify_ns - fail: msg: "Expected namespaces not found" when: item not in (mig_verify_ns | json_query('resources[*].metadata.name')) loop: "{{ mig_verify_expected_ns }}" # Leave this as the last task in the playbook. - name: pre_workload tasks complete debug: msg: "Pre-Workload tasks completed successfully." when: not silent|bool ansible/roles/ocp4-workload-mig-verification/tasks/remove_workload.yml
New file @@ -0,0 +1,16 @@ --- - name: "Removing workload" include_tasks: "{{ item }}" with_items: - './pre_workload.yml' - './workload.yml' - './post_workload.yml' vars: migration_workload_destroy: yes # Leave this as the last task in the playbook. - name: remove_workload tasks complete debug: msg: "Remove Workload tasks completed successfully." when: not silent|bool ansible/roles/ocp4-workload-mig-verification/tasks/workload.yml
New file @@ -0,0 +1,82 @@ --- # verify velero + operator in mig_namespace - block: - name: "[{{ mig_namespace }}] Reading deployments" k8s_info: api_version: v1 kind: Deployment namespace: "{{ mig_namespace }}" register: mig_verify_dc - fail: msg: "[{{ mig_namespace }}] Some/all deployments are not ready" when: item.replicas != item.readyReplicas loop: "{{ mig_verify_dc|json_query('resources[*].status') }}" # verify restic in mig_namespace - block: - name: "[{{ mig_namespace }}] Reading statefulsets" k8s_info: api_version: v1 kind: DaemonSet namespace: "{{ mig_namespace }}" register: mig_verify_ds - fail: msg: "[{{ mig_namespace }}] Some/all daemonsets are not ready" when: item.desiredNumberScheduled != item.numberReady loop: "{{ mig_verify_ds|json_query('resources[*].status') }}" # verify mig ui route - block: - name: "Discover Mig UI route" k8s_info: api_version: route.openshift.io/v1 kind: Route name: migration namespace: "{{ mig_namespace }}" register: mig_ui_route - name: "Probing Mig UI" uri: url: "https://{{ mig_ui_route | json_query('resources[*].spec.host') | first }}" validate_certs: false register: result failed_when: result.status != 200 and result.status != 302 # Test Ceph - block: - name: "Create test pod" k8s: state: present definition: "{{ lookup('template', 'storage-test.yml.j2') }}" - name: "Waiting for the pod to come up" k8s_info: api_version: v1 kind: Pod name: storage-test namespace: "{{ mig_namespace }}" retries: 20 delay: 10 register: pod_stat ignore_errors: true until: pod_stat.resources|length > 0 and pod_stat.resources[0].status is defined and pod_stat.resources[0].status.phase == 'Running' - name: "Cleaning up test pod" k8s: state: absent definition: "{{ lookup('template', 'storage-test.yml.j2') }}" - fail: msg: "Storage tests failed..." when: pod_stat.resources[0] is not defined or pod_stat.resources[0].status is not defined or pod_stat.resources[0].status.phase != 'Running' # Leave this as the last task in the playbook. - name: workload tasks complete debug: msg: "Workload Tasks completed successfully." when: not silent|bool ansible/roles/ocp4-workload-mig-verification/templates/storage-test.yml.j2
New file @@ -0,0 +1,49 @@ --- apiVersion: v1 kind: PersistentVolumeClaim metadata: name: ceph-test-0 namespace: {{ mig_namespace }} spec: storageClassName: ocs-storagecluster-ceph-rbd accessModes: - ReadWriteOnce resources: requests: storage: 20Gi --- apiVersion: v1 kind: PersistentVolumeClaim metadata: name: ceph-test-1 namespace: {{ mig_namespace }} spec: storageClassName: ocs-storagecluster-cephfs accessModes: - ReadWriteOnce resources: requests: storage: 20Gi --- apiVersion: v1 kind: Pod metadata: name: storage-test namespace: {{ mig_namespace }} spec: containers: - name: storage-test-container image: centos command: ["/bin/sh", "-c", "sleep 100000"] volumeMounts: - mountPath: "/tmp/ceph-vol-00" name: ceph-vol-00 - mountPath: "/tmp/ceph-vol-01" name: ceph-vol-01 volumes: - name: ceph-vol-00 persistentVolumeClaim: claimName: ceph-test-0 - name: ceph-vol-01 persistentVolumeClaim: claimName: ceph-test-1