3
3
# Build and install venafi-kubernetes-agent for VenafiConnection based authentication.
4
4
# Wait for it to log a message indicating successful data upload.
5
5
#
6
- # venafi-kubernetes-agent is packaged using ko and Helm and installed in a Kind cluster.
7
6
# A VenafiConnection resource is created which directly loads a bearer token
8
7
# from a Kubernetes Secret.
9
8
# This is the simplest way of testing the VenafiConnection integration,
10
9
# but it does not fully test "secretless" (workload identity federation) authentication.
11
10
#
12
11
# 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
16
12
# * kubectl: https://kubernetes.io/docs/tasks/tools/#kubectl
17
13
# * venctl: https://docs.venafi.cloud/vaas/venctl/t-venctl-install/
18
14
# * jq: https://jqlang.github.io/jq/download/
@@ -31,6 +27,7 @@ set -o nounset
31
27
set -o errexit
32
28
set -o pipefail
33
29
set -o xtrace
30
+
34
31
script_dir=$( cd -- " $( dirname -- " ${BASH_SOURCE[0]} " ) " & > /dev/null && pwd)
35
32
root_dir=$( cd " ${script_dir} /../.." && pwd)
36
33
export TERM=dumb
@@ -62,17 +59,18 @@ export TERM=dumb
62
59
# The name of the cluster to create
63
60
: ${CLUSTER_NAME?}
64
61
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)
69
62
70
63
cd " ${script_dir} "
71
64
72
65
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
76
74
popd
77
75
78
76
export USE_GKE_GCLOUD_AUTH_PLUGIN=True
85
83
kubectl create ns venafi || true
86
84
87
85
# 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.
88
88
if ! kubectl get secret venafi-image-pull-secret -n venafi; then
89
89
venctl iam service-accounts registry create \
90
90
--api-key " ${VEN_API_KEY_PULL} " \
115
115
116
116
export VENAFI_KUBERNETES_AGENT_CLIENT_ID=" not-used-but-required-by-venctl"
117
117
venctl components kubernetes apply \
118
+ --region $VEN_VCP_REGION \
118
119
--cert-manager \
119
120
--venafi-enhanced-issuer \
120
121
--approver-policy-enterprise \
121
122
--venafi-kubernetes-agent \
122
- --venafi-kubernetes-agent-version " ${version } " \
123
+ --venafi-kubernetes-agent-version " ${RELEASE_HELM_CHART_VERSION } " \
123
124
--venafi-kubernetes-agent-values-files " ${script_dir} /values.venafi-kubernetes-agent.yaml" \
124
125
--venafi-kubernetes-agent-custom-image-registry " ${OCI_BASE} /images" \
125
126
--venafi-kubernetes-agent-custom-chart-repository " oci://${OCI_BASE} /charts"
@@ -133,6 +134,8 @@ openidDiscoveryURL="${issuerURL}/.well-known/openid-configuration"
133
134
jwksURI=$( curl --fail-with-body -sSL ${openidDiscoveryURL} | jq -r ' .jwks_uri' )
134
135
135
136
# 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.
136
139
while true ; do
137
140
tenantID=$( curl --fail-with-body -sSL -H " tppl-api-key: $VEN_API_KEY " https://${VEN_API_HOST} /v1/serviceaccounts \
138
141
| jq -r ' .[] | select(.issuerURL==$issuerURL and .subject == $subject) | .companyId' \
@@ -191,6 +194,9 @@ kubectl -n team-1 wait certificate app-0 --for=condition=Ready
191
194
# Wait for log message indicating success.
192
195
# Filter out distracting data gatherer errors and warnings.
193
196
# 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
194
200
kubectl logs deployments/venafi-kubernetes-agent \
195
201
--follow \
196
202
--namespace venafi \
0 commit comments