KubeLibrary icon indicating copy to clipboard operation
KubeLibrary copied to clipboard

Add crd support

Open siaomingjeng opened this issue 3 years ago • 3 comments

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:

  • [x] At least one example testcase added in testcases/
  • [x] Library Documentation regenerated according to Generate docs
  • [ ] PR entry added in CHANGELOG.md in In progress section
  • [ ] All new testcases tagged as prerelease along other tags to exclude it from execution until released on PyPI
  • [ ] Coverage threshold increased in .coveragerc if new coverage is higher than actual, see the lint-and-coverage step in CI
fail_under = 86

siaomingjeng avatar Jun 23 '22 07:06 siaomingjeng

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

m-wcislo avatar Jul 15 '22 08:07 m-wcislo

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

siaomingjeng avatar Jul 15 '22 10:07 siaomingjeng

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

m-wcislo avatar Jul 15 '22 11:07 m-wcislo