-
Notifications
You must be signed in to change notification settings - Fork 509
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
feat: make Gateway.Spec.Addresses.Value
optional
#3616
base: main
Are you sure you want to change the base?
feat: make Gateway.Spec.Addresses.Value
optional
#3616
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: EyalPazz 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 |
Hi @EyalPazz. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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-sigs/prow repository. |
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 needs more specification; changing a field to optional is not a breaking change, but it is a big one that will require code updates from all controllers. If you are proposing this, including how to handle empty values for implementations that support it and do not will be important.
We may also need an extended feature to cover this GatewayAddressEmpty
or something, so that we can slice the conformance tests accordingly.
26365be
to
d39cc82
Compare
@youngnick, this isn't ready for merge yet, i wanted your opinion on injecting a valid |
d39cc82
to
581ba80
Compare
@shaneutt , i'd also appreciate your opinion here, as i saw you wrote the |
That seems reasonable, yes. |
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 for taking this on @EyalPazz!
// +kubebuilder:validation:MinLength=1 | ||
// +kubebuilder:validation:MaxLength=253 | ||
Value string `json:"value"` |
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.
Although the +optional
is a convention, we have two options to make this optional:
A) A pointer to allow for nil/unspecified values
// +kubebuilder:validation:MinLength=1 | |
// +kubebuilder:validation:MaxLength=253 | |
Value string `json:"value"` | |
// +kubebuilder:validation:MinLength=1 | |
// +kubebuilder:validation:MaxLength=253 | |
Value *string `json:"value,omitempty"` |
B) Allow empty string (no need to distinguish between empty string and unspecified here, so this is likely better)
// +kubebuilder:validation:MinLength=1 | |
// +kubebuilder:validation:MaxLength=253 | |
Value string `json:"value"` | |
// +kubebuilder:validation:MaxLength=253 | |
Value string `json:"value,omitempty"` |
Would appreciate some other input on this from others like @youngnick before committing to an approach.
gatewayClassName: "{GATEWAY_CLASS_NAME}" | ||
addresses: | ||
# How should we inject a valid type here? | ||
- type: "VALID_ADDRESS_TYPE_PLACEHOLDER" |
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 seems like the fundamental challenge of writing a conformance test for this. As far as I know, none of our conformance tests so far require a specific address type. I like your idea of allowing this to be a configurable flag on the test suite and that's probably sufficient as a starting point. It could be useful to expand this in the future to have a separate SupportedFeature
per type though.
|
||
// SupportGatewayAddressEmpty option indicates support for an empty | ||
// spec.addresses.value field | ||
SupportGatewayAddressEmpty FeatureName = "GatewayAddressEmpty" |
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 feature name doesn't quite seem right. Maybe useful to describe the address options that will be available after this PR merges:
- Gateway.spec.addresses unspecified - implementation automatically assigns address(es) of whatever type(s) they choose
- Gateway.spec.addresses.value unspecified (new in this PR) - implementation automatically assigns address(es) of the type requested (if possible)
- Gateway.spec.addresses fully specified - implementation automatically assigns address requested (if possible)
So that's a long way of saying that the thing that's new here is the ability to request a type of address without specifying the desired value. So maybe a better name would be GatewayTypedAddressAllocation
although that's awfully verbose. Naming is decidedly not my specialty, but something in that general direction would probably be helpful.
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't a fully specified Gateway.spec.addresses also be considered a TypedAddress
?
@youngnick @robscott can you please re-review this? |
What type of PR is this?
/kind feature
Which issue(s) this PR fixes:
Fixes #3612
Does this PR introduce a user-facing change?: