-
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
Move tf-state to machine object, and remove file system dependency #264
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: karan 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 |
/assign @mkjelland /assign @kcoronado |
cloud/vsphere/pods.go
Outdated
var machineControllerImage = "gcr.io/k8s-cluster-api/vsphere-machine-controller:0.0.1" | ||
|
||
//var machineControllerImage = "gcr.io/k8s-cluster-api/vsphere-machine-controller:0.0.2" | ||
var machineControllerImage = "gcr.io/karangoel-gke-1/vsphere-machine-controller:0.0.2-dev" |
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.
Did you intend to use leave the dev image uncommented?
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 guess I can remove it although the image published is a non-dev image.
return err | ||
} | ||
|
||
if verr := vc.validateMachine(machine, config); verr != 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.
Is there a reason to use a new error (verr) instead of using the previously declared 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.
No -- legacy code.
cloud/vsphere/machineactuator.go
Outdated
@@ -398,15 +466,17 @@ func (vc *VsphereClient) Update(cluster *clusterv1.Cluster, goalMachine *cluster | |||
// This can only happen right after bootstrapping. | |||
if goalMachine.ObjectMeta.Annotations == nil { | |||
ip, _ := vc.GetIP(goalMachine) | |||
glog.Info("Annotations do not exist. Populating existing state for bootstrapped machine.") | |||
return vc.updateAnnotations(goalMachine, ip) | |||
glog.Info("Annotations do not exist. This happens when for a newly bootstrapped 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.
remove "when"
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.
Done
cloud/vsphere/machineactuator.go
Outdated
return string(tfStateBytes), nil | ||
} | ||
|
||
return "", errors.New("could not get tfstatae") |
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.
typo: should be tfstate
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.
Done
cloud/vsphere/machineactuator.go
Outdated
cmd.Stdout = os.Stdout | ||
cmd.Stderr = os.Stderr | ||
cmd.Run() | ||
|
||
return nil | ||
} | ||
|
||
func (vc *VsphereClient) updateAnnotations(machine *clusterv1.Machine, masterEndpointIp string) error { | ||
func (vc *VsphereClient) updateAnnotations(machine *clusterv1.Machine, masterEndpointIp, tfState string) error { |
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.
Can you comment on why this is an annotation, as opposed to a field in machine status ProviderStatus? Do you see it moving there eventually, or is there a reason why you don't think it makes sense there?
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 added a comment.
// We are storing these as annotations and not in Machine Status because that's intended for
// "Provider-specific status" that will usually be used to detect updates. Additionally,
// Status requires yet another version API resource which is too heavy to store IP and TF state.
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, leaving for @kcoronado to add the lgtm label
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
The comments and PR description were helpful for me to understand what was going on, so thanks for that!
Thanks for the reviews! |
…ubernetes-sigs#264) * make the new broken type work, pass user, pass to tf * cleanup logs, bump image * Progress so far * make state in machine object work * Add and fix comments in vsphere provider
* add standalone esx support * move all glog to klog * Fixed machine provisioning on ESXi. - fixed boot sequence on some images (e.g. xenial) - fixed sudo on machines without DNS access - fixed cloud provider bootstrap - fixed rbac role preventing machine deletion - refactored templates.go and the esx cloning code Fixed boot sequence on some images by adding a serial port to allow random number initialization. This affect some images like Xenial. It currently adds a serial port to all machines if it doesn't already in the vm spec. Fixed sudo access for machines without DNS access, which for most development scenarios in nested ESXi on dev laptops. Fixed cloud provider bootstrapping on infrastructure that do not have cloud provider support (e.g. ESXi) issue kubernetes-sigs#177
What this PR does / why we need it:
#224
Special notes for your reviewer:
The only thing I have supported using this model, and tested is cluster create. Update will be done after we move to clusterctl and delete vsphere-deployer.
During bootstrap, the machineClient does not exist (we are not in K8s land). This means that to transfer the state for the master machine, we still need to scp the directory to master. This will be fixed after Working vsphere clusterctl example #263 -- in minikube, machineClient will always exist, so we can simply pivot the machine object and remove the volume mount entirely. Expect a follow-up PR.
The current flow now is that when we need to create a new machine, we create a staging directory
/tmp/cluster-api/machines/$MACHINE_NAME/
. After the machine is created, the tfstate is populated in the Machine object as an annotation. Then the staging directory is deleted.There are a lot of other refactors I want to do, but let's leave those our of this PR.
I am not updating the image. That will happen after I integrate and test cluster creation with clusterctl (and jess's bootstrap change).