-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
🏃mark defaulted fields as optional #2678
🏃mark defaulted fields as optional #2678
Conversation
I'm not sure What do folks think? More pointers or more json serialization code? |
/test pull-cluster-api-capd-e2e |
Well, I have to say that teaching On one hand, the badness is almost entirely contained inside one or two files as opposed to spread out throughout the codebase. On the other, I've done a limited survey of the code and it looks like we almost never actually use those fields from go-land, only after serializing to yaml to pass to kubeadm. At that point, the pointers are really only awkward the next time we'd need to copy over the config structures for the next kubeadm config version. |
@sethp-nr this capd-e2e is failing because the kubeadm configuration is now missing kind and apiVersion |
func (ic InitConfiguration) MarshalJSON() ([]byte, error) { | ||
return marshalJSONOmittingEmptyStructs(ic) | ||
} |
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.
We shouldn't need this I think, rather when we're adding omitempty
, we should have a pointer
Ah, ok – I hadn't gotten to the point yet where I was running that locally. In the tests I did it was populating After sleeping on it, I'm feeling like turning things into pointers is the better way forward anyway. |
Chatted with Vince in Slack: https://kubernetes.slack.com/archives/C8TSNPY4T/p1584373580418500 Since changing to pointers is a breaking API change for go clients, I'm moving that work to a different PR. This one is going to just change the |
b43d5d1
to
7090b93
Compare
@sethp-nr changes lgtm, did you want to keep the |
Oh, no, I just missed a few cleaning things up. will fix. |
7090b93
to
e8b9f1a
Compare
Add optional tags for fields that have defaults provided elsewhere (in the bootstrap provider, or kubeadm itself).
e8b9f1a
to
a963cbc
Compare
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.
/approve
/assign @ncdc
/milestone v0.3.1
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: sethp-nr, vincepri 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 |
/lgtm |
Perhaps easier to iterate on than a full kubernetes cluster
What this PR does / why we need it:
Addresses some odd defaulting behavior in the KCP webhook, as well as smoothing out some UX.
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #1941