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

Gateway::Status::Addresses has a new unique type []GatewayStatusAddress #2144

Merged
merged 3 commits into from
Jul 11, 2023

Conversation

dprotaso
Copy link
Contributor

@dprotaso dprotaso commented Jun 24, 2023

/kind cleanup
/area api

What type of PR is this?

What this PR does / why we need it:

  • This allows the status.addresses type to evolve separately from the spec type (eg. to support GEP-1651)
  • This came up a bunch of times in meetings/PR reviews
  • Notable changes from the GatewayAddress (used in spec)
    • Type field is required to be set (dropped +optional)

Does this PR introduce a user-facing change?:

v1beta1.Gateway Spec.Addresses is now a new Go type []GatewayStatusAddress

@k8s-ci-robot k8s-ci-robot added the do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. label Jun 24, 2023
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jun 24, 2023
@dprotaso dprotaso changed the title Gateway::Status::Addresses has it's unique type []GatewayStatusAddress Gateway::Status::Addresses has a new unique type []GatewayStatusAddress Jun 24, 2023
@dprotaso dprotaso force-pushed the gatewaystatusaddress branch 2 times, most recently from 834e03c to e129ab5 Compare June 24, 2023 00:21
@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 do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Jun 24, 2023
@dprotaso
Copy link
Contributor Author

dprotaso commented Jun 24, 2023

I'd like some input from the maintainers that dropping +optional on the Type field is what we want when listing addresses in the Status

As an end-user it would make sense to me that when consuming the status I would need to know the type prior to parsing the value.

@robscott
Copy link
Member

I'd like some input from the maintainers that dropping +optional on the Type field is what we want when listing addresses in the Status

This is a bit of a strange detail in CRDs. For defaulting to work properly, a field has to be marked as optional. So although the type is technically optional, the end result should never be empty since a default will be applied:

// +optional
// +kubebuilder:default=IPAddress
Type *AddressType `json:"type,omitempty"`

@dprotaso
Copy link
Contributor Author

dprotaso commented Jun 24, 2023

For defaulting to work properly, a field has to be marked as optional.

Good point. I guess the question is when implementors update the status block with addresses do we want to require this field to be explicit - or like on GET default to 'IPAddress' if empty?

@robscott
Copy link
Member

the question is when implementors update the status block with addresses do we want to require this field to be explicit - or like on GET default to 'IPAddress' if empty?

Unfortunately we can only loosen validation, we can't go in the other direction. So in this case, even if we wanted to make this require input from implementations, we can't in a backwards compatible way.

Potentially useful - k8s defaulting happens on writes, so it should be a bit more persistent/reliable than a read-based system.

@robscott
Copy link
Member

Thanks @dprotaso! This PR makes sense to me, but I want to make sure more meaningful related changes make it in before merging this one. IE we should probably only split this out in the same release as we're introducing new fields to GatewayStatusAddress. Adding a temporary hold until we can get that lined up as well.

/hold

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 26, 2023
@dprotaso
Copy link
Contributor Author

rebased

@robscott
Copy link
Member

Thanks @dprotaso! Looks like the other pieces are coming together, will leave hold in place until everything is ready.

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dprotaso, 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 Jun 29, 2023
@robscott
Copy link
Member

Thanks @dprotaso! Everything for this GEP looks to be lined up well. All the other PRs LGTM and have other approvals or LGTMs, will merge in sequence.

/hold cancel
/lgtm

@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 Jul 11, 2023
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 11, 2023
@k8s-ci-robot k8s-ci-robot merged commit 5e66dc0 into kubernetes-sigs:main Jul 11, 2023
@dprotaso dprotaso deleted the gatewaystatusaddress branch July 11, 2023 18:06
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. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants