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

Split the linkerd-version CLI flag into control-plane-version and proxy-version #2702

Merged
merged 9 commits into from
Apr 19, 2019

Conversation

ihcsim
Copy link
Contributor

@ihcsim ihcsim commented Apr 16, 2019

This PR replaces the CLI linkerd-version flag with a new flag named proxy-version. When provided during install, upgrade or inject, this flag sets the proxy image tag to the provided value. The original linkerd-version flag is marked deprecated. If provided, it has no effects on the YAML output.

All the control plane components' and proxy init's image tags are now pinned to version.Version. My thought is to not provide any CLI flags to override them, because:

  1. The override can be done via kubectl set image
  2. The only way to pass this value to the proxy init container spec is either via annotation, the config proto, or the ResourceConfig struct, none of which feel clean, just to support a dev-only flag.

The CNI linkerd-version flag isn't changed; it refers to the CNI image tag.

How I tested it:

# install the control plane with an older proxy version
bin/linkerd install --proxy-auto-inject --proxy-version=edge-19.4.3 | kubectl apply -f -

# expect proxy version to be persisted as a global property in the linkerd-config config map
kubectl -n linkerd describe configmap linkerd-config

# check the control plane components YAML; expect proxy to be edge-19.4.3
kubectl -n linkerd get deploy -o yaml | less

# try with emojivoto; expect proxy to be edge-19.4.3
curl -sL https://run.linkerd.io/emojivoto.yml | bin/linkerd inject | less

# expect proxy to be edge-19.4.4
curl -sL https://run.linkerd.io/emojivoto.yml | bin/linkerd inject --proxy-version=edge-19.4.4 - | less

# upgrade the control plane, but use proxy version edge-19.4.4
bin/linkerd upgrade --proxy-version=edge-19.4.4 | kubectl apply -f -

# expect proxy version edge-19.4.4 to be persisted as a global property
kubectl -n linkerd describe configmap linkerd-config

# upgrade control plane and proxy to HEAD
bin/linkerd upgrade | kubectl apply -f -

# expect latest dev proxy version to be persisted as a global property
k -n linkerd describe configmap linkerd-config

Fixes #2614

Signed-off-by: Ivan Sim ivan@buoyant.io

@ihcsim ihcsim requested review from siggy, olix0r and alpeb April 16, 2019 03:46
@ihcsim ihcsim self-assigned this Apr 16, 2019
@l5d-bot
Copy link
Collaborator

l5d-bot commented Apr 16, 2019

Integration test results for 7964a77: fail 😕
Log output: https://gist.github.com/ae976441a0610c9a394742d893e9d026

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.

Changes look good and tested fine for me 👍

I was thinking it might be nice to change Global.version to Global.proxy_version, but it seems changes in the config are delicate as discussed in #2671, so that could be something for the future after multi-stage install (upgrade?) lands...

@l5d-bot
Copy link
Collaborator

l5d-bot commented Apr 16, 2019

Integration test results for 453c546: success 🎉
Log output: https://gist.github.com/2fd9074a5210c8e1f9b6bf59517ceed5

Copy link
Member

@siggy siggy 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! a couple comments around deprecating --linkerd-version.

also i think you'll need to update the travis script as well:

- target/cli/linux/linkerd install --linkerd-version=$LINKERD_TAG |tee linkerd.yml

cli/cmd/root.go Show resolved Hide resolved
cli/cmd/root.go Outdated
@@ -285,8 +290,10 @@ func (options *proxyConfigOptions) flagSet(e pflag.ErrorHandling) *pflag.FlagSet
// Deprecated flags
flags.StringVar(&options.proxyMemoryRequest, "proxy-memory", options.proxyMemoryRequest, "Amount of Memory that the proxy sidecar requests")
flags.StringVar(&options.proxyCPURequest, "proxy-cpu", options.proxyCPURequest, "Amount of CPU units that the proxy sidecar requests")
flags.StringVarP(&options.linkerdVersion, "linkerd-version", "", options.linkerdVersion, "Tag to be used for Linkerd images")
Copy link
Member

Choose a reason for hiding this comment

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

related to previous comment, remove?

Copy link
Member

Choose a reason for hiding this comment

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

I think it's valuable to leave this, especially for development. but i don't think it should be visible by default

Copy link
Member

Choose a reason for hiding this comment

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

i don't think it's used anymore?

$ bin/go-run cli install --linkerd-version edge-1.2.3 | grep edge-1.2.3
Flag --linkerd-version has been deprecated, use --proxy-version instead

Copy link
Member

Choose a reason for hiding this comment

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

Ah, I think that's wrong then. We still need a way to override the linkerd version. If we want to call it control-plane-version or something, that's fine with me.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I did rename it to control-plane-version prior to submitting this PR, then back out of it, because of the changes I had to make to get it into the proxy-init image tag.

Before I go ahead and include this change, can we not just use something like kubectl edit or kubectl set image to change the control plane version, for development purposes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, if we're gonna include the control plane version in the global config, then this won't be a problem. I can fix this in my next commit.

test/inject/inject_test.go Show resolved Hide resolved
@@ -591,7 +592,7 @@ func (options *installOptions) globalConfig(identity *pb.IdentityContext) *pb.Gl
LinkerdNamespace: controlPlaneNamespace,
AutoInjectContext: autoInjectContext,
CniEnabled: options.noInitContainer,
Version: options.linkerdVersion,
Version: options.proxyVersion,
Copy link
Member

Choose a reason for hiding this comment

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

This isn't correct. the global version should be the installed control plane version. It sounds like we may need the ProxyConfig to get a Version field...

configs.Global.Version = options.linkerdVersion
overrideAnnotations[k8s.ProxyVersionOverrideAnnotation] = options.linkerdVersion
if options.proxyVersion != "" {
configs.Global.Version = options.proxyVersion
Copy link
Member

Choose a reason for hiding this comment

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

again, I think this is conflating things...

Ivan Sim added 2 commits April 18, 2019 09:19
Deprecate the linkerd-version flag. If provided, it has no effects on
the YAML output.

Signed-off-by: Ivan Sim <ivan@buoyant.io>
Signed-off-by: Ivan Sim <ivan@buoyant.io>
@ihcsim ihcsim changed the title 2.4 - Replace the linkerd-version CLI flag with proxy-version Replace the linkerd-version CLI flag with proxy-version Apr 18, 2019
Signed-off-by: Ivan Sim <ivan@buoyant.io>
@ihcsim ihcsim force-pushed the isim/cli-proxy-version-flag branch from 453c546 to 6d157c6 Compare April 18, 2019 22:19
@ihcsim ihcsim changed the title Replace the linkerd-version CLI flag with proxy-version Split the linkerd-version CLI flag into control-plane-version and proxy-version Apr 18, 2019
@ihcsim ihcsim force-pushed the isim/cli-proxy-version-flag branch from 6d157c6 to 501ef0a Compare April 18, 2019 22:38
@l5d-bot
Copy link
Collaborator

l5d-bot commented Apr 18, 2019

Integration test results for 501ef0a: fail 😕
Log output: https://gist.github.com/7ec4e516008b1dc5958dbd14b82e0053

@ihcsim
Copy link
Contributor Author

ihcsim commented Apr 18, 2019

I split the --linkerd-version flag into --proxy-version and --control-plane-version.

--control-plane-version:

  1. Available only for install and upgrade
  2. Used as the tag for the controller, web, grafana and proxy-init images
  3. Maps to the config.Global.Version proto field
  4. During install, the protobuf field defaults to version.Version, unless overridden by the --control-plane-version field
  5. This field isn't recorded in the config.Install config

--proxy-version:

  1. Available for install, inject and upgrade.
  2. Used as the tag for the proxy image
  3. Maps to the config.Proxy.ProxyVersion proto field
  4. During install, this protobuf field defaults toversion.Version, unless it's overridden by the --proxy-version field
  5. This field isn't recorded in the config.Install config
  6. It can be overridden at runtime via the config.linkerd.io/proxy-version annotation

LMK if I missed anything.

The 'linkerd-version' CLI flag is renamed to 'control-plane-version'

Signed-off-by: Ivan Sim <ivan@buoyant.io>
@ihcsim ihcsim force-pushed the isim/cli-proxy-version-flag branch from 501ef0a to fbf36db Compare April 18, 2019 23:05
@l5d-bot
Copy link
Collaborator

l5d-bot commented Apr 18, 2019

Integration test results for fbf36db: success 🎉
Log output: https://gist.github.com/9867eec63e23a9eec6527f36e16bbe76

cli/cmd/upgrade.go Outdated Show resolved Hide resolved
Signed-off-by: Ivan Sim <ivan@buoyant.io>
@l5d-bot
Copy link
Collaborator

l5d-bot commented Apr 19, 2019

Integration test results for d2d08e4: success 🎉
Log output: https://gist.github.com/043edc572a60b3cbaabea856e773d0d6

Copy link
Member

@siggy siggy left a comment

Choose a reason for hiding this comment

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

this is looking good. most of my comments are around more explicit tests.

@@ -41,6 +41,8 @@ message Proxy {
int64 proxy_uid = 10;
LogLevel log_level = 11;
bool disable_external_profiles = 12;

string proxy_version = 13;
Copy link
Member

Choose a reason for hiding this comment

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

maybe add a comment above Global.version calling out that it's for control-plane version, and also used as proxy-init version during inject.

pkg/inject/inject_test.go Show resolved Hide resolved
cli/cmd/upgrade_test.go Outdated Show resolved Hide resolved
cli/cmd/testdata/upgrade_default.golden Outdated Show resolved Hide resolved
cli/cmd/inject_test.go Outdated Show resolved Hide resolved
Ivan Sim added 4 commits April 19, 2019 10:10
Signed-off-by: Ivan Sim <ivan@buoyant.io>
Signed-off-by: Ivan Sim <ivan@buoyant.io>
Signed-off-by: Ivan Sim <ivan@buoyant.io>
Signed-off-by: Ivan Sim <ivan@buoyant.io>
@@ -184,9 +188,9 @@ metadata:
namespace: linkerd
data:
global: |
{"linkerdNamespace":"linkerd","cniEnabled":false,"version":"dev-undefined","identityContext":{"trustDomain":"cluster.local","trustAnchorsPem":"-----BEGIN CERTIFICATE-----\nMIIBYDCCAQegAwIBAgIBATAKBggqhkjOPQQDAjAYMRYwFAYDVQQDEw1jbHVzdGVy\nLmxvY2FsMB4XDTE5MDMwMzAxNTk1MloXDTI5MDIyODAyMDM1MlowGDEWMBQGA1UE\nAxMNY2x1c3Rlci5sb2NhbDBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABAChpAt0\nxtgO9qbVtEtDK80N6iCL2Htyf2kIv2m5QkJ1y0TFQi5hTVe3wtspJ8YpZF0pl364\n6TiYeXB8tOOhIACjQjBAMA4GA1UdDwEB/wQEAwIBBjAdBgNVHSUEFjAUBggrBgEF\nBQcDAQYIKwYBBQUHAwIwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAgNHADBE\nAiBQ/AAwF8kG8VOmRSUTPakSSa/N4mqK2HsZuhQXCmiZHwIgZEzI5DCkpU7w3SIv\nOLO4Zsk1XrGZHGsmyiEyvYF9lpY=\n-----END CERTIFICATE-----\n","issuanceLifetime":"86400s","clockSkewAllowance":"20s"},"autoInjectContext":null}
{"linkerdNamespace":"linkerd","cniEnabled":false,"version":"install-control-plane-version","identityContext":{"trustDomain":"cluster.local","trustAnchorsPem":"-----BEGIN CERTIFICATE-----\nMIIBYDCCAQegAwIBAgIBATAKBggqhkjOPQQDAjAYMRYwFAYDVQQDEw1jbHVzdGVy\nLmxvY2FsMB4XDTE5MDMwMzAxNTk1MloXDTI5MDIyODAyMDM1MlowGDEWMBQGA1UE\nAxMNY2x1c3Rlci5sb2NhbDBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABAChpAt0\nxtgO9qbVtEtDK80N6iCL2Htyf2kIv2m5QkJ1y0TFQi5hTVe3wtspJ8YpZF0pl364\n6TiYeXB8tOOhIACjQjBAMA4GA1UdDwEB/wQEAwIBBjAdBgNVHSUEFjAUBggrBgEF\nBQcDAQYIKwYBBQUHAwIwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAgNHADBE\nAiBQ/AAwF8kG8VOmRSUTPakSSa/N4mqK2HsZuhQXCmiZHwIgZEzI5DCkpU7w3SIv\nOLO4Zsk1XrGZHGsmyiEyvYF9lpY=\n-----END CERTIFICATE-----\n","issuanceLifetime":"86400s","clockSkewAllowance":"20s"},"autoInjectContext":null}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

global.version and proxy.proxyVersion pick up the version test values used in testInstallOptions(), instead of just dev-undefined.

@l5d-bot
Copy link
Collaborator

l5d-bot commented Apr 19, 2019

Integration test results for 8d6092a: success 🎉
Log output: https://gist.github.com/b361f5fedb7d0a4494e9d1a3c435adde

Copy link
Member

@siggy siggy left a comment

Choose a reason for hiding this comment

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

lgtm 👍 🚢

@ihcsim ihcsim merged commit 8d13084 into master Apr 19, 2019
@ihcsim ihcsim deleted the isim/cli-proxy-version-flag branch April 19, 2019 18:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deprecate/hide the --linkerd-version flag
5 participants