diff --git a/cmd/output/postgres.go b/cmd/output/postgres.go index 74aa0848..b2dea987 100644 --- a/cmd/output/postgres.go +++ b/cmd/output/postgres.go @@ -8,6 +8,7 @@ import ( "github.com/fatih/color" "github.com/fi-ts/cloud-go/api/models" "github.com/fi-ts/cloudctl/cmd/helper" + "github.com/metal-stack/metal-lib/pkg/pointer" ) type ( @@ -125,7 +126,7 @@ func (p PostgresVersionsTablePrinter) Print(data []*models.V1PostgresVersion) { p.render() } func (p PostgresPartitionsTablePrinter) Print(data models.V1PostgresPartitionsResponse) { - p.wideHeader = []string{"Name", "AllowedTenants", "AllowedStorageClasses"} + p.wideHeader = []string{"Name", "AllowedTenants", "AllowedStorageClasses", "MemoryFactor", "CPU", "Storagesize", "MaxInstances"} p.shortHeader = p.wideHeader for name, pg := range data { @@ -144,8 +145,37 @@ func (p PostgresPartitionsTablePrinter) Print(data models.V1PostgresPartitionsRe for k := range pg.AllowedStorageClasses { scs = append(scs, k) } + memMax, memMin := "-", "-" + cpuMax, cpuMin := memMax, memMin + storageMax, storageMin := memMax, memMin + maxInstances := "" + if pg.Limits != nil { + cpuMin, cpuMax = pointer.SafeDerefOrDefault(pg.Limits.CPUMin, "-"), pointer.SafeDerefOrDefault(pg.Limits.CPUMax, "-") + storageMin, storageMax = pointer.SafeDerefOrDefault(pg.Limits.StorageSizeMin, "-"), pointer.SafeDerefOrDefault(pg.Limits.StorageSizeMax, "-") + maxv := pointer.SafeDeref(pg.Limits.MemoryfactorMax) + minv := pointer.SafeDeref(pg.Limits.MemoryfactorMin) + instmax := pointer.SafeDeref(pg.Limits.InstancesMax) + + if instmax != 0 { + maxInstances = fmt.Sprintf("%d", instmax) + } + if minv != 0 { + memMin = fmt.Sprintf("%d", *pg.Limits.MemoryfactorMin) + } + if maxv != 0 { + memMax = fmt.Sprintf("%d", *pg.Limits.MemoryfactorMax) + } + } - wide := []string{name, strings.Join(tenants, ","), strings.Join(scs, ",")} + wide := []string{ + name, + strings.Join(tenants, ","), + strings.Join(scs, ","), + strings.Join([]string{memMin, memMax}, "/"), + strings.Join([]string{cpuMin, cpuMax}, "/"), + strings.Join([]string{storageMin, storageMax}, "/"), + maxInstances, + } short := wide p.addWideData(wide, pg) diff --git a/go.mod b/go.mod index a684a4f8..44553c12 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/dustin/go-humanize v1.0.1 github.com/fatih/color v1.19.0 github.com/fi-ts/accounting-go v0.11.1 - github.com/fi-ts/cloud-go v0.33.0 + github.com/fi-ts/cloud-go v0.34.0 github.com/gardener/gardener/pkg/apis v1.140.0 github.com/gardener/machine-controller-manager v0.62.1 github.com/gizak/termui/v3 v3.1.0 diff --git a/go.sum b/go.sum index 18b5ab57..a4414fb0 100644 --- a/go.sum +++ b/go.sum @@ -116,8 +116,8 @@ github.com/fatih/color v1.19.0 h1:Zp3PiM21/9Ld6FzSKyL5c/BULoe/ONr9KlbYVOfG8+w= github.com/fatih/color v1.19.0/go.mod h1:zNk67I0ZUT1bEGsSGyCZYZNrHuTkJJB+r6Q9VuMi0LE= github.com/fi-ts/accounting-go v0.11.1 h1:F4rFua+Q8wF03ASNPTgiUNEQ4vTgnZ1B/ac3B+ssiT8= github.com/fi-ts/accounting-go v0.11.1/go.mod h1:yX9yqzX+i23O/Bj9Gn22oM+/nd2QtjMsvVIWab9UAU4= -github.com/fi-ts/cloud-go v0.33.0 h1:GMU+dUnJVGAjSORB9Sqkxg62SdOwQ+1hOXdx+MaUK4g= -github.com/fi-ts/cloud-go v0.33.0/go.mod h1:gwsY2TQzq4DIu8pevHUZXI11uE1zePOnpYXkPtLYlsw= +github.com/fi-ts/cloud-go v0.34.0 h1:qVbVlXvpeZEk1KDxVpNvAaHMqz4q+dpLThpd4M8dUeI= +github.com/fi-ts/cloud-go v0.34.0/go.mod h1:gwsY2TQzq4DIu8pevHUZXI11uE1zePOnpYXkPtLYlsw= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k=