-
Notifications
You must be signed in to change notification settings - Fork 39k
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
Add deprecated, deprecationWarning fields to CRDs #92329
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: 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 |
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. |
3b12241
to
a8e56e7
Compare
/retest |
1 similar comment
/retest |
/cc @roycaihw |
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.
Some nits. LGTM overall
staging/src/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1/types.go
Outdated
Show resolved
Hide resolved
staging/src/k8s.io/apiextensions-apiserver/pkg/apiserver/customresource_handler.go
Show resolved
Hide resolved
/hold |
/lgtm |
/retest |
1 similar comment
/retest |
/assign @lavalamp |
// deprecated indicates this version of the custom resource API is deprecated. | ||
// When set to true, API requests to this version receive a warning header in the server response. | ||
// Defaults to false. | ||
Deprecated bool |
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.
Why don't we simply require someone to write their own DeprecationWarning and avoid having a bool? I haven't read all the way down, but I doubt we have a very good stock message on these since versions don't follow kube versions.
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.
The normal case of "X is deprecated" or "X is deprecated; use Y instead" is easy for us to automatically construct, and seemed valuable for consistency with built-in API deprecation warnings in the absence of specific additional information about removal timeframes.
CRD authors indicating a version is deprecated without knowledge of the cadence at which consumers plan to deploy the revision of the CRD which stops serving the deprecated version would not be able to provide a much better message than the one we're generating by default.
@@ -891,6 +913,25 @@ func (r *crdHandler) getOrCreateServingInfoFor(uid types.UID, name string) (*crd | |||
return ret, nil | |||
} | |||
|
|||
func defaultDeprecationWarning(deprecatedVersion string, crd apiextensionsv1.CustomResourceDefinitionSpec) 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.
versions for CRDs mapping to kube versions somehow seems weird. I'd rather avoid this entire method by requiring the deprecation 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.
This is following the same rules we already follow when determining the order we present the CRD versions in discovery
/lgtm |
/hold cancel |
What type of PR is this?
/kind feature
What this PR does / why we need it:
Implements CRD warnings portion of https://github.com/kubernetes/enhancements/tree/master/keps/sig-api-machinery/1693-warnings / kubernetes/enhancements#1693
Does this PR introduce a user-facing change?:
/sig api-machinery
/cc @deads2k
/area custom-resources