github.com/argoproj/argo-cd/v3@v3.2.1/applicationset/generators/interface.go (about) 1 package generators 2 3 import ( 4 "errors" 5 "time" 6 7 "sigs.k8s.io/controller-runtime/pkg/client" 8 9 argoprojiov1alpha1 "github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1" 10 "github.com/argoproj/argo-cd/v3/util/env" 11 ) 12 13 // Generator defines the interface implemented by all ApplicationSet generators. 14 type Generator interface { 15 // GenerateParams interprets the ApplicationSet and generates all relevant parameters for the application template. 16 // The expected / desired list of parameters is returned, it then will be render and reconciled 17 // against the current state of the Applications in the cluster. 18 GenerateParams(appSetGenerator *argoprojiov1alpha1.ApplicationSetGenerator, applicationSetInfo *argoprojiov1alpha1.ApplicationSet, client client.Client) ([]map[string]any, error) 19 20 // GetRequeueAfter is the generator can controller the next reconciled loop 21 // In case there is more then one generator the time will be the minimum of the times. 22 // In case NoRequeueAfter is empty, it will be ignored 23 GetRequeueAfter(appSetGenerator *argoprojiov1alpha1.ApplicationSetGenerator) time.Duration 24 25 // GetTemplate returns the inline template from the spec if there is any, or an empty object otherwise 26 GetTemplate(appSetGenerator *argoprojiov1alpha1.ApplicationSetGenerator) *argoprojiov1alpha1.ApplicationSetTemplate 27 } 28 29 var ( 30 ErrEmptyAppSetGenerator = errors.New("ApplicationSet is empty") 31 NoRequeueAfter time.Duration 32 ) 33 34 const ( 35 DefaultRequeueAfter = 3 * time.Minute 36 ) 37 38 func getDefaultRequeueAfter() time.Duration { 39 // Default is 3 minutes, min is 1 second, max is 1 year 40 return env.ParseDurationFromEnv("ARGOCD_APPLICATIONSET_CONTROLLER_REQUEUE_AFTER", DefaultRequeueAfter, 1*time.Second, 8760*time.Hour) 41 }