-
Notifications
You must be signed in to change notification settings - Fork 8
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
Add support for TLS for xDS with Gloo Gateway #10582
Conversation
Visit the preview URL for this PR (updated for commit 0500463): https://gloo-edge--pr10582-sheidkamp-k8s-gw-mtl-dm0tvwih.web.app (expires Thu, 06 Feb 2025 16:31:20 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: 77c2b86e287749579b7ff9cadb81e099042ef677 |
Issues linked to changelog: |
…o-io/gloo into sheidkamp/k8s-gw-mtls-deployer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
projects/gateway2/helm/gloo-gateway/templates/gateway/proxy-deployment.yaml
Show resolved
Hide resolved
Co-authored-by: Jenny Shu <[email protected]>
@@ -76,6 +79,11 @@ func getInitialSettings(ctx context.Context, c istiokube.Client, nns types.Names | |||
return out | |||
} | |||
|
|||
// checkGlooMtlsEnabled checks if gloo mtls is enabled by looking at the gloo deployment and checking if the sds container is present | |||
func checkGlooMtlsEnabled() bool { | |||
return os.Getenv("GLOO_MTLS_SDS_ENABLED") == "true" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: can use IsEnvTruthy helper
Co-authored-by: David Jumani <[email protected]> Co-authored-by: Jenny Shu <[email protected]>
Description
The helm setting
global.glooMtls.enabled
has been extended to configure gg2 proxies to use mtls for xds. Previously the setting only applied to Edge gateways.API changes
none
Code changes
GlooMtlsEnabled
andNamespace
toControlPlaneInfo
NewControllerBuilder
gloo-mtls-certs
secret (if gloo mTLS is enabled)ControlPlaneInfo
valuesCI changes
none
Docs changes
none
Context
Users wanted to be able to use mtls with xDS for gg2 proxies.
mTLS docs
Interesting decisions
Extending the Gloo Edge approach (we generate the certs and manage their rotation) rather than implement a "better" solution.
Decision captured here. An approach using one way TLS + JWT using a k8s projected service account token is being investigated, and wanted to continue this approach to ensure delivery of functionality.
Using the global
global.glooMtls.enabled
flagIn the gloo control plane, mtls for xDS is either on or off. Adding a field to
GatewayParameters
would have allowed us to control the use of mtls per-proxy, but if the settings did not match the global setting, the xDS connection would failDiscussion about using GatewayParameters to potentially allow mixed mode
Copying secrets across namespaces
Mtls is implemented by mounting secrets to sidecar containers. In classic Gloo Edge, the proxy was always in the same namespace as the gloo pod, so they were both able to access the secret.
gg2 proxies can be deployed into many namespaces, and secrets can only be mounted into a container from the same namespace. Because of this, the secret needs to be available in the namespace.
We chose the deployer as the mechanism to mirror the secrets, as it already has the responsibility of deploying Kubernetes resources to the proxy namespace based on changes to underlying resources.
Testing steps
Istio validation
Istio can be used with Gloo Gateway to provide autoMtls for upstreams, and is implemented using the same SDS container on the proxy deployment that the xDS mTLS uses. There shouldn't be any interference between these pieces of functionality, but we should validate.
Manual validation
Follow the steps outlined in https://github.com/solo-io/gloo/blob/main/projects/gateway2/README.md, and when installing Gloo, add
--set global.glooMtls.enabled=true
to thehelm upgrade -i
commands.Validation with e2e tests
In this (since reverted) commit, glooMtls was enabled for the Istio kubernetes e2e tests and run through CI. Results - the tests that failed were checking for exactly one container in the proxy-deployment, which is not the case under MTLS.
Notes for reviewers
Checklist: