Skip to content

Commit

Permalink
feat: add ip list agent/server k3s
Browse files Browse the repository at this point in the history
Signed-off-by: DrummyFloyd <[email protected]>
  • Loading branch information
DrummyFloyd committed Oct 29, 2023
1 parent 960d988 commit 6b722ac
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cmd/k3s/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ var (
ciFlag bool
clusterNameFlag string
clusterTypeFlag string
k3sIpServersFlag []string
k3sIpAgentsFlag []string
dnsProviderFlag string
domainNameFlag string
githubOrgFlag string
Expand Down Expand Up @@ -74,6 +76,9 @@ func Create() *cobra.Command {
createCmd.Flags().BoolVar(&ciFlag, "ci", false, "if running kubefirst in ci, set this flag to disable interactive features")
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().StringSliceVar(&k3sIpServersFlag, "ip-servers", []string{}, "the list of k3s (servers) ip x.x.x.x y.y.y.y space separated (required)")
createCmd.MarkFlagRequired("k3s-ips-servers")
createCmd.Flags().StringSliceVar(&k3sIpAgentsFlag, "k3s-ip-agents", []string{}, "the list of k3s (agents) ip x.x.x.x y.y.y.y space separated (required)")
createCmd.Flags().StringVar(&dnsProviderFlag, "dns-provider", "cloudflare", fmt.Sprintf("the dns provider - one of: %s", supportedDNSProviders))
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))
Expand Down
2 changes: 2 additions & 0 deletions internal/types/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ type CliFlags struct {
GitopsTemplateBranch string
GitopsTemplateURL string
GoogleProject string
K3sIpServers []string
K3sIpAgents []string
UseTelemetry bool
Ecr bool
}
16 changes: 16 additions & 0 deletions internal/utilities/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,22 @@ func GetFlags(cmd *cobra.Command, cloudProvider string) (types.CliFlags, error)
}
cliFlags.CloudRegion = cloudRegionFlag
}
if cloudProvider == "k3s" {
k3sIpServers, err := cmd.Flags().GetStringSlice("k3s-ip-servers")
if err != nil {
progress.Error(err.Error())
return cliFlags, err
}
cliFlags.K3sIpServers = k3sIpServers
}
if cloudProvider == "k3s" {
k3sIpAgents, err := cmd.Flags().GetStringSlice("k3s-ip-servers")
if err != nil {
progress.Error(err.Error())
return cliFlags, err
}
cliFlags.K3sIpAgents = k3sIpAgents
}

if cloudProvider == "aws" {
ecrFlag, err := cmd.Flags().GetBool("ecr")
Expand Down

0 comments on commit 6b722ac

Please sign in to comment.