mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +00:00 
			
		
		
		
	Use ObjectMetaAndSpecEquivalent in federation controllers
This commit is contained in:
		@@ -20,7 +20,6 @@ import (
 | 
				
			|||||||
	"bytes"
 | 
						"bytes"
 | 
				
			||||||
	"encoding/json"
 | 
						"encoding/json"
 | 
				
			||||||
	"fmt"
 | 
						"fmt"
 | 
				
			||||||
	"reflect"
 | 
					 | 
				
			||||||
	"sort"
 | 
						"sort"
 | 
				
			||||||
	"time"
 | 
						"time"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -489,8 +488,7 @@ func (fdc *DeploymentController) reconcileDeployment(key string) (reconciliation
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
			currentLd := ldObj.(*extensionsv1.Deployment)
 | 
								currentLd := ldObj.(*extensionsv1.Deployment)
 | 
				
			||||||
			// Update existing replica set, if needed.
 | 
								// Update existing replica set, if needed.
 | 
				
			||||||
			if !fedutil.ObjectMetaEquivalent(ld.ObjectMeta, currentLd.ObjectMeta) ||
 | 
								if !fedutil.ObjectMetaAndSpecEquivalent(ld, currentLd) {
 | 
				
			||||||
				!reflect.DeepEqual(ld.Spec, currentLd.Spec) {
 | 
					 | 
				
			||||||
				fdc.eventRecorder.Eventf(fd, api.EventTypeNormal, "UpdateInCluster",
 | 
									fdc.eventRecorder.Eventf(fd, api.EventTypeNormal, "UpdateInCluster",
 | 
				
			||||||
					"Updating deployment in cluster %s", clusterName)
 | 
										"Updating deployment in cluster %s", clusterName)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -18,7 +18,6 @@ package ingress
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import (
 | 
					import (
 | 
				
			||||||
	"fmt"
 | 
						"fmt"
 | 
				
			||||||
	"reflect"
 | 
					 | 
				
			||||||
	"sync"
 | 
						"sync"
 | 
				
			||||||
	"time"
 | 
						"time"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -711,8 +710,7 @@ func (ic *IngressController) reconcileIngress(ingress types.NamespacedName) {
 | 
				
			|||||||
				glog.V(4).Infof(logStr, "Not transferring")
 | 
									glog.V(4).Infof(logStr, "Not transferring")
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			// Update existing cluster ingress, if needed.
 | 
								// Update existing cluster ingress, if needed.
 | 
				
			||||||
			if util.ObjectMetaEquivalent(baseIngress.ObjectMeta, clusterIngress.ObjectMeta) &&
 | 
								if util.ObjectMetaAndSpecEquivalent(baseIngress, clusterIngress) {
 | 
				
			||||||
				reflect.DeepEqual(baseIngress.Spec, clusterIngress.Spec) {
 | 
					 | 
				
			||||||
				glog.V(4).Infof("Ingress %q in cluster %q does not need an update: cluster ingress is equivalent to federated ingress", ingress, cluster.Name)
 | 
									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 {
 | 
								} 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)
 | 
									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)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -18,7 +18,6 @@ package namespace
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import (
 | 
					import (
 | 
				
			||||||
	"fmt"
 | 
						"fmt"
 | 
				
			||||||
	"reflect"
 | 
					 | 
				
			||||||
	"time"
 | 
						"time"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	federation_api "k8s.io/kubernetes/federation/apis/federation/v1beta1"
 | 
						federation_api "k8s.io/kubernetes/federation/apis/federation/v1beta1"
 | 
				
			||||||
@@ -289,8 +288,7 @@ func (nc *NamespaceController) reconcileNamespace(namespace string) {
 | 
				
			|||||||
			clusterNamespace := clusterNamespaceObj.(*api_v1.Namespace)
 | 
								clusterNamespace := clusterNamespaceObj.(*api_v1.Namespace)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			// Update existing namespace, if needed.
 | 
								// Update existing namespace, if needed.
 | 
				
			||||||
			if !util.ObjectMetaEquivalent(desiredNamespace.ObjectMeta, clusterNamespace.ObjectMeta) ||
 | 
								if !util.ObjectMetaAndSpecEquivalent(desiredNamespace, clusterNamespace) {
 | 
				
			||||||
				!reflect.DeepEqual(desiredNamespace.Spec, clusterNamespace.Spec) {
 | 
					 | 
				
			||||||
				nc.eventRecorder.Eventf(baseNamespace, api.EventTypeNormal, "UpdateInCluster",
 | 
									nc.eventRecorder.Eventf(baseNamespace, api.EventTypeNormal, "UpdateInCluster",
 | 
				
			||||||
					"Updating namespace in cluster %s", cluster.Name)
 | 
										"Updating namespace in cluster %s", cluster.Name)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -20,7 +20,6 @@ import (
 | 
				
			|||||||
	"bytes"
 | 
						"bytes"
 | 
				
			||||||
	"encoding/json"
 | 
						"encoding/json"
 | 
				
			||||||
	"fmt"
 | 
						"fmt"
 | 
				
			||||||
	"reflect"
 | 
					 | 
				
			||||||
	"sort"
 | 
						"sort"
 | 
				
			||||||
	"time"
 | 
						"time"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -486,8 +485,7 @@ func (frsc *ReplicaSetController) reconcileReplicaSet(key string) (reconciliatio
 | 
				
			|||||||
		} else {
 | 
							} else {
 | 
				
			||||||
			currentLrs := lrsObj.(*extensionsv1.ReplicaSet)
 | 
								currentLrs := lrsObj.(*extensionsv1.ReplicaSet)
 | 
				
			||||||
			// Update existing replica set, if needed.
 | 
								// Update existing replica set, if needed.
 | 
				
			||||||
			if !fedutil.ObjectMetaEquivalent(lrs.ObjectMeta, currentLrs.ObjectMeta) ||
 | 
								if !fedutil.ObjectMetaAndSpecEquivalent(lrs, currentLrs) {
 | 
				
			||||||
				!reflect.DeepEqual(lrs.Spec, currentLrs.Spec) {
 | 
					 | 
				
			||||||
				frsc.eventRecorder.Eventf(frs, api.EventTypeNormal, "UpdateInCluster",
 | 
									frsc.eventRecorder.Eventf(frs, api.EventTypeNormal, "UpdateInCluster",
 | 
				
			||||||
					"Updating replicaset in cluster %s", clusterName)
 | 
										"Updating replicaset in cluster %s", clusterName)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user