Skip to content

Commit

Permalink
Revert "Machine CRDs now makes use of status subresource (#223)" (#226)
Browse files Browse the repository at this point in the history
This reverts commit 4018eb9.
  • Loading branch information
prashanth26 authored Feb 15, 2019
1 parent 4018eb9 commit 8870f1b
Show file tree
Hide file tree
Showing 16 changed files with 26 additions and 82 deletions.
12 changes: 6 additions & 6 deletions .ci/integration-tests
Original file line number Diff line number Diff line change
Expand Up @@ -403,12 +403,12 @@ function print_results() {

printf "\n\t\t\t----- Start of Test Script -----------\n"

#setup_environment
#test_all_providers
#pkill controller_manager
#cleanup_all_providers
#print_logs
#print_results
setup_environment
test_all_providers
pkill controller_manager
cleanup_all_providers
print_logs
print_results

printf "\n\t\t\t----- End of Test Script -----------\n"

Expand Down
3 changes: 2 additions & 1 deletion pkg/apis/machine/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,13 @@ import (
)

// WARNING!
// IF YOU MODIFY ANY OF THE TYPES HERE COPY THEM TO ./v1alpha1/types.go
// IF YOU MODIFY ANY OF THE TYPES HERE COPY THEM TO ../types.go
// AND RUN ./hack/generate-code

/********************** Machine APIs ***************/

// +genclient
// +genclient:noStatus
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// Machine TODO
Expand Down
1 change: 1 addition & 0 deletions pkg/apis/machine/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
/********************** Machine APIs ***************/

// +genclient
// +genclient:noStatus
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// Machine TODO
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/machine/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/apis/machine/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 0 additions & 17 deletions pkg/client/clientset/versioned/typed/machine/v1alpha1/machine.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pkg/controller/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (

"github.com/golang/glog"

v1 "k8s.io/api/core/v1"
"k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
Expand Down Expand Up @@ -487,7 +487,7 @@ func (dc *controller) reconcileClusterMachineDeployment(key string) error {
dc.recorder.Eventf(d, v1.EventTypeWarning, "SelectingAll", "This deployment is selecting all machines. A non-empty selector is required.")
if d.Status.ObservedGeneration < d.Generation {
d.Status.ObservedGeneration = d.Generation
dc.controlMachineClient.MachineDeployments(d.Namespace).UpdateStatus(d)
dc.controlMachineClient.MachineDeployments(d.Namespace).Update(d)
}
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/deployment_machineset_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func updateMachineSetStatus(machineClient machineapi.MachineV1alpha1Interface, i
fmt.Sprintf("sequence No: %v->%v", is.Status.ObservedGeneration, newStatus.ObservedGeneration))

is.Status = newStatus
updatedIS, updateErr = c.UpdateStatus(is)
updatedIS, updateErr = c.Update(is)

if updateErr == nil {
return updatedIS, nil
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/deployment_progress.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func (dc *controller) syncRolloutStatus(allISs []*v1alpha1.MachineSet, newIS *v1

newDeployment := d
newDeployment.Status = newStatus
_, err := dc.controlMachineClient.MachineDeployments(newDeployment.Namespace).UpdateStatus(newDeployment)
_, err := dc.controlMachineClient.MachineDeployments(newDeployment.Namespace).Update(newDeployment)
return err
}

Expand Down
14 changes: 7 additions & 7 deletions pkg/controller/deployment_sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import (
"github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1"
labelsutil "github.com/gardener/machine-controller-manager/pkg/util/labels"
"github.com/golang/glog"
v1 "k8s.io/api/core/v1"
"k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
Expand Down Expand Up @@ -104,7 +104,7 @@ func (dc *controller) checkPausedConditions(d *v1alpha1.MachineDeployment) error
}

var err error
d, err = dc.controlMachineClient.MachineDeployments(d.Namespace).UpdateStatus(d)
d, err = dc.controlMachineClient.MachineDeployments(d.Namespace).Update(d)
return err
}

Expand Down Expand Up @@ -273,7 +273,7 @@ func (dc *controller) getNewMachineSet(d *v1alpha1.MachineDeployment, isList, ol

if needsUpdate {
var err error
if d, err = dc.controlMachineClient.MachineDeployments(d.Namespace).UpdateStatus(d); err != nil {
if d, err = dc.controlMachineClient.MachineDeployments(d.Namespace).Update(d); err != nil {
return nil, err
}
}
Expand Down Expand Up @@ -345,7 +345,7 @@ func (dc *controller) getNewMachineSet(d *v1alpha1.MachineDeployment, isList, ol
*d.Status.CollisionCount++
// Update the collisionCount for the Deployment and let it requeue by returning the original
// error.
_, dErr := dc.controlMachineClient.MachineDeployments(d.Namespace).UpdateStatus(d)
_, dErr := dc.controlMachineClient.MachineDeployments(d.Namespace).Update(d)
if dErr == nil {
glog.V(2).Infof("Found a hash collision for machine deployment %q - bumping collisionCount (%d->%d) to resolve it", d.Name, preCollisionCount, *d.Status.CollisionCount)
}
Expand All @@ -362,7 +362,7 @@ func (dc *controller) getNewMachineSet(d *v1alpha1.MachineDeployment, isList, ol
// We don't really care about this error at this point, since we have a bigger issue to report.
// TODO: Identify which errors are permanent and switch DeploymentIsFailed to take into account
// these reasons as well. Related issue: https://github.com/kubernetes/kubernetes/issues/18568
_, _ = dc.controlMachineClient.MachineDeployments(d.Namespace).UpdateStatus(d)
_, _ = dc.controlMachineClient.MachineDeployments(d.Namespace).Update(d)
}
dc.recorder.Eventf(d, v1.EventTypeWarning, FailedISCreateReason, msg)
return nil, err
Expand All @@ -379,7 +379,7 @@ func (dc *controller) getNewMachineSet(d *v1alpha1.MachineDeployment, isList, ol
needsUpdate = true
}
if needsUpdate {
_, err = dc.controlMachineClient.MachineDeployments(d.Namespace).UpdateStatus(d)
_, err = dc.controlMachineClient.MachineDeployments(d.Namespace).Update(d)
}
return createdIS, err
}
Expand Down Expand Up @@ -573,7 +573,7 @@ func (dc *controller) syncMachineDeploymentStatus(allISs []*v1alpha1.MachineSet,

newDeployment := d
newDeployment.Status = newStatus
_, err := dc.controlMachineClient.MachineDeployments(newDeployment.Namespace).UpdateStatus(newDeployment)
_, err := dc.controlMachineClient.MachineDeployments(newDeployment.Namespace).Update(newDeployment)
return err
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/controller/machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ func (c *controller) updateMachineStatus(
clone.Status.LastOperation = lastOperation
clone.Status.CurrentStatus = currentStatus

clone, err = c.controlMachineClient.Machines(clone.Namespace).UpdateStatus(clone)
clone, err = c.controlMachineClient.Machines(clone.Namespace).Update(clone)
if err != nil {
// Keep retrying until update goes through
glog.V(3).Infof("Warning: Updated failed, retrying, error: %q", err)
Expand Down Expand Up @@ -621,7 +621,7 @@ func (c *controller) updateMachineConditions(machine *v1alpha1.Machine, conditio
}

if objectRequiresUpdate {
clone, err = c.controlMachineClient.Machines(clone.Namespace).UpdateStatus(clone)
clone, err = c.controlMachineClient.Machines(clone.Namespace).Update(clone)
if err != nil {
// Keep retrying until update goes through
glog.Warningf("Updated failed, retrying, error: %q", err)
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/machine_safety.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func (c *controller) reconcileClusterMachineSafetyAPIServer(key string) error {
State: v1alpha1.MachineStateSuccessful,
Type: v1alpha1.MachineOperationHealthCheck,
}
_, err = c.controlMachineClient.Machines(c.namespace).UpdateStatus(machine)
_, err = c.controlMachineClient.Machines(c.namespace).Update(machine)
if err != nil {
glog.Warning(err)
return err
Expand Down
2 changes: 1 addition & 1 deletion pkg/openapi/openapi_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8870f1b

Please sign in to comment.