Skip to content

Commit

Permalink
Add retry interval option to create kustomization command
Browse files Browse the repository at this point in the history
Signed-off-by: Matheus Pimenta <[email protected]>
  • Loading branch information
matheuscscp committed Mar 21, 2023
1 parent dbda8fb commit c9fea67
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cmd/flux/create_kustomization.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ type kustomizationFlags struct {
targetNamespace string
wait bool
kubeConfigSecretRef string
retryInterval time.Duration
}

var kustomizationArgs = NewKustomizationFlags()
Expand All @@ -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)
}
Expand Down Expand Up @@ -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))
}
Expand Down

0 comments on commit c9fea67

Please sign in to comment.