Skip to content

Commit

Permalink
feat: subdomain flag for cloudflare (#1976)
Browse files Browse the repository at this point in the history
  • Loading branch information
CristhianF7 authored Dec 22, 2023
1 parent ef568e7 commit 378dff8
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 1 deletion.
2 changes: 2 additions & 0 deletions cmd/aws/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ var (
gitopsTemplateURLFlag string
gitopsTemplateBranchFlag string
domainNameFlag string
subdomainNameFlag string
useTelemetryFlag bool
ecrFlag bool
nodeTypeFlag string
Expand Down Expand Up @@ -88,6 +89,7 @@ func Create() *cobra.Command {
createCmd.Flags().StringVar(&nodeCountFlag, "node-count", awsDefaults.NodeCount, "the node count for the cluster")
createCmd.Flags().StringVar(&nodeTypeFlag, "node-type", awsDefaults.InstanceSize, "the instance size of the cluster to create")
createCmd.Flags().StringVar(&dnsProviderFlag, "dns-provider", "aws", fmt.Sprintf("the dns provider - one of: %s", supportedDNSProviders))
createCmd.Flags().StringVar(&subdomainNameFlag, "subdomain", "", "the subdomain to use for DNS records (Cloudflare)")
createCmd.Flags().StringVar(&domainNameFlag, "domain-name", "", "the Route53/Cloudflare hosted zone name to use for DNS records (i.e. your-domain.com|subdomain.your-domain.com) (required)")
createCmd.MarkFlagRequired("domain-name")
createCmd.Flags().StringVar(&gitProviderFlag, "git-provider", "github", fmt.Sprintf("the git provider - one of: %s", supportedGitProviders))
Expand Down
2 changes: 2 additions & 0 deletions cmd/civo/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ var (
clusterNameFlag string
clusterTypeFlag string
dnsProviderFlag string
subdomainNameFlag string
domainNameFlag string
githubOrgFlag string
gitlabGroupFlag string
Expand Down Expand Up @@ -99,6 +100,7 @@ func Create() *cobra.Command {
createCmd.Flags().StringVar(&nodeCountFlag, "node-count", civoDefaults.NodeCount, "the node count for the cluster")
createCmd.Flags().StringVar(&nodeTypeFlag, "node-type", civoDefaults.InstanceSize, "the instance size of the cluster to create")
createCmd.Flags().StringVar(&dnsProviderFlag, "dns-provider", "civo", fmt.Sprintf("the dns provider - one of: %s", supportedDNSProviders))
createCmd.Flags().StringVar(&subdomainNameFlag, "subdomain", "", "the subdomain to use for DNS records (Cloudflare)")
createCmd.Flags().StringVar(&domainNameFlag, "domain-name", "", "the Civo DNS Name to use for DNS records (i.e. your-domain.com|subdomain.your-domain.com) (required)")
createCmd.MarkFlagRequired("domain-name")
createCmd.Flags().StringVar(&gitProviderFlag, "git-provider", "github", fmt.Sprintf("the git provider - one of: %s", supportedGitProviders))
Expand Down
2 changes: 2 additions & 0 deletions cmd/digitalocean/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ var (
clusterTypeFlag string
dnsProviderFlag string
domainNameFlag string
subdomainNameFlag string
githubOrgFlag string
gitlabGroupFlag string
gitProviderFlag string
Expand Down Expand Up @@ -92,6 +93,7 @@ func Create() *cobra.Command {
createCmd.Flags().StringVar(&nodeCountFlag, "node-count", doDefaults.NodeCount, "the node count for the cluster")
createCmd.Flags().StringVar(&nodeTypeFlag, "node-type", doDefaults.InstanceSize, "the instance size of the cluster to create")
createCmd.Flags().StringVar(&dnsProviderFlag, "dns-provider", "digitalocean", fmt.Sprintf("the dns provider - one of: %s", supportedDNSProviders))
createCmd.Flags().StringVar(&subdomainNameFlag, "subdomain", "", "the subdomain to use for DNS records (Cloudflare)")
createCmd.Flags().StringVar(&domainNameFlag, "domain-name", "", "the DigitalOcean DNS Name to use for DNS records (i.e. your-domain.com|subdomain.your-domain.com) (required)")
createCmd.MarkFlagRequired("domain-name")
createCmd.Flags().StringVar(&gitProviderFlag, "git-provider", "github", fmt.Sprintf("the git provider - one of: %s", supportedGitProviders))
Expand Down
2 changes: 2 additions & 0 deletions cmd/google/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ var (
clusterTypeFlag string
dnsProviderFlag string
domainNameFlag string
subdomainNameFlag string
googleProjectFlag string
githubOrgFlag string
gitlabGroupFlag string
Expand Down Expand Up @@ -94,6 +95,7 @@ func Create() *cobra.Command {
createCmd.Flags().StringVar(&nodeCountFlag, "node-count", googleDefaults.NodeCount, "the node count for the cluster")
createCmd.Flags().StringVar(&nodeTypeFlag, "node-type", googleDefaults.InstanceSize, "the instance size of the cluster to create")
createCmd.Flags().StringVar(&dnsProviderFlag, "dns-provider", "google", fmt.Sprintf("the dns provider - one of: %s", supportedDNSProviders))
createCmd.Flags().StringVar(&subdomainNameFlag, "subdomain", "", "the subdomain to use for DNS records (Cloudflare)")
createCmd.Flags().StringVar(&domainNameFlag, "domain-name", "", "the GCP DNS Name to use for DNS records (i.e. your-domain.com|subdomain.your-domain.com) (required)")
createCmd.MarkFlagRequired("domain-name")
createCmd.Flags().StringVar(&googleProjectFlag, "google-project", "", "google project id (required)")
Expand Down
2 changes: 2 additions & 0 deletions cmd/vultr/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ var (
clusterTypeFlag string
dnsProviderFlag string
domainNameFlag string
subdomainNameFlag string
githubOrgFlag string
gitlabGroupFlag string
gitProviderFlag string
Expand Down Expand Up @@ -92,6 +93,7 @@ func Create() *cobra.Command {
createCmd.Flags().StringVar(&nodeCountFlag, "node-count", vultrDefaults.NodeCount, "the node count for the cluster")
createCmd.Flags().StringVar(&nodeTypeFlag, "node-type", vultrDefaults.InstanceSize, "the instance size of the cluster to create")
createCmd.Flags().StringVar(&dnsProviderFlag, "dns-provider", "vultr", fmt.Sprintf("the dns provider - one of: %s", supportedDNSProviders))
createCmd.Flags().StringVar(&subdomainNameFlag, "subdomain", "", "the subdomain to use for DNS records (Cloudflare)")
createCmd.Flags().StringVar(&domainNameFlag, "domain-name", "", "the Vultr DNS Name to use for DNS records (i.e. your-domain.com|subdomain.your-domain.com) (required)")
createCmd.MarkFlagRequired("domain-name")
createCmd.Flags().StringVar(&gitProviderFlag, "git-provider", "github", fmt.Sprintf("the git provider - one of: %s", supportedGitProviders))
Expand Down
2 changes: 1 addition & 1 deletion internal/launch/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const (
helmChartName = "kubefirst"
helmChartRepoName = "kubefirst"
helmChartRepoURL = "https://charts.kubefirst.com"
helmChartVersion = "2.3.7"
helmChartVersion = "2.3.8-rc16"
namespace = "kubefirst"
secretName = "kubefirst-initial-secrets"
)
1 change: 1 addition & 0 deletions internal/types/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ type CliFlags struct {
ClusterType string
DnsProvider string
DomainName string
SubDomainName string
GitProvider string
GitProtocol string
GithubOrg string
Expand Down
7 changes: 7 additions & 0 deletions internal/utilities/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ func GetFlags(cmd *cobra.Command, cloudProvider string) (types.CliFlags, error)
return cliFlags, err
}

subdomainFlag, err := cmd.Flags().GetString("subdomain")
if err != nil {
progress.Error(err.Error())
return cliFlags, err
}

domainNameFlag, err := cmd.Flags().GetString("domain-name")
if err != nil {
progress.Error(err.Error())
Expand Down Expand Up @@ -128,6 +134,7 @@ func GetFlags(cmd *cobra.Command, cloudProvider string) (types.CliFlags, error)
cliFlags.CloudRegion = cloudRegionFlag
cliFlags.ClusterName = clusterNameFlag
cliFlags.DnsProvider = dnsProviderFlag
cliFlags.SubDomainName = subdomainFlag
cliFlags.DomainName = domainNameFlag
cliFlags.GitProtocol = gitProtocolFlag
cliFlags.GitProvider = gitProviderFlag
Expand Down
1 change: 1 addition & 0 deletions internal/utilities/utilities.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ func CreateClusterDefinitionRecordFromRaw(gitAuth apiTypes.GitAuth, cliFlags typ
CloudProvider: cloudProvider,
CloudRegion: viper.GetString("flags.cloud-region"),
DomainName: domainName,
SubdomainName: cliFlags.SubDomainName,
Type: "mgmt",
NodeType: cliFlags.NodeType,
NodeCount: stringToIntNodeCount,
Expand Down

0 comments on commit 378dff8

Please sign in to comment.