Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 32 additions & 2 deletions cmd/output/postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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 {
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down