Fix test logging (#154)

Co-authored-by: Marco Franssen <[email protected]>
This commit is contained in:
kfox1111
2023-12-19 11:52:21 +00:00
committed by GitHub
co-authored by Marco Franssen
parent 33cacd2ee8
commit f642feafef
6 changed files with 48 additions and 48 deletions
+2 -1
View File
@@ -22,6 +22,7 @@ $(kubectl --request-timeout=30s describe pods --namespace "$1")
\`\`\`shell \`\`\`shell
$(kubectl get pods -o name -n "$1" | while read -r line; do echo logs for "${line}"; kubectl logs -n "$1" "${line}" --all-containers=true --ignore-errors=true; done) $(kubectl get pods -o name -n "$1" | while read -r line; do echo logs for "${line}"; kubectl logs -n "$1" "${line}" --all-containers=true --ignore-errors=true; done)
$( ([[ -n "$2" ]] && kubectl get pods -o name -n "$2") | while read -r line; do echo logs for "${line}"; kubectl logs -n "$2" "${line}" --all-containers=true --ignore-errors=true; done)
\`\`\` \`\`\`
EOF EOF
@@ -36,7 +37,7 @@ k_rollout_status () {
} }
get_spire_release_name () { get_spire_release_name () {
helm ls -A | grep '^spire' | awk '{print $1}' helm ls -A | grep '^spire' | grep -v spire-crds | awk '{print $1}'
} }
print_spire_workload_status () { print_spire_workload_status () {
+10 -10
View File
@@ -24,6 +24,15 @@ for i in "$@"; do
done done
teardown() { teardown() {
print_helm_releases
print_spire_workload_status spire-server
print_spire_workload_status spire-system
if [[ "$1" -ne 0 ]]; then
get_namespace_details spire-server
get_namespace_details spire-system
fi
if [ "${CLEANUP}" -eq 1 ]; then if [ "${CLEANUP}" -eq 1 ]; then
helm uninstall --namespace "spire-server" spire 2>/dev/null || true helm uninstall --namespace "spire-server" spire 2>/dev/null || true
helm uninstall --namespace mysql mysql 2>/dev/null || true helm uninstall --namespace mysql mysql 2>/dev/null || true
@@ -32,7 +41,7 @@ teardown() {
fi fi
} }
trap 'trap - SIGTERM && teardown' SIGINT SIGTERM EXIT trap 'EC=$? && trap - SIGTERM && teardown $EC' SIGINT SIGTERM EXIT
kubectl create namespace spire-system --dry-run=client -o yaml | kubectl apply -f - kubectl create namespace spire-system --dry-run=client -o yaml | kubectl apply -f -
kubectl label namespace spire-system pod-security.kubernetes.io/enforce=privileged || true kubectl label namespace spire-system pod-security.kubernetes.io/enforce=privileged || true
@@ -48,12 +57,3 @@ helm upgrade --install --namespace "spire-server" \
--values "${SCRIPTPATH}/values.yaml,${SCRIPTPATH}/../production/values.yaml,${SCRIPTPATH}/../production/values-node-pod-antiaffinity.yaml,${SCRIPTPATH}/../production/example-your-values.yaml" \ --values "${SCRIPTPATH}/values.yaml,${SCRIPTPATH}/../production/values.yaml,${SCRIPTPATH}/../production/values-node-pod-antiaffinity.yaml,${SCRIPTPATH}/../production/example-your-values.yaml" \
--set 'spire-server.dataStore.sql.password=sp1ff3Test' --wait spire charts/spire --set 'spire-server.dataStore.sql.password=sp1ff3Test' --wait spire charts/spire
helm test --namespace "spire-server" spire helm test --namespace "spire-server" spire
print_helm_releases
print_spire_workload_status spire-server
print_spire_workload_status spire-system
if [[ "$1" -ne 0 ]]; then
get_namespace_details spire-server
get_namespace_details spire-system
fi
+10 -10
View File
@@ -24,6 +24,15 @@ for i in "$@"; do
done done
teardown() { teardown() {
print_helm_releases
print_spire_workload_status spire-server
print_spire_workload_status spire-system
if [[ "$1" -ne 0 ]]; then
get_namespace_details spire-server
get_namespace_details spire-system
fi
if [ "${CLEANUP}" -eq 1 ]; then if [ "${CLEANUP}" -eq 1 ]; then
helm uninstall --namespace "spire-server" spire 2>/dev/null || true helm uninstall --namespace "spire-server" spire 2>/dev/null || true
helm uninstall --namespace "spire-server" postgresql 2>/dev/null || true helm uninstall --namespace "spire-server" postgresql 2>/dev/null || true
@@ -32,7 +41,7 @@ teardown() {
fi fi
} }
trap 'trap - SIGTERM && teardown' SIGINT SIGTERM EXIT trap 'EC=$? && trap - SIGTERM && teardown $EC' SIGINT SIGTERM EXIT
kubectl create namespace spire-system --dry-run=client -o yaml | kubectl apply -f - kubectl create namespace spire-system --dry-run=client -o yaml | kubectl apply -f -
kubectl label namespace spire-system pod-security.kubernetes.io/enforce=privileged || true kubectl label namespace spire-system pod-security.kubernetes.io/enforce=privileged || true
@@ -48,12 +57,3 @@ helm upgrade --install --namespace "spire-server" \
--values "${SCRIPTPATH}/values.yaml,${SCRIPTPATH}/../production/values.yaml,${SCRIPTPATH}/../production/values-node-pod-antiaffinity.yaml,${SCRIPTPATH}/../production/example-your-values.yaml" \ --values "${SCRIPTPATH}/values.yaml,${SCRIPTPATH}/../production/values.yaml,${SCRIPTPATH}/../production/values-node-pod-antiaffinity.yaml,${SCRIPTPATH}/../production/example-your-values.yaml" \
--set 'spire-server.dataStore.sql.password=sp1ff3Test' --wait spire charts/spire --set 'spire-server.dataStore.sql.password=sp1ff3Test' --wait spire charts/spire
helm test --namespace "spire-server" spire helm test --namespace "spire-server" spire
print_helm_releases
print_spire_workload_status spire-server
print_spire_workload_status spire-system
if [[ "$1" -ne 0 ]]; then
get_namespace_details spire-server
get_namespace_details spire-system
fi
+10 -11
View File
@@ -24,6 +24,15 @@ for i in "$@"; do
done done
teardown() { teardown() {
print_helm_releases
print_spire_workload_status spire-root-server
print_spire_workload_status spire-server spire-system
if [[ "$1" -ne 0 ]]; then
get_namespace_details spire-root-server
get_namespace_details spire-server spire-system
fi
if [ "${CLEANUP}" -eq 1 ]; then if [ "${CLEANUP}" -eq 1 ]; then
helm uninstall --namespace spire-server spire 2>/dev/null || true helm uninstall --namespace spire-server spire 2>/dev/null || true
kubectl delete ns spire-server 2>/dev/null || true kubectl delete ns spire-server 2>/dev/null || true
@@ -34,7 +43,7 @@ teardown() {
fi fi
} }
trap 'trap - SIGTERM && teardown' SIGINT SIGTERM EXIT trap 'EC=$? && trap - SIGTERM && teardown $EC' SIGINT SIGTERM EXIT
kubectl create namespace spire-system --dry-run=client -o yaml | kubectl apply -f - kubectl create namespace spire-system --dry-run=client -o yaml | kubectl apply -f -
kubectl label namespace spire-system pod-security.kubernetes.io/enforce=privileged || true kubectl label namespace spire-system pod-security.kubernetes.io/enforce=privileged || true
@@ -50,13 +59,3 @@ helm upgrade --install --create-namespace --namespace spire-server --values "${S
--wait spire charts/spire --wait spire charts/spire
helm test --namespace spire-server spire helm test --namespace spire-server spire
print_helm_releases
print_spire_workload_status spire-root-server
print_spire_workload_status spire-server
print_spire_workload_status spire-system
if [[ "$1" -ne 0 ]]; then
get_namespace_details spire-root-server
get_namespace_details spire-server
get_namespace_details spire-system
fi
+8 -8
View File
@@ -35,6 +35,13 @@ for i in "$@"; do
done done
teardown() { teardown() {
print_helm_releases
print_spire_workload_status spire-server spire-system
if [[ "$1" -ne 0 ]]; then
get_namespace_details spire-server spire-system
fi
if [ "${CLEANUP}" -eq 1 ]; then if [ "${CLEANUP}" -eq 1 ]; then
helm uninstall --namespace "${ns}" spire 2>/dev/null || true helm uninstall --namespace "${ns}" spire 2>/dev/null || true
kubectl delete ns "${ns}" 2>/dev/null || true kubectl delete ns "${ns}" 2>/dev/null || true
@@ -46,7 +53,7 @@ teardown() {
fi fi
} }
trap 'trap - SIGTERM && teardown' SIGINT SIGTERM EXIT trap 'EC=$? && trap - SIGTERM && teardown $EC' SIGINT SIGTERM EXIT
if [[ -n "$UPGRADE_ARGS" ]]; then if [[ -n "$UPGRADE_ARGS" ]]; then
pushd "${SCRIPTPATH}" pushd "${SCRIPTPATH}"
@@ -132,10 +139,3 @@ if helm get manifest -n spire-server spire | grep -i example; then
echo Global settings did not work. Please fix. echo Global settings did not work. Please fix.
exit 1 exit 1
fi fi
print_helm_releases
print_spire_workload_status "${ns}"
if [[ "$1" -ne 0 ]]; then
get_namespace_details "${ns}"
fi
+8 -8
View File
@@ -24,20 +24,20 @@ for i in "$@"; do
done done
teardown() { teardown() {
print_helm_releases
print_spire_workload_status "${ns}"
if [[ "$1" -ne 0 ]]; then
get_namespace_details "${ns}"
fi
if [ "${CLEANUP}" -eq 1 ]; then if [ "${CLEANUP}" -eq 1 ]; then
helm uninstall --namespace "${ns}" spire 2>/dev/null || true helm uninstall --namespace "${ns}" spire 2>/dev/null || true
kubectl delete ns "${ns}" 2>/dev/null || true kubectl delete ns "${ns}" 2>/dev/null || true
fi fi
} }
trap 'trap - SIGTERM && teardown' SIGINT SIGTERM EXIT trap 'EC=$? && trap - SIGTERM && teardown $EC' SIGINT SIGTERM EXIT
"${helm_install[@]}" --namespace "${ns}" --values "${SCRIPTPATH}/values.yaml" --wait spire charts/spire "${helm_install[@]}" --namespace "${ns}" --values "${SCRIPTPATH}/values.yaml" --wait spire charts/spire
helm test --namespace "${ns}" spire helm test --namespace "${ns}" spire
print_helm_releases
print_spire_workload_status "${ns}"
if [[ "$1" -ne 0 ]]; then
get_namespace_details "${ns}"
fi