-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added setting up test cluster and priming certificates
- Loading branch information
Showing
12 changed files
with
157 additions
and
11 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -22,3 +22,4 @@ go.work | |
go.work.sum | ||
bin/ | ||
dist/ | ||
hack/cert-manager.yaml |
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,21 @@ | ||
apiVersion: cert-manager.io/v1 | ||
kind: Certificate | ||
metadata: | ||
name: bitwarden-tls-certs | ||
namespace: default | ||
spec: | ||
secretName: bitwarden-tls-certs | ||
dnsNames: | ||
- bitwarden-sdk-server.default.svc.cluster.local | ||
- localhost | ||
ipAddresses: | ||
- 127.0.0.1 | ||
- ::1 | ||
privateKey: | ||
algorithm: RSA | ||
encoding: PKCS8 | ||
size: 2048 | ||
issuerRef: | ||
name: bitwarden-certificate-issuer | ||
kind: ClusterIssuer | ||
group: cert-manager.io |
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,42 @@ | ||
apiVersion: cert-manager.io/v1 | ||
kind: ClusterIssuer | ||
metadata: | ||
name: bitwarden-bootstrap-issuer | ||
spec: | ||
selfSigned: {} | ||
--- | ||
apiVersion: cert-manager.io/v1 | ||
kind: Certificate | ||
metadata: | ||
name: bitwarden-bootstrap-certificate | ||
namespace: cert-manager | ||
spec: | ||
# this is discouraged but required by ios | ||
commonName: cert-manager-bitwarden-tls | ||
isCA: true | ||
secretName: bitwarden-tls-certs | ||
subject: | ||
organizations: | ||
- external-secrets.io | ||
dnsNames: | ||
- bitwarden-sdk-server.default.svc.cluster.local | ||
- localhost | ||
ipAddresses: | ||
- 127.0.0.1 | ||
- ::1 | ||
privateKey: | ||
algorithm: RSA | ||
encoding: PKCS8 | ||
size: 2048 | ||
issuerRef: | ||
name: bitwarden-bootstrap-issuer | ||
kind: ClusterIssuer | ||
group: cert-manager.io | ||
--- | ||
apiVersion: cert-manager.io/v1 | ||
kind: ClusterIssuer | ||
metadata: | ||
name: bitwarden-certificate-issuer | ||
spec: | ||
ca: | ||
secretName: bitwarden-tls-certs |
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,44 @@ | ||
#!/usr/bin/env bash | ||
|
||
# cleanup | ||
rm -fr hack/rootCA.pem | ||
|
||
CERT_MANAGER_VERSION=${CERT_MANAGER_VERSION:-v1.14.1} | ||
|
||
if [ ! -e 'hack/cert-manager.yaml' ]; then | ||
echo "fetching cert-manager manifest for version ${CERT_MANAGER_VERSION}" | ||
curl -L https://github.com/cert-manager/cert-manager/releases/download/"${CERT_MANAGER_VERSION}"/cert-manager.yaml -o hack/cert-manager.yaml | ||
fi | ||
|
||
kind create cluster --name=e2e-test-cluster | ||
|
||
echo -n 'installing cert-manager' | ||
kubectl apply -f hack/cert-manager.yaml | ||
kubectl wait --for=condition=Available=True Deployment/cert-manager -n cert-manager --timeout=60s | ||
kubectl wait --for=condition=Available=True Deployment/cert-manager-webhook -n cert-manager --timeout=60s | ||
kubectl wait --for=condition=Available=True Deployment/cert-manager-cainjector -n cert-manager --timeout=60s | ||
echo 'done' | ||
|
||
echo -n 'applying root certificate issuer' | ||
kubectl apply -f hack/cluster_issuer.yaml | ||
echo 'done' | ||
|
||
echo -n 'waiting for root certificate to be generated...' | ||
kubectl wait --for=condition=Ready=true Certificate/bitwarden-bootstrap-certificate -n cert-manager --timeout=60s | ||
echo 'done' | ||
|
||
kubectl get secret bitwarden-tls-certs -n cert-manager -o jsonpath="{.data['tls\.crt']}" | base64 -d > hack/rootCA.pem | ||
echo -n 'installing root certificate into local trust store...' | ||
CAROOT=hack ./bin/mkcert -install | ||
rootCAPath="./hack/rootCA.pem" | ||
|
||
if [ -e '/etc/ssl/certs/ca-certificates.crt' ]; then | ||
echo "updating root certificate" | ||
sudo cat "${rootCAPath}" | sudo tee -a /etc/ssl/certs/ca-certificates.crt || echo "failed to append to ca-certificates. Ignoring the failure" | ||
fi | ||
|
||
echo 'done' | ||
|
||
echo -n 'applying certificate request for bitwarden-sdk-server...' | ||
kubectl apply -f hack/bitwarden-certificate.yaml | ||
echo 'done' |
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,22 @@ | ||
-----BEGIN CERTIFICATE----- | ||
MIIDszCCApugAwIBAgIRAMGiIBGuNGKQ6WoBh4Pgh8gwDQYJKoZIhvcNAQELBQAw | ||
QzEcMBoGA1UEChMTZXh0ZXJuYWwtc2VjcmV0cy5pbzEj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oM2ZjqvBsHfZhHdDrdHwdbH4LTfKC9OHj0TSPAT/ZOSnyO21u/a | ||
bJ4ecxOfskY4TS05hS23ue6JqQkMEncKhXwpEH3/msD9Rx1F7Qi7g7xOr7SWA+fw | ||
Po/3R8gLLrdbjCorvkw7fZs24iYuBsGn9UOULzb2ggYGgXYyJLcP | ||
-----END CERTIFICATE----- |
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