Include glob filter rules and matched selector in nsTracker debug logs
Run the E2E test on kind / setup-test-matrix (push) Failing after 2s
e2e-test-kind.yaml / extract (push) Failing after 5s
Run the E2E test on kind / get-go-version (push) Failing after 6s
Run the E2E test on kind / build (push) Skipped
Run the E2E test on kind / run-e2e-test (push) Skipped

Debugf messages named which rule tracked/skipped a namespace but not
its actual value, making the (glob-pattern) namespace filter and
label-selector matches hard to verify from logs alone.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: Tiger Kaovilai <tkaovila@redhat.com>
This commit is contained in:
Tiger Kaovilai
2026-09-16 16:38:19 -04:00
co-authored by Claude Sonnet 5
parent 39d33ca0a3
commit 6323035d9c
+9 -6
View File
@@ -130,13 +130,16 @@ func (nt *nsTracker) init(
// (Or)LabelSelectors, so check it upfront once instead of
// repeating it in every branch below.
if !nt.namespaceFilter.ShouldInclude(namespace.GetName()) {
nt.logger.Debugf("Skip namespace %s, because it doesn't match backup namespace filter (glob rules) includes=%q excludes=%q.",
namespace.GetName(), nt.namespaceFilter.IncludesString(), nt.namespaceFilter.ExcludesString(),
)
continue
}
if nt.singleLabelSelector != nil &&
nt.singleLabelSelector.Matches(labels.Set(namespace.GetLabels())) {
nt.logger.Debugf("Track namespace %s, because its labels match backup LabelSelector.",
namespace.GetName(),
nt.logger.Debugf("Track namespace %s, because its labels match backup LabelSelector %q.",
namespace.GetName(), nt.singleLabelSelector.String(),
)
nt.track(namespace.GetName())
@@ -146,8 +149,8 @@ func (nt *nsTracker) init(
if len(nt.orLabelSelector) > 0 {
for _, selector := range nt.orLabelSelector {
if selector.Matches(labels.Set(namespace.GetLabels())) {
nt.logger.Debugf("Track namespace %s, because its labels match the backup OrLabelSelector.",
namespace.GetName(),
nt.logger.Debugf("Track namespace %s, because its labels match the backup OrLabelSelector %q.",
namespace.GetName(), selector.String(),
)
nt.track(namespace.GetName())
continue
@@ -164,8 +167,8 @@ func (nt *nsTracker) init(
continue
}
nt.logger.Debugf("Track namespace %s, because its name match the backup namespace filter.",
namespace.GetName(),
nt.logger.Debugf("Track namespace %s, because its name matches backup namespace filter (glob rules) includes=%q excludes=%q.",
namespace.GetName(), nt.namespaceFilter.IncludesString(), nt.namespaceFilter.ExcludesString(),
)
nt.track(namespace.GetName())
}