Skip to content
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

Use GCP SA json for auth #1588

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions test/bats/gcp.bats
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ export RESOURCE_NAME=${RESOURCE_NAME:-"projects/735463103342/secrets/test-secret
export FILE_NAME=${FILE_NAME:-"secret"}
export SECRET_VALUE=${SECRET_VALUE:-"aHVudGVyMg=="}

setup() {
if [[ -z "${GCP_SA_JSON}" ]]; then
echo "Error: GCP Service Account (GCP_SA_JSON) is not provided" >&2
return 1
fi
}

@test "install gcp provider" {
run kubectl apply -f $PROVIDER_YAML --namespace $PROVIDER_NAMESPACE
assert_success
Expand All @@ -26,6 +33,15 @@ export SECRET_VALUE=${SECRET_VALUE:-"aHVudGVyMg=="}
assert_success
}

@test "create gcp k8s secret for provider auth" {
run kubectl create secret generic secrets-store-creds --namespace $NAMESPACE --from-literal=key.json="${GCP_SA_JSON}"
assert_success

# label the node publish secret ref secret
run kubectl label secret secrets-store-creds secrets-store.csi.k8s.io/used=true
assert_success
}

@test "deploy gcp secretproviderclass crd" {
envsubst < $BATS_TESTS_DIR/gcp_v1_secretproviderclass.yaml | kubectl apply --namespace=$NAMESPACE -f -

Expand Down
3 changes: 3 additions & 0 deletions test/bats/tests/gcp/pod-secrets-store-inline-volume-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ spec:
readOnly: true
volumeAttributes:
secretProviderClass: "gcp"
nodePublishSecretRef:
name: secrets-store-creds