Skip to content

Update install and upgrade code to use the new helm charts#3229

Merged
ihcsim merged 17 commits intomasterfrom
isim/install-with-new-charts
Aug 13, 2019
Merged

Update install and upgrade code to use the new helm charts#3229
ihcsim merged 17 commits intomasterfrom
isim/install-with-new-charts

Conversation

@ihcsim
Copy link
Contributor

@ihcsim ihcsim commented Aug 12, 2019

This PR updates the linkerd install and linkerd upgrade commands to use the new Helm chart.

The following commands were executed to install and upgrade the control plane. Their YAML output are also diff'ed with that of edge-19.8.2:

bin/linkerd install
bin/linkerd install --ha
bin/linkerd install config
bin/linkerd install control-plane
bin/linkerd install-cni
bin/linkerd install --linkerd-cni-enabled
bin/linkerd install --ignore-cluster --admin-port=7000 --control-port=7001 --controller-log-level=warn --controller-uid=9009 --disable-h2-upgrade=true --enable-external-profiles=true --identity-clock-skew-allowance=60s --identity-issuance-lifetime=3600s --identity-issuer-key-file=fake-tls/key.pem --identity-trust-anchors-file=fake-tls/crt.pem --identity-issuer-certificate-file=fake-tls/crt.pem --identity-trust-domain=cluster.local --image-pull-policy=Always --inbound-port=7002 --omit-webhook-side-effects=false --outbound-port=7003 --proxy-cpu-limit=2 --proxy-cpu-request=1 --proxy-log-level=debug --proxy-memory-limit=256M --proxy-memory-request=64M --proxy-uid=3000 --skip-inbound-ports=3000,3001 --skip-outbound-ports=4000,4001 --registry=gcr.io/runconduit --restrict-dashboard-privileges=true

# inject, auto-inject and manual inject with emojivoto
bin/linkerd inject https://run.linkerd.io/emojivoto.yml 
bin/linkerd inject --manual https://run.linkerd.io/emojivoto.yml 

# upgrade from stable-2.4.0
bin/linkerd upgrade

Fixes #3127

@ihcsim ihcsim requested a review from alpeb August 12, 2019 03:57
@ihcsim ihcsim self-assigned this Aug 12, 2019
{{ $ca := genCA (printf "linkerd-proxy-injector.%s.svc" .Namespace) 365 -}}
crt.pem: {{ b64enc $ca.Cert }}
key.pem: {{ b64enc $ca.Key }}
crt.pem: {{ ternary (b64enc $ca.Cert) (b64enc .ProxyInjector.CrtPEM) (empty .ProxyInjector.CrtPEM) }}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

During upgrade, .ProxyInjector.CrtPEM and .ProxyInjector.KeyPEM will be assigned the values of the existing cert and key, so that they can be re-used. This change is also added to the service profile validator and tap RBAC templates.

Also, the .ProxyInjector.CrtPEM and .ProxyInjector.KeyPEM variables are needed to pin the test fixtures in the install and upgrade tests. Otherwise, Helm will always regenerate the cert/key pairs on every test run. If needed, we can revisit whether it's necessary to use Helm to auto-generate the TLS secrets.

selector:
matchLabels:
{{.ControllerComponentLabel}}: sp-validator
{{.ControllerNamespaceLabel}}: {{.Namespace}}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Service profile validator already has its own selectors in 2.4. Since these selectors are immutable, adding new match labels here will cause upgrade to fail. Hence, I have to revert this change. The same revert is also added to the proxy injector template.


configJSONs struct{ Global, Proxy, Install string }

resources struct{ CPU, Memory constraints }
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These are all moved to the common package at pkg/charts/template-values.go.


// function pointers that can be overridden for tests
generateUUID func() string
generateWebhookTLS func(webhook string) (*tlsValues, 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.

During install, the webhook TLS secrets will be generated by Helm functions. During an upgrade, these secrets will be preserved.

if err := options.validate(); err != nil {
return nil, nil, err
}
options.handleHA()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

See changes in the buildValuesWithoutIdentity() function.

return fmt.Sprintf("%s-tls", webhook)
}

func verifyWebhookTLS(value *tlsValues, webhook string) 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.

Move to upgrade.go, since they are now only relevant during upgrade.

@l5d-bot
Copy link
Collaborator

l5d-bot commented Aug 12, 2019

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.

totally works! mostly questions for my own understanding...

EnablePodAntiAffinity: false
ImagePullPolicy: &image_pull_policy IfNotPresent

# control plane version. See Proxy section for proxy version
Copy link
Member

Choose a reason for hiding this comment

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

unrelated to this PR, should this be edge-19.8.2, or something else?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it should. We are yet to figure out a way to inject the new version numbers into these static files (values.yaml and Chart.yaml) as part of the build.

Ivan Sim added 17 commits August 12, 2019 20:19
These are now handle by Helm functions inside the templates

Signed-off-by: Ivan Sim <[email protected]>
* Merge the way the 'install' ha and non-ha options are handled into one function
* Honor the 'NoInitContainer' option in the components templates
* Fail upgrade if the proxy injector, profile validator or tap TLS
secrets are missing. These are now auto-generated by Helm during
install. And during upgrade, they will be preserved.
* Control plane mTLS will not be disabled if identity context in the
config map is empty. The data plane mTLS will still be automatically disabled
if the context is nil.

Signed-off-by: Ivan Sim <[email protected]>
Signed-off-by: Ivan Sim <[email protected]>
During upgrade, these secrets are preserved to ensure they remain synced
wih the CA bundle in the webhook configurations. These Helm variables are used
to override the defaults in the templates.

Signed-off-by: Ivan Sim <[email protected]>
Signed-off-by: Ivan Sim <[email protected]>
When upgrading from an older version that don't have these secrets, fallback to let Helm
create them by creating an empty charts.TLS struct.

Signed-off-by: Ivan Sim <[email protected]>
In 2.4, the proxy injector and profile validator webhooks already have their selector labels defined.
Since these attributes are immutable, the recent change to these selectors introduced by the Helm chart
work will cause upgrade to fail.

Signed-off-by: Ivan Sim <[email protected]>
Signed-off-by: Ivan Sim <[email protected]>
Signed-off-by: Ivan Sim <[email protected]>
@ihcsim ihcsim force-pushed the isim/install-with-new-charts branch from d61ca13 to 159a862 Compare August 13, 2019 03:50
@l5d-bot
Copy link
Collaborator

l5d-bot commented Aug 13, 2019

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.

💥 Screen Shot 2019-08-13 at 10 19 25 AM

code updates look good. confirmed fresh install and upgrade from 2.4 both worked!

👍 🚢

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.

LGTM! 👍 🌮 🥇

@ihcsim ihcsim merged commit 4d01e37 into master Aug 13, 2019
@ihcsim ihcsim deleted the isim/install-with-new-charts branch August 13, 2019 21:16
alpeb added a commit that referenced this pull request Aug 13, 2019
Followup to #3229

Signed-off-by: Alejandro Pedraza <[email protected]>
ihcsim pushed a commit that referenced this pull request Aug 14, 2019
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.

Refactor CLI Install Command To Work With 2.5 Helm Chart

4 participants