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

Kubernetes: ensure params vals are bool, with test #3285

Merged
merged 1 commit into from
Jun 19, 2018

Conversation

jackfrancis
Copy link
Member

What this PR does / why we need it: Explicitly pass in a bool (not *bool) to params to ensure we never have a type mismatch between ARM and golang

Which issue this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close that issue when PR gets merged): fixes #3279

Special notes for your reviewer:

If applicable:

  • documentation
  • unit tests
  • tested backward compatibility (ie. deploy with previous version, upgrade with this branch)

Release note:

ensure params vals are bool

@ghost ghost assigned jackfrancis Jun 15, 2018
@ghost ghost added the in progress label Jun 15, 2018
kubernetesHyperkubeSpec = properties.OrchestratorProfile.KubernetesConfig.CustomHyperkubeImage
dockerEngineVersion := KubeConfigs[k8sVersion]["dockerEngineVersion"]

if properties.OrchestratorProfile.KubernetesConfig != nil {
Copy link
Member Author

Choose a reason for hiding this comment

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

Re-arranged params assignment so that all kubernetesConfig dereferences are nil-checked.

aciConnectorAddon := getAddonByName(properties.OrchestratorProfile.KubernetesConfig.Addons, DefaultACIConnectorAddonName)
c = getAddonContainersIndexByName(aciConnectorAddon.Containers, DefaultACIConnectorAddonName)
if c > -1 {
addValue(parametersMap, "kubernetesACIConnectorEnabled", helpers.IsTrueBoolPointer(aciConnectorAddon.Enabled))
Copy link
Member Author

Choose a reason for hiding this comment

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

@amanohar hard to see in this diff, but we're now passing a bool to params and not a pointer

addValue(parametersMap, "kubernetesClusterAutoscalerMemoryLimit", clusterAutoscalerAddon.Containers[c].MemoryLimits)
addValue(parametersMap, "kubernetesClusterAutoscalerMinNodes", clusterAutoscalerAddon.Config["minNodes"])
addValue(parametersMap, "kubernetesClusterAutoscalerMaxNodes", clusterAutoscalerAddon.Config["maxNodes"])
addValue(parametersMap, "kubernetesClusterAutoscalerEnabled", helpers.IsTrueBoolPointer(clusterAutoscalerAddon.Enabled))
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

assignKubernetesParameters(containerService.Properties, parametersMap, cloudSpecConfig, DefaultGeneratorCode)
for k, v := range parametersMap {
switch val := v.(paramsMap)["value"].(type) {
case *bool:
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 test iterates through all testdata api models, and then performs the params assignment, and then ensures that there are no *bool type values.

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

@acs-bot acs-bot added the lgtm label Jun 15, 2018
@acs-bot
Copy link

acs-bot commented Jun 15, 2018

[APPROVALNOTIFIER] This PR is APPROVED

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

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]

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

@codecov
Copy link

codecov bot commented Jun 15, 2018

Codecov Report

Merging #3285 into master will decrease coverage by 0.66%.
The diff coverage is 72.98%.

@@            Coverage Diff             @@
##           master    #3285      +/-   ##
==========================================
- Coverage   53.31%   52.65%   -0.67%     
==========================================
  Files         104      104              
  Lines       15574    15580       +6     
==========================================
- Hits         8304     8204     -100     
- Misses       6537     6646     +109     
+ Partials      733      730       -3

@jackfrancis jackfrancis merged commit 68e9550 into Azure:master Jun 19, 2018
@ghost ghost removed the in progress label Jun 19, 2018
@jackfrancis jackfrancis deleted the params_test_nil_bool branch June 19, 2018 17:22
PaulCharlton added a commit to ElementAnalytics/acs-engine that referenced this pull request Jun 20, 2018
* 'master' of https://github.com/Azure/acs-engine: (44 commits)
  remove duplicate ebtables (Azure#3308)
  Kubernetes: Remove Windows-specific foo for control plane config (Azure#3240)
  add k8s 1.8.14 (Azure#3303)
  run /usr/lib/apt/apt.systemd.daily in background (Azure#3304)
  add annotation to secrets field (Azure#3292)
  fix(oms): pull oms directly from docker (Azure#3294)
  ensure params vals are bool, with test (Azure#3285)
  udpate to latest 16.04 LTS image (Azure#3286)
  Enable openshift e2e tests on centos (Azure#2910)
  remove docker dependency from hyperkube extract (Azure#3296)
  remove pathological test (Azure#3291)
  Refactor validateDNSPrefix function in one place (Azure#3276)
  remove unnecessary nil check (Azure#3290)
  Fixing panic issue in Validate when properties are nil (Azure#3242)
  Updating the omsagent yaml file to include new changes for node zero dependency (Azure#3277)
  revert Azure CNI to 1.0.4 (Azure#3289)
  Add e2e test for openshift vnet (Azure#3274)
  Support upgrading a Kubernetes cluster that contains Virtual Machine Scale Sets (Azure#3223)
  Set extension for custom DNS (Azure#3264)
  don't exit CSE on apt.systemd.daily error (Azure#3278)
  ...
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.

Some agentPoolOnly upgrades fail due to InvalidDeploymentParameterValue for 'kubernetesACIConnectorEnabled'
4 participants