Revert "controller: unit tests for overlapping and recreate deployments"
This commit is contained in:
@@ -73,8 +73,6 @@ type DeploymentController struct {
|
||||
|
||||
// To allow injection of syncDeployment for testing.
|
||||
syncHandler func(dKey string) error
|
||||
// used for unit testing
|
||||
enqueueDeployment func(deployment *extensions.Deployment)
|
||||
|
||||
// A store of deployments, populated by the dController
|
||||
dLister *cache.StoreToDeploymentLister
|
||||
@@ -136,8 +134,6 @@ func NewDeploymentController(dInformer informers.DeploymentInformer, rsInformer
|
||||
})
|
||||
|
||||
dc.syncHandler = dc.syncDeployment
|
||||
dc.enqueueDeployment = dc.enqueue
|
||||
|
||||
dc.dLister = dInformer.Lister()
|
||||
dc.rsLister = rsInformer.Lister()
|
||||
dc.podLister = podInformer.Lister()
|
||||
@@ -347,7 +343,7 @@ func (dc *DeploymentController) deletePod(obj interface{}) {
|
||||
}
|
||||
}
|
||||
|
||||
func (dc *DeploymentController) enqueue(deployment *extensions.Deployment) {
|
||||
func (dc *DeploymentController) enqueueDeployment(deployment *extensions.Deployment) {
|
||||
key, err := controller.KeyFunc(deployment)
|
||||
if err != nil {
|
||||
utilruntime.HandleError(fmt.Errorf("Couldn't get key for object %#v: %v", deployment, err))
|
||||
@@ -612,27 +608,14 @@ func (dc *DeploymentController) handleOverlap(d *extensions.Deployment, deployme
|
||||
// deployments if this one has been marked deleted, we only update its status as long
|
||||
// as it is not actually deleted.
|
||||
if foundOverlaps && d.DeletionTimestamp == nil {
|
||||
overlapping = true
|
||||
// Look at the overlapping annotation in both deployments. If one of them has it and points
|
||||
// to the other one then we don't need to compare their timestamps.
|
||||
otherOverlapsWith := otherD.Annotations[util.OverlapAnnotation]
|
||||
currentOverlapsWith := d.Annotations[util.OverlapAnnotation]
|
||||
// The other deployment is already marked as overlapping with the current one.
|
||||
if otherOverlapsWith == d.Name {
|
||||
var err error
|
||||
if d, err = dc.clearDeploymentOverlap(d, otherD.Name); err != nil {
|
||||
errs = append(errs, err)
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
otherCopy, err := util.DeploymentDeepCopy(otherD)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
overlapping = true
|
||||
|
||||
// Skip syncing this one if older overlapping one is found.
|
||||
if currentOverlapsWith == otherCopy.Name || util.SelectorUpdatedBefore(otherCopy, d) {
|
||||
if util.SelectorUpdatedBefore(otherCopy, d) {
|
||||
if _, err = dc.markDeploymentOverlap(d, otherCopy.Name); err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
Reference in New Issue
Block a user