adapting check to pod labels
@@ -139,18 +139,16 @@ echo "-------------------------------------"
# Check no tls-dex cert conflict issue
-# Check the pod name
-target_cert_manager_pod=$(kubectl get pod -n cert-manager -lapp=cert-manager -o jsonpath="{.items[0].metadata.name}")
-
# Counting logs of undesired message
-check_dex_log=$(kubectl logs ${target_cert_manager_pod} -n cert-manager | grep '"secret"="dex-tls" "message"="unexpected managed Secret Owner Reference field on Secret --enable-certificate-owner-ref=true"' | wc -l)
+message_dex_tls='"secret"="dex-tls" "message"="unexpected managed Secret Owner Reference field on Secret --enable-certificate-owner-ref=true"'
+check_dex_log_count=$(kubectl logs -n cert-manager -lapp=cert-manager --tail=-1 | grep ${message_dex_tls} | wc -l)
# Exiting with count of bad logs if more than 10 are found
if [ $check_dex_log -gt 10 ]; then
echo
echo "-------------------------------------"
echo "Warning: 'dex-tls' secrets may be be updated many times a second."
- echo "More than '${check_dex_log}' logs found in pod '${target_cert_manager_pod}' with entry = '"secret"="dex-tls" "message"="unexpected managed Secret Owner Reference field on Secret --enable-certificate-owner-ref=true"'"
+ echo "More than '${check_dex_log_count}' logs found in 'cert-manager/cert-manager' pod with entry = ' ${message_dex_tls} '"
echo "Exiting installation"
echo "-------------------------------------"
exit 1
