Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce multi-stage upgrade #2723

Merged
merged 4 commits into from
Apr 25, 2019
Merged

Introduce multi-stage upgrade #2723

merged 4 commits into from
Apr 25, 2019

Conversation

siggy
Copy link
Member

@siggy siggy commented Apr 19, 2019

linkerd install supports a 2-stage install process, linkerd upgrade
did not.

Add 2-stage support for linkerd upgrade. Also exercise multi-stage
functionality during upgrade integration tests.

Part of #2337

Signed-off-by: Andrew Seigner [email protected]

Depends on #2719

@siggy siggy requested review from alpeb and ihcsim April 19, 2019 20:35
@siggy siggy self-assigned this Apr 19, 2019
@l5d-bot
Copy link
Collaborator

l5d-bot commented Apr 19, 2019

Integration test results for b3eaf61: fail 😕
Log output: https://gist.github.com/6c564f077015749a076428fac6314900

Copy link
Member

@alpeb alpeb left a comment

Choose a reason for hiding this comment

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

On a first pass, this is working as expected.

One small issue is that --from-manifests is being allowed in the first stage, because of it being separate from the main flagset.

I wonder how we can let users know when the need for linkerd upgrade config is needed, which would only be occasionally. First thing that occurs to me is hard-coding some boolean const alongside version.Version indicating that. Then linkerd upgrade control-plane would just issue a warning in stderr about it.

@siggy siggy force-pushed the siggy/install-stages branch from e2fc912 to 3e7cf8d Compare April 23, 2019 17:49
@siggy siggy force-pushed the siggy/upgrade-stages branch from b3eaf61 to e364a16 Compare April 23, 2019 22:38
@siggy siggy changed the base branch from siggy/install-stages to master April 23, 2019 22:38
@l5d-bot
Copy link
Collaborator

l5d-bot commented Apr 23, 2019

Integration test results for e364a16: fail 😕
Log output: https://gist.github.com/ef4812ddaf0e7172a0487ca3300a39c5

@siggy siggy force-pushed the siggy/upgrade-stages branch from e364a16 to 79ea456 Compare April 23, 2019 23:06
@l5d-bot
Copy link
Collaborator

l5d-bot commented Apr 23, 2019

Integration test results for 79ea456: fail 😕
Log output: https://gist.github.com/c3dc980f8e0e299abe9afb001a92e20e

@siggy siggy force-pushed the siggy/upgrade-stages branch from 79ea456 to 59f7f65 Compare April 24, 2019 02:32
@l5d-bot
Copy link
Collaborator

l5d-bot commented Apr 24, 2019

Integration test results for 59f7f65: success 🎉
Log output: https://gist.github.com/63b77b487a735c25e3c451db5655e207

@grampelberg grampelberg mentioned this pull request Apr 24, 2019
11 tasks
@siggy siggy force-pushed the siggy/upgrade-stages branch 2 times, most recently from f3d48ff to 37f234e Compare April 24, 2019 23:14
@l5d-bot
Copy link
Collaborator

l5d-bot commented Apr 24, 2019

Integration test results for 37f234e: fail 😕
Log output: https://gist.github.com/4f4fce69616d1a85b83624644ff616eb

Copy link
Contributor

@dadjeibaah dadjeibaah left a comment

Choose a reason for hiding this comment

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

This change looks good, had one clarifying question below.

if err != nil {
return err
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Just noticed this now, when trying to test --from-manifests after @alpeb's comment. It seems, on line 79 of this file, that we are using a testing artifact to create a Kubernetes clientset. Is this intended? Wasn't clear on how its being used.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good question! (Also I forgot about @alpeb's original question re: allowing linkerd config --from-manifests, have pushed a new commit to prevent that.)

Re: k8s.NewFakeClientSetsFromManifests on line 79, this is intended. Adding --from-manifests required reading k8s yaml from stdin (or files), and processing them in lieu of k8s resources returned from the k8s api. We already had some test code doing this to mock out k8s clients. The change in #2697 moved that test code into a new fake.go file, to support --from-manifests. Leveraging fake.go allows most of the upgrade code to be agnostic of where the k8s resources came from, since it's just using a k8s client.

@l5d-bot
Copy link
Collaborator

l5d-bot commented Apr 25, 2019

Integration test results for dd404b9: fail 😕
Log output: https://gist.github.com/4f8fce394536f8cf2e1b7b2c0d730637

Copy link
Contributor

@ihcsim ihcsim left a comment

Choose a reason for hiding this comment

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

Code change LGTM. Just a minor comment.

I will do some more testing on this branch.

Also, given what we saw today on how the CRD change affected the integration tests, I guess there is a chance that after running linkerd upgrade config, the control plane is left in limbo if the controller and other components aren't restarted, right?

return cmd
}

func (options *upgradeOptions) validateAndBuild(k kubernetes.Interface, flags *pflag.FlagSet) (*installValues, *pb.All, error) {
func (options *upgradeOptions) validateAndBuild(stage string, k kubernetes.Interface, flags *pflag.FlagSet) (*installValues, *pb.All, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think stage is needed in this function; should be able to assign it to values after the call to validateAndBuild().

Copy link
Member Author

@siggy siggy Apr 25, 2019

Choose a reason for hiding this comment

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

I considered this initially as it would have minimized the change and preserved validateAndBuild's signature. I opted to set stage in this function keep all the code that creates an installValues in one place. The alternative is that validateAndBuild creates a nearly-complete installValues that the caller must know to set stage after the fact.

@alpeb
Copy link
Member

alpeb commented Apr 25, 2019

I verified --from-manifests is now only available in the second stage 👍

there is a chance that after running linkerd upgrade config, the control plane is left in limbo if the controller and other components aren't restarted

Probably an extra message in stderr alongside the existing "You're on your way to upgrading Linkerd!" could do the trick, like "Don't forget to run linkerd upgrade control-plane!" (in bold if possible?)

I wonder how we can let users know when the need for linkerd upgrade config is needed, which would only be occasionally. First thing that occurs to me is hard-coding some boolean const alongside version.Version indicating that. Then linkerd upgrade control-plane would just issue a warning in stderr about it.

A different take to ensure the second stage is ran after the first would be to add an annotation into linkerd's namespace with the version string. The second stage would retrieve the namespace and ensure it has the proper version. This could also apply to linkerd install, through a refactor of exitIfNamespaceDoesNotExist(). This also means both stages would always need to be run. An extra linkerd check could be added to ensure the namespace's version would match the control plane's.

@ihcsim
Copy link
Contributor

ihcsim commented Apr 25, 2019

Probably an extra message in stderr alongside the existing "You're on your way to upgrading Linkerd!" could do the trick, like "Don't forget to run linkerd upgrade control-plane!" (in bold if possible?)

Yeah, the scenario I was thinking about is hey, your control plane is broken, until you run linkerd upgrade control-plane and restart the controller

@siggy
Copy link
Member Author

siggy commented Apr 25, 2019

I agree there's more we could do here around version checking during an upgrade. Some of that will happen via multi-stage support in linkerd check, and I think most of it will happen as we consider versioning as part of #2671.

Copy link
Contributor

@ihcsim ihcsim left a comment

Choose a reason for hiding this comment

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

👍 Works on my machine.

siggy added 4 commits April 25, 2019 13:59
`linkerd install` supports a 2-stage install process, `linkerd upgrade`
did not.

Add 2-stage support for `linkerd upgrade`. Also exercise multi-stage
functionality during upgrade integration tests.

Part of #2337

Signed-off-by: Andrew Seigner <[email protected]>
@siggy siggy force-pushed the siggy/upgrade-stages branch from 5daa740 to 7602ab8 Compare April 25, 2019 21:00
Copy link
Member

@alpeb alpeb left a comment

Choose a reason for hiding this comment

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

This looks good to me 👍
I also verified the integrations tests are green, since it seems l5d-bot decided to take a break 🤖 🔥

@l5d-bot
Copy link
Collaborator

l5d-bot commented Apr 25, 2019

Integration test results for 7602ab8: success 🎉
Log output: https://gist.github.com/cf31fe038ee03b1bea2176f0219c6158

@siggy siggy merged commit 15ffd86 into master Apr 25, 2019
@siggy siggy deleted the siggy/upgrade-stages branch April 25, 2019 21:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants