File tree Expand file tree Collapse file tree 1 file changed +31
-1
lines changed Expand file tree Collapse file tree 1 file changed +31
-1
lines changed Original file line number Diff line number Diff line change 2626set -o nounset
2727set -o errexit
2828set -o pipefail
29- set -o xtrace
3029
3130script_dir=$( cd -- " $( dirname -- " ${BASH_SOURCE[0]} " ) " & > /dev/null && pwd)
3231root_dir=$( cd " ${script_dir} /../.." && pwd)
@@ -195,7 +194,38 @@ kubectl -n team-1 wait certificate app-0 --for=condition=Ready
195194# Parse logs as JSON using jq to ensure logs are all JSON formatted.
196195# Disable pipefail to prevent SIGPIPE (141) errors from tee
197196# See https://unix.stackexchange.com/questions/274120/pipe-fail-141-when-piping-output-into-tee-why
197+ set +o pipefail
198198kubectl logs deployments/venafi-kubernetes-agent \
199199 --follow \
200200 --namespace venafi \
201201 | timeout 60 jq ' if .msg | test("Data sent successfully") then . | halt_error(0) end'
202+ set -o pipefail
203+
204+ # Create a unique TLS Secret and wait for it to appear in the Venafi certificate inventory API
205+ commonname=" venafi-kubernetes-agent-e2e.$( uuidgen) "
206+ openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /tmp/tls.key -out /tmp/tls.crt -subj " /CN=$commonname "
207+ kubectl create secret tls " $commonname " --cert=/tmp/tls.crt --key=/tmp/tls.key -o yaml --dry-run=client | kubectl apply -f -
208+
209+ getCertificate () {
210+ jq -n ' {
211+ "expression": {
212+ "field": "subjectCN",
213+ "operator": "MATCH",
214+ "value": $commonname
215+ },
216+ "ordering": {
217+ "orders": [
218+ { "direction": "DESC", "field": "certificatInstanceModificationDate" }
219+ ]
220+ },
221+ "paging": { "pageNumber": 0, "pageSize": 10 }
222+ }' --arg commonname " ${commonname} " \
223+ | curl " https://${VEN_API_HOST} /outagedetection/v1/certificatesearch?excludeSupersededInstances=true&ownershipTree=true" \
224+ -fsSL \
225+ -H " tppl-api-key: $VEN_API_KEY " \
226+ --json @- \
227+ | jq ' if .count == 0 then . | halt_error(1) end'
228+ }
229+
230+ # Wait 5 minutes for the certificate to appear.
231+ for (( i= 0 ;;i++ )) ; do if getCertificate; then exit 0; fi ; sleep 30; done | timeout 5m cat
You can’t perform that action at this time.
0 commit comments