From 73157bc1687432a6d3bbe7e331e0866780641829 Mon Sep 17 00:00:00 2001 From: Philipp Eberle Date: Tue, 23 Feb 2021 11:37:26 +0100 Subject: [PATCH 1/2] Add a reference to the zalando resource in the status part of our postgres resource --- api/v1/postgres_types.go | 2 ++ controllers/status_controller.go | 3 +++ 2 files changed, 5 insertions(+) diff --git a/api/v1/postgres_types.go b/api/v1/postgres_types.go index 4257d7eb..7ec2d85c 100644 --- a/api/v1/postgres_types.go +++ b/api/v1/postgres_types.go @@ -150,6 +150,8 @@ type PostgresStatus struct { Description string `json:"description,omitempty"` Socket Socket `json:"socket,omitempty"` + + ChildReference string `json:"childReference,omitempty"` } // Socket represents load-balancer socket of Postgres diff --git a/controllers/status_controller.go b/controllers/status_controller.go index 741274ce..2f4a40fd 100644 --- a/controllers/status_controller.go +++ b/controllers/status_controller.go @@ -82,7 +82,10 @@ func (r *StatusReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctr if err := r.Control.Get(ctx, types.NamespacedName{Name: owner.Name, Namespace: owner.Namespace}, &owner); err != nil { return err } + // update the status of the remote object owner.Status.Description = instance.Status.PostgresClusterStatus + // update the reference to the zalando instance in the remote object + owner.Status.ChildReference = string(instance.UID) log.Info("Updating owner", "owner", owner) if err := r.Control.Status().Update(ctx, &owner); err != nil { From c8397f6a659c59b7c8d081adcbf54d06ca92719d Mon Sep 17 00:00:00 2001 From: Philipp Eberle Date: Wed, 24 Feb 2021 09:36:40 +0100 Subject: [PATCH 2/2] Add updated CRD --- .../bases/database.fits.cloud_postgres.yaml | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/config/crd/bases/database.fits.cloud_postgres.yaml b/config/crd/bases/database.fits.cloud_postgres.yaml index e9e099ab..6c42aed3 100644 --- a/config/crd/bases/database.fits.cloud_postgres.yaml +++ b/config/crd/bases/database.fits.cloud_postgres.yaml @@ -59,22 +59,6 @@ spec: type: string type: array type: object - backup: - description: 'todo: add default Backup parametes of the database backup' - properties: - retention: - description: Retention defines how many days a backup will persist - format: int32 - type: integer - s3BucketURL: - description: S3BucketURL defines the URL of the S3 bucket for - backup - type: string - schedule: - description: Schedule defines how often a backup should be made, - in cron format - type: string - type: object description: description: Description type: string @@ -141,6 +125,8 @@ spec: status: description: PostgresStatus defines the observed state of Postgres properties: + childReference: + type: string description: description: 'INSERT ADDITIONAL STATUS FIELD - define observed state of cluster Important: Run "make" to regenerate code after modifying