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
3127set -o errexit
3228set -o pipefail
3329set -o xtrace
30+
3431script_dir=$( cd -- " $( dirname -- " ${BASH_SOURCE[0]} " ) " & > /dev/null && pwd)
3532root_dir=$( cd " ${script_dir} /../.." && pwd)
3633export 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
7063cd " ${script_dir} "
7164
7265pushd " ${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
7674popd
7775
7876export USE_GKE_GCLOUD_AUTH_PLUGIN=True
8583kubectl 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.
8888if ! kubectl get secret venafi-image-pull-secret -n venafi; then
8989 venctl iam service-accounts registry create \
9090 --api-key " ${VEN_API_KEY_PULL} " \
115115
116116export VENAFI_KUBERNETES_AGENT_CLIENT_ID=" not-used-but-required-by-venctl"
117117venctl 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"
133134jwksURI=$( 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.
136139while 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
194200kubectl logs deployments/venafi-kubernetes-agent \
195201 --follow \
196202 --namespace venafi \
0 commit comments