-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Björn Wenzel
committed
Jun 24, 2020
1 parent
7453c13
commit f5eff6a
Showing
14 changed files
with
398 additions
and
14 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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: vault-crd | ||
namespace: vault-crd | ||
spec: | ||
selector: | ||
app: vault-crd | ||
ports: | ||
- port: 8080 | ||
type: ClusterIP | ||
--- | ||
apiVersion: admissionregistration.k8s.io/v1 | ||
kind: ValidatingWebhookConfiguration | ||
metadata: | ||
labels: | ||
app: vault-crd | ||
name: vault-crd-admission | ||
webhooks: | ||
- name: validate.vault.koudingspawn.de | ||
admissionReviewVersions: ["v1beta1"] | ||
sideEffects: None | ||
rules: | ||
- apiGroups: | ||
- koudingspawn.de | ||
apiVersions: | ||
- v1 | ||
operations: | ||
- CREATE | ||
- UPDATE | ||
resources: | ||
- vault | ||
failurePolicy: Fail | ||
clientConfig: | ||
service: | ||
namespace: vault-crd | ||
name: vault-crd | ||
path: /validation/vault-crd | ||
port: 8080 | ||
caBundle: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURRVENDQWltZ0F3SUJBZ0lVUDk4cG9lNXF0TVExWXhrVS85eHc5ZGp4N05Bd0RRWUpLb1pJaHZjTkFRRUwKQlFBd0dqRVlNQllHQTFVRUF4TVBhMjkxWkdsdVozTndZWGR1TG1SbE1CNFhEVEl3TURZeU5ERTVNVEF4TkZvWApEVE13TURZeU1qRTVNVEEwTkZvd0dqRVlNQllHQTFVRUF4TVBhMjkxWkdsdVozTndZWGR1TG1SbE1JSUJJakFOCkJna3Foa2lHOXcwQkFRRUZBQU9DQVE4QU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k2aEVZc1lnUVl6VW5KcURoT0Z2RWF1MjRLeEk2NlpXUnIKMGlSNkZmTTQ2ZjBNRVdqdmRSUGRucHh2dDhPbTBiNjVER0czc2hVTHNLZWJENFI4YjdCeTdrVUV0U1FkNVkzcwpHK1k5RTdpbXdWR1hlUTh1eWw3ZGNSV1AwTkJ1Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K |
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,9 @@ | ||
apiVersion: "koudingspawn.de/v1" | ||
kind: Vault | ||
metadata: | ||
name: test-keyvaluev2 | ||
spec: | ||
path: "keyvaluev2/example" | ||
type: "KEYVALUEV2" | ||
versionConfiguration: | ||
version: 2 |
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,7 @@ | ||
kind: Cluster | ||
apiVersion: kind.x-k8s.io/v1alpha4 | ||
nodes: | ||
- role: control-plane | ||
extraPortMappings: | ||
- containerPort: 30078 | ||
hostPort: 8200 |
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,55 @@ | ||
#!/usr/bin/env bash | ||
|
||
### setup kind cluster | ||
kind create cluster --config $PWD/cluster.yaml | ||
### it exposes at 8200 a port for vault | ||
|
||
|
||
### install vault with a static token | ||
kind get kubeconfig > ~/.kube/kind_config | ||
export KUBECONFIG="$HOME/.kube/kind_config" | ||
|
||
kubectl create namespace vault | ||
kubectl apply -f vault.yaml --namespace vault | ||
|
||
while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:8200/ui/)" != "200" ]]; do sleep 5; done | ||
echo "Vault is up and running" | ||
|
||
export VAULT_ADDR="http://localhost:8200" | ||
export VAULT_TOKEN="root" | ||
### end: install vault with a static token | ||
|
||
### deploy vault-crd | ||
kubectl apply -f ../../deploy/rbac.yaml | ||
kubectl apply -f ../../deploy/admission-webhook.yaml | ||
### end: deploy vault-crd | ||
|
||
### configure vault | ||
vault secrets enable -version=1 --path=keyvaluev1 kv | ||
|
||
echo "Configure vault with default values" | ||
vault write keyvaluev1/docker-hub url=registry.gitlab.com username=username password=VERYSECURE [email protected] | ||
|
||
vault secrets enable -path=testpki -description=testpki pki | ||
vault secrets tune -max-lease-ttl=8760h testpki | ||
vault write testpki/root/generate/internal \ | ||
common_name=koudingspawn.de \ | ||
ttl=8500h | ||
vault write testpki/roles/testrole \ | ||
allowed_domains=koudingspawn.de \ | ||
allow_subdomains=true \ | ||
max_ttl=200h | ||
|
||
vault write -format=json testpki/issue/testrole common_name=vault.koudingspawn.de > data.json | ||
vault write keyvaluev1/vault.koudingspawn.de @data.json | ||
rm data.json | ||
|
||
vault secrets enable -version=2 --path=keyvaluev2 kv | ||
vault kv put keyvaluev2/example key=first-version value=first-version | ||
vault kv put keyvaluev2/example key=second-version value=second-version | ||
vault kv put keyvaluev2/example key=third-version value=third-version | ||
vault kv put keyvaluev2/example key=fourth-version value=fourth-version | ||
|
||
vault kv put keyvaluev2/database/root username=root password=really | ||
vault write keyvaluev1/database/host host=localhost | ||
### end: configure vault |
Oops, something went wrong.