Skip to content

feat: make Gateway.Spec.Addresses.Value optional #3616

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

Merged

Conversation

EyalPazz
Copy link
Member

What type of PR is this?
/kind feature

Which issue(s) this PR fixes:
Fixes #3612

Does this PR introduce a user-facing change?:

Make the `value` field in Gateway.Spec.Addresses array optional

@k8s-ci-robot k8s-ci-robot added kind/feature Categorizes issue or PR as related to a new feature. release-note Denotes a PR that will be considered when it comes time to generate release notes. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Feb 16, 2025
@k8s-ci-robot
Copy link
Contributor

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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Feb 16, 2025
@shaneutt shaneutt added this to the v1.3.0 milestone Feb 17, 2025
Copy link
Contributor

@youngnick youngnick left a 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.

@@ -672,6 +672,7 @@ type GatewayAddress struct {
//
// Examples: `1.2.3.4`, `128::1`, `my-ip-address`.
//
// +optional
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs some more explanation:

  • what behavior is expected if an implementation supports an empty Value here?
  • what behavior is expected if an implementation does not support an empty Value here?

This should then guide you to adding some conformance tests for implementations to test against.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

amazing thanks!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 to @youngnick's comments, a couple suggestions as a starting point:

  1. If an implementation does support an empty value, we expect them to assign an address matching the type that has been requested with a value of the implementation's choice.
  2. If an implementation does not support an empty value, we expect them to set the Programmed condition in status to False with a reason of AddressNotAssigned. Here's what that reason means as a reference:

// This reason is used with the "Programmed" condition when the underlying
// implementation and network have yet to dynamically assign addresses for a
// Gateway.
//
// Some example situations where this reason can be used:
//
// * IPAM address exhaustion
// * Address not yet allocated
//
// When this reason is used the implementation SHOULD provide a clear
// message explaining the underlying problem, ideally with some hints as to
// what actions can be taken that might resolve the problem.
GatewayReasonAddressNotAssigned GatewayConditionReason = "AddressNotAssigned"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the extra doc requirement here got missed. I'd still like to see some description of what should happen in both cases on this field, if it's supported and not.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching this @youngnick! @EyalPazz any chance you can squeeze this in in the next day or two? Really hoping we can fit this into v1.3 if possible, and we'll need to cut a RC pretty soon.

@shaneutt shaneutt removed their request for review February 18, 2025 11:17
@k8s-ci-robot k8s-ci-robot added do-not-merge/invalid-commit-message Indicates that a PR should not merge because it has an invalid commit message. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Feb 19, 2025
@EyalPazz EyalPazz force-pushed the make-addresses-value-optional branch from 26365be to d39cc82 Compare February 19, 2025 14:04
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/invalid-commit-message Indicates that a PR should not merge because it has an invalid commit message. label Feb 19, 2025
@EyalPazz EyalPazz requested a review from youngnick February 19, 2025 14:06
@EyalPazz
Copy link
Member Author

@youngnick, this isn't ready for merge yet, i wanted your opinion on injecting a valid type value to the test suite
Should we take a similar approach to the GatewayStaticAddresses test?

@EyalPazz EyalPazz force-pushed the make-addresses-value-optional branch from d39cc82 to 581ba80 Compare February 19, 2025 14:11
@EyalPazz
Copy link
Member Author

@shaneutt , i'd also appreciate your opinion here, as i saw you wrote the PLACEHOLDER_**_ADDRS hacks

@youngnick
Copy link
Contributor

@youngnick, this isn't ready for merge yet, i wanted your opinion on injecting a valid type value to the test suite Should we take a similar approach to the GatewayStaticAddresses test?

That seems reasonable, yes.

Copy link
Member

@robscott robscott left a 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!

@@ -672,6 +672,7 @@ type GatewayAddress struct {
//
// Examples: `1.2.3.4`, `128::1`, `my-ip-address`.
//
// +optional
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 to @youngnick's comments, a couple suggestions as a starting point:

  1. If an implementation does support an empty value, we expect them to assign an address matching the type that has been requested with a value of the implementation's choice.
  2. If an implementation does not support an empty value, we expect them to set the Programmed condition in status to False with a reason of AddressNotAssigned. Here's what that reason means as a reference:

// This reason is used with the "Programmed" condition when the underlying
// implementation and network have yet to dynamically assign addresses for a
// Gateway.
//
// Some example situations where this reason can be used:
//
// * IPAM address exhaustion
// * Address not yet allocated
//
// When this reason is used the implementation SHOULD provide a clear
// message explaining the underlying problem, ideally with some hints as to
// what actions can be taken that might resolve the problem.
GatewayReasonAddressNotAssigned GatewayConditionReason = "AddressNotAssigned"

@EyalPazz
Copy link
Member Author

@youngnick @robscott can you please re-review this?

@EyalPazz EyalPazz requested a review from robscott February 24, 2025 12:26
@k8s-ci-robot k8s-ci-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. do-not-merge/invalid-commit-message Indicates that a PR should not merge because it has an invalid commit message. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. kind/gep PRs related to Gateway Enhancement Proposal(GEP) and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Feb 27, 2025
@EyalPazz EyalPazz force-pushed the make-addresses-value-optional branch from 4cd24c2 to 687de42 Compare March 3, 2025 07:36
Copy link
Member

@robscott robscott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @EyalPazz!

@robscott
Copy link
Member

robscott commented Mar 5, 2025

Hey @EyalPazz, I chatted with @youngnick about this and we agreed that it would make sense to move the conformance test for this into a follow up PR. The rationale is that as long as we have a clearly defined API spec for this, the conformance test would be covering with 99+% of implementations already do (automatically assign an IP address to a Gateway), so it's not quite as critical as we'd initially thought.

Will you have time to update the PR in the next day or two to reflect this new smaller scope? Would love to get this into v1.3 if possible.

@EyalPazz
Copy link
Member Author

EyalPazz commented Mar 5, 2025

Hey @EyalPazz, I chatted with @youngnick about this and we agreed that it would make sense to move the conformance test for this into a follow up PR. The rationale is that as long as we have a clearly defined API spec for this, the conformance test would be covering with 99+% of implementations already do (automatically assign an IP address to a Gateway), so it's not quite as critical as we'd initially thought.

Will you have time to update the PR in the next day or two to reflect this new smaller scope? Would love to get this into v1.3 if possible.

Yea for sure, i'll do it tomorrow morning

@EyalPazz
Copy link
Member Author

EyalPazz commented Mar 6, 2025

Should be ok now :) @robscott

@robscott
Copy link
Member

robscott commented Mar 7, 2025

Thanks @EyalPazz! Will leave final LGTM for @youngnick or someone else.

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: EyalPazz, robscott

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 added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 7, 2025
@robscott
Copy link
Member

I missed something when I approved. Adding a hold until #3616 (comment) is addressed.

/hold

Copy link
Member

@robscott robscott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @EyalPazz! This mostly LGTM, just needs another codegen run and a bit of clarification in the spec.

@EyalPazz EyalPazz requested a review from robscott March 15, 2025 11:08
@robscott
Copy link
Member

Thanks @EyalPazz! This LGTM, will defer to @youngnick for final approval.

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 16, 2025
@youngnick
Copy link
Contributor

Thanks for the extra changes @EyalPazz, great work.

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 16, 2025
@k8s-ci-robot k8s-ci-robot merged commit 09cfd3e into kubernetes-sigs:main Mar 16, 2025
13 checks passed
@github-project-automation github-project-automation bot moved this from Review to Done in Gateway API Pipeline Mar 16, 2025
EyalPazz added a commit to EyalPazz/gateway-api that referenced this pull request Mar 18, 2025
)

* feat: make `Gateway.Spec.Addresses.Value` optional

* wip: test mock

* feat: flag injection & change `GatewayAddress` -> `GatewaySpecAddress`

* add `omitempty` to the value

* chore: update codegen

* fix: type validation and minLength

* chore: remove conformance test for now

* complete rename of `GatewayAddress` -> `GatewaySpecAddress`

* fix: improve docs for value field

* fix: value field doc
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. kind/gep PRs related to Gateway Enhancement Proposal(GEP) lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

Gateway.Spec.Addresses.Value should be optional
5 participants