This repository was archived by the owner on May 22, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +11
-9
lines changed Expand file tree Collapse file tree 4 files changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ import (
2727 "github.com/golang/glog"
2828)
2929
30- var machineControllerImage = "gcr.io/k8s-cluster-api/machine-controller:0.14 "
30+ var machineControllerImage = "gcr.io/k8s-cluster-api/machine-controller:0.15 "
3131
3232func init () {
3333 if img , ok := os .LookupEnv ("MACHINE_CONTROLLER_IMAGE" ); ok {
Original file line number Diff line number Diff line change @@ -134,7 +134,8 @@ func clone(old clusterv1.Machine) *clusterv1.Machine {
134134 newMachine .ObjectMeta = metav1.ObjectMeta {}
135135 newMachine .ObjectMeta .GenerateName = old .ObjectMeta .GenerateName
136136 newMachine .ObjectMeta .Labels = old .ObjectMeta .Labels
137- newMachine .ObjectMeta .Annotations = old .ObjectMeta .Annotations
137+ // Do not copy annotations as they currently contain info like machine name/location etc.
138+ // newMachine.ObjectMeta.Annotations = old.ObjectMeta.Annotations
138139 newMachine .ObjectMeta .ClusterName = old .ObjectMeta .ClusterName
139140
140141 // Completely wipe out the status as well
Original file line number Diff line number Diff line change 11PROJECT =k8s-cluster-api
22NAME =machine-controller
3- VERSION =0.14
3+ VERSION =0.15
44
55staticbuild :
66 CGO_ENABLED=0 GOOS=linux go build -a -ldflags ' -extldflags "-static"' .
Original file line number Diff line number Diff line change @@ -197,17 +197,18 @@ func (c *MachineController) create(machine *clusterv1.Machine) error {
197197 return err
198198 }
199199
200- //TODO: check if the actual machine does not already exist
201200 return c .actuator .Create (cluster , machine )
202- //TODO: wait for machine to become a node
203- //TODO: link node to machine CRD
204201}
205202
206203func (c * MachineController ) delete (machine * clusterv1.Machine ) error {
207- //TODO: check if the actual machine does not exist
208- //TODO: delink node from machine CRD
209204 c .kubeClientSet .CoreV1 ().Nodes ().Delete (machine .ObjectMeta .Name , & metav1.DeleteOptions {})
210- return c .actuator .Delete (machine )
205+ if err := c .actuator .Delete (machine ); err != nil {
206+ return err
207+ }
208+ // Do a second node cleanup after the delete completes in case the node joined the cluster
209+ // while the deletion of the machine was mid-way.
210+ c .kubeClientSet .CoreV1 ().Nodes ().Delete (machine .ObjectMeta .Name , & metav1.DeleteOptions {})
211+ return nil
211212}
212213
213214func (c * MachineController ) update (old_machine * clusterv1.Machine , new_machine * clusterv1.Machine ) error {
You can’t perform that action at this time.
0 commit comments