Skip to content

Commit

Permalink
k8s: add monkeypatch to solve list_node() error
Browse files Browse the repository at this point in the history
To remove once Kubernetes releases the new version fixing it
reanahub#197
kubernetes-client/python#895
kubernetes/kubernetes#102159
  • Loading branch information
mvidalgarcia committed Jun 9, 2021
1 parent 1fd02a7 commit 5cb55aa
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions reana_commons/k8s/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,23 @@
from werkzeug.local import LocalProxy


# FIXME: monkeypatch to avoid `Invalid value for `names`, must not be `None``
# error when calling `current_k8s_corev1_api_client.list_node()`.
# After new Kubernetes release this should not be needed.
# https://github.com/reanahub/reana-commons/issues/197
# https://github.com/kubernetes-client/python/issues/895
# https://github.com/kubernetes/kubernetes/pull/102159
from kubernetes.client.models.v1_container_image import V1ContainerImage


def names(self, names):
"""Monkeypatch."""
self._names = names


V1ContainerImage.names = V1ContainerImage.names.setter(names)


def create_api_client(api="BatchV1"):
"""Create Kubernetes API client using config.
Expand Down

0 comments on commit 5cb55aa

Please sign in to comment.