-
Notifications
You must be signed in to change notification settings - Fork 4
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
feat(postgres): Support TLS ca and client keypair as a secret #121
Conversation
a7f5139
to
c13e933
Compare
2666901
to
3ff1850
Compare
… tls init container
@@ -0,0 +1,12 @@ | |||
{{- if .Values.backend.postgres.sslsecret.name }} |
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.
This configmap is mounted by the init container and executed to set permissions.
@@ -0,0 +1,40 @@ | |||
# Required options |
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.
This test case is executed by CI
@@ -3,6 +3,19 @@ apiVersion: v1 | |||
metadata: | |||
name: postgres | |||
--- | |||
kind: ConfigMap |
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.
Updated the CI test postgres to use TLS.
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.
qa'd
Description of Changes
This PR requires BindPlane v1.56.0, which will release May 8th.
backend.postgres
optionsAdded an
initContainer
tobindplane
andbindplane-jobs
deployments. This container is used to configure certificate permissions. The postgres client will refuse to start if the certificates are world readable. By default, files mounted from a secret will be world readable. To get around this, the init container will copy the files to an emptyDir volume and set their permissions. The environment variables that point to the TLS certificates will use the copy in the emptyDir volume.Updated the
bindplane
andbindplane-jobs
deployments with the followingTesting
I have a CloudSQL instance that requires mTLS. With the certs downloaded (I can share these). Latency is pretty bad, but it does work when using minikube locally.
minikube start minikube addons enable ingress kubectl apply -f test/helper/pubsub/pubsub.yaml
I created the bindplane and postgres secret with:
kubectl create secret generic bindplane \ --from-literal=license=$BINDPLANE_LICENSE kubectl create secret generic postgres-tls \ --from-file server-ca.pem \ --from-file client-cert.pem \ --from-file client-key.pem
My values file looks like this:
The pods should spin up without issue, connecting to pubsub emulator (in cluster) and cloudsql.
On macOS, run
minikube tunnel
and navigate to http://bindplane.local (make sure you have an /etc/hosts entry for this hostname, pointing to127.0.0.1
).You should be able to create and delete configs, integrating that access to Postgres is working correctly.
If you turn SSL off with
backend.postgres.sslmode: disable
and redeploy, the new pod will fail to startup (old pod stays in place).The new pod will log the following:
Please check that the PR fulfills these requirements