Skip to content

Commit

Permalink
Remove MasterProfile that AgentBaker doesn't use. (Azure#376)
Browse files Browse the repository at this point in the history
  • Loading branch information
yizhang4321 authored Oct 14, 2020
1 parent 8606139 commit 34d2f86
Show file tree
Hide file tree
Showing 13 changed files with 20 additions and 323 deletions.
3 changes: 0 additions & 3 deletions cmd/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,6 @@ func (gc *generateCmd) run(cloudSpecConfig *datamodel.AzureEnvironmentSpecConfig
gc.containerService.Properties.HostedMasterProfile = &datamodel.HostedMasterProfile{
FQDN: "abc.aks.com",
}
gc.containerService.Properties.MasterProfile.VnetCidr = "vnetcidr"
gc.containerService.Properties.MasterProfile.VnetSubnetID = "VnetSubnetID"
fmt.Printf("Cs%++v", gc.containerService.Properties.MasterProfile)
fmt.Printf("Cs%++v", gc.containerService.Properties)

config := &agent.NodeBootstrappingConfiguration{
Expand Down
9 changes: 1 addition & 8 deletions pkg/agent/datamodel/mocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ func CreateMockContainerService(containerServiceName, orchestratorVersion string

cs.Properties = &Properties{}

cs.Properties.MasterProfile = &MasterProfile{}
cs.Properties.MasterProfile.Count = masterCount
cs.Properties.MasterProfile.DNSPrefix = "testmaster"
cs.Properties.MasterProfile.VMSize = "Standard_D2_v2"

cs.Properties.AgentPoolProfiles = []*AgentPoolProfile{}
agentPool := &AgentPoolProfile{}
agentPool.Count = agentCount
Expand Down Expand Up @@ -102,10 +97,8 @@ func GetK8sDefaultProperties(hasWindows bool) *Properties {
OrchestratorType: Kubernetes,
KubernetesConfig: &KubernetesConfig{},
},
MasterProfile: &MasterProfile{
Count: 1,
HostedMasterProfile: &HostedMasterProfile{
DNSPrefix: "foo",
VMSize: "Standard_DS2_v2",
},
AgentPoolProfiles: []*AgentPoolProfile{
{
Expand Down
43 changes: 0 additions & 43 deletions pkg/agent/datamodel/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -499,48 +499,6 @@ type CustomFile struct {
Dest string `json:"dest,omitempty"`
}

// MasterProfile represents the definition of the master cluster
type MasterProfile struct {
Count int `json:"count"`
DNSPrefix string `json:"dnsPrefix"`
SubjectAltNames []string `json:"subjectAltNames"`
VMSize string `json:"vmSize"`
OSDiskSizeGB int `json:"osDiskSizeGB,omitempty"`
VnetSubnetID string `json:"vnetSubnetID,omitempty"`
VnetCidr string `json:"vnetCidr,omitempty"`
AgentVnetSubnetID string `json:"agentVnetSubnetID,omitempty"`
FirstConsecutiveStaticIP string `json:"firstConsecutiveStaticIP,omitempty"`
Subnet string `json:"subnet"`
SubnetIPv6 string `json:"subnetIPv6"`
IPAddressCount int `json:"ipAddressCount,omitempty"`
StorageProfile string `json:"storageProfile,omitempty"`
HTTPSourceAddressPrefix string `json:"HTTPSourceAddressPrefix,omitempty"`
OAuthEnabled bool `json:"oauthEnabled"`
PreprovisionExtension *Extension `json:"preProvisionExtension"`
Extensions []Extension `json:"extensions"`
Distro Distro `json:"distro,omitempty"`
KubernetesConfig *KubernetesConfig `json:"kubernetesConfig,omitempty"`
ImageRef *ImageReference `json:"imageReference,omitempty"`
CustomFiles *[]CustomFile `json:"customFiles,omitempty"`
AvailabilityProfile string `json:"availabilityProfile"`
PlatformFaultDomainCount *int `json:"platformFaultDomainCount"`
PlatformUpdateDomainCount *int `json:"platformUpdateDomainCount"`
AgentSubnet string `json:"agentSubnet,omitempty"`
AvailabilityZones []string `json:"availabilityZones,omitempty"`
SinglePlacementGroup *bool `json:"singlePlacementGroup,omitempty"`
AuditDEnabled *bool `json:"auditDEnabled,omitempty"`
UltraSSDEnabled *bool `json:"ultraSSDEnabled,omitempty"`
EncryptionAtHost *bool `json:"encryptionAtHost,omitempty"`
CustomVMTags map[string]string `json:"customVMTags,omitempty"`
// Master LB public endpoint/FQDN with port
// The format will be FQDN:2376
// Not used during PUT, returned as part of GET
FQDN string `json:"fqdn,omitempty"`
// True: uses cosmos etcd endpoint instead of installing etcd on masters
CosmosEtcd *bool `json:"cosmosEtcd,omitempty"`
ProximityPlacementGroupID string `json:"proximityPlacementGroupID,omitempty"`
}

// OrchestratorProfile contains Orchestrator properties
type OrchestratorProfile struct {
OrchestratorType string `json:"orchestratorType"`
Expand Down Expand Up @@ -610,7 +568,6 @@ type Properties struct {
ClusterID string
ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
OrchestratorProfile *OrchestratorProfile `json:"orchestratorProfile,omitempty"`
MasterProfile *MasterProfile `json:"masterProfile,omitempty"`
AgentPoolProfiles []*AgentPoolProfile `json:"agentPoolProfiles,omitempty"`
LinuxProfile *LinuxProfile `json:"linuxProfile,omitempty"`
WindowsProfile *WindowsProfile `json:"windowsProfile,omitempty"`
Expand Down
70 changes: 2 additions & 68 deletions pkg/agent/datamodel/types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,6 @@ func TestPropertiesIsIPMasqAgentDisabled(t *testing.T) {

func TestOSType(t *testing.T) {
p := Properties{
MasterProfile: &MasterProfile{
Distro: AKSUbuntu1604,
},
AgentPoolProfiles: []*AgentPoolProfile{
{
OSType: Linux,
Expand Down Expand Up @@ -243,10 +240,6 @@ func TestHasAvailabilityZones(t *testing.T) {
}{
{
p: Properties{
MasterProfile: &MasterProfile{
Count: 1,
AvailabilityZones: []string{"1", "2"},
},
AgentPoolProfiles: []*AgentPoolProfile{
{
Count: 1,
Expand All @@ -263,9 +256,6 @@ func TestHasAvailabilityZones(t *testing.T) {
},
{
p: Properties{
MasterProfile: &MasterProfile{
Count: 1,
},
AgentPoolProfiles: []*AgentPoolProfile{
{
Count: 1,
Expand All @@ -281,9 +271,6 @@ func TestHasAvailabilityZones(t *testing.T) {
},
{
p: Properties{
MasterProfile: &MasterProfile{
Count: 1,
},
AgentPoolProfiles: []*AgentPoolProfile{
{
Count: 1,
Expand Down Expand Up @@ -804,7 +791,7 @@ func TestGetSubnetName(t *testing.T) {
expectedSubnetName string
}{
{
name: "Cluster with HosterMasterProfile",
name: "Cluster with HostedMasterProfile",
properties: &Properties{
OrchestratorProfile: &OrchestratorProfile{
OrchestratorType: Kubernetes,
Expand All @@ -826,7 +813,7 @@ func TestGetSubnetName(t *testing.T) {
expectedSubnetName: "aks-subnet",
},
{
name: "Cluster with HosterMasterProfile and custom VNET",
name: "Cluster with HostedMasterProfile and custom VNET",
properties: &Properties{
OrchestratorProfile: &OrchestratorProfile{
OrchestratorType: Kubernetes,
Expand Down Expand Up @@ -1091,15 +1078,10 @@ func TestAgentPoolProfileIsVHDDistro(t *testing.T) {
func TestUbuntuVersion(t *testing.T) {
cases := []struct {
p Properties
expectedAgent1604 bool
expectedAgent1804 bool
}{
{
p: Properties{
MasterProfile: &MasterProfile{
Count: 1,
Distro: AKSUbuntu1604,
},
AgentPoolProfiles: []*AgentPoolProfile{
{
Count: 1,
Expand All @@ -1108,31 +1090,21 @@ func TestUbuntuVersion(t *testing.T) {
},
},
},
expectedAgent1604: true,
expectedAgent1804: false,
},
{
p: Properties{
MasterProfile: &MasterProfile{
Count: 1,
Distro: AKSUbuntu1804,
},
AgentPoolProfiles: []*AgentPoolProfile{
{
Count: 1,
Distro: AKSUbuntu1604,
},
},
},
expectedAgent1604: true,
expectedAgent1804: false,
},
{
p: Properties{
MasterProfile: &MasterProfile{
Count: 1,
Distro: Ubuntu,
},
AgentPoolProfiles: []*AgentPoolProfile{
{
Count: 1,
Expand All @@ -1141,7 +1113,6 @@ func TestUbuntuVersion(t *testing.T) {
},
},
},
expectedAgent1604: false,
expectedAgent1804: false,
},
}
Expand All @@ -1160,9 +1131,6 @@ func TestIsCustomVNET(t *testing.T) {
}{
{
p: Properties{
MasterProfile: &MasterProfile{
VnetSubnetID: "testSubnet",
},
AgentPoolProfiles: []*AgentPoolProfile{
{
VnetSubnetID: "testSubnet",
Expand All @@ -1173,9 +1141,6 @@ func TestIsCustomVNET(t *testing.T) {
},
{
p: Properties{
MasterProfile: &MasterProfile{
Count: 1,
},
AgentPoolProfiles: []*AgentPoolProfile{
{
Count: 1,
Expand Down Expand Up @@ -1314,9 +1279,6 @@ func TestHasStorageProfile(t *testing.T) {
{
name: "Storage Account",
p: Properties{
MasterProfile: &MasterProfile{
StorageProfile: StorageAccount,
},
AgentPoolProfiles: []*AgentPoolProfile{
{
StorageProfile: StorageAccount,
Expand All @@ -1337,9 +1299,6 @@ func TestHasStorageProfile(t *testing.T) {
{
name: "Managed Disk",
p: Properties{
MasterProfile: &MasterProfile{
StorageProfile: ManagedDisks,
},
AgentPoolProfiles: []*AgentPoolProfile{
{
StorageProfile: StorageAccount,
Expand All @@ -1358,9 +1317,6 @@ func TestHasStorageProfile(t *testing.T) {
{
name: "both",
p: Properties{
MasterProfile: &MasterProfile{
StorageProfile: StorageAccount,
},
AgentPoolProfiles: []*AgentPoolProfile{
{
StorageProfile: ManagedDisks,
Expand All @@ -1382,9 +1338,6 @@ func TestHasStorageProfile(t *testing.T) {
OrchestratorProfile: &OrchestratorProfile{
OrchestratorType: Kubernetes,
},
MasterProfile: &MasterProfile{
StorageProfile: ManagedDisks,
},
AgentPoolProfiles: []*AgentPoolProfile{
{
StorageProfile: ManagedDisks,
Expand All @@ -1407,9 +1360,6 @@ func TestHasStorageProfile(t *testing.T) {
OrchestratorProfile: &OrchestratorProfile{
OrchestratorType: Kubernetes,
},
MasterProfile: &MasterProfile{
StorageProfile: ManagedDisks,
},
AgentPoolProfiles: []*AgentPoolProfile{
{
StorageProfile: Ephemeral,
Expand Down Expand Up @@ -1437,9 +1387,6 @@ func TestHasStorageProfile(t *testing.T) {
},
},
},
MasterProfile: &MasterProfile{
StorageProfile: StorageAccount,
},
AgentPoolProfiles: []*AgentPoolProfile{
{
StorageProfile: StorageAccount,
Expand Down Expand Up @@ -1467,9 +1414,6 @@ func TestHasStorageProfile(t *testing.T) {
},
},
},
MasterProfile: &MasterProfile{
StorageProfile: ManagedDisks,
},
AgentPoolProfiles: []*AgentPoolProfile{
{
StorageProfile: ManagedDisks,
Expand All @@ -1489,9 +1433,6 @@ func TestHasStorageProfile(t *testing.T) {
OrchestratorProfile: &OrchestratorProfile{
OrchestratorType: Kubernetes,
},
MasterProfile: &MasterProfile{
StorageProfile: ManagedDisks,
},
AgentPoolProfiles: []*AgentPoolProfile{
{
StorageProfile: ManagedDisks,
Expand All @@ -1517,10 +1458,6 @@ func TestHasStorageProfile(t *testing.T) {
OrchestratorProfile: &OrchestratorProfile{
OrchestratorType: Kubernetes,
},
MasterProfile: &MasterProfile{
StorageProfile: ManagedDisks,
EncryptionAtHost: to.BoolPtr(true),
},
AgentPoolProfiles: []*AgentPoolProfile{
{
StorageProfile: ManagedDisks,
Expand All @@ -1546,9 +1483,6 @@ func TestHasStorageProfile(t *testing.T) {
c := c
t.Run(c.name, func(t *testing.T) {
t.Parallel()
if to.Bool(c.p.MasterProfile.EncryptionAtHost) != c.expectedEncryptionAtHost {
t.Fatalf("expected EncryptionAtHost to return %v but instead returned %v", c.expectedEncryptionAtHost, to.Bool(c.p.MasterProfile.EncryptionAtHost))
}
if c.p.OrchestratorProfile != nil && c.p.OrchestratorProfile.KubernetesConfig.PrivateJumpboxProvision() != c.expectedPrivateJB {
t.Fatalf("expected PrivateJumpboxProvision() to return %t but instead returned %t", c.expectedPrivateJB, c.p.OrchestratorProfile.KubernetesConfig.PrivateJumpboxProvision())
}
Expand Down
6 changes: 1 addition & 5 deletions pkg/aks-engine/api/apiloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,7 @@ func LoadDefaultContainerServiceProperties() (datamodel.TypeMeta, *datamodel.Pro
OrchestratorProfile: &datamodel.OrchestratorProfile{
OrchestratorType: defaultOrchestrator,
},
MasterProfile: &datamodel.MasterProfile{
Count: defaultMasterCount,
VMSize: defaultVMSize,
OSDiskSizeGB: defaultOSDiskSizeGB,
},
HostedMasterProfile: &datamodel.HostedMasterProfile{},
AgentPoolProfiles: []*datamodel.AgentPoolProfile{
{
Name: defaultAgentPoolName,
Expand Down
Loading

0 comments on commit 34d2f86

Please sign in to comment.