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

fix: networkplugin conversion only if networkpolicy is empty #1823

Merged
merged 3 commits into from
Aug 21, 2019

Conversation

jackfrancis
Copy link
Member

@jackfrancis jackfrancis commented Aug 20, 2019

Reason for Change:

This PR adds unit test coverage to generate + validate as vlabs (the new default flow with #1766), and fixes a faulty bit of logic in automatically setting the networkPlugin to the default value during "vlabs to unversioned" api model conversion.

This work reflects the fact that one of the examples api models we use to perform E2E tests was broken with the above commit, and we didn't know about it. In order to protect against that a full audit of the examples/ directory was performed, and all vlabs JSON files were given basic aks-engine generate unit test coverage. Where appropriate, api model specs were updated when these new unit tests revealed that in fact they were non-working. Also, where appropriate, api model files (e.g., no-longer aks-engine-supported Kubernetes versions) were deleted from the examples/ directory to improve the fidelity of stuff in there that actually works.

Additionally, *.json.env files which were used by an older, no longer used/maintained E2E script, were deleted.

Only api model examples under examples/ that are vlabs-versioned were included in additional unit tests.

Issue Fixed:

Fixes #1828

Requirements:

Notes:

@acs-bot acs-bot added the size/L label Aug 20, 2019
@jackfrancis jackfrancis changed the title fix: networkplugin conversion only if networkpolicy is empty [WIP] fix: networkplugin conversion only if networkpolicy is empty Aug 20, 2019
@codecov
Copy link

codecov bot commented Aug 20, 2019

Codecov Report

Merging #1823 into master will decrease coverage by <.01%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master    #1823      +/-   ##
==========================================
- Coverage   76.42%   76.41%   -0.01%     
==========================================
  Files         130      130              
  Lines       19419    19413       -6     
==========================================
- Hits        14841    14835       -6     
  Misses       3780     3780              
  Partials      798      798

@@ -747,7 +747,7 @@ func setVlabsKubernetesDefaults(vp *vlabs.Properties, api *OrchestratorProfile)
api.KubernetesConfig.NetworkPolicy = vp.OrchestratorProfile.KubernetesConfig.NetworkPolicy
}
}
if api.KubernetesConfig.NetworkPlugin == "" {
if api.KubernetesConfig.NetworkPlugin == "" && api.KubernetesConfig.NetworkPolicy == "" {
Copy link
Member Author

Choose a reason for hiding this comment

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

This is the fix to the prior logic during vlabs-->unversioned conversion. Because not every version of NetworkPolicy will work with the default NetworkPlugin values below, we don't want to brute force set the default unless NetworkPolicy is also empty.

Copy link
Contributor

Choose a reason for hiding this comment

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

so what happens now if NetworkPlugin is empty but not NetworkPolicy? Do we set the NetworkPlugin somewhere else?

@jackfrancis jackfrancis changed the title [WIP] fix: networkplugin conversion only if networkpolicy is empty fix: networkplugin conversion only if networkpolicy is empty Aug 21, 2019
@@ -39,8 +39,8 @@
}
],
"servicePrincipalProfile": {
"servicePrincipalClientID": "",
"servicePrincipalClientSecret": ""
"clientId": "",
Copy link
Member Author

Choose a reason for hiding this comment

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

These properties were not valid :|

@@ -40,8 +40,8 @@
}
],
"servicePrincipalProfile": {
"servicePrincipalClientID": "",
"servicePrincipalClientSecret": ""
"clientId": "",
Copy link
Member Author

Choose a reason for hiding this comment

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

ditto

@@ -43,8 +43,8 @@
}
],
"servicePrincipalProfile": {
"servicePrincipalClientID": "",
"servicePrincipalClientSecret": ""
"clientId": "",
Copy link
Member Author

Choose a reason for hiding this comment

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

ditto

4. **swarmmodevnet.json** - deploying and using [Swarm Mode](../../docs/swarmmode.md)
1. First, deploy a custom vnet. An example of an arm template that does this is under directory vnetarmtemplate.
2. Next configure the example templates, and deploy according to the examples:
1. **kubernetesvnet.json** - deploying and using [Kubernetes](../../docs/topics/features.md#feat-custom-vnet)
Copy link
Member Author

Choose a reason for hiding this comment

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

Cleaned up broken references and did a super quick version of making what remains more or less correct.

@@ -50,19 +50,11 @@
},
{
"name": "keyvault-flexvolume",
"enabled": false,
Copy link
Member Author

Choose a reason for hiding this comment

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

These properties were not valid :|

},
{
"name": "blobfuse-flexvolume",
"enabled": false,
Copy link
Member Author

Choose a reason for hiding this comment

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

ditto

@@ -99,7 +99,7 @@ func (cs *ContainerService) setOrchestratorDefaults(isUpgrade, isScale bool) {
// we translate deprecated NetworkPolicy usage to the NetworkConfig equivalent
// and set a default network policy enforcement configuration
switch o.KubernetesConfig.NetworkPolicy {
case NetworkPluginAzure:
case NetworkPolicyAzure:
Copy link
Member Author

Choose a reason for hiding this comment

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

@CecileRobertMichon I made this sort of superficial change because (1) it's more expressive to use the NetworkPolicy const here and (2) hopefully it answers your question below.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sorry, your question above ;)

Copy link
Contributor

@CecileRobertMichon CecileRobertMichon left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link
Member

@mboersma mboersma left a comment

Choose a reason for hiding this comment

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

/lgtm

@acs-bot
Copy link

acs-bot commented Aug 21, 2019

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: CecileRobertMichon, jackfrancis, mboersma

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:
  • OWNERS [CecileRobertMichon,jackfrancis,mboersma]

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

@jackfrancis jackfrancis merged commit d879a29 into Azure:master Aug 21, 2019
@jackfrancis jackfrancis deleted the vlabs-networkplugin-defaults branch August 21, 2019 19:02
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cilium NetworkPolicy api model no longer works
4 participants