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

remove enum markers on types without validation #108639

Conversation

jiahuif
Copy link
Member

@jiahuif jiahuif commented Mar 10, 2022

What type of PR is this?

/kind bug
/kind feature

What this PR does / why we need it:

This PR unmarks a few types that are not validated to be in a set of defined values as enum type. In production, we see applications and/or cloud providers setting these fields to be a value that is not built in.

Which issue(s) this PR fixes:

xref: kubernetes-client/python#1733
xref: kubernetes-client/python#1735
xref: kubernetes-client/python#1739

Special notes for your reviewer:

Release note: this affects only generated clients but not directly the end users.

Does this PR introduce a user-facing change?

Fixes a 1.23 regression in published openAPI that incorrectly identified some fields as enum values

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/bug Categorizes issue or PR as related to a bug. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. kind/feature Categorizes issue or PR as related to a new feature. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Mar 10, 2022
@k8s-ci-robot k8s-ci-robot added kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Mar 10, 2022
@k8s-triage-robot
Copy link

This PR may require API review.

If so, when the changes are ready, complete the pre-review checklist and request an API review.

Status of requested reviews is tracked in the API Review project.

@jiahuif jiahuif force-pushed the feature/openapi/node-condition-type-non-enum branch 2 times, most recently from 78d449a to 6406c02 Compare March 10, 2022 21:36
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Mar 10, 2022
@jiahuif jiahuif changed the title mark NodeConditionType as non enum mark NodeConditionType and PodConditionType as non enum Mar 10, 2022
@jiahuif jiahuif force-pushed the feature/openapi/node-condition-type-non-enum branch from 6406c02 to c35aebe Compare March 10, 2022 22:09
@apelisse
Copy link
Member

Looks good, but can we clarify the doc on these fields so that we have a better understanding why/how that happened?
Their docs don't read like other values should be accepted. @thockin

@jiahuif
Copy link
Member Author

jiahuif commented Mar 14, 2022

NodeConditionType is left as a TODO as in the comment. We observed cloud providers filling status of load balancers, node agents to this field.

// These are valid conditions of node. Currently, we don't have enough information to decide
// node condition. In the future, we will add more. The proposed set of conditions are:
// NodeReachable, NodeLive, NodeReady, NodeSchedulable, NodeRunnable.

https://github.com/kubernetes/kubernetes/blob/v1.24.0-alpha.3/staging/src/k8s.io/api/core/v1/types.go#L5053-L5069

PodConditionType is defined to be unbounded, ref: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#pod-readiness-gate

@apelisse
Copy link
Member

// These are valid conditions of node. Currently, we don't have enough information to decide
// node condition. In the future, we will add more. The proposed set of conditions are:
// NodeReachable, NodeLive, NodeReady, NodeSchedulable, NodeRunnable.

That first comment is hand-wavy, but not as in "we can have other values", but rather as "This was written when Kubernetes started and we didn't really know where we're going". I'm sure we can improve this.

PodConditionType is defined to be unbounded, ref: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#pod-readiness-gate

I'm sure we can improve this field comment.

types: PodConditionType, NodeConditionType
@apelisse
Copy link
Member

Thanks,
/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 14, 2022
@jiahuif jiahuif force-pushed the feature/openapi/node-condition-type-non-enum branch from 228f3c9 to c9dd7bd Compare March 15, 2022 19:07
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Mar 15, 2022
@jiahuif
Copy link
Member Author

jiahuif commented Mar 15, 2022

I've manually checked the validation of every type listed above and updated as needed.

@jiahuif jiahuif changed the title mark NodeConditionType and PodConditionType as non enum remove enum markers on types without validation Mar 15, 2022
@jiahuif
Copy link
Member Author

jiahuif commented Mar 15, 2022

/retest

@liggitt
Copy link
Member

liggitt commented Mar 16, 2022

/hold cancel
/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added lgtm "Looks good to me", indicates that a PR is ready to be merged. and removed do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. labels Mar 16, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: apelisse, jiahuif, liggitt

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot merged commit 5ea2615 into kubernetes:master Mar 16, 2022
@k8s-ci-robot k8s-ci-robot added this to the v1.24 milestone Mar 16, 2022
@apelisse
Copy link
Member

Awesome, let's cherry-pick this in the the latest release!

@leilajal
Copy link
Contributor

/triage accepted

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Mar 17, 2022
@jiahuif jiahuif deleted the feature/openapi/node-condition-type-non-enum branch March 17, 2022 18:25
k8s-ci-robot added a commit that referenced this pull request Mar 31, 2022
…f-#108639-upstream-release-1.23

Automated cherry pick of #108639: unmark non-validated types as enums.
@sftim
Copy link
Contributor

sftim commented Apr 13, 2022

We now have a gap where these non-exhaustive, enum-like field values are not documented. Folks will previously have found those explanations useful.

See kubernetes/website#32833 (review) for an example where the v1.23 docs enumerate taints and list meanings (NoExecute, NoSchedule and PreferNoSchedule) but the v1.24 docs won't.

I'll file a feature request about this.

@liggitt
Copy link
Member

liggitt commented Apr 13, 2022

The enums were removed from the 1.23 static file as well in #109179

@sftim
Copy link
Contributor

sftim commented Apr 13, 2022

That's OK by accident because SIG Docs makes an assumption that once we've made a minor release the [Open]API for that release doesn't change.

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed release-note-none Denotes a PR that doesn't merit a release note. labels Sep 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/code-generation cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API kind/bug Categorizes issue or PR as related to a bug. kind/feature Categorizes issue or PR as related to a new feature. kind/regression Categorizes issue or PR as related to a regression from a prior release. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/apps Categorizes an issue or PR as relevant to SIG Apps. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants