From c9fea671a7c2613050d2f7145ea09eac97721bf7 Mon Sep 17 00:00:00 2001 From: Matheus Pimenta Date: Fri, 17 Mar 2023 19:17:09 +0000 Subject: [PATCH] Add retry interval option to create kustomization command Signed-off-by: Matheus Pimenta --- cmd/flux/create_kustomization.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmd/flux/create_kustomization.go b/cmd/flux/create_kustomization.go index bc40de0d..6da5365a 100644 --- a/cmd/flux/create_kustomization.go +++ b/cmd/flux/create_kustomization.go @@ -97,6 +97,7 @@ type kustomizationFlags struct { targetNamespace string wait bool kubeConfigSecretRef string + retryInterval time.Duration } var kustomizationArgs = NewKustomizationFlags() @@ -116,6 +117,7 @@ func init() { createKsCmd.Flags().StringVar(&kustomizationArgs.targetNamespace, "target-namespace", "", "overrides the namespace of all Kustomization objects reconciled by this Kustomization") createKsCmd.Flags().StringVar(&kustomizationArgs.kubeConfigSecretRef, "kubeconfig-secret-ref", "", "the name of the Kubernetes Secret that contains a key with the kubeconfig file for connecting to a remote cluster") createKsCmd.Flags().MarkDeprecated("validation", "this arg is no longer used, all resources are validated using server-side apply dry-run") + createKsCmd.Flags().DurationVar(&kustomizationArgs.retryInterval, "retry-interval", 0, "the interval at which to retry a previously failed reconciliation") createCmd.AddCommand(createKsCmd) } @@ -238,6 +240,10 @@ func createKsCmdRun(cmd *cobra.Command, args []string) error { } } + if kustomizationArgs.retryInterval > 0 { + kustomization.Spec.RetryInterval = &metav1.Duration{Duration: kustomizationArgs.retryInterval} + } + if createArgs.export { return printExport(exportKs(&kustomization)) }