forked from kelseyhightower/confd
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor Vault backend integration tests
Set a full path for all keys because Vault >=1.0 no longer accepts empties [[GH-19]](hashicorp/vault-plugin-secrets-kv#19)
- Loading branch information
Showing
21 changed files
with
182 additions
and
40 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,7 @@ | ||
[template] | ||
mode = "0644" | ||
src = "basic.conf.tmpl" | ||
dest = "/tmp/confd-basic-test.conf" | ||
keys = [ | ||
"kv-v1/database", | ||
] |
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 @@ | ||
[template] | ||
mode = "0644" | ||
src = "exists-test.conf.tmpl" | ||
dest = "/tmp/confd-exists-test.conf" | ||
keys = [ | ||
"kv-v1/exists", | ||
] |
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 @@ | ||
[template] | ||
mode = "0644" | ||
src = "iteration.conf.tmpl" | ||
dest = "/tmp/confd-iteration-test.conf" | ||
keys = [ | ||
"kv-v1/upstream", | ||
] |
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 @@ | ||
[template] | ||
mode = "0644" | ||
src = "basic.conf.tmpl" | ||
dest = "/tmp/confd-manykeys-test.conf" | ||
keys = [ | ||
"kv-v1/database", | ||
] |
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 @@ | ||
[template] | ||
mode = "0644" | ||
src = "nested.conf.tmpl" | ||
dest = "/tmp/confd-nested-test.conf" | ||
keys = [ | ||
"kv-v1/nested", | ||
] |
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,6 @@ | ||
hostname: {{ getenv "HOSTNAME" }} | ||
[database] | ||
host={{ getv "/kv-v1/database/host" }} | ||
password={{ getv "/kv-v1/database/password" }} | ||
port={{ getv "/kv-v1/database/port" }} | ||
username={{ getv "/kv-v1/database/username" }} |
2 changes: 2 additions & 0 deletions
2
integration/vault-approle/confdir/templates/exists-test.conf.tmpl
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,2 @@ | ||
{{ if exists "/kv-v1/exists" }}value: {{ getv "/kv-v1/exists/key" }}{{ end }} | ||
{{- if exists "/kv-v1/doesnotexist" }}This line will not be printed value: {{ getv "/kv-v1/exists/key" }}{{ end }} |
16 changes: 16 additions & 0 deletions
16
integration/vault-approle/confdir/templates/iteration.conf.tmpl
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,16 @@ | ||
upstream app { | ||
{{- range gets "/kv-v1/upstream/*" }} | ||
server {{ .Value }}; | ||
{{- end }} | ||
} | ||
|
||
server { | ||
server_name www.example.com; | ||
location / { | ||
proxy_pass http://app; | ||
proxy_redirect off; | ||
proxy_set_header Host $host; | ||
proxy_set_header X-Real-IP $remote_addr; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
integration/vault-approle/confdir/templates/nested.conf.tmpl
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,18 @@ | ||
upstream app { | ||
{{- range gets "/kv-v1/nested/*" }} | ||
{{- range gets .Key }} | ||
server {{ .Value }}; | ||
{{- end }} | ||
{{- end }} | ||
} | ||
|
||
server { | ||
server_name www.example.com; | ||
location / { | ||
proxy_pass http://app; | ||
proxy_redirect off; | ||
proxy_set_header Host $host; | ||
proxy_set_header X-Real-IP $remote_addr; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
} | ||
} |
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 @@ | ||
[template] | ||
mode = "0644" | ||
src = "basic.conf.tmpl" | ||
dest = "/tmp/confd-basic-test.conf" | ||
keys = [ | ||
"kv-v1/database", | ||
] |
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 @@ | ||
[template] | ||
mode = "0644" | ||
src = "exists-test.conf.tmpl" | ||
dest = "/tmp/confd-exists-test.conf" | ||
keys = [ | ||
"kv-v1/exists", | ||
] |
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 @@ | ||
[template] | ||
mode = "0644" | ||
src = "iteration.conf.tmpl" | ||
dest = "/tmp/confd-iteration-test.conf" | ||
keys = [ | ||
"kv-v1/upstream", | ||
] |
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 @@ | ||
[template] | ||
mode = "0644" | ||
src = "basic.conf.tmpl" | ||
dest = "/tmp/confd-manykeys-test.conf" | ||
keys = [ | ||
"kv-v1/database", | ||
] |
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 @@ | ||
[template] | ||
mode = "0644" | ||
src = "nested.conf.tmpl" | ||
dest = "/tmp/confd-nested-test.conf" | ||
keys = [ | ||
"kv-v1/nested", | ||
] |
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,6 @@ | ||
hostname: {{ getenv "HOSTNAME" }} | ||
[database] | ||
host={{ getv "/kv-v1/database/host" }} | ||
password={{ getv "/kv-v1/database/password" }} | ||
port={{ getv "/kv-v1/database/port" }} | ||
username={{ getv "/kv-v1/database/username" }} |
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,2 @@ | ||
{{ if exists "/kv-v1/exists" }}value: {{ getv "/kv-v1/exists/key" }}{{ end }} | ||
{{- if exists "/kv-v1/doesnotexist" }}This line will not be printed value: {{ getv "/kv-v1/exists/key" }}{{ end }} |
16 changes: 16 additions & 0 deletions
16
integration/vault-v1/confdir/templates/iteration.conf.tmpl
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,16 @@ | ||
upstream app { | ||
{{- range gets "/kv-v1/upstream/*" }} | ||
server {{ .Value }}; | ||
{{- end }} | ||
} | ||
|
||
server { | ||
server_name www.example.com; | ||
location / { | ||
proxy_pass http://app; | ||
proxy_redirect off; | ||
proxy_set_header Host $host; | ||
proxy_set_header X-Real-IP $remote_addr; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
} | ||
} |
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,18 @@ | ||
upstream app { | ||
{{- range gets "/kv-v1/nested/*" }} | ||
{{- range gets .Key }} | ||
server {{ .Value }}; | ||
{{- end }} | ||
{{- end }} | ||
} | ||
|
||
server { | ||
server_name www.example.com; | ||
location / { | ||
proxy_pass http://app; | ||
proxy_redirect off; | ||
proxy_set_header Host $host; | ||
proxy_set_header X-Real-IP $remote_addr; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
} | ||
} |
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,20 @@ | ||
#!/bin/bash | ||
|
||
export HOSTNAME="localhost" | ||
export ROOT_TOKEN="$(vault read -field id auth/token/lookup-self)" | ||
|
||
vault secrets enable -version 1 -path kv-v1 kv | ||
|
||
vault write kv-v1/exists key=foobar | ||
vault write kv-v1/database host=127.0.0.1 port=3306 username=confd password=p@sSw0rd | ||
vault write kv-v1/upstream app1=10.0.1.10:8080 app2=10.0.1.11:8080 | ||
vault write kv-v1/nested/east app1=10.0.1.10:8080 | ||
vault write kv-v1/nested/west app2=10.0.1.11:8080 | ||
|
||
# Run confd | ||
confd --onetime --log-level debug \ | ||
--confdir ./integration/vault-v1/confdir \ | ||
--backend vault \ | ||
--auth-type token \ | ||
--auth-token $ROOT_TOKEN \ | ||
--node http://127.0.0.1:8200 |
This file was deleted.
Oops, something went wrong.