Skip to content

[helm] [self-hosted] correct proxy deployment to use kubernetes.io/tls secrets #3199

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

Closed
wants to merge 1 commit into from

Conversation

cyrilcros
Copy link

@cyrilcros cyrilcros commented Feb 16, 2021

I am suggesting this as a fix to #3183
Instead of fetching from an existingSecret various keys, you could use the Kubernetes kubernetes.io/tls secret type. Only fullchain.pem aka tls.crt and privkey.pem aka tls.key seem to be in use in the templates, the current documentations asks for more: https://www.gitpod.io/docs/self-hosted/latest/install/configure-ingress/
See https://github.com/gitpod-io/gitpod/blob/master/chart/config/proxy/lib.ssl.conf . ssl_dhparam also seems to be off?
You would need to edit your current existing secret, this is a breaking change!
Please feel absolutely free to close, this is only intended as a suggestion on how to fix... The documentation for the ingress would need to be changed too.

EDIT: I now just check if fullchain.pem and privkey.pem are in the secret and assume tls.crt and tls.key are there if it isn't the case. That's a non breaking change.

@cyrilcros cyrilcros changed the title correct proxy deployment to use kubernetes.io/tls secrets [helm] [self-hosted] correct proxy deployment to use kubernetes.io/tls secrets Feb 16, 2021
@fullmetalrooster fullmetalrooster self-assigned this Feb 17, 2021
@csweichel
Copy link
Contributor

Thank you for pointing out the kubernetes.io/tls secret type - and for the PR of course :)

As middle ground we could default to tls.crt and tls.key in the values.yaml. This way older setups that use this naming mechanism/are not kubernetes.io/tls compatible would still work, but we'd also nudge folks closer to the Kubernetes way (insert Mandalorian quote here).

It would still be a breaking change for those relying on the defaults, but one for which we could provide an easy upgrade route. WDYT?

@cyrilcros
Copy link
Author

cyrilcros commented Feb 18, 2021

I guess it makes the chart a bit more complicated, but you could also just add in the values keySecretRef: privkey.pem and fullcertSecretRef: fullchain.pem and edit it a tiny bit the templates . Ie, you specify what key:value pairs from the secret you want to use as the key and the full certificate. It isn’t a breaking change and new users can just adapt it to tls.key tls.crt.

@aledbf
Copy link
Member

aledbf commented Feb 18, 2021

Ie, you specify what key:value pairs from the secret you want to use as the key and the full certificate.

Any alternative to TLS Secrets can lead to confusion and additional complexity integrating with tools like cert-manager.
This is a really old issue but still applies kubernetes/kubernetes#27010

but one for which we could provide an easy upgrade route.

Maybe an update to the secret to rename the keys?

@cyrilcros I really like this change :)

@cyrilcros
Copy link
Author

cyrilcros commented Feb 19, 2021

Hi, in this case the Helm chart doesn't create a separate secret (see ingress docs). You would still to make a change to the templates (fullchain.pem -> tls.crt and privkey.pem -> tls.key).
The other thing we can do is assume you just have a proper TLS secret if your secret doesn't use the older format. We keep the block starting at

{{- if (and $.Values.certificatesSecret.fullChainName $.Values.certificatesSecret.chainName $.Values.certificatesSecret.keyName) }}
and I add after {{- else }} ... whatever is needed for tls.crt / tls. key ... {{- end -}}.
@aledbf @csweichel that way that's no longer a breaking change

@cyrilcros cyrilcros force-pushed the kubernetes_tls_fix branch 2 times, most recently from 88b3bbd to d2d4dd8 Compare February 19, 2021 23:26
Base automatically changed from master to main February 23, 2021 18:09
@aledbf
Copy link
Member

aledbf commented Feb 24, 2021

that way that's no longer a breaking change

Can you emit a warning using a NOTES.txt file to suggest the migration to the new format if the old values are used?

@cyrilcros
Copy link
Author

@aledbf that's done BUT I also previously altered the docs to document the new method. I have now seen in another issue those are included as a submodule. Should I just remove those doc changes from my pull requests and make them to the right repo?

Users can still use the previous form but get a deprecation warning.
@cyrilcros cyrilcros force-pushed the kubernetes_tls_fix branch from 472414e to bca5238 Compare March 1, 2021 20:42
@cyrilcros
Copy link
Author

@aledbf I removed the docs update, I will make something on the docs repository. For me this pull request is done..

@csweichel
Copy link
Contributor

Maybe an update to the secret to rename the keys?

Very good point indeed :)

Should I just remove those doc changes from my pull requests and make them to the right repo?

I think it's fine for now. We'd keep this change in mind and add it to the #3262 issue.

@csweichel
Copy link
Contributor

csweichel commented Mar 2, 2021

/werft run

👍 started the job as gitpod-build-kubernetes-tls-fix.0

@cyrilcros
Copy link
Author

@aledbf @csweichel any chance this could be merged soon? Thanks!

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.

4 participants