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

create horizontal_pod_autoscaler error, conditions must not be None #1200

Closed
yylt opened this issue Jul 14, 2020 · 3 comments
Closed

create horizontal_pod_autoscaler error, conditions must not be None #1200

yylt opened this issue Jul 14, 2020 · 3 comments
Labels
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/bug Categorizes issue or PR as related to a bug.

Comments

@yylt
Copy link

yylt commented Jul 14, 2020

What happened (please include outputs or screenshots):

 spec = client.V2beta2HorizontalPodAutoscalerSpec(
            max_replicas=max_num,
            min_replicas=min_num,
            scale_target_ref=client.V2beta2CrossVersionObjectReference(
                api_version='apps/v1',
                kind='Deployment',
                name=name,
            ),
            metrics=v2beta2MetricSpecs,
        )
        meta = k8sobject.build_metadata(name=name, namespace=namespace)
        body = client.V2beta2HorizontalPodAutoscaler(
            metadata=meta,
            spec=spec,
        )

        return self._k8s.create_group_version_object('Autoscaling',
                                                     'V2beta2',
                                                     'horizontal_pod_autoscaler',
                                                     body)
Traceback:
...
  File "/usr/lib/python2.7/site-packages/kubernetes/client/api/autoscaling_v2beta2_api.py", line 58, in create_namespaced_horizontal_pod_autoscaler
    (data) = self.create_namespaced_horizontal_pod_autoscaler_with_http_info(namespace, body, **kwargs)  # noqa: E501
  File "/usr/lib/python2.7/site-packages/kubernetes/client/api/autoscaling_v2beta2_api.py", line 149, in create_namespaced_horizontal_pod_autoscaler_with_http_info
    collection_formats=collection_formats)
  File "/usr/lib/python2.7/site-packages/kubernetes/client/api_client.py", line 345, in call_api
    _preload_content, _request_timeout)
  File "/usr/lib/python2.7/site-packages/kubernetes/client/api_client.py", line 184, in __call_api
    return_data = self.deserialize(response_data, response_type)
  File "/usr/lib/python2.7/site-packages/kubernetes/client/api_client.py", line 256, in deserialize
    return self.__deserialize(data, response_type)
  File "/usr/lib/python2.7/site-packages/kubernetes/client/api_client.py", line 295, in __deserialize
    return self.__deserialize_model(data, klass)
  File "/usr/lib/python2.7/site-packages/kubernetes/client/api_client.py", line 636, in __deserialize_model
    kwargs[attr] = self.__deserialize(value, attr_type)
  File "/usr/lib/python2.7/site-packages/kubernetes/client/api_client.py", line 295, in __deserialize
    return self.__deserialize_model(data, klass)
  File "/usr/lib/python2.7/site-packages/kubernetes/client/api_client.py", line 638, in __deserialize_model
    instance = klass(**kwargs)
  File "/usr/lib/python2.7/site-packages/kubernetes/client/models/v2beta2_horizontal_pod_autoscaler_status.py", line 62, in __init__
    self.conditions = conditions
  File "/usr/lib/python2.7/site-packages/kubernetes/client/models/v2beta2_horizontal_pod_autoscaler_status.py", line 93, in conditions
    raise ValueError("Invalid value for `conditions`, must not be `None`")  # noqa: E501
ValueError: Invalid value for `conditions`, must not be `None`

What you expected to happen:
create success

How to reproduce it (as minimally and precisely as possible):
create v2beta2 hpa resource

Anything else we need to know?:

Environment:

  • Kubernetes version (kubectl version):

Server Version: version.Info{Major:"1", Minor:"16+", GitVersion:"v1.16.6", GitCommit:"85ec80c3a5e1d28f947972e7d6c95d5b72ee2a14", GitTreeState:"clean", BuildDate:"2020-05-19T02:40:43Z", GoVersion:"go1.14.2", Compiler:"gc", Platform:"linux/amd64"

  • OS (e.g., MacOS 10.13.6):
  • Python version (python --version)
  • Python client version (pip list | grep kubernetes)

kubernetes (11.0.0)

@yylt yylt added the kind/bug Categorizes issue or PR as related to a bug. label Jul 14, 2020
@roycaihw
Copy link
Member

This looks like another occurrence of kubernetes-client/gen#52. The field conditions is marked as required in upstream openapi spec. The upstream openapi spec needs to be fixed (with something like kubernetes/kubernetes#64996)

@roycaihw roycaihw added the help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. label Jul 20, 2020
@tdmalone
Copy link

Unless I've misunderstood something, there's a bunch of issues about this already and it's apparently fixed in v12 of this client (yet to be released). In the meantime there are at least 3 potential workarounds available in #1098.

@yylt
Copy link
Author

yylt commented Jul 24, 2020

same with the issue #1098

@yylt yylt closed this as completed Jul 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

No branches or pull requests

3 participants