-
Notifications
You must be signed in to change notification settings - Fork 280
⚠️ Update NetworkStatus ready for dual stack #1577
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
Conversation
Skipping CI for Draft Pull Request. |
✅ Deploy Preview for kubernetes-sigs-cluster-api-openstack ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mdbooth 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 |
/cc @dulek @MaysaMacedo |
@mdbooth: GitHub didn't allow me to request PR reviews from the following users: maysamacedo. Note that only kubernetes-sigs members and repo collaborators can review this PR, and authors cannot review their own PRs. In response to this:
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/test-infra repository. |
// externalNetwork contains information about the external network used for default ingress and egress traffic. | ||
ExternalNetwork *NetworkStatus `json:"externalNetwork,omitempty"` | ||
|
||
// router describes the default cluster router | ||
Router *Router `json:"router,omitempty"` | ||
|
||
// apiServerLoadBalancer describes the api server load balancer if one exists |
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.
Comment case should match variable case Router
, ExternalNetwork
, APIServerLoadBalancer
and end with a dot.
The dot linter would be great but is unfortunately not reliable enough.
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.
Interesting. I have no strong personal preference, but as our API astronauts in OpenShift always insist on using the json tag in API godocs I was assuming it was a documented convention. And it is, but the only reference I can find is for OpenShift specifically: https://github.com/openshift/enhancements/blob/master/dev-guide/api-conventions.md#use-json-field-names-in-godoc
The reasoning is that users see this output in kubectl explain
, and only the json tags make sense in that context.
But... this isn't documented in kubernetes 🤔 The API Conventions don't have anything to say on the matter, and the coding conventions just point to the Go conventions, which obviously say to use the Go field. I'm genuinely surprised by that. I was kinda hoping to do a big API cleanup and change it everywhere so it's consistent, but now I'm wondering.
Thoughts?
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.
I think we don't even have to start with the object name itself. If we take a look at kubectl explain
we can see that the name will be printed anyway.
Example
❯ k explain osc.spec | grep -A1 "^ network"
network <Object>
If NodeCIDR cannot be set this can be used to detect an existing network.
If we want to keep the name in the comment I'd suggest to use the go notation and not the json tag.
But tbh, I don't really have a hard opinion on this.
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.
On that there is a convention: https://www.kubernetes.dev/docs/guide/coding-convention/ points to https://go.dev/blog/godoc, which says:
Notice this comment is a complete sentence that begins with the name of the element it describes. This important convention allows us to generate documentation in a variety of formats, from plain text to HTML to UNIX man pages, and makes it read better when tools truncate it for brevity, such as when they extract the first line or sentence.
@@ -157,7 +157,7 @@ type OpenStackClusterStatus struct { | |||
|
|||
// Network contains all information about the created OpenStack Network. | |||
// It includes Subnets and Router. |
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.
Does it still include Router
?
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.
Nope! I need to update that.
|
@seanschneeweiss it‘s the other way around. Setting the squash label would squash the commits. The default merge behavior of Prow is a merge commit :) |
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, Sean!
@@ -157,7 +157,7 @@ type OpenStackClusterStatus struct { | |||
|
|||
// Network contains all information about the created OpenStack Network. | |||
// It includes Subnets and Router. |
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.
Nope! I need to update that.
description: apiServerLoadBalancer describes the api server load balancer | ||
if one exists | ||
properties: | ||
allowedCIDRs: |
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.
nit: it's maybe not part of this PR, but we should add a short description to all properties itself. kubectl explain
is not very meaningful if we don't add descriptions.
❯ k explain osc.status.network.apiServerLoadBalancer
GROUP: infrastructure.cluster.x-k8s.io
KIND: OpenStackCluster
VERSION: v1alpha5
FIELD: apiServerLoadBalancer <Object>
DESCRIPTION:
Be careful when using APIServerLoadBalancer, because this field is optional
and therefore not set in all cases
FIELDS:
id <string> -required-
<no description>
internalIP <string> -required-
<no description>
ip <string> -required-
<no description>
name <string> -required-
<no description>
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.
For consistency I'm going to stick with Go type case for now. I thought we were obviously flouting a definite convention, which it seems we're not. As the cleanup is uncertain I'll stick with how most of them are currently defined.
This update rebases on to the latest main and updates some godocs as discussed above. |
Renames the Network type to NetworkStatusWithSubnets, and embeds NetworkStatus. This is a pure Go change with no implications for the CRDs.
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.
Looks good to me!
Leaving the hold for now so others have time to review
/lgtm
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.
/lgtm
// It includes Subnets and Router. | ||
Network *Network `json:"network,omitempty"` | ||
// Network contains information about the created OpenStack Network. | ||
Network *NetworkStatusWithSubnets `json:"network,omitempty"` | ||
|
||
// externalNetwork contains information about the external network used for default ingress and egress traffic. |
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.
Not really part of your PR, would you mind changing that too?
// externalNetwork contains information about the external network used for default ingress and egress traffic. | |
// ExternalNetwork contains information about the external network used for default ingress and egress traffic. |
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.
I think we need a general godoc cleanup, tbh.
/hold cancel |
What this PR does / why we need it:
This is a breaking API change to OpenStackClusterStatus. It makes 2 changes to
status.Network
. These are done in a single PR as they're somewhat related and can't be merged separately without conflicts. I have intentionally kept them in multiple commits.The first change moves
apiServerLoadBalancer
androuter
out ofstatus.network
. These are not properties of the cluster network and may evolve separately in the future. Separating them now before v1beta1 reduces the scope of future churn.The second change transforms
network.subnet
into a slice of subnets. This is in anticipation of dual stack support, which we hope to add to a future release based on v1beta1.Special notes for your reviewer:
The multiple commits are deliberate. I don't intend to squash them. I recommend reviewing this PR by commit, as the changes are logically separate.
Where it was simpler to do so I have updated code to handle multiple subnets, but not in all places. This change doesn't intend to support multiple subnets. It simply allows the API to represent multiple subnets.
This does not represent all API changes required for dual stack support, only one of them.
/hold