-
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
Merged
Merged
Changes from 8 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
26696a0
feat(postgres): Support TLS ca and client keypair as a secret
jsirianni cddc1fb
Rename ldap script and create postgres tls secret
jsirianni 47664f0
add version notice
jsirianni 94a6320
wip, sort out cert permissions
jsirianni fa17e2f
fix test postgres deployment and certificate script
jsirianni 6f79e08
fix postgres cert init
jsirianni 3ff1850
create ns if it does not exist
jsirianni 19c57c5
move configmap to dedicated template. update jobs pod to use postgres…
jsirianni 08eae7c
revert
jsirianni File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
curl -L -o step-cli_amd64.deb https://github.com/smallstep/cli/releases/download/v0.26.1/step-cli_0.26.1_amd64.deb | ||
sudo apt-get install -y -qq -f ./step-cli_amd64.deb | ||
|
||
step certificate create \ | ||
ca.ldap.example.com \ | ||
ca.crt ca.key \ | ||
--profile root-ca \ | ||
--no-password \ | ||
--insecure \ | ||
--not-after=87600h | ||
|
||
# Can be used for server and client | ||
# despite the name being "client". | ||
step certificate create \ | ||
'ldap.example.com' \ | ||
client.crt client.key \ | ||
--profile leaf \ | ||
--not-after 2160h \ | ||
--no-password \ | ||
--insecure \ | ||
--ca ca.crt \ | ||
--ca-key ca.key | ||
|
||
kubectl create secret generic ldap-tls \ | ||
--from-file ca.crt \ | ||
--from-file client.crt \ | ||
--from-file client.key | ||
|
||
rm -f ca.crt ca.key client.crt client.key | ||
|
||
step certificate create \ | ||
postgres.svc.cluster.local \ | ||
ca.crt ca.key \ | ||
--profile root-ca \ | ||
--no-password \ | ||
--insecure \ | ||
--not-after=87600h | ||
|
||
step certificate create \ | ||
'postgres' \ | ||
client.crt client.key \ | ||
--profile leaf \ | ||
--not-after 2160h \ | ||
--no-password \ | ||
--insecure \ | ||
--ca ca.crt \ | ||
--ca-key ca.key | ||
|
||
step certificate create \ | ||
'postgres.postgres.svc.cluster.local' \ | ||
server.crt server.key \ | ||
--profile leaf \ | ||
--not-after 2160h \ | ||
--no-password \ | ||
--insecure \ | ||
--ca ca.crt \ | ||
--ca-key ca.key | ||
|
||
kubectl create secret generic postgres-tls \ | ||
--from-file ca.crt \ | ||
--from-file client.crt \ | ||
--from-file client.key | ||
|
||
kubectl create namespace postgres || true | ||
|
||
kubectl create secret generic postgres-tls \ | ||
-n postgres \ | ||
--from-file ca.crt \ | ||
--from-file server.crt \ | ||
--from-file server.key |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{{- if .Values.backend.postgres.sslsecret.name }} | ||
kind: ConfigMap | ||
apiVersion: v1 | ||
metadata: | ||
name: postgres-tls-init | ||
data: | ||
init.sh: | | ||
#!/bin/sh | ||
cp /ca.crt /client.crt /client.key /postgres-tls | ||
chmod 0400 /postgres-tls/* | ||
chown -R 65534:65534 /postgres-tls | ||
{{ end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Required options | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test case is executed by CI |
||
config: | ||
username: bpuser | ||
password: bppass | ||
sessions_secret: 4484766F-5016-4077-B8E0-0DE1D637854B | ||
licenseUseSecret: true | ||
|
||
backend: | ||
type: postgres | ||
postgres: | ||
host: postgres.postgres.svc.cluster.local | ||
database: bindplane | ||
username: postgres | ||
password: password | ||
maxConnections: 12 | ||
sslmode: verify-ca | ||
sslsecret: | ||
name: postgres-tls | ||
sslrootcertSubPath: ca.crt | ||
sslcertSubPath: client.crt | ||
sslkeySubPath: client.key | ||
|
||
replicas: 2 | ||
|
||
resources: | ||
requests: | ||
memory: 100Mi | ||
cpu: 100m | ||
limits: | ||
memory: 100Mi | ||
cpu: 100m | ||
|
||
jobs: | ||
resources: | ||
requests: | ||
memory: 100Mi | ||
cpu: 100m | ||
limits: | ||
memory: 100Mi | ||
cpu: 100m |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.