Skip to content

Commit

Permalink
Merge pull request #301 from replicatedhq/no-cli-defaults
Browse files Browse the repository at this point in the history
Do not apply defaults in the CLI
  • Loading branch information
marccampbell authored Aug 4, 2023
2 parents a6ba951 + 02fe6cb commit 120b904
Showing 1 changed file with 0 additions and 27 deletions.
27 changes: 0 additions & 27 deletions pkg/kotsclient/cluster_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,34 +39,7 @@ type ValidationError struct {
SupportedDistributions map[string][]string `json:"supported_distributions"`
}

var defaultCreateClusterOpts = CreateClusterOpts{
Name: "",
KubernetesDistribution: "kind",
KubernetesVersion: "v1.25.3",
NodeCount: int(1),
DiskGiB: int64(50),
TTL: "2h",
InstanceType: "",
}

func (c *VendorV3Client) CreateCluster(opts CreateClusterOpts) (*types.Cluster, *ValidationError, error) {
// merge opts with defaults
if opts.KubernetesDistribution == "" {
opts.KubernetesDistribution = defaultCreateClusterOpts.KubernetesDistribution
}
if opts.KubernetesVersion == "" {
opts.KubernetesVersion = defaultCreateClusterOpts.KubernetesVersion
}
if opts.NodeCount == int(0) {
opts.NodeCount = defaultCreateClusterOpts.NodeCount
}
if opts.DiskGiB == int64(0) {
opts.DiskGiB = defaultCreateClusterOpts.DiskGiB
}
if opts.TTL == "" {
opts.TTL = defaultCreateClusterOpts.TTL
}

reqBody := &CreateClusterRequest{
Name: opts.Name,
KubernetesDistribution: opts.KubernetesDistribution,
Expand Down

0 comments on commit 120b904

Please sign in to comment.