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

chore: force external cloud provider for Kubernetes v1.21+ on Azure Stack Hub #4849

Merged
merged 6 commits into from
Mar 3, 2022

Conversation

haofan-ms
Copy link
Contributor

Reason for Change:

Start Kubernetes 1.21, only external cloud provider is supported on Azure Stack cloud. Adding the logic to enforce that for deploy and upgrade operations.

Issue Fixed:

Credit Where Due:

Does this change contain code from or inspired by another project?

  • No
  • Yes

If "Yes," did you notify that project's maintainers and provide attribution?

  • No
  • Yes

Requirements:

Notes:

@@ -926,6 +926,18 @@ func (cs *ContainerService) setAddonsConfig(isUpgrade bool) {
}
}

// Ensure cloud-node-manager is enabled on appropriate upgrades for Azure Stack cloud
if isUpgrade &&
Copy link
Member

Choose a reason for hiding this comment

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

do we need to check for to.Bool(cs.Properties.OrchestratorProfile.KubernetesConfig.UseCloudControllerManager) && common.IsKubernetesVersionGe(o.OrchestratorVersion, "1.21.0"?

The UseCCM flag is overridden already and supported version list starts on 1.21

Copy link
Member

Choose a reason for hiding this comment

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

The UseCCM flag is overridden already

I am assuming that upgrade.go is executed first

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, upgrade.go executed first, I will remove the check for k8s version

to.Bool(cs.Properties.OrchestratorProfile.KubernetesConfig.UseCloudControllerManager) &&
common.IsKubernetesVersionGe(o.OrchestratorVersion, "1.21.0") {
// Force enabling cloud-node-manager addon
log.Infoln("Updating cloud-node-manager addon to 'true' on Azure Stack cloud...")
Copy link
Member

Choose a reason for hiding this comment

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

I am not sure this message is adding relevant information given that upgrade.go is already logging something similar.

If you see extra value, then I would use the debug level instead of info

Copy link
Contributor Author

Choose a reason for hiding this comment

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

unnecessary log removed

@@ -147,6 +149,18 @@ func (cs *ContainerService) setComponentsConfig(isUpgrade bool) {
}
}

// Ensure cloud-controller-manager is enabled on appropriate upgrades for Azure Stack cloud
Copy link
Member

Choose a reason for hiding this comment

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

Same comments as addons.go

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated

@@ -300,6 +300,10 @@ func (a *Properties) ValidateOrchestratorProfile(isUpdate bool) error {
}

if a.IsAzureStackCloud() {
if common.IsKubernetesVersionGe(a.OrchestratorProfile.OrchestratorVersion, "1.21.0") && !to.Bool(o.KubernetesConfig.UseCloudControllerManager) {
return errors.New("useCloudControllerManager should be set to true for Kubernetes 1.21+ cluster on Azure Stack")
Copy link
Member

@jadarsie jadarsie Feb 28, 2022

Choose a reason for hiding this comment

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

v1.21+ instead of 1.21+

Could you please update the messages so they read Azure Stack Hub instead of Azure Stack?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated

@jadarsie jadarsie changed the title chore: Enforce using external cloud provider for Kubernetes 1.21+ on Azure Stack cloud chore: force external cloud provider for Kubernetes v1.21+ on Azure Stack Hub Feb 28, 2022
jadarsie
jadarsie previously approved these changes Feb 28, 2022
@@ -77,6 +77,9 @@ func (cs *ContainerService) setKubeletConfig(isUpgrade bool) {
staticWindowsKubeletConfig["--image-pull-progress-deadline"] = "20m"
staticWindowsKubeletConfig["--resolv-conf"] = "\"\"\"\""
staticWindowsKubeletConfig["--eviction-hard"] = "\"\"\"\""
if to.Bool(o.KubernetesConfig.UseCloudControllerManager) {
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this is necessary. Windows nodes are never used as control plane nodes, and worker node kubelet runtimes don't have a functional "external cloud-provider" context.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, I will remove this

@@ -191,6 +194,10 @@ func (cs *ContainerService) setKubeletConfig(isUpgrade bool) {
// if upgrade, force default "--pod-infra-container-image" value
cs.Properties.MasterProfile.KubernetesConfig.KubeletConfig["--pod-infra-container-image"] = o.KubernetesConfig.KubeletConfig["--pod-infra-container-image"]
}
//Ensure cloud-provider setting
Copy link
Member

Choose a reason for hiding this comment

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

We don't need this, this is already being taken care of in L152-L154

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is to ensure the KubeletConfig in MasterProfile get updated when we upgrade from a in-tree cloud-provider cluster to a external cloud-provider. Without this line, the previous value for this field will not get overwritten.

Copy link
Member

Choose a reason for hiding this comment

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

O.K., thanks for clarifying

@@ -300,6 +300,10 @@ func (a *Properties) ValidateOrchestratorProfile(isUpdate bool) error {
}

if a.IsAzureStackCloud() {
if common.IsKubernetesVersionGe(a.OrchestratorProfile.OrchestratorVersion, "1.21.0") && !to.Bool(o.KubernetesConfig.UseCloudControllerManager) {
Copy link
Member

Choose a reason for hiding this comment

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

This validation happens before defaults enforcement, so this is going to throw an error every time a user tries to create a cluster with an empty UseCloudControllerManager configuration

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, that's what we want. We want users to add this UseCloudControllerManager: true in the apimodel for v1.21+ clusters on Azure Stack Hub, and be aware of the existence of external cloud-provider in these clusters.

Copy link
Member

@jackfrancis jackfrancis left a comment

Choose a reason for hiding this comment

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

/lgtm

@jackfrancis jackfrancis merged commit 4d203b2 into Azure:master Mar 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants