migtools / pvc-migrate

Standalone PVC migration
Apache License 2.0
5 stars 13 forks source link

Wrong validation after route creation #129

Closed lcordero closed 4 years ago

lcordero commented 4 years ago

Description: Router validation expect to have only one status.ingress; that validation does not work when you have more than one ingressController.

Error:

TASK [Wait for route to get admitted] ********************************************************************
FAILED - RETRYING: Wait for route to get admitted (3 retries left).
FAILED - RETRYING: Wait for route to get admitted (2 retries left).
FAILED - RETRYING: Wait for route to get admitted (1 retries left).

fatal: [localhost]: FAILED! => {"attempts": 3, "changed": false, "resources": [{"apiVersion": "route.openshift.io/v1", "kind": "Route", "metadata": {"creationTimestamp": "2020-08-26T21:40:02Z", "labels": {"app": "pvc-migrate-pod-ae4f34d43e", "owner": "pvc-migrate", "purpose": "rsync"}, "name": "pvc-migrate-route-ae4f34d43e", "namespace": "lcordero", "resourceVersion": "50890783", "selfLink": "/apis/route.openshift.io/v1/namespaces/lcordero/routes/pvc-migrate-route-ae4f34d43e", "uid": "d68155fb-8a4e-41bb-a88d-6a1c61762e81"}, "spec": {"host": "pvc-migrate-route-ae4f34d43e.apps.in-external.appcanvas.net", "port": {"targetPort": 2222}, "tls": {"termination": "passthrough"}, "to": {"kind": "Service", "name": "pvc-migrate-svc-ae4f34d43e", "weight": 100}, "wildcardPolicy": "None"}, "status": {"ingress": [{"conditions": [{"lastTransitionTime": "2020-08-26T21:39:40Z", "status": "True", "type": "Admitted"}], "host": "pvc-migrate-route-ae4f34d43e.apps.in-external.appcanvas.net", "routerCanonicalHostname": "apitest.d.apps.experian.com", "routerName": "apigee-test", "wildcardPolicy": "None"}, {"conditions": [{"lastTransitionTime": "2020-08-26T21:40:09Z", "status": "True", "type": "Admitted"}], "host": "pvc-migrate-route-ae4f34d43e.apps.in-external.appcanvas.net", "routerCanonicalHostname": "api.d.apps.experian.com", "routerName": "apigee", "wildcardPolicy": "None"}, {"conditions": [{"lastTransitionTime": "2020-08-26T21:40:09Z", "status": "True", "type": "Admitted"}], "host": "pvc-migrate-route-ae4f34d43e.apps.in-external.appcanvas.net", "routerCanonicalHostname": "d-internal.in.appcanvas.net", "routerName": "internal", "wildcardPolicy": "None"}, {"conditions": [{"lastTransitionTime": "2020-08-26T21:40:09Z", "status": "True", "type": "Admitted"}], "host": "pvc-migrate-route-ae4f34d43e.apps.in-external.appcanvas.net", "routerCanonicalHostname": "apps.in-external.appcanvas.net", "routerName": "default", "wildcardPolicy": "None"}, {"conditions": [{"lastTransitionTime": "2020-08-26T21:40:09Z", "status": "True", "type": "Admitted"}], "host": "pvc-migrate-route-ae4f34d43e.apps.in-external.appcanvas.net", "routerCanonicalHostname": "api.apps.in-external.appcanvas.net", "routerName": "api", "wildcardPolicy": "None"}, {"conditions": [{"lastTransitionTime": "2020-08-26T21:40:09Z", "status": "True", "type": "Admitted"}], "host": "pvc-migrate-route-ae4f34d43e.apps.in-external.appcanvas.net", "routerCanonicalHostname": "testus.apps.experian.com", "routerName": "external-test", "wildcardPolicy": "None"}, {"conditions": [{"lastTransitionTime": "2020-08-26T21:39:56Z", "status": "True", "type": "Admitted"}], "host": "pvc-migrate-route-ae4f34d43e.apps.in-external.appcanvas.net", "routerCanonicalHostname": "d.apps.experian.com", "routerName": "external", "wildcardPolicy": "None"}]}}]}

Possible Solution: File: https://github.com/konveyor/pvc-migrate/blob/master/3_run_rsync/tasks/create-pod-service.yml#L131

...
- name: "Wait for route to get admitted"
  k8s_facts:
    api_version: route.openshift.io/v1
    kind: route
    name: "{{ route_name }}"
    namespace: "{{ pvc_namespace }}"
  register: rsync_route
  until:
... ...
    - rsync_route.resources[0].get('status', {}).get('ingress', []) | length == 1  # <<<----- Here instead of "== 1" should be "> 0"
 ... ...
pranavgaikwad commented 4 years ago

Closed through #133