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

config: Store install parameters with global config #2577

Merged
merged 10 commits into from
Mar 29, 2019
Merged

Conversation

olix0r
Copy link
Member

@olix0r olix0r commented Mar 27, 2019

When installing Linkerd, a user may override default settings, or may
explicitly configure defaults. Consider install options like --ha --controller-replicas=4 -- the --ha flag sets a new default value for
the controller-replicas, and then we override it.

When we later upgrade this cluster, how can we know how to configure the
cluster?

We could store EnableHA and ControllerReplicas configurations in the
config, but what if, in a later upgrade, the default value changes? How
can we know whether the user specified an override or just used the
default?

To solve this, we add an InstallContext message onto the Global
config. This message includes (at least) the CLI flags used to invoke
install.

upgrade does not specify defaults for install/proxy-options fields and,
instead, uses the persisted install flags to populate default values,
before applying overrides from the upgrade invocation.

This change breaks the protobuf compability by altering the
installation_uuid field introduced in 9c442f6.
Because this change was not yet released (even in an edge release), we
feel that it is safe to break.

Fixes #2574

When installing Linkerd, a user may override default settings, or may
explicitly configure defaults. Consider install options like `--ha
--controller-replicas=4` -- the `--ha` flag sets a new default value for
the controller-replicas, and then we override it.

When we later upgrade this cluster, how can we know how to configure the
cluster?

We could store EnableHA and ControllerReplicas configurations in the
config, but what if, in a later upgrade, the default value changes? How
can we know whether the user specified an override or just used the
default?

To solve this, we add an `InstallContext` message onto the `Global`
config.  This message includes (at least) the CLI flags used to invoke
install.

upgrade does not specify defaults for install/proxy-options fields and,
instead, uses the persisted install flags to populate default values,
before applying overrides from the upgrade invocation.

This change breaks the protobuf compability by altering the
`installation_uuid` field introduced in 9c442f6.
Because this change was not yet released (even in an edge release), we
feel that it is safe to break.

Fixes #2574
@olix0r olix0r self-assigned this Mar 27, 2019
@olix0r olix0r requested a review from grampelberg March 27, 2019 21:46
@olix0r olix0r requested review from alpeb and ihcsim March 27, 2019 21:46
@l5d-bot
Copy link
Collaborator

l5d-bot commented Mar 27, 2019

Integration test results for 7c22b24: fail 😕
Log output: https://gist.github.com/8aee6a53acaf4cfc73ee57b9f862666a

@l5d-bot
Copy link
Collaborator

l5d-bot commented Mar 27, 2019

Integration test results for c7f1d6c: fail 😕
Log output: https://gist.github.com/debe2d2cc2d3d2d75ba72fbc825d03d2

@alpeb
Copy link
Member

alpeb commented Mar 27, 2019

TIOLI: How do you feel about black-listing some of the Global flags from InstallContext (like --context, --kubeconfig). Seems like those would be used only for the current install/upgrade.

Also we still gotta figure the issue you brought in #2564: how does one disable --ha, for example?

proto/config/config.proto Outdated Show resolved Hide resolved
proto/config/config.proto Outdated Show resolved Hide resolved
This changes install and inject to produce FlagSets containing each of
their flags. These flags are then used to record the install flags
without extraneous flags such as --kubeconfig.
@l5d-bot
Copy link
Collaborator

l5d-bot commented Mar 28, 2019

Integration test results for 73b9647: fail 😕
Log output: https://gist.github.com/2bab73168b17e865dce7f672dd88f0c3

@grampelberg
Copy link
Contributor

I got concerned about serializing the CLI flags themselves this morning. It'll make it difficult for a helm chart to create these settings. Thinking about it some more, helm would never call out to the control plane to read those settings, so it should be okay ... with the caveat that once you use a helm chart you can never to back (or we change the serialization strategy in the future).

So, tldr, I can't come up with a major reason not to do it and a whole bunch to do it =)

@l5d-bot
Copy link
Collaborator

l5d-bot commented Mar 28, 2019

Integration test results for 0f21537: fail 😕
Log output: https://gist.github.com/4969c01ba4cec2a114e4468980361f9b

if f.Changed {
switch f.Name {
case "ignore-cluster", "linkerd-version":
// Thse flags don't make sense to record.
Copy link
Member

Choose a reason for hiding this comment

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

typo: These

Also how about including here as well api-addr, context, kubeconfig and verbose? Most likely these are particular to some user, so shouldn't be stored in the config shared by all.

Copy link
Member Author

@olix0r olix0r Mar 28, 2019

Choose a reason for hiding this comment

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

We only have to handle flags set by options.flagSet now! This was the main rational in building FlagSet instead of appending to PersistenFlags.

I've confirmed this with manual testing.

Copy link
Member

Choose a reason for hiding this comment

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

And what do you think about identity-issuer-certificate-file, identity-issuer-key-file and identity-trust-anchors-file? I believe linkerd upgrade will ignore them but they don't belong in the shared config IMO.

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 call. These should be omitted as well.

Copy link
Member Author

Choose a reason for hiding this comment

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

PTAL. I moved these issuer flags onto a separate flagset so they are just never considered to be recorded (and also means we won't expose them from upgrade).

@l5d-bot
Copy link
Collaborator

l5d-bot commented Mar 28, 2019

Integration test results for 2219d8f: success 🎉
Log output: https://gist.github.com/a58b4a11b13e9e22a71b4d10a9b00cf4

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.

LGTM with some minor stuff or TIOLI.

cli/cmd/root.go Show resolved Hide resolved
cli/cmd/install.go Outdated Show resolved Hide resolved
cli/cmd/root.go Outdated Show resolved Hide resolved
pkg/config/config.go Outdated Show resolved Hide resolved
@l5d-bot
Copy link
Collaborator

l5d-bot commented Mar 29, 2019

Integration test results for e22c84c: success 🎉
Log output: https://gist.github.com/0fc12abe8d8bff8b77d3ddd7846ebe64

@l5d-bot
Copy link
Collaborator

l5d-bot commented Mar 29, 2019

Integration test results for 0e2fdb5: success 🎉
Log output: https://gist.github.com/ee70baedcb50412c77e526ab8224ee51

@l5d-bot
Copy link
Collaborator

l5d-bot commented Mar 29, 2019

Integration test results for ad1c6fc: success 🎉
Log output: https://gist.github.com/f765d2e45dab3ff9eadfee888b5c2cbe

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.

Looks good to me 👍

@olix0r olix0r merged commit 6556321 into master Mar 29, 2019
@olix0r olix0r deleted the ver/install-context branch March 29, 2019 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants