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

feat: Set EtcdDiskSizeGB max default size to 1023 if target platform is Azure Stack #1558

Merged
merged 2 commits into from
Jul 3, 2019
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
3 changes: 3 additions & 0 deletions pkg/api/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,9 @@ const (

// DefaultAzureStackFaultDomainCount set to 3 as Azure Stack today has minimum 4 node deployment.
DefaultAzureStackFaultDomainCount = 3

// MaxAzureStackManagedDiskSize = size for Kubernetes master etcd disk volumes in GB if > 10 nodes as this is max what Azure Stack supports today.
MaxAzureStackManagedDiskSize = "1023"
)

// WindowsProfile defaults
Expand Down
14 changes: 12 additions & 2 deletions pkg/api/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,19 @@ func (cs *ContainerService) setOrchestratorDefaults(isUpgrade, isScale bool) {
if "" == a.OrchestratorProfile.KubernetesConfig.EtcdDiskSizeGB {
switch {
case a.TotalNodes() > 20:
a.OrchestratorProfile.KubernetesConfig.EtcdDiskSizeGB = DefaultEtcdDiskSizeGT20Nodes
if a.IsAzureStackCloud() {
// Currently on Azure Stack max size of managed disk size is 1023GB.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rjaini do we know how much disk is required for 20 + nodes? The cluster will be not usable if the disc is out of space.
Another alternative is to limit the total count of agent nodes.
And we should raise the request to Disk RP on Azure Stack to support larger size of disk.

Copy link
Contributor Author

@rjaini rjaini Jul 2, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure about disk space requirements. But from #923 thread it looks like the 1024 size itself is very high.
I will check with Disk RP team to understand the reason of 1023 limit.

@mboersma : Do you know why we have such large disk size for higher number of nodes in AKS Engine ?.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Matt is out on vacation but see Azure/acs-engine#2435 for context.

a.OrchestratorProfile.KubernetesConfig.EtcdDiskSizeGB = MaxAzureStackManagedDiskSize
} else {
a.OrchestratorProfile.KubernetesConfig.EtcdDiskSizeGB = DefaultEtcdDiskSizeGT20Nodes
}
case a.TotalNodes() > 10:
a.OrchestratorProfile.KubernetesConfig.EtcdDiskSizeGB = DefaultEtcdDiskSizeGT10Nodes
if a.IsAzureStackCloud() {
// Currently on Azure Stack max size of managed disk size is 1023GB.
a.OrchestratorProfile.KubernetesConfig.EtcdDiskSizeGB = MaxAzureStackManagedDiskSize
} else {
a.OrchestratorProfile.KubernetesConfig.EtcdDiskSizeGB = DefaultEtcdDiskSizeGT10Nodes
}
case a.TotalNodes() > 3:
a.OrchestratorProfile.KubernetesConfig.EtcdDiskSizeGB = DefaultEtcdDiskSizeGT3Nodes
default:
Expand Down
126 changes: 126 additions & 0 deletions pkg/api/defaults_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2476,6 +2476,132 @@ func TestSetAgentProfileDefaultsOnAzureStack(t *testing.T) {
}
}

func TestEtcdDiskSizeOnAzureStack(t *testing.T) {
location := "testlocation"
mockCS := getMockBaseContainerService("1.11.6")
mockCS.Location = location
mockCS.Properties.MasterProfile.Count = 1
mockCS.Properties.OrchestratorProfile.OrchestratorType = Kubernetes
mockCS.Properties.CustomCloudProfile = &CustomCloudProfile{
PortalURL: "https://portal.testlocation.contoso.com",
}

httpmock.Activate()
defer httpmock.DeactivateAndReset()
httpmock.RegisterResponder("GET", fmt.Sprintf("%smetadata/endpoints?api-version=1.0", fmt.Sprintf("https://management.%s.contoso.com/", location)),
func(req *http.Request) (*http.Response, error) {
resp := httpmock.NewStringResponse(200, `{"galleryEndpoint":"https://galleryartifacts.hosting.testlocation.contoso.com/galleryartifacts/","graphEndpoint":"https://graph.testlocation.contoso.com/","portalEndpoint":"https://portal.testlocation.contoso.com/","authentication":{"loginEndpoint":"https://adfs.testlocation.contoso.com/adfs","audiences":["https://management.adfs.azurestack.testlocation/ce080287-be51-42e5-b99e-9de760fecae7"]}}`)
return resp, nil
},
)

mockCS.SetPropertiesDefaults(false, false)
if mockCS.Properties.OrchestratorProfile.KubernetesConfig.EtcdDiskSizeGB != DefaultEtcdDiskSize {
t.Fatalf("EtcdDiskSizeGB did not have the expected size, got %s, expected %s",
mockCS.Properties.OrchestratorProfile.KubernetesConfig.EtcdDiskSizeGB, DefaultEtcdDiskSize)
}

// Case where total node count is 5.
mockCS = getMockBaseContainerService("1.11.6")
mockCS.Location = location
mockCS.Properties.OrchestratorProfile.OrchestratorType = Kubernetes
mockCS.Properties.MasterProfile.Count = 5
mockCS.Properties.CustomCloudProfile = &CustomCloudProfile{
PortalURL: "https://portal.testlocation.contoso.com",
}

httpmock.DeactivateAndReset()
httpmock.Activate()
httpmock.RegisterResponder("GET", fmt.Sprintf("%smetadata/endpoints?api-version=1.0", fmt.Sprintf("https://management.%s.contoso.com/", location)),
func(req *http.Request) (*http.Response, error) {
resp := httpmock.NewStringResponse(200, `{"galleryEndpoint":"https://galleryartifacts.hosting.testlocation.contoso.com/galleryartifacts/","graphEndpoint":"https://graph.testlocation.contoso.com/","portalEndpoint":"https://portal.testlocation.contoso.com/","authentication":{"loginEndpoint":"https://adfs.testlocation.contoso.com/","audiences":["https://management.adfs.azurestack.testlocation/ce080287-be51-42e5-b99e-9de760fecae7"]}}`)
return resp, nil
},
)

mockCS.SetPropertiesDefaults(false, false)
if mockCS.Properties.OrchestratorProfile.KubernetesConfig.EtcdDiskSizeGB != DefaultEtcdDiskSizeGT3Nodes {
t.Fatalf("EtcdDiskSizeGB did not have the expected size, got %s, expected %s",
mockCS.Properties.OrchestratorProfile.KubernetesConfig.EtcdDiskSizeGB, DefaultEtcdDiskSizeGT3Nodes)
}

// Case where total node count is 11.
mockCS = getMockBaseContainerService("1.11.6")
mockCS.Location = location
mockCS.Properties.OrchestratorProfile.OrchestratorType = Kubernetes
mockCS.Properties.MasterProfile.Count = 5
mockCS.Properties.AgentPoolProfiles[0].Count = 6
mockCS.Properties.CustomCloudProfile = &CustomCloudProfile{
PortalURL: "https://portal.testlocation.contoso.com",
}

httpmock.DeactivateAndReset()
httpmock.Activate()
httpmock.RegisterResponder("GET", fmt.Sprintf("%smetadata/endpoints?api-version=1.0", fmt.Sprintf("https://management.%s.contoso.com/", location)),
func(req *http.Request) (*http.Response, error) {
resp := httpmock.NewStringResponse(200, `{"galleryEndpoint":"https://galleryartifacts.hosting.testlocation.contoso.com/galleryartifacts/","graphEndpoint":"https://graph.testlocation.contoso.com/","portalEndpoint":"https://portal.testlocation.contoso.com/","authentication":{"loginEndpoint":"https://adfs.testlocation.contoso.com/","audiences":["https://management.adfs.azurestack.testlocation/ce080287-be51-42e5-b99e-9de760fecae7"]}}`)
return resp, nil
},
)

mockCS.SetPropertiesDefaults(false, false)
if mockCS.Properties.OrchestratorProfile.KubernetesConfig.EtcdDiskSizeGB != MaxAzureStackManagedDiskSize {
t.Fatalf("EtcdDiskSizeGB did not have the expected size, got %s, expected %s",
mockCS.Properties.OrchestratorProfile.KubernetesConfig.EtcdDiskSizeGB, MaxAzureStackManagedDiskSize)
}

// Case where total node count is 21.
mockCS = getMockBaseContainerService("1.11.6")
mockCS.Location = location
mockCS.Properties.OrchestratorProfile.OrchestratorType = Kubernetes
mockCS.Properties.MasterProfile.Count = 5
mockCS.Properties.AgentPoolProfiles[0].Count = 16
mockCS.Properties.CustomCloudProfile = &CustomCloudProfile{
PortalURL: "https://portal.testlocation.contoso.com",
}

httpmock.DeactivateAndReset()
httpmock.Activate()
httpmock.RegisterResponder("GET", fmt.Sprintf("%smetadata/endpoints?api-version=1.0", fmt.Sprintf("https://management.%s.contoso.com/", location)),
func(req *http.Request) (*http.Response, error) {
resp := httpmock.NewStringResponse(200, `{"galleryEndpoint":"https://galleryartifacts.hosting.testlocation.contoso.com/galleryartifacts/","graphEndpoint":"https://graph.testlocation.contoso.com/","portalEndpoint":"https://portal.testlocation.contoso.com/","authentication":{"loginEndpoint":"https://adfs.testlocation.contoso.com/","audiences":["https://management.adfs.azurestack.testlocation/ce080287-be51-42e5-b99e-9de760fecae7"]}}`)
return resp, nil
},
)

mockCS.SetPropertiesDefaults(false, false)
if mockCS.Properties.OrchestratorProfile.KubernetesConfig.EtcdDiskSizeGB != MaxAzureStackManagedDiskSize {
t.Fatalf("EtcdDiskSizeGB did not have the expected size, got %s, expected %s",
mockCS.Properties.OrchestratorProfile.KubernetesConfig.EtcdDiskSizeGB, MaxAzureStackManagedDiskSize)
}

// Case where total node count is 55 but EtcdDiskSizeGB size is passed
mockCS = getMockBaseContainerService("1.11.6")
mockCS.Location = location
mockCS.Properties.OrchestratorProfile.OrchestratorType = Kubernetes
mockCS.Properties.MasterProfile.Count = 5
mockCS.Properties.AgentPoolProfiles[0].Count = 50
customEtcdDiskSize := "512"
mockCS.Properties.OrchestratorProfile.KubernetesConfig.EtcdDiskSizeGB = customEtcdDiskSize
mockCS.Properties.CustomCloudProfile = &CustomCloudProfile{
PortalURL: "https://portal.testlocation.contoso.com",
}

httpmock.DeactivateAndReset()
httpmock.Activate()
httpmock.RegisterResponder("GET", fmt.Sprintf("%smetadata/endpoints?api-version=1.0", fmt.Sprintf("https://management.%s.contoso.com/", location)),
func(req *http.Request) (*http.Response, error) {
resp := httpmock.NewStringResponse(200, `{"galleryEndpoint":"https://galleryartifacts.hosting.testlocation.contoso.com/galleryartifacts/","graphEndpoint":"https://graph.testlocation.contoso.com/","portalEndpoint":"https://portal.testlocation.contoso.com/","authentication":{"loginEndpoint":"https://adfs.testlocation.contoso.com/","audiences":["https://management.adfs.azurestack.testlocation/ce080287-be51-42e5-b99e-9de760fecae7"]}}`)
return resp, nil
},
)

mockCS.SetPropertiesDefaults(false, false)
if mockCS.Properties.OrchestratorProfile.KubernetesConfig.EtcdDiskSizeGB != customEtcdDiskSize {
t.Fatalf("EtcdDiskSizeGB did not have the expected size, got %s, expected %s",
mockCS.Properties.OrchestratorProfile.KubernetesConfig.EtcdDiskSizeGB, customEtcdDiskSize)
}
}
func TestPreserveNodesProperties(t *testing.T) {
mockCS := getMockBaseContainerService("1.10.8")
mockCS.SetPropertiesDefaults(false, false)
Expand Down