diff --git a/api/v1/postgres_types.go b/api/v1/postgres_types.go index a479aafc..ca89b41e 100644 --- a/api/v1/postgres_types.go +++ b/api/v1/postgres_types.go @@ -218,6 +218,9 @@ type PostgresSpec struct { // DisableLoadBalancers enable or disable the Load Balancers (Services) DisableLoadBalancers *bool `json:"disableLoadBalancers,omitempty"` + + // StorageClass custom storage class for this database + StorageClass *string `json:"storageClass,omitempty"` } // AccessList defines the type of restrictions to access the database @@ -706,7 +709,11 @@ func (p *Postgres) ToUnstructuredZalandoPostgresql(z *zalando.Postgresql, c *cor z.Spec.Resources.ResourceLimits.Memory = ptr.To(p.Spec.Size.Memory) z.Spec.TeamID = p.generateTeamID() z.Spec.Volume.Size = p.Spec.Size.StorageSize - z.Spec.Volume.StorageClass = sc + if p.Spec.StorageClass != nil { + z.Spec.Volume.StorageClass = *p.Spec.StorageClass + } else { + z.Spec.Volume.StorageClass = sc + } z.Spec.Patroni.TTL = patroniTTL z.Spec.Patroni.LoopWait = patroniLoopWait diff --git a/api/v1/zz_generated.deepcopy.go b/api/v1/zz_generated.deepcopy.go index 54b29514..33ad01d5 100644 --- a/api/v1/zz_generated.deepcopy.go +++ b/api/v1/zz_generated.deepcopy.go @@ -198,6 +198,11 @@ func (in *PostgresSpec) DeepCopyInto(out *PostgresSpec) { *out = new(bool) **out = **in } + if in.StorageClass != nil { + in, out := &in.StorageClass, &out.StorageClass + *out = new(string) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PostgresSpec. diff --git a/config/crd/bases/database.fits.cloud_postgres.yaml b/config/crd/bases/database.fits.cloud_postgres.yaml index bbd62b1f..ee419a65 100644 --- a/config/crd/bases/database.fits.cloud_postgres.yaml +++ b/config/crd/bases/database.fits.cloud_postgres.yaml @@ -178,6 +178,9 @@ spec: pattern: ^[1-9][0-9]*Gi type: string type: object + storageClass: + description: StorageClass custom storage class for this database + type: string tenant: description: Tenant metal tenant type: string diff --git a/main.go b/main.go index e4740e5e..785fb33e 100644 --- a/main.go +++ b/main.go @@ -301,7 +301,7 @@ func main() { viper.SetDefault(enableLBSourceRangesFlg, true) enableLBSourceRanges = viper.GetBool(enableLBSourceRangesFlg) - viper.SetDefault(enableRandomStorageEncryptionSecretFlg, false) + viper.SetDefault(enableRandomStorageEncryptionSecretFlg, true) enableRandomStorageEncryptionSecret = viper.GetBool(enableRandomStorageEncryptionSecretFlg) viper.SetDefault(enableWalGEncryptionFlg, false)