From ef3654e92cbc6e7ed5de03e2cfdec6232db5c500 Mon Sep 17 00:00:00 2001 From: "Mitch Harding (the weird one)" Date: Wed, 20 Nov 2024 13:01:27 -0500 Subject: [PATCH] CASMPET-7273: k8s-verify-cluster: Allow etcdbackup pods in states other than Running and Completed --- goss-testing/tests/ncn/goss-k8s-verify-cluster.yaml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/goss-testing/tests/ncn/goss-k8s-verify-cluster.yaml b/goss-testing/tests/ncn/goss-k8s-verify-cluster.yaml index 9887d2e1..fbc9878f 100644 --- a/goss-testing/tests/ncn/goss-k8s-verify-cluster.yaml +++ b/goss-testing/tests/ncn/goss-k8s-verify-cluster.yaml @@ -1,7 +1,7 @@ # # MIT License # -# (C) Copyright 2014-2022 Hewlett Packard Enterprise Development LP +# (C) Copyright 2014-2022, 2024 Hewlett Packard Enterprise Development LP # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), @@ -53,9 +53,14 @@ command: meta: desc: All Kubernetes kube-system namespace pods are Running or Completed. sev: 0 + # Look for pods that are not Running or Completed + # However, we do allow etcdbackup job pods to be in other "normal" lifecycle states exec: |- "{{$logrun}}" -l "{{$testlabel_2}}" \ - "{{$kubectl}}" get po -n kube-system --no-headers | grep -Ev 'Running|Completed' + "{{$kubectl}}" get po -n kube-system --no-headers \ + | awk '{ print $1" "$3 }' \ + | grep -Ev ' (Running|Completed)$' \ + | grep -Ev '-etcdbackup-.* (ContainerCreating|Init:[0-9]+/[0-9]+|NotReady|Pending|PodInitializing|Terminating)$' # We expect no output and for the grep command to return non-0 stdout: - "!/./"