Skip to content

Commit 0e6a3e8

Browse files
authored
Add support to define pool name during tenant creation/expansion (minio#1322)
``` ./kubectl-minio tenant create <TENANTNAME> --pool <POOLNAME> --servers <NSERVERS> --volumes <NVOLUMES> --capacity <SIZE> --namespace <TENANTNS>" ``` and ``` ./kubectl-minio tenant expand <TENANTNAME> --pool <POOLNAME> --servers <NSERVERS> --volumes <NVOLUMES> --capacity <SIZE> ``` Signed-off-by: Lenin Alevski <[email protected]> Signed-off-by: Lenin Alevski <[email protected]>
1 parent 19069be commit 0e6a3e8

File tree

4 files changed

+6
-2
lines changed

4 files changed

+6
-2
lines changed

kubectl-minio/cmd/resources/common.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ func tenantStorage(q resource.Quantity) corev1.ResourceList {
5858
// Pool returns a Pool object from given values
5959
func Pool(opts *TenantOptions, volumes int32, q resource.Quantity) miniov2.Pool {
6060
p := miniov2.Pool{
61+
Name: opts.PoolName,
6162
Servers: opts.Servers,
6263
VolumesPerServer: volumes,
6364
VolumeClaimTemplate: &corev1.PersistentVolumeClaim{

kubectl-minio/cmd/resources/tenant.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import (
3030
// TenantOptions encapsulates the CLI options for a MinIO Tenant
3131
type TenantOptions struct {
3232
Name string
33+
PoolName string
3334
ConfigurationSecretName string
3435
Servers int32
3536
Volumes int32

kubectl-minio/cmd/tenant-create.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func newTenantCreateCmd(out io.Writer, errOut io.Writer) *cobra.Command {
5555
c := &createCmd{out: out, errOut: errOut}
5656

5757
cmd := &cobra.Command{
58-
Use: "create <TENANTNAME> --servers <NSERVERS> --volumes <NVOLUMES> --capacity <SIZE> --namespace <TENANTNS>",
58+
Use: "create <TENANTNAME> --pool <POOLNAME> --servers <NSERVERS> --volumes <NVOLUMES> --capacity <SIZE> --namespace <TENANTNS>",
5959
Short: "Create a MinIO tenant",
6060
Long: createDesc,
6161
Example: createExample,
@@ -77,6 +77,7 @@ func newTenantCreateCmd(out io.Writer, errOut io.Writer) *cobra.Command {
7777
}
7878
cmd = helpers.DisableHelp(cmd)
7979
f := cmd.Flags()
80+
f.StringVarP(&c.tenantOpts.PoolName, "pool", "p", "", "name for this pool")
8081
f.Int32Var(&c.tenantOpts.Servers, "servers", 0, "total number of pods in MinIO tenant")
8182
f.Int32Var(&c.tenantOpts.Volumes, "volumes", 0, "total number of volumes in the MinIO tenant")
8283
f.StringVar(&c.tenantOpts.Capacity, "capacity", "", "total raw capacity of MinIO tenant in this pool, e.g. 16Ti")

kubectl-minio/cmd/tenant-expand.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func newTenantExpandCmd(out io.Writer, errOut io.Writer) *cobra.Command {
5151
v := &expandCmd{out: out, errOut: errOut}
5252

5353
cmd := &cobra.Command{
54-
Use: "expand <TENANTNAME> --servers <NSERVERS> --volumes <NVOLUMES> --capacity <SIZE>",
54+
Use: "expand <TENANTNAME> --pool <POOLNAME> --servers <NSERVERS> --volumes <NVOLUMES> --capacity <SIZE> --namespace <TENANTNS>",
5555
Short: "Add capacity to existing tenant",
5656
Long: expandDesc,
5757
Example: expandExample,
@@ -70,6 +70,7 @@ func newTenantExpandCmd(out io.Writer, errOut io.Writer) *cobra.Command {
7070
cmd = helpers.DisableHelp(cmd)
7171
f := cmd.Flags()
7272
f.StringVarP(&v.tenantOpts.NS, "namespace", "n", "", "k8s namespace for this MinIO tenant")
73+
f.StringVarP(&v.tenantOpts.PoolName, "pool", "p", "", "name for this pool expansion")
7374
f.Int32Var(&v.tenantOpts.Servers, "servers", 0, "total number of pods to add to tenant")
7475
f.Int32Var(&v.tenantOpts.Volumes, "volumes", 0, "total number of volumes to add to tenant")
7576
f.StringVar(&v.tenantOpts.Capacity, "capacity", "", "total raw capacity to add to tenant, e.g. 16Ti")

0 commit comments

Comments
 (0)