diff --git a/cmd/flux/create.go b/cmd/flux/create.go index 1c3d99ef..9aed0c43 100644 --- a/cmd/flux/create.go +++ b/cmd/flux/create.go @@ -59,7 +59,7 @@ func init() { name := args[0] if !validateObjectName(name) { - return fmt.Errorf("name '%s' is invalid, it should adhere to standard defined in RFC 1123", name) + return fmt.Errorf("name '%s' is invalid, it should adhere to standard defined in RFC 1123, the name can only contain alphanumeric characters or '-'", name) } return nil diff --git a/cmd/flux/create_alert.go b/cmd/flux/create_alert.go index 0a5ea93a..7f9968b8 100644 --- a/cmd/flux/create_alert.go +++ b/cmd/flux/create_alert.go @@ -63,9 +63,6 @@ func init() { } func createAlertCmdRun(cmd *cobra.Command, args []string) error { - if len(args) < 1 { - return fmt.Errorf("Alert name is required") - } name := args[0] if alertArgs.providerRef == "" { diff --git a/cmd/flux/create_alertprovider.go b/cmd/flux/create_alertprovider.go index 7d5bf640..2663482c 100644 --- a/cmd/flux/create_alertprovider.go +++ b/cmd/flux/create_alertprovider.go @@ -73,9 +73,6 @@ func init() { } func createAlertProviderCmdRun(cmd *cobra.Command, args []string) error { - if len(args) < 1 { - return fmt.Errorf("Provider name is required") - } name := args[0] if alertProviderArgs.alertType == "" { diff --git a/cmd/flux/create_helmrelease.go b/cmd/flux/create_helmrelease.go index 2072c720..d8f37cc5 100644 --- a/cmd/flux/create_helmrelease.go +++ b/cmd/flux/create_helmrelease.go @@ -139,9 +139,6 @@ func init() { } func createHelmReleaseCmdRun(cmd *cobra.Command, args []string) error { - if len(args) < 1 { - return fmt.Errorf("HelmRelease name is required") - } name := args[0] if helmReleaseArgs.chart == "" { diff --git a/cmd/flux/create_image_policy.go b/cmd/flux/create_image_policy.go index 05cb5c14..b9d8eb1a 100644 --- a/cmd/flux/create_image_policy.go +++ b/cmd/flux/create_image_policy.go @@ -84,9 +84,6 @@ func (obj imagePolicyAdapter) getObservedGeneration() int64 { } func createImagePolicyRun(cmd *cobra.Command, args []string) error { - if len(args) < 1 { - return fmt.Errorf("ImagePolicy name is required") - } objectName := args[0] if imagePolicyArgs.imageRef == "" { diff --git a/cmd/flux/create_image_repository.go b/cmd/flux/create_image_repository.go index b5ffdcb8..140658f3 100644 --- a/cmd/flux/create_image_repository.go +++ b/cmd/flux/create_image_repository.go @@ -83,9 +83,6 @@ func init() { } func createImageRepositoryRun(cmd *cobra.Command, args []string) error { - if len(args) < 1 { - return fmt.Errorf("ImageRepository name is required") - } objectName := args[0] if imageRepoArgs.image == "" { diff --git a/cmd/flux/create_image_update.go b/cmd/flux/create_image_update.go index f1b7e2ca..a67f6bc3 100644 --- a/cmd/flux/create_image_update.go +++ b/cmd/flux/create_image_update.go @@ -94,9 +94,6 @@ func init() { } func createImageUpdateRun(cmd *cobra.Command, args []string) error { - if len(args) < 1 { - return fmt.Errorf("ImageUpdateAutomation name is required") - } objectName := args[0] if imageUpdateArgs.gitRepoName == "" { diff --git a/cmd/flux/create_kustomization.go b/cmd/flux/create_kustomization.go index d523374d..4d0ebb99 100644 --- a/cmd/flux/create_kustomization.go +++ b/cmd/flux/create_kustomization.go @@ -119,9 +119,6 @@ func NewKustomizationFlags() kustomizationFlags { } func createKsCmdRun(cmd *cobra.Command, args []string) error { - if len(args) < 1 { - return fmt.Errorf("Kustomization name is required") - } name := args[0] if kustomizationArgs.path == "" { diff --git a/cmd/flux/create_receiver.go b/cmd/flux/create_receiver.go index d6004dc1..6533f173 100644 --- a/cmd/flux/create_receiver.go +++ b/cmd/flux/create_receiver.go @@ -67,9 +67,6 @@ func init() { } func createReceiverCmdRun(cmd *cobra.Command, args []string) error { - if len(args) < 1 { - return fmt.Errorf("Receiver name is required") - } name := args[0] if receiverArgs.receiverType == "" { diff --git a/cmd/flux/create_secret_git.go b/cmd/flux/create_secret_git.go index 769c2526..0effc1b5 100644 --- a/cmd/flux/create_secret_git.go +++ b/cmd/flux/create_secret_git.go @@ -112,9 +112,6 @@ func NewSecretGitFlags() secretGitFlags { } func createSecretGitCmdRun(cmd *cobra.Command, args []string) error { - if len(args) < 1 { - return fmt.Errorf("secret name is required") - } name := args[0] if secretGitArgs.url == "" { return fmt.Errorf("url is required") diff --git a/cmd/flux/create_secret_helm.go b/cmd/flux/create_secret_helm.go index 8f9df1b5..80a7ce9d 100644 --- a/cmd/flux/create_secret_helm.go +++ b/cmd/flux/create_secret_helm.go @@ -18,7 +18,6 @@ package main import ( "context" - "fmt" "github.com/spf13/cobra" corev1 "k8s.io/api/core/v1" @@ -68,9 +67,6 @@ func init() { } func createSecretHelmCmdRun(cmd *cobra.Command, args []string) error { - if len(args) < 1 { - return fmt.Errorf("secret name is required") - } name := args[0] labels, err := parseLabels() diff --git a/cmd/flux/create_secret_tls.go b/cmd/flux/create_secret_tls.go index a308066e..b89a2601 100644 --- a/cmd/flux/create_secret_tls.go +++ b/cmd/flux/create_secret_tls.go @@ -18,7 +18,6 @@ package main import ( "context" - "fmt" "github.com/spf13/cobra" "github.com/spf13/pflag" @@ -67,9 +66,6 @@ func init() { } func createSecretTLSCmdRun(cmd *cobra.Command, args []string) error { - if len(args) < 1 { - return fmt.Errorf("secret name is required") - } name := args[0] labels, err := parseLabels() diff --git a/cmd/flux/create_source_bucket.go b/cmd/flux/create_source_bucket.go index 50858c5b..31279799 100644 --- a/cmd/flux/create_source_bucket.go +++ b/cmd/flux/create_source_bucket.go @@ -93,9 +93,6 @@ func NewSourceBucketFlags() sourceBucketFlags { } func createSourceBucketCmdRun(cmd *cobra.Command, args []string) error { - if len(args) < 1 { - return fmt.Errorf("Bucket source name is required") - } name := args[0] if sourceBucketArgs.name == "" { diff --git a/cmd/flux/create_source_git.go b/cmd/flux/create_source_git.go index 17a928b6..2f13dd9c 100644 --- a/cmd/flux/create_source_git.go +++ b/cmd/flux/create_source_git.go @@ -150,9 +150,6 @@ func newSourceGitFlags() sourceGitFlags { } func createSourceGitCmdRun(cmd *cobra.Command, args []string) error { - if len(args) < 1 { - return fmt.Errorf("GitRepository source name is required") - } name := args[0] if sourceGitArgs.url == "" { diff --git a/cmd/flux/create_source_helm.go b/cmd/flux/create_source_helm.go index 81b5a05f..2d3f2513 100644 --- a/cmd/flux/create_source_helm.go +++ b/cmd/flux/create_source_helm.go @@ -91,9 +91,6 @@ func init() { } func createSourceHelmCmdRun(cmd *cobra.Command, args []string) error { - if len(args) < 1 { - return fmt.Errorf("HelmRepository source name is required") - } name := args[0] if sourceHelmArgs.url == "" { diff --git a/cmd/flux/create_tenant.go b/cmd/flux/create_tenant.go index 88b8eda6..4ac8eb96 100644 --- a/cmd/flux/create_tenant.go +++ b/cmd/flux/create_tenant.go @@ -70,9 +70,6 @@ func init() { } func createTenantCmdRun(cmd *cobra.Command, args []string) error { - if len(args) < 1 { - return fmt.Errorf("tenant name is required") - } tenant := args[0] if err := validation.IsQualifiedName(tenant); len(err) > 0 { return fmt.Errorf("invalid tenant name '%s': %v", tenant, err)