Skip to content

Commit 64a9255

Browse files
authored
Merge pull request #592 from jetstack/fix-gke-e2e-test
[VC-35738] Update the E2E test script to use the makefile-modules build targets
2 parents 40224c2 + 8a79e87 commit 64a9255

File tree

2 files changed

+26
-12
lines changed

2 files changed

+26
-12
lines changed

hack/e2e/test.sh

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,12 @@
33
# Build and install venafi-kubernetes-agent for VenafiConnection based authentication.
44
# Wait for it to log a message indicating successful data upload.
55
#
6-
# venafi-kubernetes-agent is packaged using ko and Helm and installed in a Kind cluster.
76
# A VenafiConnection resource is created which directly loads a bearer token
87
# from a Kubernetes Secret.
98
# This is the simplest way of testing the VenafiConnection integration,
109
# but it does not fully test "secretless" (workload identity federation) authentication.
1110
#
1211
# Prerequisites:
13-
# * ko: https://github.com/ko-build/ko/releases/tag/v0.16.0
14-
# * helm: https://helm.sh/docs/intro/install/
15-
# * kind: https://kubernetes.io/docs/tasks/tools/#kind
1612
# * kubectl: https://kubernetes.io/docs/tasks/tools/#kubectl
1713
# * venctl: https://docs.venafi.cloud/vaas/venctl/t-venctl-install/
1814
# * jq: https://jqlang.github.io/jq/download/
@@ -31,6 +27,7 @@ set -o nounset
3127
set -o errexit
3228
set -o pipefail
3329
set -o xtrace
30+
3431
script_dir=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
3532
root_dir=$(cd "${script_dir}/../.." && pwd)
3633
export TERM=dumb
@@ -62,17 +59,18 @@ export TERM=dumb
6259
# The name of the cluster to create
6360
: ${CLUSTER_NAME?}
6461

65-
# IMPORTANT: we pick the first team as the owning team for the registry and
66-
# workload identity service account as it doesn't matter.
67-
68-
version=$(git describe --tags --always --match='v*' --abbrev=14 --dirty)
6962

7063
cd "${script_dir}"
7164

7265
pushd "${root_dir}"
73-
KO_DOCKER_REPO=$OCI_BASE/images/venafi-agent ko build --bare --tags "${version}"
74-
helm package deploy/charts/venafi-kubernetes-agent --version "${version}" --app-version "${version}"
75-
helm push "venafi-kubernetes-agent-${version}.tgz" "oci://${OCI_BASE}/charts"
66+
> release.env
67+
make release \
68+
OCI_SIGN_ON_PUSH=false \
69+
oci_platforms=linux/amd64 \
70+
oci_preflight_image_name=$OCI_BASE/images/venafi-agent \
71+
helm_chart_repo_base=oci://$OCI_BASE/charts \
72+
GITHUB_OUTPUT=release.env
73+
source release.env
7674
popd
7775

7876
export USE_GKE_GCLOUD_AUTH_PLUGIN=True
@@ -85,6 +83,8 @@ fi
8583
kubectl create ns venafi || true
8684

8785
# Pull secret for Venafi OCI registry
86+
# IMPORTANT: we pick the first team as the owning team for the registry and
87+
# workload identity service account as it doesn't matter.
8888
if ! kubectl get secret venafi-image-pull-secret -n venafi; then
8989
venctl iam service-accounts registry create \
9090
--api-key "${VEN_API_KEY_PULL}" \
@@ -115,11 +115,12 @@ fi
115115

116116
export VENAFI_KUBERNETES_AGENT_CLIENT_ID="not-used-but-required-by-venctl"
117117
venctl components kubernetes apply \
118+
--region $VEN_VCP_REGION \
118119
--cert-manager \
119120
--venafi-enhanced-issuer \
120121
--approver-policy-enterprise \
121122
--venafi-kubernetes-agent \
122-
--venafi-kubernetes-agent-version "${version}" \
123+
--venafi-kubernetes-agent-version "${RELEASE_HELM_CHART_VERSION}" \
123124
--venafi-kubernetes-agent-values-files "${script_dir}/values.venafi-kubernetes-agent.yaml" \
124125
--venafi-kubernetes-agent-custom-image-registry "${OCI_BASE}/images" \
125126
--venafi-kubernetes-agent-custom-chart-repository "oci://${OCI_BASE}/charts"
@@ -133,6 +134,8 @@ openidDiscoveryURL="${issuerURL}/.well-known/openid-configuration"
133134
jwksURI=$(curl --fail-with-body -sSL ${openidDiscoveryURL} | jq -r '.jwks_uri')
134135

135136
# Create the Venafi agent service account if one does not already exist
137+
# IMPORTANT: we pick the first team as the owning team for the registry and
138+
# workload identity service account as it doesn't matter.
136139
while true; do
137140
tenantID=$(curl --fail-with-body -sSL -H "tppl-api-key: $VEN_API_KEY" https://${VEN_API_HOST}/v1/serviceaccounts \
138141
| jq -r '.[] | select(.issuerURL==$issuerURL and .subject == $subject) | .companyId' \
@@ -191,6 +194,9 @@ kubectl -n team-1 wait certificate app-0 --for=condition=Ready
191194
# Wait for log message indicating success.
192195
# Filter out distracting data gatherer errors and warnings.
193196
# Show other useful log messages on stderr.
197+
# Disable pipefail to prevent SIGPIPE (141) errors from tee
198+
# See https://unix.stackexchange.com/questions/274120/pipe-fail-141-when-piping-output-into-tee-why
199+
set +o pipefail
194200
kubectl logs deployments/venafi-kubernetes-agent \
195201
--follow \
196202
--namespace venafi \

make/02_mod.mk

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,11 @@ $(helm_chart_source_dir)/templates/venafi-connection-crd.yaml: $(helm_chart_sour
4545
shared_generate_targets := $(filter-out generate-crds,$(shared_generate_targets))
4646
shared_generate_targets += generate-crds-venconn
4747

48+
.PHONY: test-e2e-gke
49+
## Run a basic E2E test on a GKE cluster
50+
## Build and install venafi-kubernetes-agent for VenafiConnection based authentication.
51+
## Wait for it to log a message indicating successful data upload.
52+
## See `hack/e2e/test.sh` for the full test script.
53+
## @category Testing
54+
test-e2e-gke:
55+
./hack/e2e/test.sh

0 commit comments

Comments
 (0)