python: Recent changes to v1_node_condition.py causing ValueError for MCEHardwareErrors on Oracle OKE cloud platform

Changes for 23.3.0: https://github.com/kubernetes-client/python/commit/b227345fb27fdee65b3218e0d7af18748d78469d

Includes a hard coded set of conditions which may not include all supported conditions for different cloud providers:

https://github.com/kubernetes-client/python/blob/master/kubernetes/client/models/v1_node_condition.py#L217

On Oracle’s OKE cloud platform, it includes an additional condition: MCEHardwareErrors

Which is causing a ValueError when the 23.3.0 client is used to list nodes:

  File "/usr/local/lib/python3.6/site-packages/kubernetes/client/models/v1_node_condition.py", line 221, in type
    .format(type, allowed_values)
ValueError: Invalid value for `type` (MCEHardwareErrors), must be one of ['DiskPressure', 'MemoryPressure', 'NetworkUnavailable', 'PIDPressure',

Node conditions should be more dynamic based on the cloud provider used.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 4
  • Comments: 18 (2 by maintainers)

Commits related to this issue

Most upvoted comments

Is there any mitigation available while a permanent fix is being developed yet?

Same for GCP/GKE:

.../lib/python3.9/site-packages/kubernetes/client/models/v1_pod_readiness_gate.py", line 78, in condition_type
    raise ValueError(
ValueError: Invalid value for `condition_type` (cloud.google.com/load-balancer-neg-ready), must be one of ['ContainersReady', 'Initialized', 'PodScheduled', 'Ready']

This is about pod conditions or pod readiness gates, but it looks to me like is has the same root cause as the node condition issue of @koaps

Edit: it happened first after upgrading from 21.7.0 to 23.3.0

I see the change that was breaking it was reverted in https://github.com/kubernetes-client/python/pull/1789

Is there any mitigation available while a permanent fix is being developed yet?

We faced the issue too. We would like to know a workaround until a new version will be released.