diff --git a/pkg/api/agentPoolOnlyApi/v20180331/merge.go b/pkg/api/agentPoolOnlyApi/v20180331/merge.go index ab75e3b4b3..f467119e33 100644 --- a/pkg/api/agentPoolOnlyApi/v20180331/merge.go +++ b/pkg/api/agentPoolOnlyApi/v20180331/merge.go @@ -42,19 +42,6 @@ func (mc *ManagedCluster) Merge(emc *ManagedCluster) error { mc.Properties.KubernetesVersion = emc.Properties.KubernetesVersion } - // Merge properties.enableRBAC - if emc.Properties.EnableRBAC == nil { - return errors.New("existing ManagedCluster expect properties.enableRBAC not to be nil") - } - - if mc.Properties.EnableRBAC == nil { - // For update scenario, the default behavior is to use existing behavior - mc.Properties.EnableRBAC = emc.Properties.EnableRBAC - } else if *mc.Properties.EnableRBAC != *emc.Properties.EnableRBAC { - return errors.Errorf("existing ManagedCluster has properties.enableRBAC %v. update to %v is not supported", - *emc.Properties.EnableRBAC, - *mc.Properties.EnableRBAC) - } if mc.Properties.NetworkProfile == nil { // For update scenario, the default behavior is to use existing behavior mc.Properties.NetworkProfile = emc.Properties.NetworkProfile diff --git a/pkg/api/agentPoolOnlyApi/v20180331/merge_test.go b/pkg/api/agentPoolOnlyApi/v20180331/merge_test.go index c81b9a7e05..fb9e3941c1 100644 --- a/pkg/api/agentPoolOnlyApi/v20180331/merge_test.go +++ b/pkg/api/agentPoolOnlyApi/v20180331/merge_test.go @@ -62,108 +62,6 @@ func TestMerge_DNSPrefix(t *testing.T) { } } -func TestMerge_EnableRBAC(t *testing.T) { - newMC := &ManagedCluster{ - Properties: &Properties{ - EnableRBAC: nil, - }, - } - - existingMC := &ManagedCluster{ - Properties: &Properties{ - DNSPrefix: "something", - EnableRBAC: helpers.PointerToBool(false), - }, - } - - e := newMC.Merge(existingMC) - if e != nil { - t.Error("expect error to be nil") - } - if newMC.Properties.EnableRBAC == nil || *newMC.Properties.EnableRBAC != false { - t.Error("expect EnableRBAC to be same with existing when omit in updating") - } - - newMC = &ManagedCluster{ - Properties: &Properties{ - EnableRBAC: nil, - }, - } - - existingMC = &ManagedCluster{ - Properties: &Properties{ - DNSPrefix: "something", - EnableRBAC: helpers.PointerToBool(true), - }, - } - - e = newMC.Merge(existingMC) - if e != nil { - t.Error("expect error to be nil") - } - if newMC.Properties.EnableRBAC == nil || *newMC.Properties.EnableRBAC != true { - t.Error("expect EnableRBAC to be same with existing when omit in updating") - } - - newMC = &ManagedCluster{ - Properties: &Properties{ - EnableRBAC: nil, - }, - } - - existingMC = &ManagedCluster{ - Properties: &Properties{ - DNSPrefix: "something", - EnableRBAC: nil, - }, - } - - e = newMC.Merge(existingMC) - if e == nil { - t.Error("expect error not to be nil") - } - - newMC = &ManagedCluster{ - Properties: &Properties{ - EnableRBAC: helpers.PointerToBool(true), - }, - } - - existingMC = &ManagedCluster{ - Properties: &Properties{ - DNSPrefix: "something", - EnableRBAC: helpers.PointerToBool(true), - }, - } - - e = newMC.Merge(existingMC) - if e != nil { - t.Error("expect error to be nil") - } - if newMC.Properties.EnableRBAC == nil || *newMC.Properties.EnableRBAC != true { - t.Error("expect EnableRBAC to be true") - } - - newMC = &ManagedCluster{ - Properties: &Properties{ - EnableRBAC: helpers.PointerToBool(false), - }, - } - - existingMC = &ManagedCluster{ - Properties: &Properties{ - DNSPrefix: "something", - EnableRBAC: helpers.PointerToBool(true), - }, - } - - e = newMC.Merge(existingMC) - if e == nil { - t.Error("expect error to be nil") - } - -} - func TestMerge_AAD(t *testing.T) { // Partial AAD profile was passed during update newMC := &ManagedCluster{