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

Support --set flag in deploy command #3188

Merged
merged 6 commits into from
Jun 11, 2018

Conversation

jcorioland
Copy link
Contributor

@jcorioland jcorioland commented Jun 6, 2018

What this PR does / why we need it:
Brings support for using --set flag to override values from the api model JSON file directly from acs-engine deploy command

Ex:

acs-engine deploy --resource-group "your-resource-group" \
  --location "westeurope" \
  --subscription-id "your-subscription-id" \
  --api-model "./apimodel.json" \
  --set masterProfile.dnsPrefix="your-dns-prefix-override" \
  --set agentPoolProfiles[0].name="your-agentpool-0-name-override" \
  --set agentPoolProfiles[0].count=1 \
  --set linuxProfile.ssh.publicKeys[0].keyData="ssh-rsa PUBLICKEY azureuser@linuxvm" \
  --set servicePrincipalProfile.clientId="spn-client-id" \
  --set servicePrincipalProfile.secret="spn-client-secret"

Which issue this PR fixes: fixes #2796

Special notes for your reviewer:
I've done some refactoring in the deploy.go file to be able to extract the api model validation from the api model loading. That means that there is now 5 steps:

  • validate the command line args
  • merge the api model with eventual --set overrides into a new file
  • load the merge api model
  • validate the api model
  • run the command

I think some code could be refactored more and shared between generate and deploy command, but it may be better to handle this in another issue/PR.

If applicable:

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

Release note:

Support for using --set flag to override api model JSON file directly in the acs-engine deploy command

@acs-bot acs-bot added size/L and removed size/M labels Jun 6, 2018
@codecov
Copy link

codecov bot commented Jun 6, 2018

Codecov Report

Merging #3188 into master will decrease coverage by 0.08%.
The diff coverage is 17.77%.

@@            Coverage Diff             @@
##           master    #3188      +/-   ##
==========================================
- Coverage   52.32%   52.24%   -0.09%     
==========================================
  Files         103      103              
  Lines       15452    15487      +35     
==========================================
+ Hits         8086     8091       +5     
- Misses       6638     6668      +30     
  Partials      728      728

@jcorioland jcorioland changed the title [wip] #2796 - support --set flag in deploy command Support --set flag in deploy command Jun 6, 2018
cmd/deploy.go Outdated
@@ -139,11 +170,40 @@ func (dc *deployCmd) load(cmd *cobra.Command, args []string) error {
}

// do not validate when initially loading the apimodel, validation is done later after autofilling values
dc.containerService, dc.apiVersion, err = apiloader.LoadContainerServiceFromFile(dc.apimodelPath, false, false, nil)
dc.containerService, dc.apiVersion, err = apiloader.LoadContainerServiceFromFile(dc.apimodelPath, true, false, nil)
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the reason for changing this to true? See #3112

Copy link
Contributor Author

@jcorioland jcorioland Jun 7, 2018

Choose a reason for hiding this comment

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

@CecileRobertMichon, good catch, no reason. It was a mistake. I've just fixed it. I've messed up with the generate command where we are loading the api model with validation. This is typically the "duplicated" code I was talking about that we need to find a way to share.

@acs-bot
Copy link

acs-bot commented Jun 7, 2018

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

Assign the PR to them by writing /assign @brendandburns 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

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

@CecileRobertMichon CecileRobertMichon merged commit 0cc5b1d into Azure:master Jun 11, 2018
@ghost ghost removed the in progress label Jun 11, 2018
@jcorioland jcorioland deleted the feat/deploy-set-flag branch June 12, 2018 05:34
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.

Support --set flag for deploy command
3 participants