From e37bb3d63c2550532adb64aac3f6f41fc1c1e2e2 Mon Sep 17 00:00:00 2001 From: Stefan Majer Date: Tue, 16 Feb 2021 13:59:41 +0100 Subject: [PATCH 1/3] Add memory to size --- api/v1/postgres_types.go | 2 ++ config/crd/bases/database.fits.cloud_postgres.yaml | 5 ++++- config/crd/bases/database.fits.cloud_zalandopostgres.yaml | 2 +- controllers/postgres_controller.go | 1 + 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/api/v1/postgres_types.go b/api/v1/postgres_types.go index eea7d98e..40963248 100644 --- a/api/v1/postgres_types.go +++ b/api/v1/postgres_types.go @@ -102,6 +102,8 @@ type Backup struct { type Size struct { // CPU is in the format as pod.spec.resource.request.cpu CPU string `json:"cpu,omitempty"` + // Memory is in the format as pod.spec.resource.request.memory + Memory string `json:"memory,omitempty"` // SharedBuffer of the database SharedBuffer string `json:"sharedBuffer,omitempty"` diff --git a/config/crd/bases/database.fits.cloud_postgres.yaml b/config/crd/bases/database.fits.cloud_postgres.yaml index e16bb69d..af5e0516 100644 --- a/config/crd/bases/database.fits.cloud_postgres.yaml +++ b/config/crd/bases/database.fits.cloud_postgres.yaml @@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.2.5 + controller-gen.kubebuilder.io/version: v0.4.0 creationTimestamp: null name: postgres.database.fits.cloud spec: @@ -123,6 +123,9 @@ spec: cpu: description: CPU is in the format as pod.spec.resource.request.cpu type: string + memory: + description: Memory is in the format as pod.spec.resource.request.memory + type: string sharedBuffer: description: SharedBuffer of the database type: string diff --git a/config/crd/bases/database.fits.cloud_zalandopostgres.yaml b/config/crd/bases/database.fits.cloud_zalandopostgres.yaml index 658b0501..01def6f0 100644 --- a/config/crd/bases/database.fits.cloud_zalandopostgres.yaml +++ b/config/crd/bases/database.fits.cloud_zalandopostgres.yaml @@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.2.5 + controller-gen.kubebuilder.io/version: v0.4.0 creationTimestamp: null name: zalandopostgres.database.fits.cloud spec: diff --git a/controllers/postgres_controller.go b/controllers/postgres_controller.go index 2b1ae4bb..db82de67 100644 --- a/controllers/postgres_controller.go +++ b/controllers/postgres_controller.go @@ -265,6 +265,7 @@ func patchRawZ(out *zalando.Postgresql, in *pg.Postgres) { out.Spec.PostgresqlParam.PgVersion = in.Spec.Version out.Spec.ResourceRequests.CPU = in.Spec.Size.CPU + out.Spec.ResourceRequests.Memory = in.Spec.Size.CPU // todo: Check if the validation should be performed here. out.Spec.Volume.Size = in.Spec.Size.StorageSize From 0ac9bff9ae1eaf8cd1a461e946874b627e680303 Mon Sep 17 00:00:00 2001 From: Stefan Majer Date: Tue, 16 Feb 2021 14:01:50 +0100 Subject: [PATCH 2/3] Typo --- controllers/postgres_controller.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controllers/postgres_controller.go b/controllers/postgres_controller.go index db82de67..7156ab9f 100644 --- a/controllers/postgres_controller.go +++ b/controllers/postgres_controller.go @@ -265,7 +265,7 @@ func patchRawZ(out *zalando.Postgresql, in *pg.Postgres) { out.Spec.PostgresqlParam.PgVersion = in.Spec.Version out.Spec.ResourceRequests.CPU = in.Spec.Size.CPU - out.Spec.ResourceRequests.Memory = in.Spec.Size.CPU + out.Spec.ResourceRequests.Memory = in.Spec.Size.Memory // todo: Check if the validation should be performed here. out.Spec.Volume.Size = in.Spec.Size.StorageSize From 209a6e756161bd1fe5ade12182e1d90da2793650 Mon Sep 17 00:00:00 2001 From: Stefan Majer Date: Tue, 16 Feb 2021 14:02:58 +0100 Subject: [PATCH 3/3] revert controller-gen version --- config/crd/bases/database.fits.cloud_postgres.yaml | 2 +- config/crd/bases/database.fits.cloud_zalandopostgres.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/crd/bases/database.fits.cloud_postgres.yaml b/config/crd/bases/database.fits.cloud_postgres.yaml index af5e0516..e998b223 100644 --- a/config/crd/bases/database.fits.cloud_postgres.yaml +++ b/config/crd/bases/database.fits.cloud_postgres.yaml @@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.4.0 + controller-gen.kubebuilder.io/version: v0.2.5 creationTimestamp: null name: postgres.database.fits.cloud spec: diff --git a/config/crd/bases/database.fits.cloud_zalandopostgres.yaml b/config/crd/bases/database.fits.cloud_zalandopostgres.yaml index 01def6f0..658b0501 100644 --- a/config/crd/bases/database.fits.cloud_zalandopostgres.yaml +++ b/config/crd/bases/database.fits.cloud_zalandopostgres.yaml @@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.4.0 + controller-gen.kubebuilder.io/version: v0.2.5 creationTimestamp: null name: zalandopostgres.database.fits.cloud spec: