|
580 | 580 | export KUBECONFIG |
581 | 581 | } |
582 | 582 |
|
| 583 | +# Deletes kind cluster inside a prow job |
| 584 | +delete_cluster_inside_prow_job() { |
| 585 | + # Inside a real Prow job it is better to clean up at runtime |
| 586 | + # instead of leaving that to the Prow job cleanup code |
| 587 | + # because the later sometimes times out (https://github.com/kubernetes-csi/csi-release-tools/issues/24#issuecomment-554765872). |
| 588 | + if [ "$JOB_NAME" ]; then |
| 589 | + if kind get clusters | grep -q csi-prow; then |
| 590 | + run kind delete cluster --name=csi-prow || die "kind delete failed" |
| 591 | + fi |
| 592 | + unset KUBECONFIG |
| 593 | + fi |
| 594 | +} |
| 595 | + |
583 | 596 | # Looks for the deployment as specified by CSI_PROW_DEPLOYMENT and CSI_PROW_KUBERNETES_VERSION |
584 | 597 | # in the given directory. |
585 | 598 | find_deployment () { |
@@ -683,16 +696,16 @@ EOF |
683 | 696 |
|
684 | 697 | } |
685 | 698 |
|
686 | | -# Gets logs of all containers in the default namespace. When passed -f, kubectl will |
| 699 | +# Gets logs of all containers in all namespaces. When passed -f, kubectl will |
687 | 700 | # keep running and capture new output. Prints the pid of all background processes. |
688 | 701 | # The caller must kill (when using -f) and/or wait for them. |
689 | 702 | # |
690 | 703 | # May be called multiple times and thus appends. |
691 | 704 | start_loggers () { |
692 | | - kubectl get pods -o go-template --template='{{range .items}}{{.metadata.name}} {{range .spec.containers}}{{.name}} {{end}}{{"\n"}}{{end}}' | while read -r pod containers; do |
| 705 | + kubectl get pods --all-namespaces -o go-template --template='{{range .items}}{{.metadata.namespace}} {{.metadata.name}} {{range .spec.containers}}{{.name}} {{end}}{{"\n"}}{{end}}' | while read -r namespace pod containers; do |
693 | 706 | for container in $containers; do |
694 | | - mkdir -p "${ARTIFACTS}/$pod" |
695 | | - kubectl logs "$@" "$pod" "$container" >>"${ARTIFACTS}/$pod/$container.log" & |
| 707 | + mkdir -p "${ARTIFACTS}/$namespace/$pod" |
| 708 | + kubectl logs -n "$namespace" "$@" "$pod" "$container" >>"${ARTIFACTS}/$namespace/$pod/$container.log" & |
696 | 709 | echo "$!" |
697 | 710 | done |
698 | 711 | done |
@@ -1017,6 +1030,7 @@ main () { |
1017 | 1030 | fi |
1018 | 1031 | fi |
1019 | 1032 | fi |
| 1033 | + delete_cluster_inside_prow_job |
1020 | 1034 | fi |
1021 | 1035 |
|
1022 | 1036 | if tests_need_alpha_cluster && [ "${CSI_PROW_E2E_ALPHA_GATES}" ]; then |
@@ -1047,6 +1061,7 @@ main () { |
1047 | 1061 | fi |
1048 | 1062 | fi |
1049 | 1063 | fi |
| 1064 | + delete_cluster_inside_prow_job |
1050 | 1065 | fi |
1051 | 1066 | fi |
1052 | 1067 |
|
|
0 commit comments