Skip to content

Commit e105353

Browse files
authored
Merge pull request #238 from replicatedhq/reliability-matrix-cluster-management
Add additional cluster management crud
2 parents f880ae2 + 4d60d60 commit e105353

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

cli/cmd/cluster_create.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@ package cmd
22

33
import (
44
"github.com/pkg/errors"
5+
"github.com/replicatedhq/replicated/cli/print"
56
"github.com/replicatedhq/replicated/pkg/kotsclient"
67
"github.com/replicatedhq/replicated/pkg/platformclient"
8+
"github.com/replicatedhq/replicated/pkg/types"
79
"github.com/spf13/cobra"
810
)
911

@@ -21,7 +23,7 @@ func (r *runners) InitClusterCreate(parent *cobra.Command) *cobra.Command {
2123
cmd.MarkFlagRequired("name")
2224

2325
cmd.Flags().StringVar(&r.args.createClusterKubernetesDistribution, "kubernetes-distribution", "kind", "Kubernetes distribution of the cluster to provision")
24-
cmd.Flags().StringVar(&r.args.createClusterKubernetesVersion, "kubernetes-version", "1.25.3", "Kubernetes version to provision (format is distribution dependent)")
26+
cmd.Flags().StringVar(&r.args.createClusterKubernetesVersion, "kubernetes-version", "v1.25.3", "Kubernetes version to provision (format is distribution dependent)")
2527
cmd.Flags().IntVar(&r.args.createClusterNodeCount, "node-count", int(1), "Node count")
2628
cmd.Flags().Int64Var(&r.args.createClusterVCpus, "vcpus", int64(4), "vCPUs to request per node")
2729
cmd.Flags().Int64Var(&r.args.createClusterMemoryMiB, "memory-mib", int64(4096), "Memory (MiB) to request per node")
@@ -42,13 +44,13 @@ func (r *runners) createCluster(_ *cobra.Command, args []string) error {
4244
MemoryMiB: r.args.createClusterMemoryMiB,
4345
TTL: r.args.createClusterTTL,
4446
}
45-
_, err := kotsRestClient.CreateCluster(opts)
47+
cl, err := kotsRestClient.CreateCluster(opts)
4648
if errors.Cause(err) == platformclient.ErrForbidden {
4749
return errors.New("This command is not available for your account or team. Please contact your customer success representative for more information.")
4850
}
4951
if err != nil {
5052
return errors.Wrap(err, "create cluster")
5153
}
5254

53-
return nil
55+
return print.Clusters(r.w, []*types.Cluster{cl})
5456
}

pkg/kotsclient/cluster_create.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ type CreateClusterOpts struct {
3333
var defaultCreateClusterOpts = CreateClusterOpts{
3434
Name: "", // server will generate
3535
KubernetesDistribution: "kind",
36-
KubernetesVersion: "1.25.3",
36+
KubernetesVersion: "v1.25.3",
3737
NodeCount: int(1),
3838
VCpus: int64(4),
3939
MemoryMiB: int64(4096),
@@ -75,5 +75,6 @@ func (c *VendorV3Client) CreateCluster(opts CreateClusterOpts) (*types.Cluster,
7575
if err != nil {
7676
return nil, err
7777
}
78+
7879
return cluster.Cluster, nil
7980
}

0 commit comments

Comments
 (0)