Skip to content

Commit

Permalink
Add VAULT_API_ADDR as environment var (hashicorp#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonodonnell authored Aug 20, 2019
1 parent abb2b6e commit acd1638
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 29 deletions.
2 changes: 2 additions & 0 deletions templates/server-statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ spec:
fieldPath: status.podIP
- name: VAULT_ADDR
value: "{{ include "vault.scheme" . }}://127.0.0.1:8200"
- name: VAULT_API_ADDR
value: "{{ include "vault.scheme" . }}://$(POD_IP):8200"
- name: SKIP_CHOWN
value: "true"
{{ template "vault.envs" . }}
Expand Down
20 changes: 10 additions & 10 deletions test/unit/server-dev-statefulset.bats
Original file line number Diff line number Diff line change
Expand Up @@ -224,19 +224,19 @@ load _helpers
yq -r '.spec.template.spec.containers[0].env' | tee /dev/stderr)

local actual=$(echo $object |
yq -r '.[5].name' | tee /dev/stderr)
yq -r '.[6].name' | tee /dev/stderr)
[ "${actual}" = "FOO" ]

local actual=$(echo $object |
yq -r '.[5].value' | tee /dev/stderr)
yq -r '.[6].value' | tee /dev/stderr)
[ "${actual}" = "bar" ]

local actual=$(echo $object |
yq -r '.[6].name' | tee /dev/stderr)
yq -r '.[7].name' | tee /dev/stderr)
[ "${actual}" = "FOOBAR" ]

local actual=$(echo $object |
yq -r '.[6].value' | tee /dev/stderr)
yq -r '.[7].value' | tee /dev/stderr)
[ "${actual}" = "foobar" ]
}

Expand All @@ -257,23 +257,23 @@ load _helpers
yq -r '.spec.template.spec.containers[0].env' | tee /dev/stderr)

local actual=$(echo $object |
yq -r '.[4].name' | tee /dev/stderr)
yq -r '.[5].name' | tee /dev/stderr)
[ "${actual}" = "ENV_FOO_0" ]
local actual=$(echo $object |
yq -r '.[4].valueFrom.secretKeyRef.name' | tee /dev/stderr)
yq -r '.[5].valueFrom.secretKeyRef.name' | tee /dev/stderr)
[ "${actual}" = "secret_name_0" ]
local actual=$(echo $object |
yq -r '.[4].valueFrom.secretKeyRef.key' | tee /dev/stderr)
yq -r '.[5].valueFrom.secretKeyRef.key' | tee /dev/stderr)
[ "${actual}" = "secret_key_0" ]

local actual=$(echo $object |
yq -r '.[5].name' | tee /dev/stderr)
yq -r '.[6].name' | tee /dev/stderr)
[ "${actual}" = "ENV_FOO_1" ]
local actual=$(echo $object |
yq -r '.[5].valueFrom.secretKeyRef.name' | tee /dev/stderr)
yq -r '.[6].valueFrom.secretKeyRef.name' | tee /dev/stderr)
[ "${actual}" = "secret_name_1" ]
local actual=$(echo $object |
yq -r '.[5].valueFrom.secretKeyRef.key' | tee /dev/stderr)
yq -r '.[6].valueFrom.secretKeyRef.key' | tee /dev/stderr)
[ "${actual}" = "secret_key_1" ]
}

Expand Down
20 changes: 10 additions & 10 deletions test/unit/server-ha-statefulset.bats
Original file line number Diff line number Diff line change
Expand Up @@ -320,19 +320,19 @@ load _helpers
yq -r '.spec.template.spec.containers[0].env' | tee /dev/stderr)

local actual=$(echo $object |
yq -r '.[4].name' | tee /dev/stderr)
yq -r '.[5].name' | tee /dev/stderr)
[ "${actual}" = "FOO" ]

local actual=$(echo $object |
yq -r '.[4].value' | tee /dev/stderr)
yq -r '.[5].value' | tee /dev/stderr)
[ "${actual}" = "bar" ]

local actual=$(echo $object |
yq -r '.[5].name' | tee /dev/stderr)
yq -r '.[6].name' | tee /dev/stderr)
[ "${actual}" = "FOOBAR" ]

local actual=$(echo $object |
yq -r '.[5].value' | tee /dev/stderr)
yq -r '.[6].value' | tee /dev/stderr)
[ "${actual}" = "foobar" ]
}

Expand All @@ -354,23 +354,23 @@ load _helpers
yq -r '.spec.template.spec.containers[0].env' | tee /dev/stderr)

local actual=$(echo $object |
yq -r '.[4].name' | tee /dev/stderr)
yq -r '.[5].name' | tee /dev/stderr)
[ "${actual}" = "ENV_FOO_0" ]
local actual=$(echo $object |
yq -r '.[4].valueFrom.secretKeyRef.name' | tee /dev/stderr)
yq -r '.[5].valueFrom.secretKeyRef.name' | tee /dev/stderr)
[ "${actual}" = "secret_name_0" ]
local actual=$(echo $object |
yq -r '.[4].valueFrom.secretKeyRef.key' | tee /dev/stderr)
yq -r '.[5].valueFrom.secretKeyRef.key' | tee /dev/stderr)
[ "${actual}" = "secret_key_0" ]

local actual=$(echo $object |
yq -r '.[5].name' | tee /dev/stderr)
yq -r '.[6].name' | tee /dev/stderr)
[ "${actual}" = "ENV_FOO_1" ]
local actual=$(echo $object |
yq -r '.[5].valueFrom.secretKeyRef.name' | tee /dev/stderr)
yq -r '.[6].valueFrom.secretKeyRef.name' | tee /dev/stderr)
[ "${actual}" = "secret_name_1" ]
local actual=$(echo $object |
yq -r '.[5].valueFrom.secretKeyRef.key' | tee /dev/stderr)
yq -r '.[6].valueFrom.secretKeyRef.key' | tee /dev/stderr)
[ "${actual}" = "secret_key_1" ]
}

Expand Down
16 changes: 8 additions & 8 deletions test/unit/server-statefulset.bats
Original file line number Diff line number Diff line change
Expand Up @@ -296,19 +296,19 @@ load _helpers
yq -r '.spec.template.spec.containers[0].env' | tee /dev/stderr)

local actual=$(echo $object |
yq -r '.[4].name' | tee /dev/stderr)
yq -r '.[5].name' | tee /dev/stderr)
[ "${actual}" = "FOO" ]

local actual=$(echo $object |
yq -r '.[4].value' | tee /dev/stderr)
yq -r '.[5].value' | tee /dev/stderr)
[ "${actual}" = "bar" ]

local actual=$(echo $object |
yq -r '.[5].name' | tee /dev/stderr)
yq -r '.[6].name' | tee /dev/stderr)
[ "${actual}" = "FOOBAR" ]

local actual=$(echo $object |
yq -r '.[5].value' | tee /dev/stderr)
yq -r '.[6].value' | tee /dev/stderr)
[ "${actual}" = "foobar" ]

local object=$(helm template \
Expand All @@ -319,19 +319,19 @@ load _helpers
yq -r '.spec.template.spec.containers[0].env' | tee /dev/stderr)

local actual=$(echo $object |
yq -r '.[4].name' | tee /dev/stderr)
yq -r '.[5].name' | tee /dev/stderr)
[ "${actual}" = "FOO" ]

local actual=$(echo $object |
yq -r '.[4].value' | tee /dev/stderr)
yq -r '.[5].value' | tee /dev/stderr)
[ "${actual}" = "bar" ]

local actual=$(echo $object |
yq -r '.[5].name' | tee /dev/stderr)
yq -r '.[6].name' | tee /dev/stderr)
[ "${actual}" = "FOOBAR" ]

local actual=$(echo $object |
yq -r '.[5].value' | tee /dev/stderr)
yq -r '.[6].value' | tee /dev/stderr)
[ "${actual}" = "foobar" ]
}

Expand Down
3 changes: 2 additions & 1 deletion values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ global:
enabled: true

# Image is the name (and tag) of the Vault Docker image.
image: "vault:1.2.1"
image: "vault:1.2.2"
# TLS for end-to-end encrypted transport
tlsDisable: true

Expand Down Expand Up @@ -176,6 +176,7 @@ server:
# This should be HCL.
config: |
ui = true
listener "tcp" {
tls_disable = 1
address = "[::]:8200"
Expand Down

0 comments on commit acd1638

Please sign in to comment.