Skip to content

Commit

Permalink
Merge pull request #269 from replicatedhq/joshd/sc-80765/memory-shoul…
Browse files Browse the repository at this point in the history
…d-be-using-gib

Memory should be using GiB
  • Loading branch information
marccampbell authored Jun 28, 2023
2 parents 96bcf28 + 194b228 commit d7df328
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions cli/cmd/cluster_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func (r *runners) InitClusterCreate(parent *cobra.Command) *cobra.Command {
cmd.Flags().StringVar(&r.args.createClusterKubernetesVersion, "version", "v1.25.3", "Kubernetes version to provision (format is distribution dependent)")
cmd.Flags().IntVar(&r.args.createClusterNodeCount, "node-count", int(1), "Node count")
cmd.Flags().Int64Var(&r.args.createClusterVCpus, "vcpus", int64(4), "vCPUs to request per node")
cmd.Flags().Int64Var(&r.args.createClusterMemoryMiB, "memory", int64(4096), "Memory (MiB) to request per node (Default: 4096)")
cmd.Flags().Int64Var(&r.args.createClusterMemoryGiB, "memory", int64(4), "Memory (GiB) to request per node")
cmd.Flags().Int64Var(&r.args.createClusterDiskGiB, "disk", int64(50), "Disk Size (GiB) to request per node (Default: 50)")
cmd.Flags().StringVar(&r.args.createClusterTTL, "ttl", "2h", "Cluster TTL (duration, max 48h)")
cmd.Flags().BoolVar(&r.args.createClusterDryRun, "dry-run", false, "Dry run")
Expand All @@ -51,7 +51,7 @@ func (r *runners) createCluster(_ *cobra.Command, args []string) error {
KubernetesVersion: r.args.createClusterKubernetesVersion,
NodeCount: r.args.createClusterNodeCount,
VCpus: r.args.createClusterVCpus,
MemoryMiB: r.args.createClusterMemoryMiB,
MemoryGiB: r.args.createClusterMemoryGiB,
DiskGiB: r.args.createClusterDiskGiB,
TTL: r.args.createClusterTTL,
DryRun: r.args.createClusterDryRun,
Expand Down
2 changes: 1 addition & 1 deletion cli/cmd/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ type runnerArgs struct {
createClusterKubernetesVersion string
createClusterNodeCount int
createClusterVCpus int64
createClusterMemoryMiB int64
createClusterMemoryGiB int64
createClusterDiskGiB int64
createClusterDryRun bool
createClusterTTL string
Expand Down
12 changes: 6 additions & 6 deletions pkg/kotsclient/cluster_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type CreateClusterRequest struct {
KubernetesVersion string `json:"kubernetes_version"`
NodeCount int `json:"node_count"`
VCpus int64 `json:"vcpus"`
MemoryMiB int64 `json:"memory_mib"`
MemoryGiB int64 `json:"memory_gib"`
DiskGiB int64 `json:"disk_gib"`
TTL string `json:"ttl"`
InstanceType string `json:"instance_type"`
Expand All @@ -31,7 +31,7 @@ type CreateClusterOpts struct {
KubernetesVersion string
NodeCount int
VCpus int64
MemoryMiB int64
MemoryGiB int64
DiskGiB int64
TTL string
DryRun bool
Expand All @@ -49,7 +49,7 @@ var defaultCreateClusterOpts = CreateClusterOpts{
KubernetesVersion: "v1.25.3",
NodeCount: int(1),
VCpus: int64(4),
MemoryMiB: int64(4096),
MemoryGiB: int64(4),
DiskGiB: int64(50),
TTL: "2h",
InstanceType: "",
Expand All @@ -69,8 +69,8 @@ func (c *VendorV3Client) CreateCluster(opts CreateClusterOpts) (*types.Cluster,
if opts.VCpus == int64(0) {
opts.VCpus = defaultCreateClusterOpts.VCpus
}
if opts.MemoryMiB == int64(0) {
opts.MemoryMiB = defaultCreateClusterOpts.MemoryMiB
if opts.MemoryGiB == int64(0) {
opts.MemoryGiB = defaultCreateClusterOpts.MemoryGiB
}
if opts.DiskGiB == int64(0) {
opts.DiskGiB = defaultCreateClusterOpts.DiskGiB
Expand All @@ -85,7 +85,7 @@ func (c *VendorV3Client) CreateCluster(opts CreateClusterOpts) (*types.Cluster,
KubernetesVersion: opts.KubernetesVersion,
NodeCount: opts.NodeCount,
VCpus: opts.VCpus,
MemoryMiB: opts.MemoryMiB,
MemoryGiB: opts.MemoryGiB,
DiskGiB: opts.DiskGiB,
TTL: opts.TTL,
InstanceType: opts.InstanceType,
Expand Down
2 changes: 1 addition & 1 deletion pkg/types/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ type Cluster struct {
KubernetesVersion string `json:"kubernetes_version"`
NodeCount int `json:"node_count"`
VCpus int64 `json:"vcpus"`
MemoryMiB int64 `json:"memory_mib"`
MemoryGiB int64 `json:"memory_gib"`
DiskGiB int64 `json:"disk_gib"`

Status string `json:"status"`
Expand Down

0 comments on commit d7df328

Please sign in to comment.