diff --git a/cmd/output/postgres.go b/cmd/output/postgres.go index 74aa084..d759920 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 c5b0b6b..452a8d9 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.18.0 github.com/fi-ts/accounting-go v0.11.1 - github.com/fi-ts/cloud-go v0.30.20 + github.com/fi-ts/cloud-go v0.32.1-0.20260706095957-0e56a1b60b46 github.com/gardener/gardener v1.123.5 github.com/gardener/machine-controller-manager v0.58.0 github.com/gizak/termui/v3 v3.1.0 diff --git a/go.sum b/go.sum index 3054437..46bb8e7 100644 --- a/go.sum +++ b/go.sum @@ -134,8 +134,8 @@ github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM= github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU= 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.30.20 h1:FEfRHVdbBTcGHRWXaaZ+VFsvn488ilFsEkWowa62l8Q= -github.com/fi-ts/cloud-go v0.30.20/go.mod h1:gwsY2TQzq4DIu8pevHUZXI11uE1zePOnpYXkPtLYlsw= +github.com/fi-ts/cloud-go v0.32.1-0.20260706095957-0e56a1b60b46 h1:Dfm4coG31mu3jtlqNFvydKYuC7MVOfAtdh9enGtqsVQ= +github.com/fi-ts/cloud-go v0.32.1-0.20260706095957-0e56a1b60b46/go.mod h1:gwsY2TQzq4DIu8pevHUZXI11uE1zePOnpYXkPtLYlsw= github.com/fluent/fluent-operator/v3 v3.3.0 h1:zBtt8IOVSyTiywnmom3V2byqIi2ZXMCCKBUx/4bnFBk= github.com/fluent/fluent-operator/v3 v3.3.0/go.mod h1:x54zzJ60QYJ6jnN7n9/Mseyaz9oWjSO99hbhVXJaar0= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8=