From 027039530d43bc01c9c17cc0be48db583bff943f Mon Sep 17 00:00:00 2001 From: Brad Davidson Date: Thu, 29 Sep 2022 23:25:28 +0000 Subject: [PATCH] Dump info on coredns when deployment rollout fails Signed-off-by: Brad Davidson --- tests/install/centos-7/Vagrantfile | 10 ++++++++++ tests/install/fedora-coreos/Vagrantfile | 10 ++++++++++ tests/install/opensuse-leap/Vagrantfile | 10 ++++++++++ tests/install/opensuse-microos/Vagrantfile | 10 ++++++++++ tests/install/rocky-8/Vagrantfile | 10 ++++++++++ tests/install/ubuntu-focal/Vagrantfile | 12 +++++++++++- tests/snapshotter/btrfs/opensuse-leap/Vagrantfile | 10 ++++++++++ 7 files changed, 71 insertions(+), 1 deletion(-) diff --git a/tests/install/centos-7/Vagrantfile b/tests/install/centos-7/Vagrantfile index c854c9dfe9..78186523d7 100644 --- a/tests/install/centos-7/Vagrantfile +++ b/tests/install/centos-7/Vagrantfile @@ -42,6 +42,16 @@ Vagrant.configure("2") do |config| sh.inline = <<~SHELL #!/usr/bin/env bash set -eu -o pipefail + function describe-coredns { + RC=$? + if [[ $RC -ne 0 ]]; then + kubectl describe node + kubectl --namespace kube-system describe pod -l k8s-app=kube-dns + kubectl --namespace kube-system logs -l k8s-app=kube-dns + fi + exit $RC + } + trap describe-coredns EXIT time timeout 300 bash -c 'while ! (kubectl --namespace kube-system rollout status --timeout 10s deploy/coredns 2>/dev/null); do sleep 5; done' SHELL end diff --git a/tests/install/fedora-coreos/Vagrantfile b/tests/install/fedora-coreos/Vagrantfile index ba00178541..bec0ea97ac 100644 --- a/tests/install/fedora-coreos/Vagrantfile +++ b/tests/install/fedora-coreos/Vagrantfile @@ -42,6 +42,16 @@ Vagrant.configure("2") do |config| sh.inline = <<~SHELL #!/usr/bin/env bash set -eu -o pipefail + function describe-coredns { + RC=$? + if [[ $RC -ne 0 ]]; then + kubectl describe node + kubectl --namespace kube-system describe pod -l k8s-app=kube-dns + kubectl --namespace kube-system logs -l k8s-app=kube-dns + fi + exit $RC + } + trap describe-coredns EXIT time timeout 300 bash -c 'while ! (kubectl --namespace kube-system rollout status --timeout 10s deploy/coredns 2>/dev/null); do sleep 5; done' SHELL end diff --git a/tests/install/opensuse-leap/Vagrantfile b/tests/install/opensuse-leap/Vagrantfile index e948e163ce..6b1eeac315 100644 --- a/tests/install/opensuse-leap/Vagrantfile +++ b/tests/install/opensuse-leap/Vagrantfile @@ -44,6 +44,16 @@ Vagrant.configure("2") do |config| sh.inline = <<~SHELL #!/usr/bin/env bash set -eu -o pipefail + function describe-coredns { + RC=$? + if [[ $RC -ne 0 ]]; then + kubectl describe node + kubectl --namespace kube-system describe pod -l k8s-app=kube-dns + kubectl --namespace kube-system logs -l k8s-app=kube-dns + fi + exit $RC + } + trap describe-coredns EXIT timeout 300 bash -c 'while ! (kubectl --namespace kube-system rollout status --timeout 10s deploy/coredns); do sleep 5; done' SHELL end diff --git a/tests/install/opensuse-microos/Vagrantfile b/tests/install/opensuse-microos/Vagrantfile index f588b005e6..08cb085612 100644 --- a/tests/install/opensuse-microos/Vagrantfile +++ b/tests/install/opensuse-microos/Vagrantfile @@ -45,6 +45,16 @@ Vagrant.configure("2") do |config| sh.inline = <<~SHELL #!/usr/bin/env bash set -eu -o pipefail + function describe-coredns { + RC=$? + if [[ $RC -ne 0 ]]; then + kubectl describe node + kubectl --namespace kube-system describe pod -l k8s-app=kube-dns + kubectl --namespace kube-system logs -l k8s-app=kube-dns + fi + exit $RC + } + trap describe-coredns EXIT time timeout 300 bash -c 'while ! (kubectl --namespace kube-system rollout status --timeout 10s deploy/coredns 2>/dev/null); do sleep 5; done' SHELL end diff --git a/tests/install/rocky-8/Vagrantfile b/tests/install/rocky-8/Vagrantfile index 31fa397579..052fe1a388 100644 --- a/tests/install/rocky-8/Vagrantfile +++ b/tests/install/rocky-8/Vagrantfile @@ -43,6 +43,16 @@ Vagrant.configure("2") do |config| sh.inline = <<~SHELL #!/usr/bin/env bash set -eu -o pipefail + function describe-coredns { + RC=$? + if [[ $RC -ne 0 ]]; then + kubectl describe node + kubectl --namespace kube-system describe pod -l k8s-app=kube-dns + kubectl --namespace kube-system logs -l k8s-app=kube-dns + fi + exit $RC + } + trap describe-coredns EXIT time timeout 300 bash -c 'while ! (kubectl --namespace kube-system rollout status --timeout 10s deploy/coredns 2>/dev/null); do sleep 5; done' SHELL end diff --git a/tests/install/ubuntu-focal/Vagrantfile b/tests/install/ubuntu-focal/Vagrantfile index c86c5dbb78..4599949ba5 100644 --- a/tests/install/ubuntu-focal/Vagrantfile +++ b/tests/install/ubuntu-focal/Vagrantfile @@ -42,6 +42,16 @@ Vagrant.configure("2") do |config| sh.inline = <<~SHELL #!/usr/bin/env bash set -eu -o pipefail + function describe-coredns { + RC=$? + if [[ $RC -ne 0 ]]; then + kubectl describe node + kubectl --namespace kube-system describe pod -l k8s-app=kube-dns + kubectl --namespace kube-system logs -l k8s-app=kube-dns + fi + exit $RC + } + trap describe-coredns EXIT time timeout 300 bash -c 'while ! (kubectl --namespace kube-system rollout status --timeout 10s deploy/coredns 2>/dev/null); do sleep 5; done' SHELL end @@ -97,4 +107,4 @@ Vagrant.configure("2") do |config| v.gui = false v.check_guest_additions = false end -end \ No newline at end of file +end diff --git a/tests/snapshotter/btrfs/opensuse-leap/Vagrantfile b/tests/snapshotter/btrfs/opensuse-leap/Vagrantfile index 4fe886fb94..2a411e8686 100644 --- a/tests/snapshotter/btrfs/opensuse-leap/Vagrantfile +++ b/tests/snapshotter/btrfs/opensuse-leap/Vagrantfile @@ -73,6 +73,16 @@ Vagrant.configure("2") do |config| sh.inline = <<~SHELL #!/usr/bin/env bash set -eu -o pipefail + function describe-coredns { + RC=$? + if [[ $RC -ne 0 ]]; then + kubectl describe node + kubectl --namespace kube-system describe pod -l k8s-app=kube-dns + kubectl --namespace kube-system logs -l k8s-app=kube-dns + fi + exit $RC + } + trap describe-coredns EXIT time timeout 300 bash -c 'while ! (kubectl --namespace kube-system rollout status --timeout 10s deploy/coredns 2>/dev/null); do sleep 5; done' SHELL end