rundeck-plugins / kubernetes

52 stars 59 forks source link

Kubernetes waitfor does not work on job/deployent with multiple containers #133

Open psandhu79 opened 2 years ago

psandhu79 commented 2 years ago

If you for example run a job which contains multiple jobs for e.g istio then get logs does not work because it does not know which logs to get

 

20:11:54 |   | Traceback (most recent call last): 20:11:54 |   | File "/home/rundeck/libext/cache/kubernetes-plugin-2.0.3/job-wait.py", line 159, in wait 20:11:54 |   | namespace=namespace) 20:11:54 |   | File "/usr/local/lib/python3.7/dist-packages/kubernetes/client/api/core_v1_api.py", line 19199, in read_namespaced_pod_log 20:11:54 |   | (data) = self.read_namespaced_pod_log_with_http_info(name, namespace, **kwargs) # noqa: E501 20:11:54 |   | File "/usr/local/lib/python3.7/dist-packages/kubernetes/client/api/core_v1_api.py", line 19305, in read_namespaced_pod_log_with_http_info 20:11:54 |   | collection_formats=collection_formats) 20:11:54 |   | File "/usr/local/lib/python3.7/dist-packages/kubernetes/client/api_client.py", line 345, in call_api 20:11:54 |   | _preload_content, _request_timeout) 20:11:54 |   | File "/usr/local/lib/python3.7/dist-packages/kubernetes/client/api_client.py", line 176, in __call_api 20:11:54 |   | _request_timeout=_request_timeout) 20:11:54 |   | File "/usr/local/lib/python3.7/dist-packages/kubernetes/client/api_client.py", line 366, in request 20:11:54 |   | headers=headers) 20:11:54 |   | File "/usr/local/lib/python3.7/dist-packages/kubernetes/client/rest.py", line 241, in GET 20:11:54 |   | query_params=query_params) 20:11:54 |   | File "/usr/local/lib/python3.7/dist-packages/kubernetes/client/rest.py", line 231, in request 20:11:54 |   | raise ApiException(http_resp=r) 20:11:54 |   | kubernetes.client.rest.ApiException: (400) 20:11:54 |   | Reason: Bad Request 20:11:54 |   | HTTP response headers: HTTPHeaderDict({'Audit-Id': 'cf4fe8d7-4dce-436f-a63b-b58c73fb113f', 'Cache-Control': 'no-cache, private', 'Content-Type': 'application/json', 'Date': 'Wed, 10 Aug 2022 19:11:39 GMT', 'Content-Length': '267'}) 20:11:54 |   | HTTP response body: {"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"a container name must be specified for pod echo-provision-tenant-681356-sxqzw, choose one of: [istio-init istio-proxy echo-deprovision-tenant]","reason":"BadRequest","code":400}