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

adding offset to kubernetes cluster templates. Adding outputs needed … #366

Merged
merged 1 commit into from
Mar 13, 2017

Conversation

JackQuincy
Copy link
Contributor

@JackQuincy JackQuincy commented Mar 6, 2017

…to make scale down idempotent in RP


This change is Reviewable

@msftclas
Copy link

msftclas commented Mar 6, 2017

@JackQuincy,
Thanks for your contribution as a Microsoft full-time employee or intern. You do not need to sign a CLA.
Thanks,
Microsoft Pull Request Bot

@acs-bot
Copy link

acs-bot commented Mar 6, 2017

Can one of the admins verify this patch?

@JackQuincy
Copy link
Contributor Author

2 changes I have decided I want to make to this since sending it.

  1. Remove total count and use count - offset for number of times through the loop so that the agent pool count in the template == agent pool count in the ACS API model.
  2. Add to the Kubernetes walkthrough/documentation somewhere about using the offset for scale up scenarios and list steps to scale down.

"metadata": {
"description": "The offset into the agent pool where to start creating agents. This value can be from 0 to 100"
},
"type": "int"
Copy link
Contributor

Choose a reason for hiding this comment

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

How will this impact the case of multiple agent pools. Will this offset impact all agent pools? Shouldn't offset be applied on a per agent pool basis?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the {{.Name}} part is saying the name of the agent pool see unit test output below to see something like:
agentpool1Offset

@@ -1,7 +1,9 @@
"{{.Name}}StorageAccountOffset": "[mul(variables('maxStorageAccountsPerAgent'),variables('{{.Name}}Index'))]",
"{{.Name}}Count": "[parameters('{{.Name}}Count')]",
"{{.Name}}Offset": "[parameters('{{.Name}}Offset')]",
"{{.Name}}TotalCount": "[add(parameters('{{.Name}}Count'), parameters('{{.Name}}Offset'))]",
Copy link
Contributor

@amanohar amanohar Mar 6, 2017

Choose a reason for hiding this comment

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

Shouldn't total count be the goal state. E.g. If current VM count is 4, and desired count is 5 (goal state). So total count will be: 5+4 =9?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

agreed it is in my list of things todo to fix this PR up and get it ready for checkin

@acs-bot
Copy link

acs-bot commented Mar 7, 2017

Can one of the admins verify this patch?

@JackQuincy
Copy link
Contributor Author

Currently there is still down time on scale up. This is because our template reinputs the nsg which wipes out some rules that NRP adds. I'm looking into making it not reput the nsg potentially at the very least I'll document a work around of removing the nsg from the template before resubmitting

@colemickens
Copy link
Contributor

The NSG rules can be made tracked sub-resources will which avoid clobbering them.

@JackQuincy
Copy link
Contributor Author

@colemickens would that be the Kubernetes driver NSG rules , or the ACS NSG rules in the template, or both?

@colemickens
Copy link
Contributor

Well, the cloudprovider code does a manual merge already, so it does the right thing by avoiding any automatic behavior. In this case, the fix is in the template. By making them sub-resources, it supposedly will use PATCH-like semantics and only add rules, rather than explicitly setting the "rules" subfield, thus causing a completely replacement of the entire set of rules, as we are doing now.

(Note, I don't have first hand knowledge of this; this is my understanding based on discussions with @yangl900 and @weinong. I hope that I'm portraying it accurately.)

@weinong
Copy link
Contributor

weinong commented Mar 7, 2017

Reviewed 1 of 63 files at r2.
Review status: 1 of 39 files reviewed at latest revision, 2 unresolved discussions.


Comments from Reviewable

@weinong
Copy link
Contributor

weinong commented Mar 7, 2017

Reviewed 2 of 63 files at r2.
Review status: 3 of 39 files reviewed at latest revision, 3 unresolved discussions.


examples/scale-up/README.md, line 20 at r3 (raw file):

Example template kubernetes_tempalte.json
Orignal Parameters kubernetes_orignal_params.json
Scale up parameters kubernetes_scale_up_params.json
Show the reuse of a template with that was created with 6 nodes and scaled up to 15

can you reformat them a bit? they look like stuffed in single paragraph.


Comments from Reviewable

@weinong
Copy link
Contributor

weinong commented Mar 8, 2017

Review status: 3 of 39 files reviewed at latest revision, 4 unresolved discussions, some commit checks failed.


parts/agentparams.t, line 16 at r1 (raw file):

Previously, JackQuincy (Jack) wrote…

the {{.Name}} part is saying the name of the agent pool see unit test output below to see something like:
agentpool1Offset

is 100 a valid offset?


pkg/acsengine/testdata/disks-managed/swarm-vmas_expected.json, line 216 at r3 (raw file):

        98,
        99,
        100

is 100 an valid offset?


Comments from Reviewable

@JackQuincy
Copy link
Contributor Author

Review status: 3 of 39 files reviewed at latest revision, 4 unresolved discussions.


examples/scale-up/README.md, line 20 at r3 (raw file):

Previously, weinong (Weinong Wang) wrote…

Example template kubernetes_tempalte.json
Orignal Parameters kubernetes_orignal_params.json
Scale up parameters kubernetes_scale_up_params.json
Show the reuse of a template with that was created with 6 nodes and scaled up to 15

can you reformat them a bit? they look like stuffed in single paragraph.

Does this look better


parts/agentparams.t, line 16 at r1 (raw file):

Previously, weinong (Weinong Wang) wrote…

is 100 a valid offset?

No, I'm reducing to just 99 and adding comment about the change


pkg/acsengine/testdata/disks-managed/swarm-vmas_expected.json, line 216 at r3 (raw file):

Previously, weinong (Weinong Wang) wrote…

is 100 an valid offset?

no reducing to just 99 and adding comment about it needing to be less than count


Comments from Reviewable

@weinong
Copy link
Contributor

weinong commented Mar 8, 2017

Reviewed 10 of 63 files at r2, 2 of 2 files at r3, 24 of 24 files at r5.
Review status: all files reviewed at latest revision, 2 unresolved discussions.


Comments from Reviewable

Copy link
Contributor

@anhowe anhowe left a comment

Choose a reason for hiding this comment

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

a few comments added

@@ -150,20 +150,20 @@
},
"dependsOn": [
{{if .IsStorageAccount}}
"[concat('Microsoft.Storage/storageAccounts/',variables('storageAccountPrefixes')[mod(add(div(copyIndex(),variables('maxVMsPerStorageAccount')),variables('{{.Name}}StorageAccountOffset')),variables('storageAccountPrefixesCount'))],variables('storageAccountPrefixes')[div(add(div(copyIndex(),variables('maxVMsPerStorageAccount')),variables('{{.Name}}StorageAccountOffset')),variables('storageAccountPrefixesCount'))],variables('{{.Name}}AccountName'))]",
"[concat('Microsoft.Storage/storageAccounts/',variables('storageAccountPrefixes')[mod(add(div(copyIndex(variables('{{.Name}}Offset')),variables('maxVMsPerStorageAccount')),variables('{{.Name}}StorageAccountOffset')),variables('storageAccountPrefixesCount'))],variables('storageAccountPrefixes')[div(add(div(copyIndex(variables('{{.Name}}Offset')),variables('maxVMsPerStorageAccount')),variables('{{.Name}}StorageAccountOffset')),variables('storageAccountPrefixesCount'))],variables('{{.Name}}AccountName'))]",
Copy link
Contributor

Choose a reason for hiding this comment

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

in your testing, set vms per storage account to 2, and then test a number of vms and a number of pools. For example 5 vms, 2 agent pools. That will ensure the math all checks out.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not related to this pr. This is related to Resource Provider work to consume some of these changes

@@ -1761,6 +1981,14 @@
}
],
"outputs": {
"agentStorageAccountPrefixes": {
Copy link
Contributor

Choose a reason for hiding this comment

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

where are the agent outputs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

my bad didn't realize Kubernetes base template doesn't reference agents outputs template. Will update.

@weinong
Copy link
Contributor

weinong commented Mar 9, 2017

:lgtm:


Reviewed 4 of 63 files at r2, 26 of 26 files at r6.
Review status: all files reviewed at latest revision, 4 unresolved discussions.


Comments from Reviewable

@weinong
Copy link
Contributor

weinong commented Mar 9, 2017

Review status: all files reviewed at latest revision, 4 unresolved discussions.


parts/agentparams.t, line 16 at r1 (raw file):

Previously, JackQuincy (Jack) wrote…

No, I'm reducing to just 99 and adding comment about the change

OK


Comments from Reviewable

@JackQuincy JackQuincy force-pushed the scale-up-down-relability branch 2 times, most recently from ae35b1d to ac9199b Compare March 10, 2017 23:10
…to make scale down idempotent in RP

also updating swarm and dcos vmas agent pools and adding example file

moving output definition so that we can properly format it
@JackQuincy JackQuincy dismissed amanohar’s stale review March 13, 2017 17:19

stale, it is several commits old and she hasn't had time to take a look and I am blocking others at this point

@weinong
Copy link
Contributor

weinong commented Mar 13, 2017

Reviewed 15 of 15 files at r7.
Review status: all files reviewed at latest revision, 4 unresolved discussions.


Comments from Reviewable

@JackQuincy JackQuincy merged commit 25cf3ac into master Mar 13, 2017
@colemickens
Copy link
Contributor

This broke the build.

@acs-bot test this please

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

7 participants