diff --git a/cluster-api/cloud/google/pods.go b/cluster-api/cloud/google/pods.go index 158413682..f4611a7c7 100644 --- a/cluster-api/cloud/google/pods.go +++ b/cluster-api/cloud/google/pods.go @@ -27,7 +27,7 @@ import ( "github.com/golang/glog" ) -var machineControllerImage = "gcr.io/k8s-cluster-api/machine-controller:0.15" +var machineControllerImage = "gcr.io/k8s-cluster-api/machine-controller:0.16" func init() { if img, ok := os.LookupEnv("MACHINE_CONTROLLER_IMAGE"); ok { diff --git a/cluster-api/machine-controller/Makefile b/cluster-api/machine-controller/Makefile index 6626169e0..0caa19462 100644 --- a/cluster-api/machine-controller/Makefile +++ b/cluster-api/machine-controller/Makefile @@ -1,6 +1,6 @@ PROJECT=k8s-cluster-api NAME=machine-controller -VERSION=0.15 +VERSION=0.16 staticbuild: CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static"' . diff --git a/cluster-api/machine-controller/controller/machinecontroller.go b/cluster-api/machine-controller/controller/machinecontroller.go index b014bc59f..94c2b8216 100644 --- a/cluster-api/machine-controller/controller/machinecontroller.go +++ b/cluster-api/machine-controller/controller/machinecontroller.go @@ -43,6 +43,7 @@ type MachineController struct { clusterClient *client.ClusterAPIV1Alpha1Client actuator cloud.MachineActuator nodeWatcher *NodeWatcher + machineClient client.MachinesInterface runner *asyncRunner } @@ -82,6 +83,7 @@ func NewMachineController(config *Configuration) *MachineController { clusterClient: clusterClient, actuator: actuator, nodeWatcher: nodeWatcher, + machineClient: machineClient, runner: newAsyncRunner(), } } @@ -197,6 +199,15 @@ func (c *MachineController) create(machine *clusterv1.Machine) error { return err } + // Sometimes old events get replayed even though they have already been processed by this + // controller. Temporarily work around this by checking if the machine CRD actually exists + // on create. + _, err = c.machineClient.Get(machine.ObjectMeta.Name, metav1.GetOptions{}) + if err != nil { + glog.Errorf("Skipping machine create due to error getting machine %v: %v\n", machine.ObjectMeta.Name, err) + return err + } + return c.actuator.Create(cluster, machine) }