Merge pull request #34609 from mwielgus/usespecandmeta

Automatic merge from submit-queue

Use ObjectMetaAndSpecEquivalent in federation controllers

Use util added in #34561.

cc: @quinton-hoole
pull/6/head
Kubernetes Submit Queue 2016-10-12 10:16:00 -07:00 committed by GitHub
commit 7d8c0fa0c9
4 changed files with 4 additions and 12 deletions

View File

@ -20,7 +20,6 @@ import (
"bytes"
"encoding/json"
"fmt"
"reflect"
"sort"
"time"
@ -489,8 +488,7 @@ func (fdc *DeploymentController) reconcileDeployment(key string) (reconciliation
currentLd := ldObj.(*extensionsv1.Deployment)
// Update existing replica set, if needed.
if !fedutil.ObjectMetaEquivalent(ld.ObjectMeta, currentLd.ObjectMeta) ||
!reflect.DeepEqual(ld.Spec, currentLd.Spec) {
if !fedutil.ObjectMetaAndSpecEquivalent(ld, currentLd) {
fdc.eventRecorder.Eventf(fd, api.EventTypeNormal, "UpdateInCluster",
"Updating deployment in cluster %s", clusterName)

View File

@ -18,7 +18,6 @@ package ingress
import (
"fmt"
"reflect"
"sync"
"time"
@ -711,8 +710,7 @@ func (ic *IngressController) reconcileIngress(ingress types.NamespacedName) {
glog.V(4).Infof(logStr, "Not transferring")
}
// Update existing cluster ingress, if needed.
if util.ObjectMetaEquivalent(baseIngress.ObjectMeta, clusterIngress.ObjectMeta) &&
reflect.DeepEqual(baseIngress.Spec, clusterIngress.Spec) {
if util.ObjectMetaAndSpecEquivalent(baseIngress, clusterIngress) {
glog.V(4).Infof("Ingress %q in cluster %q does not need an update: cluster ingress is equivalent to federated ingress", ingress, cluster.Name)
} else {
glog.V(4).Infof("Ingress %s in cluster %s needs an update: cluster ingress %v is not equivalent to federated ingress %v", ingress, cluster.Name, clusterIngress, desiredIngress)

View File

@ -18,7 +18,6 @@ package namespace
import (
"fmt"
"reflect"
"time"
federation_api "k8s.io/kubernetes/federation/apis/federation/v1beta1"
@ -289,8 +288,7 @@ func (nc *NamespaceController) reconcileNamespace(namespace string) {
clusterNamespace := clusterNamespaceObj.(*api_v1.Namespace)
// Update existing namespace, if needed.
if !util.ObjectMetaEquivalent(desiredNamespace.ObjectMeta, clusterNamespace.ObjectMeta) ||
!reflect.DeepEqual(desiredNamespace.Spec, clusterNamespace.Spec) {
if !util.ObjectMetaAndSpecEquivalent(desiredNamespace, clusterNamespace) {
nc.eventRecorder.Eventf(baseNamespace, api.EventTypeNormal, "UpdateInCluster",
"Updating namespace in cluster %s", cluster.Name)

View File

@ -20,7 +20,6 @@ import (
"bytes"
"encoding/json"
"fmt"
"reflect"
"sort"
"time"
@ -486,8 +485,7 @@ func (frsc *ReplicaSetController) reconcileReplicaSet(key string) (reconciliatio
} else {
currentLrs := lrsObj.(*extensionsv1.ReplicaSet)
// Update existing replica set, if needed.
if !fedutil.ObjectMetaEquivalent(lrs.ObjectMeta, currentLrs.ObjectMeta) ||
!reflect.DeepEqual(lrs.Spec, currentLrs.Spec) {
if !fedutil.ObjectMetaAndSpecEquivalent(lrs, currentLrs) {
frsc.eventRecorder.Eventf(frs, api.EventTypeNormal, "UpdateInCluster",
"Updating replicaset in cluster %s", clusterName)