Add --auto-reload-all flag

This commit is contained in:
itaispiegel
2023-08-06 15:34:13 +03:00
committed by Itai Spiegel
parent a99e5383d0
commit e9942a56f4
6 changed files with 15 additions and 3 deletions
+1
View File
@@ -32,6 +32,7 @@ func NewReloaderCommand() *cobra.Command {
}
// options
cmd.PersistentFlags().BoolVar(&options.AutoReloadAll, "auto-reload-all", false, "Auto reload all resources")
cmd.PersistentFlags().StringVar(&options.ConfigmapUpdateOnChangeAnnotation, "configmap-annotation", "configmap.reloader.stakater.com/reload", "annotation to detect changes in configmaps, specified by name")
cmd.PersistentFlags().StringVar(&options.SecretUpdateOnChangeAnnotation, "secret-annotation", "secret.reloader.stakater.com/reload", "annotation to detect changes in secrets, specified by name")
cmd.PersistentFlags().StringVar(&options.ReloaderAutoAnnotation, "auto-annotation", "reloader.stakater.com/auto", "annotation to detect changes in secrets")
+3 -2
View File
@@ -153,8 +153,9 @@ func PerformRollingUpgrade(clients kube.Clients, config util.Config, upgradeFunc
reloaderEnabledValue = annotations[options.ReloaderAutoAnnotation]
}
result := constants.NotUpdated
reloaderEnabled, err := strconv.ParseBool(reloaderEnabledValue)
if err == nil && reloaderEnabled {
reloaderEnabled, _ := strconv.ParseBool(reloaderEnabledValue)
reloaderEnabled = reloaderEnabled && foundAuto || !foundAuto && options.AutoReloadAll
if reloaderEnabled {
result = invokeReloadStrategy(upgradeFuncs, i, config, true)
}
+2
View File
@@ -3,6 +3,8 @@ package options
import "github.com/stakater/Reloader/internal/pkg/constants"
var (
// Auto reload all resources when their corresponding configmaps/secrets are updated
AutoReloadAll = false
// ConfigmapUpdateOnChangeAnnotation is an annotation to detect changes in
// configmaps specified by name
ConfigmapUpdateOnChangeAnnotation = "configmap.reloader.stakater.com/reload"