In Python, when you write `import foo.bar.baz` this means that the modules would be imported and the name `foo` will be bound locally and becomes available in the module. https://docs.python.org/3/reference/simple_stmts.html#import
So, doing `import kubernetes.client` leads to name `kubernetes` (not `client`) being added to the `kubernetes` module leading to a weird duplicate nesting. See:
```
>>> import kubernetes
>>> kubernetes
<module 'kubernetes' from 'C:\\Users\\Ark\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\kubernetes\\__init__.py'>
>>> kubernetes.kubernetes
<module 'kubernetes' from 'C:\\Users\\Ark\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\kubernetes\\__init__.py'>
```
We can solve this issues by using the `import ... from ...` syntax: Replace `import kubernetes.client` with `from kubernetes import client`.
I see that most modules already use relative imports, so I'm using relative imports here as well: `from . import client`.
As seen in https://github.com/openshift/openshift-restclient-python/issues/430
We are hitting a bunch of these logging errors:
```bash
load cache error: __init__() got an unexpected keyword argument 'base_resource_lookup'
```
Which seem like they could be fixed by expecting this arg.
We might be off here so would appreciate any pointers,
but kept it simple at this point without adding the actual client request support.
Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>
This allows to execute in a restricted environment, like a FIPS-enabled
Kubernetes cluster.
See https://docs.python.org/3/library/hashlib.html#hash-algorithms:
> False indicates that the hashing algorithm is [used] as a
> non-cryptographic one-way compression function.
DynamicClient.server_side_apply is designed to accept a dict or a
ResourceInstance as body. However, if a dict or a ResourceInstance is
passed actually, an error occurs because RESTClientObject.rest cannot
interpret the Content-Type application/apply-patch+yaml.
So, modify RESTClientObject.rest to treat application/apply-patch+yaml
as other json-based Content-Types.
When eventlet is monkey patched, select.poll is removed since
it is not thread safe. So check availability of `poll` method
before using it.
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>