This repository was archived by the owner on May 22, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +13
-2
lines changed Expand file tree Collapse file tree 3 files changed +13
-2
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.15 "
30+ var machineControllerImage = "gcr.io/k8s-cluster-api/machine-controller:0.16 "
3131
3232func init () {
3333 if img , ok := os .LookupEnv ("MACHINE_CONTROLLER_IMAGE" ); ok {
Original file line number Diff line number Diff line change 11PROJECT =k8s-cluster-api
22NAME =machine-controller
3- VERSION =0.15
3+ VERSION =0.16
44
55staticbuild :
66 CGO_ENABLED=0 GOOS=linux go build -a -ldflags ' -extldflags "-static"' .
Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ type MachineController struct {
4343 clusterClient * client.ClusterAPIV1Alpha1Client
4444 actuator cloud.MachineActuator
4545 nodeWatcher * NodeWatcher
46+ machineClient client.MachinesInterface
4647 runner * asyncRunner
4748}
4849
@@ -82,6 +83,7 @@ func NewMachineController(config *Configuration) *MachineController {
8283 clusterClient : clusterClient ,
8384 actuator : actuator ,
8485 nodeWatcher : nodeWatcher ,
86+ machineClient : machineClient ,
8587 runner : newAsyncRunner (),
8688 }
8789}
@@ -197,6 +199,15 @@ func (c *MachineController) create(machine *clusterv1.Machine) error {
197199 return err
198200 }
199201
202+ // Sometimes old events get replayed even though they have already been processed by this
203+ // controller. Temporarily work around this by checking if the machine CRD actually exists
204+ // on create.
205+ _ , err = c .machineClient .Get (machine .ObjectMeta .Name , metav1.GetOptions {})
206+ if err != nil {
207+ glog .Errorf ("Skipping machine create due to error getting machine %v: %v\n " , machine .ObjectMeta .Name , err )
208+ return err
209+ }
210+
200211 return c .actuator .Create (cluster , machine )
201212}
202213
You can’t perform that action at this time.
0 commit comments