mirror of
https://github.com/stakater/Reloader.git
synced 2026-08-27 14:37:17 +00:00
Surface invalid-regex errors to the call site with workload context
Per review: instead of logging the skipped pattern inside ShouldReload (which lacks workload identity), collect the compile errors on ReloadCheckResult.Errors and log them at the upgrade call site, where the resource name, type, and namespace are known. Add a test for the multi-value case where one comma-separated pattern is malformed and a valid one still matches.
This commit is contained in:
@@ -310,6 +310,10 @@ func upgradeResource(clients kube.Clients, config common.Config, upgradeFuncs ca
|
||||
podAnnotations := upgradeFuncs.PodAnnotationsFunc(resource)
|
||||
result := common.ShouldReload(config, upgradeFuncs.ResourceType, annotations, podAnnotations, common.GetCommandLineOptions())
|
||||
|
||||
for _, reloadErr := range result.Errors {
|
||||
logrus.Errorf("Skipping invalid reload annotation on %s '%s' in namespace '%s': %v", upgradeFuncs.ResourceType, resourceName, config.Namespace, reloadErr)
|
||||
}
|
||||
|
||||
if !result.ShouldReload {
|
||||
logrus.Debugf("No changes detected in '%s' of type '%s' in namespace '%s'", config.ResourceName, config.Type, config.Namespace)
|
||||
return false, nil
|
||||
|
||||
Reference in New Issue
Block a user