Skip to content
This repository has been archived by the owner on Sep 30, 2020. It is now read-only.

feat: Fine-grained stack update #1233

Merged
merged 18 commits into from May 10, 2018

Conversation

mumoshu
Copy link
Contributor

@mumoshu mumoshu commented Apr 11, 2018

USAGE:

Update all the stacks including root, control-plane, worker:

kube-aws update --force

Update the control-plane stack only:

kube-aws update --targets control-plane --force

Note that, for the root stack, just the Resources.Controlplane.Properties.TemplateURL is updated in this case.

Update the worker node pool stack(s) only:

kube-aws update --targets worker --force

NOTES:

  • The root stack is updated implicitly when you update all the stacks including worker, control-plane, etcd and network

TODO:

  • The separation and extraction of the etcd stack and the network stack from the control-plane stack
  • Add a new option in cluster.yaml rollbackOnFailure for control-plane and etcd stack only

Everything else should be there

Ref #1112

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Apr 11, 2018
@@ -237,51 +249,103 @@ func (c clusterImpl) Info() (*Info, error) {
return describer.Info()
}

func (c clusterImpl) prepareTemplateWithAssets() (string, error) {
assets, err := c.Assets()
func (c clusterImpl) generateAssets(targets OperationTargets) (cfnstack.Assets, error) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is where the magic happens.

@codecov-io
Copy link

codecov-io commented Apr 11, 2018

Codecov Report

Merging #1233 into master will decrease coverage by 0.39%.
The diff coverage is 29.88%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #1233     +/-   ##
=========================================
- Coverage   36.63%   36.23%   -0.4%     
=========================================
  Files          63       64      +1     
  Lines        3882     3913     +31     
=========================================
- Hits         1422     1418      -4     
- Misses       2242     2279     +37     
+ Partials      218      216      -2
Impacted Files Coverage Δ
core/controlplane/config/stack_config.go 0% <ø> (ø) ⬆️
model/subnet.go 1.39% <0%> (-0.06%) ⬇️
model/vpc.go 0% <0%> (ø)
model/etcd.go 0% <0%> (ø) ⬆️
model/derived/api_endpoint_lb.go 0% <0%> (ø) ⬆️
model/controller.go 0% <0%> (ø) ⬆️
cfnstack/assets.go 0% <0%> (ø) ⬆️
model/derived/etcd_node.go 0% <0%> (ø) ⬆️
model/subnets.go 23.33% <0%> (-76.67%) ⬇️
cfnstack/provisioner.go 0% <0%> (ø) ⬆️
... and 5 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a55c665...1133d20. Read the comment docs.

@mumoshu
Copy link
Contributor Author

mumoshu commented Apr 13, 2018

This is triggering a considerable amount of refactorings... 😉

@mumoshu mumoshu changed the title WIP: feat: Fine-grained stack update feat: Fine-grained stack update Apr 13, 2018
@mumoshu
Copy link
Contributor Author

mumoshu commented Apr 13, 2018

Whoa. Can't believe this is actually working 🤣

$ KUBECONFIG=kubeconfig kubectl get no
NAME                                            STATUS    ROLES     AGE       VERSION
ip-10-0-0-180.ap-northeast-1.compute.internal   Ready     node      7m        v1.9.1
ip-10-0-0-20.ap-northeast-1.compute.internal    Ready     master    15m       v1.9.1

image

@mumoshu
Copy link
Contributor Author

mumoshu commented Apr 24, 2018

You now have to enumerate node pools explicitly like kube-aws update --targets nodepool1,nodepool2 in order to update a part of node pools only. Previously, kube-aws update --targets worker had been updating all the node pools but it was removed in favor of this.

Also note that --targets is enhanced to accept all, so that you can target all the stacks with --targets all, rather than --targets worker,controller,etcd.

@mumoshu mumoshu force-pushed the per-substack-update branch 2 times, most recently from fa009a6 to 42d501a Compare April 24, 2018 05:01
@mumoshu mumoshu modified the milestones: v0.10.0, v0.11.0 May 10, 2018
@mumoshu
Copy link
Contributor Author

mumoshu commented May 10, 2018

Go ahead!

@cknowles
Copy link
Contributor

Is this intended to work with just --targets etcd? I did an update like that but it also updated controllers and started on workers too. The controllers appeared to be mostly blank container linux instances, they didn't even have a kubelet service! To fix it I cancelled the update and the cluster has a functioning control plane again.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants