-
Notifications
You must be signed in to change notification settings - Fork 411
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 support for +default markers #938
Conversation
/hold forgot about the ref(type) support in the KEP... that's going to be a pain to reimplement :-/ |
cc @alexzielenski for thoughts on the best way to add support for |
In our code generators we use To add |
yeah... it's really thorny... I might start by limiting support here to inlined json-formatted values. We don't actually use |
Reworked this to delegate specialized marker parsing to the value holder, structured to ignore /hold cancel |
Sounds reasonable. I've looked around a little, and closest thing I found to static evaluation of constants from symbol path is ❯ go doc k8s.io/api/core/v1.TerminationMessageReadFile
package v1 // import "k8s.io/kubernetes/staging/src/k8s.io/api/core/v1"
const (
// TerminationMessageReadFile is the default behavior and will set the container status message to
// the contents of the container's terminationMessagePath when the container exits.
TerminationMessageReadFile TerminationMessagePolicy = "File"
// TerminationMessageFallbackToLogsOnError will read the most recent contents of the container logs
// for the container status message when the container exits with an error and the
// terminationMessagePath has no contents.
TerminationMessageFallbackToLogsOnError TerminationMessagePolicy = "FallbackToLogsOnError"
) Unfortunately it is not machine readable, not isolated to what was asked for, and returns go source so if the constant was an expression like |
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.
Just a few nits, otherwise lgtm
Thx! /lgtm |
LGTM label has been added. Git tree hash: 3a1e540dedac1ba2aae86a0a41d631d8ff0255d4
|
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.
thanks!
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: alvaroaleman, 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 adds annotation support for
+default
markers for specifying default values in JSON format, as is done in core Kubernetes types and described in https://github.com/kubernetes/enhancements/tree/master/keps/sig-api-machinery/1929-built-in-default#summaryIf both
+default
and+kubebuilder:default
are specified, the kubebuilder-specific annotation wins.Fixes #939