From 960d988f6659df47b884318d66f0978fa131df9f Mon Sep 17 00:00:00 2001 From: DrummyFloyd Date: Sun, 29 Oct 2023 00:13:52 +0200 Subject: [PATCH] fix: missing stuff Signed-off-by: DrummyFloyd --- cmd/k3s/command.go | 4 ++-- internal/utilities/flags.go | 16 +++++++++------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/cmd/k3s/command.go b/cmd/k3s/command.go index 9dcfadc33..7b840987a 100644 --- a/cmd/k3s/command.go +++ b/cmd/k3s/command.go @@ -62,7 +62,7 @@ func NewCommand() *cobra.Command { func Create() *cobra.Command { createCmd := &cobra.Command{ Use: "create", - Short: "create the kubefirst platform running on GCP kubernetes", + Short: "create the kubefirst platform running on premise", TraverseChildren: true, RunE: createK3s, // PreRun: common.CheckDocker, @@ -75,7 +75,7 @@ func Create() *cobra.Command { createCmd.Flags().StringVar(&clusterNameFlag, "cluster-name", "kubefirst", "the name of the cluster to create") createCmd.Flags().StringVar(&clusterTypeFlag, "cluster-type", "mgmt", "the type of cluster to create (i.e. mgmt|workload)") createCmd.Flags().StringVar(&dnsProviderFlag, "dns-provider", "cloudflare", fmt.Sprintf("the dns provider - one of: %s", supportedDNSProviders)) - createCmd.MarkFlagRequired("domain-name") + createCmd.Flags().StringVar(&domainNameFlag, "domain-name", "", "the cloudProvider DNS Name to use for DNS records (i.e. your-domain.com|subdomain.your-domain.com) (required)") createCmd.Flags().StringVar(&gitProviderFlag, "git-provider", "github", fmt.Sprintf("the git provider - one of: %s", supportedGitProviders)) createCmd.Flags().StringVar(&gitProtocolFlag, "git-protocol", "ssh", fmt.Sprintf("the git protocol - one of: %s", supportedGitProtocolOverride)) createCmd.Flags().StringVar(&githubOrgFlag, "github-org", "", "the GitHub organization for the new gitops and metaphor repositories - required if using github") diff --git a/internal/utilities/flags.go b/internal/utilities/flags.go index 1d5bca5e4..76165de28 100644 --- a/internal/utilities/flags.go +++ b/internal/utilities/flags.go @@ -24,12 +24,6 @@ func GetFlags(cmd *cobra.Command, cloudProvider string) (types.CliFlags, error) return cliFlags, err } - cloudRegionFlag, err := cmd.Flags().GetString("cloud-region") - if err != nil { - progress.Error(err.Error()) - return cliFlags, err - } - clusterNameFlag, err := cmd.Flags().GetString("cluster-name") if err != nil { progress.Error(err.Error()) @@ -92,6 +86,15 @@ func GetFlags(cmd *cobra.Command, cloudProvider string) (types.CliFlags, error) return cliFlags, err } + if cloudProvider != "k3s" { + cloudRegionFlag, err := cmd.Flags().GetString("cloud-region") + if err != nil { + progress.Error(err.Error()) + return cliFlags, err + } + cliFlags.CloudRegion = cloudRegionFlag + } + if cloudProvider == "aws" { ecrFlag, err := cmd.Flags().GetBool("ecr") if err != nil { @@ -113,7 +116,6 @@ func GetFlags(cmd *cobra.Command, cloudProvider string) (types.CliFlags, error) } cliFlags.AlertsEmail = alertsEmailFlag - cliFlags.CloudRegion = cloudRegionFlag cliFlags.ClusterName = clusterNameFlag cliFlags.DnsProvider = dnsProviderFlag cliFlags.DomainName = domainNameFlag