mirror of
				https://github.com/fluxcd/flux2.git
				synced 2025-10-31 08:17:19 +08:00 
			
		
		
		
	Merge pull request #3696 from matheuscscp/retry-interval
Add retry interval option to create kustomization command
This commit is contained in:
		| @ -97,6 +97,7 @@ type kustomizationFlags struct { | |||||||
| 	targetNamespace     string | 	targetNamespace     string | ||||||
| 	wait                bool | 	wait                bool | ||||||
| 	kubeConfigSecretRef string | 	kubeConfigSecretRef string | ||||||
|  | 	retryInterval       time.Duration | ||||||
| } | } | ||||||
|  |  | ||||||
| var kustomizationArgs = NewKustomizationFlags() | 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.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().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().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) | 	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 { | 	if createArgs.export { | ||||||
| 		return printExport(exportKs(&kustomization)) | 		return printExport(exportKs(&kustomization)) | ||||||
| 	} | 	} | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 Stefan Prodan
					Stefan Prodan