From a1c35a41946ad308fd3622a3409ea3fae8cbf18a Mon Sep 17 00:00:00 2001 From: Nicolas Bigler Date: Thu, 24 Oct 2024 17:05:53 +0200 Subject: [PATCH] Clarify Repack and Vacuum API docs and fix wrong error message Signed-off-by: Nicolas Bigler --- apis/vshn/v1/dbaas_vshn_postgresql.go | 5 ++++- pkg/controller/webhooks/postgresql.go | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/apis/vshn/v1/dbaas_vshn_postgresql.go b/apis/vshn/v1/dbaas_vshn_postgresql.go index 285e997c36..63d4837acd 100644 --- a/apis/vshn/v1/dbaas_vshn_postgresql.go +++ b/apis/vshn/v1/dbaas_vshn_postgresql.go @@ -2,6 +2,7 @@ package v1 import ( "fmt" + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" sgv1 "github.com/vshn/appcat/v4/apis/stackgres/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -148,9 +149,11 @@ type VSHNPostgreSQLServiceSpec struct { PgBouncerSettings *sgv1.SGPoolingConfigSpecPgBouncerPgbouncerIni `json:"pgBouncerSettings,omitempty"` // +kubebuilder:default=true - // This is default option if neither repack or vacuum are selected + // RepackEnabled defines if `pg_repack` should be performed during the maintenance. Defaults to true. RepackEnabled bool `json:"repackEnabled,omitempty"` + // +kubebuilder:default=false + // VacuumEnabled defines if `VACUUM` should be performed during the maintenace. Defaults to false. VacuumEnabled bool `json:"vacuumEnabled,omitempty"` // Access defines additional users and databases for this instance. diff --git a/pkg/controller/webhooks/postgresql.go b/pkg/controller/webhooks/postgresql.go index 21c50f4f92..e7f25e733a 100644 --- a/pkg/controller/webhooks/postgresql.go +++ b/pkg/controller/webhooks/postgresql.go @@ -312,7 +312,7 @@ func (p *PostgreSQLWebhookHandler) checkGuaranteedAvailability(pg *vshnv1.VSHNPo // validate vacuum and repack settings func validateVacuumRepack(vacuum, repack bool) error { if !vacuum && !repack { - return fmt.Errorf("repack cannot be enabled without vacuum") + return fmt.Errorf("can't disable vacuum and repack at the same time") } return nil }