-
Notifications
You must be signed in to change notification settings - Fork 206
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
Migrate to CRDs (and kubebuilder) #37
Migrate to CRDs (and kubebuilder) #37
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: roberthbailey 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 |
I've verified that this works following the (updated) instructions in the README:
Tests pass locally, but we need to update prow to use go 1.10+ and add some of the kubebuilder binaries before CI tests will pass. |
/test pull-cluster-api-provider-gcp-test |
- Parse flags - Add cluster-api Scheme - Initialize deps
- Issue with serializer / deserializer - Issue with registering actuator multiple times
removed and be sourced from the vendored kubebuilder code.
d48e0c5
to
1b9dced
Compare
@roberthbailey - I'm just trying to figure out how we consume downstream :-/ |
@timothysc and I chatted on slack about his question. Unfortunately, I don't see any easy way for other providers to pick up this change. Each one will need to update deps and migrate to kubebuilder following the same steps. The good news is that the steps aren't too complicated. |
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.
A few suggestions, but nothing that should delay this PR further..
./generate-yaml.sh | ||
cd ../.. | ||
cd ../../../.. | ||
kustomize build config/default/ > cmd/clusterctl/examples/google/out/provider-components.yaml |
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.
Yay for more kustomize and less bash :-)
) | ||
|
||
func main() { | ||
flag.Parse() |
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 always like to do flag.Set("logtostderr", "true")
, so don't be surprised to see a PR for that soon!
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 file was generated by kubebuilder - so send it upstream (and then everyone will get the change).
Zone string `json:"zone"` | ||
MachineType string `json:"machineType"` | ||
|
||
// The name of the OS to be installed on the machine. |
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 is matching the yaml file, rather than actually installing the OS... so I'm wondering if we should just make it key value pairs. That might actually be generic enough for the Machine
type itself. Probably best discussed at the next cluster API meeting!
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 can discuss these types separately; for this PR they were just copied from the existing types.
SourceTags: []string{cluster.Name + "-worker"}, | ||
}) | ||
if err != nil { | ||
glog.Warningf("Error creating firewall rule for internal cluster traffic: %v", err) |
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.
Just warning feels like we will bury bad news in the logs, and users won't understand why their cluster didn't launch. return error instead?
SourceRanges: []string{"0.0.0.0/0"}, | ||
}) | ||
if err != nil { | ||
glog.Warningf("Error creating firewall rule for core api server traffic: %v", err) |
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.
Same concern here, but will stop commenting on this class of problem for brevity :-)
// Sets the status of the instance identified by the given machine to the given machine | ||
func (gce *GCEClient) updateInstanceStatus(machine *clusterv1.Machine) error { | ||
if gce.client == nil { | ||
return nil |
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 feel this should be an error(?)
|
||
// Gets the state of the instance stored on the given machine CRD | ||
func (gce *GCEClient) machineInstanceStatus(machine *clusterv1.Machine) (instanceStatus, error) { | ||
if machine.ObjectMeta.Annotations == nil { |
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: I think this check could be ommitted, because a nil map is treated the same as an empty map for reading
|
||
// The two machines differ in a way that requires an update | ||
func (gce *GCEClient) requiresUpdate(a *clusterv1.Machine, b *clusterv1.Machine) bool { | ||
// Do not want status changes. Do want changes that impact machine provisioning |
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: I would zero-out the fields you don't care about (after copying!); my fear is that someone adds a field that we do care about and we get hard-to-figure out bugs.
|
||
// Otherwise, fall back to the base image. | ||
glog.Infof("Could not find image at %s. Defaulting to %s.", img, defaultImg) | ||
return defaultImg |
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.
Should this be an error?
|
||
const nodeEnvironmentVars = ` | ||
#!/bin/bash | ||
KUBELET_VERSION={{ .Machine.Spec.Versions.Kubelet }} |
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.
Idea: we should move this to building in code from a map (no template), then we can have some sanity checks around quoting or invalid characters
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 agree that this should be tidied up.
Looks great @roberthbailey - a few suggestions, but it sounds like the community needs an existence proof :-) /lgtm |
Can you send a PR to fix the issues that you found? |
What this PR does / why we need it: Picks up kubernetes-sigs/cluster-api#494 and migrates the GCP provider repository to use CRDs and kubebuilder to stay in line with the cluster-api repository.
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 #
Special notes for your reviewer:
Release note: