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

fix: add masterSubnet to azuredeploy.parameters.json while using custom VNET #431

Closed
wants to merge 3 commits into from

Conversation

zhiweiv
Copy link
Contributor

@zhiweiv zhiweiv commented Feb 2, 2019

Reason for Change:

masterSubnet is used by Windows nodes, it is missing from azuredeploy.parameters.json while using custom VNET, we can add it to azuredeploy.parameters.json manually while building cluster as a workaround, however while scaling cluster, aks-engine updates the cluster directly, we don't get change to update the template, the new added Windows nodes do not join the cluster due to missing masterSubnet. This PR make it work at least while master and agents using same custom VNET.

Issue Fixed:

Fixes #210
Fixes #341

Requirements:

Notes:

@acs-bot acs-bot added the size/XS label Feb 2, 2019
@codecov
Copy link

codecov bot commented Feb 2, 2019

Codecov Report

Merging #431 into master will increase coverage by 13.85%.
The diff coverage is 100%.

@@             Coverage Diff             @@
##           master     #431       +/-   ##
===========================================
+ Coverage   53.38%   67.24%   +13.85%     
===========================================
  Files          95      121       +26     
  Lines       14374    20429     +6055     
===========================================
+ Hits         7674    13737     +6063     
+ Misses       6037     5809      -228     
- Partials      663      883      +220

@@ -64,6 +64,7 @@ func getParameters(cs *api.ContainerService, generatorCode string, aksEngineVers
}
if properties.OrchestratorProfile.IsKubernetes() {
addValue(parametersMap, "vnetCidr", properties.MasterProfile.VnetCidr)
addValue(parametersMap, "masterSubnet", properties.MasterProfile.VnetCidr)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are we not adding this in params_k8s.go ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Note to self: Check the pre-conditions for populating VnetCidr

Copy link
Contributor Author

Choose a reason for hiding this comment

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

if properties.MasterProfile.IsCustomVNET() {
	addValue(parametersMap, "masterVnetSubnetID", properties.MasterProfile.VnetSubnetID)
	if properties.MasterProfile.IsVirtualMachineScaleSets() {
		addValue(parametersMap, "agentVnetSubnetID", properties.MasterProfile.AgentVnetSubnetID)
	}
	if properties.OrchestratorProfile.IsKubernetes() {
		addValue(parametersMap, "vnetCidr", properties.MasterProfile.VnetCidr)
		addValue(parametersMap, "masterSubnet", properties.MasterProfile.VnetCidr)
	}
} else {
	addValue(parametersMap, "masterSubnet", properties.MasterProfile.Subnet)
	addValue(parametersMap, "agentSubnet", properties.MasterProfile.AgentSubnet)
}

This is the whole part of related code, masterSubnet is added in else condition, I followed this rule to add my code here. Do I need to move it to params_k8s.go?

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think setting redundant parameters is advisable. i.e having masterSubnet and VnetCidr point to the same value. If there are references to masterSubnet in windows scenarios. They should probably reference VnetCidr.

I'll let @PatrickLang chime in as well.

Copy link
Contributor Author

@zhiweiv zhiweiv Feb 6, 2019

Choose a reason for hiding this comment

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

The vnetCidr is not used in any condition now.

Copy link
Contributor

Choose a reason for hiding this comment

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

Then I believe we should change that to use VnetCidr, not duplicate values across different parameters.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There are a few parameters related to custom VNET, they are vnetCidr/kubeClusterCidr/masterSubnet/agentSubnet. vnetCidr is not used, agentSubnet is a null value. kubeClusterCidr and masterSubnet are added to azure cni's exception list only.

I guess there were some thoughts for custom VNET, but not fully implemented yet on Windows. From my side this PR is more as a workaround with minimal change to make things work.

@PatrickLang
Any ideas?

@PatrickLang
Copy link
Contributor

/LGTM

@jsturtevant - do you have anyone looking for this functionality and if so would you be able to help document this?

@acs-bot
Copy link

acs-bot commented Feb 11, 2019

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: PatrickLang, zhiweiv
To fully approve this pull request, please assign additional approvers.
We suggest the following additional approver: mboersma

If they are not already assigned, you can assign the PR to them by writing /assign @mboersma in a comment when ready.

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@tariq1890
Copy link
Contributor

/hold

@stale
Copy link

stale bot commented Mar 14, 2019

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Mar 14, 2019
@zhiweiv
Copy link
Contributor Author

zhiweiv commented Mar 14, 2019

@tariq1890 @PatrickLang @CecileRobertMichon
Do we have change to merge this to trunk, currently I am using local build with changes from this PR. It is inconvenient because I have to rebuild often to catch up new version.

@stale stale bot removed the stale label Mar 14, 2019
@CecileRobertMichon
Copy link
Contributor

/azp run pr-e2e

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@CecileRobertMichon
Copy link
Contributor

@tariq1890 what is still holding this PR?

@tariq1890
Copy link
Contributor

I am enquiring if there is a way instead of going for a workaround here. Having values duplicated across multiple parameters seems like a code/design smell to me.

@zhiweiv
Copy link
Contributor Author

zhiweiv commented Apr 3, 2019

The PR maybe not a good solution, I will keep using local build as workaround. AKS-Engine doesn't work for Windows nodes with custom VNET by default now, hope this can be fixed sometime.

@zhiweiv zhiweiv closed this Apr 3, 2019
@rogersollberger
Copy link

Is it true, this fix is still not in the current version (v0.35.1) ? So there is currently no way to use a hybrid setup with custom vnet than to manually add the mastersubnet after aks-engine generate to azuredeploy.parameters.json?

@zhiweiv
Copy link
Contributor Author

zhiweiv commented May 8, 2019

@rogersollberger
This PR is closed without being merged.
You can fork and modify the code like this PR on your branch, then use your own build of AKS-Engine, that is the way I am using now.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
6 participants