devopsspiral / KubeLibrary

Kubernetes library for Robot Framework
MIT License
138 stars 37 forks source link

Add crd support #109

Open siaomingjeng opened 2 years ago

siaomingjeng commented 2 years ago

Add Custom Resource Definition (CRD)

Following the existing Custom Resource Object functions to add support for CRD read and list.

Fixes #108

Before merge following needs to be applied:

m-wcislo commented 2 years ago

Let's move discussion here. Seems the problem you faced in grafana helm issue: https://github.com/grafana/helm-charts/issues/1515

siaomingjeng commented 2 years ago

Can anybody help with the test requirements?

Get below error when trying to add test in test/test_KubeLibrary.py. Looks like the test run engineer does not have permission to read CRD's.

Traceback (most recent call last): File "/home/circleci/.local/lib/python3.8/site-packages/urllib3/connection.py", line 174, in _new_conn conn = connection.create_connection( File "/home/circleci/.local/lib/python3.8/site-packages/urllib3/util/connection.py", line 95, in create_connection raise err File "/home/circleci/.local/lib/python3.8/site-packages/urllib3/util/connection.py", line 85, in create_connection sock.connect(sa) ConnectionRefusedError: [Errno 111] Connection refused

m-wcislo commented 2 years ago

I think the problem is that in unit tests you are actually trying to connect to real cluster which doesn't exist, you are not using mock

@mock.patch('kubernetes.client.BatchV1beta1Api.<your functionality>')

which would allow your test to act as cluster is in place