ansibleplaybookbundle / ansible-playbook-bundle

THIS REPO IS MIGRATING: https://github.com/automationbroker/apb
GNU General Public License v2.0
140 stars 70 forks source link

Cannot retrieve test results when running `apb test` #190

Closed psturc closed 6 years ago

psturc commented 6 years ago

Hi, I can't get over the issue with gathering test results when running apb test

Log from pod

  | TASK [Run the verify role.] ****************************************************
  |  
  | TASK [verify-test-apb : url check for webpage status] **************************
  | FAILED - RETRYING: url check for webpage status (10 retries left).
  | ok: [localhost]
  |  
  | TASK [verify-test-apb : Save failure for the web page] *************************
  | skipping: [localhost]
  |  
  | TASK [verify-test-apb : fail] **************************************************
  | skipping: [localhost]
  |  
  | TASK [verify-test-apb : Save test pass] ****************************************
  | changed: [localhost]
  |  
  | PLAY RECAP *********************************************************************
  | localhost                  : ok=6    changed=4    unreachable=0    failed=0
  |  
  | + EXIT_CODE=0
  | + set +ex
  | + '[' -f /var/tmp/test-result ']'
  | + test-retrieval-init
  | Waiting for the user to gather the test resutls...
  | Waiting for the user to gather the test resutls...
  | Waiting for the user to gather the test resutls...

The pod just ends after 5 minutes (as defined in /usr/bin/test-retrieval-init), because the test results can't be gathered from here

Log from terminal

Building APB using tag: [test-apb]
Successfully built APB image: test-apb
Creating project apb-test-test-apb
Created project
Creating service account in apb-test-test-apb
Created service account
Creating role binding for apb-test-test-apbvl4vn in apb-test-test-apb
Created Role Binding
Creating pod with image test-apb in apb-test-test-apb
Created Pod
Unable to retrieve test result.
Deleting project apb-test-test-apb
Project deleted

When I printed out the ApiException, it says

(0)
Reason: Handshake status 400

How to reproduce this:

  1. Clone this repo
  2. Edit Makefile and run make
  3. Run apb test

Environment

macOS High Sierra 10.13.1

oc v3.7.0+7ed6862 kubernetes v1.7.6+a08f5eeb62 features: Basic-Auth

Server https://192.168.37.1:8443 openshift v3.7.0+7ed6862 kubernetes v1.7.6+a08f5eeb62

rthallisey commented 6 years ago

@shawn-hurley do you have some thoughts on this?

shawn-hurley commented 6 years ago

I am seeing the same behavior. I am wondering if a new version of the python client is needed. I think that the python client is attempting to hit an old pod execution endpoint. I will dig into this and try and get a fix in. @psturc I will keep you updated on this bug as I dig into it.

shawn-hurley commented 6 years ago

@fabianvf @djzager I might need your help.

So I found that it appears according to the swagger spec it appears that the Method that is expected is a GET request. The python kubernetes client v3.0 appears to attempt a post request at line 4059. I think that we need to resolve this mismatch for this to be able to connect to the running pod and complete the job.

@psturc I was testing with our environment and was seeing the same thing you were. I am going to try and see if this is the same issue that you are seeing.

shawn-hurley commented 6 years ago

I have also verified that this would occur with the version of k8s that you are using with openshift.

djzager commented 6 years ago

@shawn-hurley the method you linked to from the swagger spec maps to connect_get_namespaced_pod_exec, there are other methods on that path with corresponding methods in the client-python's core_v1_api but it isn't clear to me yet what needs to be reconciled.

shawn-hurley commented 6 years ago

The swagger spec only has a endpoint that accepts get methods.

The client python has a get and post, currently, the apb tool is using the connect_post_namespaced_pod_exec. Because the swagger spec does not have a defined endpoint that I can see for a POST request I think this is why the apb tool cannot connect to the pod.

fabianvf commented 6 years ago

@shawn-hurley is this not the POST endpoint? https://github.com/kubernetes/kubernetes/blob/release-1.8/api/swagger-spec/v1.json#L10241

shawn-hurley commented 6 years ago

I think you nad @djzager are correct. I think I am wrong. This might be some other error then.

cfchase commented 6 years ago

Attempting to fix in PR https://github.com/ansibleplaybookbundle/ansible-playbook-bundle/pull/196