Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

removing rbac error checking from merge fn #3530

Merged
merged 2 commits into from
Jul 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions pkg/api/agentPoolOnlyApi/v20180331/merge.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
102 changes: 0 additions & 102 deletions pkg/api/agentPoolOnlyApi/v20180331/merge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down