mirror of
https://github.com/stakater/Reloader.git
synced 2026-08-27 14:37:17 +00:00
resolved comments
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
apivalidation "k8s.io/apimachinery/pkg/util/validation"
|
||||
|
||||
"github.com/stakater/Reloader/internal/pkg/workload"
|
||||
)
|
||||
@@ -97,6 +98,19 @@ func (c *Config) Validate() error {
|
||||
)
|
||||
}
|
||||
|
||||
// Watched namespaces must be valid DNS-1123 labels; an invalid entry would
|
||||
// otherwise fail deep inside the controller-runtime cache with an opaque error.
|
||||
for _, ns := range c.WatchedNamespaces {
|
||||
if msgs := apivalidation.IsDNS1123Label(ns); len(msgs) > 0 {
|
||||
errs = append(
|
||||
errs, ValidationError{
|
||||
Field: "WatchedNamespaces",
|
||||
Message: fmt.Sprintf("invalid namespace %q: %s", ns, strings.Join(msgs, "; ")),
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
c.IgnoredResources = normalizeToLower(c.IgnoredResources)
|
||||
|
||||
// Normalize ignored workloads to canonical Kind values (e.g., "cronjobs" -> "CronJob")
|
||||
|
||||
Reference in New Issue
Block a user