From 7a3d40786b4b5c716dc122fc92e1b21d417bda24 Mon Sep 17 00:00:00 2001 From: kargakis Date: Tue, 23 Feb 2016 19:30:14 +0100 Subject: [PATCH] switch internal field to int64 --- pkg/apis/extensions/types.go | 2 +- pkg/apis/extensions/validation/validation.go | 2 +- pkg/controller/deployment/deployment_controller.go | 4 ++-- test/e2e/util.go | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/apis/extensions/types.go b/pkg/apis/extensions/types.go index b061a333a9b..6b46cb6074e 100644 --- a/pkg/apis/extensions/types.go +++ b/pkg/apis/extensions/types.go @@ -333,7 +333,7 @@ type RollingUpdateDeployment struct { type DeploymentStatus struct { // The generation observed by the deployment controller. - ObservedGeneration int `json:"observedGeneration,omitempty"` + ObservedGeneration int64 `json:"observedGeneration,omitempty"` // Total number of non-terminated pods targeted by this deployment (their labels match the selector). Replicas int `json:"replicas,omitempty"` diff --git a/pkg/apis/extensions/validation/validation.go b/pkg/apis/extensions/validation/validation.go index 42f317bde75..157dc87dacc 100644 --- a/pkg/apis/extensions/validation/validation.go +++ b/pkg/apis/extensions/validation/validation.go @@ -332,7 +332,7 @@ func ValidateDeploymentSpec(spec *extensions.DeploymentSpec, fldPath *field.Path // Validates given deployment status. func ValidateDeploymentStatus(status *extensions.DeploymentStatus, fldPath *field.Path) field.ErrorList { allErrs := field.ErrorList{} - allErrs = append(allErrs, apivalidation.ValidateNonnegativeField(int64(status.ObservedGeneration), fldPath.Child("observedGeneration"))...) + allErrs = append(allErrs, apivalidation.ValidateNonnegativeField(status.ObservedGeneration, fldPath.Child("observedGeneration"))...) allErrs = append(allErrs, apivalidation.ValidateNonnegativeField(int64(status.Replicas), fldPath.Child("replicas"))...) allErrs = append(allErrs, apivalidation.ValidateNonnegativeField(int64(status.UpdatedReplicas), fldPath.Child("updatedReplicas"))...) allErrs = append(allErrs, apivalidation.ValidateNonnegativeField(int64(status.AvailableReplicas), fldPath.Child("availableReplicas"))...) diff --git a/pkg/controller/deployment/deployment_controller.go b/pkg/controller/deployment/deployment_controller.go index 939e5536b6a..8b6a4205807 100644 --- a/pkg/controller/deployment/deployment_controller.go +++ b/pkg/controller/deployment/deployment_controller.go @@ -582,7 +582,7 @@ func (dc *DeploymentController) syncDeploymentStatus(allRSs []*extensions.Replic if err != nil { return err } - if d.Status.Replicas != totalReplicas || d.Status.UpdatedReplicas != updatedReplicas || d.Status.AvailableReplicas != availableReplicas || int(d.Generation) > d.Status.ObservedGeneration { + if d.Generation > d.Status.ObservedGeneration || d.Status.Replicas != totalReplicas || d.Status.UpdatedReplicas != updatedReplicas || d.Status.AvailableReplicas != availableReplicas { return dc.updateDeploymentStatus(allRSs, newRS, d) } return nil @@ -1037,7 +1037,7 @@ func (dc *DeploymentController) updateDeploymentStatus(allRSs []*extensions.Repl // TODO: Reconcile this with API definition. API definition talks about ready pods, while this just computes created pods. newDeployment.Status = extensions.DeploymentStatus{ // TODO: Ensure that if we start retrying status updates, we won't pick up a new Generation value. - ObservedGeneration: int(deployment.Generation), + ObservedGeneration: deployment.Generation, Replicas: totalReplicas, UpdatedReplicas: updatedReplicas, AvailableReplicas: availableReplicas, diff --git a/test/e2e/util.go b/test/e2e/util.go index 617433f5df0..849ef8bd81d 100644 --- a/test/e2e/util.go +++ b/test/e2e/util.go @@ -2192,7 +2192,7 @@ func waitForObservedDeployment(c *clientset.Clientset, ns, deploymentName string if err != nil { return false, err } - return int(deployment.Generation) == deployment.Status.ObservedGeneration, nil + return deployment.Generation == deployment.Status.ObservedGeneration, nil }) }