From e848d6f558d87e2150767be87f4cf0cb18a28954 Mon Sep 17 00:00:00 2001 From: jannfis Date: Wed, 19 Aug 2020 09:41:14 +0200 Subject: feat: Allow filtering by application name (#66) * feat: Allow filtering by application name * include allowed word otherapp --- cmd/main.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'cmd') diff --git a/cmd/main.go b/cmd/main.go index b0d2ab9..ff951c4 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -41,6 +41,7 @@ type ImageUpdaterConfig struct { MaxConcurrency int HealthPort int RegistriesConf string + AppNamePatterns []string } // Main loop for argocd-image-controller @@ -66,7 +67,7 @@ func runImageUpdater(cfg *ImageUpdaterConfig) (argocd.ImageUpdaterResult, error) // Get the list of applications that are allowed for updates, that is, those // applications which have correct annotation. - appList, err := argocd.FilterApplicationsForUpdate(apps) + appList, err := argocd.FilterApplicationsForUpdate(apps, cfg.AppNamePatterns) if err != nil { return result, err } @@ -305,6 +306,7 @@ func newRunCommand() *cobra.Command { runCmd.Flags().BoolVar(&disableKubernetes, "disable-kubernetes", false, "do not create and use a Kubernetes client") runCmd.Flags().IntVar(&cfg.MaxConcurrency, "max-concurrency", 10, "maximum number of update threads to run concurrently") runCmd.Flags().StringVar(&cfg.ArgocdNamespace, "argocd-namespace", "argocd", "namespace where ArgoCD runs in") + runCmd.Flags().StringSliceVar(&cfg.AppNamePatterns, "match-application-name", nil, "patterns to match application name against") return runCmd } -- cgit v1.2.3