Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating a CRD fails with "ValueError: Invalid value for conditions, must not be None" #1022

Closed
ashpreetbedi opened this issue Dec 2, 2019 · 4 comments
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug. priority/backlog Higher priority than priority/awaiting-more-evidence.

Comments

@ashpreetbedi
Copy link

What happened (please include outputs or screenshots):

NOTE: This is a duplicate of #415 and #376 but those issues are closed.

I'm trying to create a CRD with python client 10.0.1 (kubernetes==10.0.1) and with Kubernetes server 1.14 using the kubernetes.client.ApiextensionsV1beta1Api.create_custom_resource_definition() API

Body for the CRD:

{
 'api_version': 'apiextensions.k8s.io/v1beta1',
 'kind': 'CustomResourceDefinition',
 'metadata': {
              'labels': {'app.kubernetes.io/component': 'ingressroutes.traefik.containo.us',
                         'app.kubernetes.io/part-of': 'traefik'},
              'name': 'ingressroutes.traefik.containo.us',
 },
 'spec': {
          'group': 'traefik.containo.us',
          'names': {
                    'kind': 'IngressRoute',
                    'plural': 'ingressroutes',
                    'singular': 'ingressroute'
          },
          'scope': 'Namespaced',
          'version': 'v1alpha1',
  },
}

This raises the following error:

    raise ValueError("Invalid value for `conditions`, must not be `None`")
ValueError: Invalid value for `conditions`, must not be `None`

This issue is also reported #415 and #376 but those issues are closed as stale

Could someone help me in finding a patch for this?

What you expected to happen:

CRD Should be created

How to reproduce it (as minimally and precisely as possible):

Anything else we need to know?:

Environment:

  • Kubernetes version (kubectl version): 1.14
  • OS (e.g., MacOS 10.13.6): MacOS 10.15
  • Python version (python --version): 3.7.4
  • Python client version (pip list | grep kubernetes): 10.0.1
@ashpreetbedi ashpreetbedi added the kind/bug Categorizes issue or PR as related to a bug. label Dec 2, 2019
@roycaihw
Copy link
Member

roycaihw commented Dec 3, 2019

This is fixed in upstream Kubernetes 1.16 kubernetes/kubernetes#64996. The next major release of this client (v12.x) will include the fix

/assign

@roycaihw roycaihw added the priority/backlog Higher priority than priority/awaiting-more-evidence. label Dec 3, 2019
@ashpreetbedi
Copy link
Author

Awesome, thanks @roycaihw

@acesir
Copy link

acesir commented Mar 16, 2020

Is there currently a workaround for this?

@LouisPlisso
Copy link

LouisPlisso commented May 19, 2020

When is version 12 planned to be released? 🥺

We (MongoDB kubernetes operator) are currently blocked by this 😿

@roycaihw

joker-at-work added a commit to sapcc/vcenter-operator that referenced this issue Jun 25, 2021
We're on k8s 1.15 everywhere and 12 is the release for 1.16, but still
supports 1.15 according to the compatibility matrix in [0].

We need to switch, even though things worked until now, because a new
region is already on 1.20 and there, we cannot create CRDs anymore:

	Traceback (most recent call last):
	  File "/usr/local/bin/vcenter-operator", line 10, in <module>
		sys.exit(main())
	  File "/usr/src/app/vcenter_operator/cmd.py", line 70, in main
		configurator.poll()
	  File "/usr/src/app/vcenter_operator/configurator.py", line 371, in poll
		self._add_code('vcenter_global', all_values)
	  File "/usr/src/app/vcenter_operator/configurator.py", line 269, in _add_code
		template_names = env.list_templates(
	  File "/usr/local/lib/python3.8/site-packages/jinja2/environment.py", line 810, in list_templates
		names = self.loader.list_templates()
	  File "/usr/local/lib/python3.8/site-packages/jinja2/loaders.py", line 434, in list_templates
		found.update(loader.list_templates())
	  File "/usr/src/app/vcenter_operator/templates.py", line 149, in list_templates
		self.poll_crds()
	  File "/usr/src/app/vcenter_operator/templates.py", line 164, in poll_crds
		self._create_custom_resource_definitions()
	  File "/usr/src/app/vcenter_operator/templates.py", line 239, in _create_custom_resource_definitions
		api.create_custom_resource_definition(self._crd)
	  File "/usr/local/lib/python3.8/site-packages/kubernetes/client/apis/apiextensions_v1beta1_api.py", line 57, in create_custom_resource_definition
		(data) = self.create_custom_resource_definition_with_http_info(body, **kwargs)
	  File "/usr/local/lib/python3.8/site-packages/kubernetes/client/apis/apiextensions_v1beta1_api.py", line 123, in create_custom_resource_definition_with_http_info
		return self.api_client.call_api('/apis/apiextensions.k8s.io/v1beta1/customresourcedefinitions', 'POST',
	  File "/usr/local/lib/python3.8/site-packages/kubernetes/client/api_client.py", line 317, in call_api
		return self.__call_api(resource_path, method,
	  File "/usr/local/lib/python3.8/site-packages/kubernetes/client/api_client.py", line 163, in __call_api
		return_data = self.deserialize(response_data, response_type)
	  File "/usr/local/lib/python3.8/site-packages/kubernetes/client/api_client.py", line 236, in deserialize
		return self.__deserialize(data, response_type)
	  File "/usr/local/lib/python3.8/site-packages/kubernetes/client/api_client.py", line 276, in __deserialize
		return self.__deserialize_model(data, klass)
	  File "/usr/local/lib/python3.8/site-packages/kubernetes/client/api_client.py", line 620, in __deserialize_model
		kwargs[attr] = self.__deserialize(value, attr_type)
	  File "/usr/local/lib/python3.8/site-packages/kubernetes/client/api_client.py", line 276, in __deserialize
		return self.__deserialize_model(data, klass)
	  File "/usr/local/lib/python3.8/site-packages/kubernetes/client/api_client.py", line 622, in __deserialize_model
		instance = klass(**kwargs)
	  File "/usr/local/lib/python3.8/site-packages/kubernetes/client/models/v1beta1_custom_resource_definition_status.py", line 53, in __init__
		self.conditions = conditions
	  File "/usr/local/lib/python3.8/site-packages/kubernetes/client/models/v1beta1_custom_resource_definition_status.py", line 101, in conditions
		raise ValueError("Invalid value for `conditions`, must not be `None`")
	ValueError: Invalid value for `conditions`, must not be `None`

Searching for this error, [1] suggests that release 12 of the
kubernetes python client has a fix for it.

[0] https://github.com/kubernetes-client/python#compatibility
[1] kubernetes-client/python#1022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. priority/backlog Higher priority than priority/awaiting-more-evidence.
Projects
None yet
Development

No branches or pull requests

4 participants