Skip to content

Commit

Permalink
Do not apply defaults in the CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
marccampbell committed Aug 4, 2023
1 parent b72c40b commit 02fe6cb
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 02fe6cb

Please sign in to comment.