-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
fixing listing nodes #1739
fixing listing nodes #1739
Conversation
|
Welcome @jesskranz! |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: jesskranz The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
the file is auto generated, please apply any fix upstream |
@@ -214,12 +214,13 @@ def type(self, type): | |||
""" | |||
if self.local_vars_configuration.client_side_validation and type is None: # noqa: E501 | |||
raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 | |||
allowed_values = ["DiskPressure", "MemoryPressure", "NetworkUnavailable", "PIDPressure", "Ready"] # noqa: E501 | |||
allowed_values = ["DiskPressure", "MemoryPressure", "NetworkUnavailable", "PIDPressure", "Ready", "TerminateScheduled", "PreemptScheduled", "FreezeScheduled", "RebootScheduled", "FrequentContainerdRestart", "RedeployScheduled", "ReadonlyFilesystem", "FrequentKubeletRestart", "ContainerRuntimeProblem", "FilesystemCorruptionProblem", "FrequentDockerRestart", "KubeletProblem", "KernelDeadlock","FrequentUnregisterNetDevice"] # noqa: E501 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this needs to be fixed in the upstream kubernetes. This client is generated from Kubernetes OpenAPI spec, and according to the spec:
"type": {
"description": "Type of node condition.\n\nPossible enum values:\n - `\"DiskPressure\"` means the kubelet is under pressure due to insufficient available disk.\n - `\"MemoryPressure\"` means the kubelet is under pressure due to insufficient available memory.\n - `\"NetworkUnavailable\"` means that network for the node is not correctly configured.\n - `\"PIDPressure\"` means the kubelet is under pressure due to insufficient available PID.\n - `\"Ready\"` means kubelet is healthy and ready to accept pods.",
"enum": [
"DiskPressure",
"MemoryPressure",
"NetworkUnavailable",
"PIDPressure",
"Ready"
],
"type": "string"
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@roycaihw you reckon we should make a PR over there? any guidelines on where should we add this ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I'm afraid we should remove this line.
kubernetes/kubernetes#105057 made the openapi-generated clients do more strict validation for this enum. However, according to #1735 it seems common for cloud providers (e.g. GKE, AKS) to expend the possible values for this enum-- which won't pass the client-side validation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the meantime, I think we can accept a hot patch to remove this client-side validation. It seems pretty bad that the client will randomly fail listing nodes when talking to a cloud provider.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should treat this field to be not an enum. I will send a PR shortly.
kubernetes/kubernetes#105057 broke python client |
#1739 (comment): +1. It may affect other openapi-generated clients / other APIs as well |
This is expected. KEP-2887 change all fields that are actually enums to be enum in the OpenAPI spec. |
if self.local_vars_configuration.client_side_validation and type not in allowed_values: # noqa: E501 | ||
raise ValueError( | ||
"Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 | ||
.format(type, allowed_values) | ||
) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: stray edit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we postpone this PR a bit? I will send a PR to k/k to mark this field to be non-enum.
@jiahuif Would be great if k/k can also do a cherrypick. Otherwise this client (and other clients that are affected) has to either wait for a new k/k minor release, or do its own hot patch. |
+1 it shouldn't be a static enum. |
backport to 1.23 pending approval as kubernetes/kubernetes#108740 |
The upstream openapi spec is fixed (in master). Once the cherrypick https://github.com/kubernetes/kubernetes/pull/108740/files is merged we can cut a new 23 client to fix this issue. |
@roycaihw: Closed this PR. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
What type of PR is this?
/kind bug
What this PR does / why we need it:
While listing the nodes i'm getting errors, because types were not in the allow list. Not sure what these types are, but adding these allowed me to list the nodes in my cluster.
Which issue(s) this PR fixes:
Fixes #1735
Special notes for your reviewer:
This is my first contribution to an open source project, please help me go through the steps
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: