Apply object meta functions to controllers

This commit is contained in:
Marcin Wielgus 2016-08-21 13:02:55 +02:00
parent 66df63f618
commit b0ec300ce8
2 changed files with 6 additions and 4 deletions

View File

@ -263,7 +263,7 @@ func (nc *NamespaceController) reconcileNamespace(namespace string) {
return
}
desiredNamespace := &api_v1.Namespace{
ObjectMeta: baseNamespace.ObjectMeta,
ObjectMeta: util.CopyObjectMeta(baseNamespace.ObjectMeta),
Spec: baseNamespace.Spec,
}
@ -277,7 +277,7 @@ func (nc *NamespaceController) reconcileNamespace(namespace string) {
clusterNamespace := clusterNamespaceObj.(*api_v1.Namespace)
// Update existing namespace, if needed.
if !reflect.DeepEqual(desiredNamespace.ObjectMeta, clusterNamespace.ObjectMeta) ||
if !util.ObjectMetaEquivalent(desiredNamespace.ObjectMeta, clusterNamespace.ObjectMeta) ||
!reflect.DeepEqual(desiredNamespace.Spec, clusterNamespace.Spec) {
operations = append(operations, util.FederatedOperation{
Type: util.OperationTypeUpdate,

View File

@ -272,7 +272,7 @@ func (secretcontroller *SecretController) reconcileSecret(namespace string, secr
}
desiredSecret := &api_v1.Secret{
ObjectMeta: baseSecret.ObjectMeta,
ObjectMeta: util.CopyObjectMeta(baseSecret.ObjectMeta),
Data: baseSecret.Data,
Type: baseSecret.Type,
}
@ -287,7 +287,9 @@ func (secretcontroller *SecretController) reconcileSecret(namespace string, secr
clusterSecret := clusterSecretObj.(*api_v1.Secret)
// Update existing secret, if needed.
if !reflect.DeepEqual(desiredSecret.ObjectMeta, clusterSecret.ObjectMeta) {
if !util.ObjectMetaEquivalent(desiredSecret.ObjectMeta, clusterSecret.ObjectMeta) ||
!reflect.DeepEqual(desiredSecret.Data, clusterSecret.Data) ||
!reflect.DeepEqual(desiredSecret.Type, clusterSecret.Type) {
operations = append(operations, util.FederatedOperation{
Type: util.OperationTypeUpdate,
Obj: desiredSecret,