From 7ea196ebea3751cdcd6234ecb56825f2479398c0 Mon Sep 17 00:00:00 2001 From: pjuarezd Date: Mon, 19 Dec 2022 12:48:48 -0600 Subject: [PATCH] add option to krew plugin command `kubectl minio tenant create` to enable expose services as LB --- kubectl-minio/cmd/resources/tenant.go | 6 ++++++ kubectl-minio/cmd/tenant-create.go | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/kubectl-minio/cmd/resources/tenant.go b/kubectl-minio/cmd/resources/tenant.go index df70b0509e6..82b716b6e0d 100644 --- a/kubectl-minio/cmd/resources/tenant.go +++ b/kubectl-minio/cmd/resources/tenant.go @@ -44,6 +44,8 @@ type TenantOptions struct { ImagePullSecret string DisableAntiAffinity bool EnableAuditLogs bool + ExposeMinioService bool + ExposeConsoleService bool AuditLogsDiskSpace int32 AuditLogsImage string AuditLogsPGImage string @@ -132,6 +134,10 @@ func NewTenant(opts *TenantOptions, userSecret *v1.Secret) (*miniov2.Tenant, err Configuration: &v1.LocalObjectReference{ Name: opts.ConfigurationSecretName, }, + ExposeServices: &miniov2.ExposeServices{ + Console: opts.ExposeConsoleService, + MinIO: opts.ExposeMinioService, + }, Pools: []miniov2.Pool{Pool(opts, volumesPerServer, *capacityPerVolume)}, RequestAutoCert: &autoCert, Mountpath: helpers.MinIOMountPath, diff --git a/kubectl-minio/cmd/tenant-create.go b/kubectl-minio/cmd/tenant-create.go index a19bf222a82..0317b8964e5 100644 --- a/kubectl-minio/cmd/tenant-create.go +++ b/kubectl-minio/cmd/tenant-create.go @@ -102,6 +102,8 @@ func newTenantCreateCmd(out io.Writer, errOut io.Writer) *cobra.Command { f.StringVar(&c.tenantOpts.PrometheusStorageClass, "prometheus-storage-class", "", "(Only used when enable-prometheus is on) Storage class for prometheus") f.BoolVarP(&c.output, "output", "o", false, "generate tenant yaml for 'kubectl apply -f tenant.yaml'") f.BoolVar(&c.tenantOpts.Interactive, "interactive", false, "Create tenant in interactive mode") + f.BoolVar(&c.tenantOpts.ExposeMinioService, "expose-minio-service", false, "Enable/Disable expose the Minio Service") + f.BoolVar(&c.tenantOpts.ExposeConsoleService, "expose-console-service", false, "Enable/Disable expose the Console service") return cmd } @@ -205,6 +207,8 @@ func (c *createCmd) populateInteractiveTenant() error { if c.tenantOpts.EnablePrometheus { c.populatePrometheus() } + c.tenantOpts.ExposeMinioService = helpers.Ask("Expose Minio Service") + c.tenantOpts.ExposeConsoleService = helpers.Ask("Expose Console Service") return nil }