Skip to content

WIP: Add a reference to the zalando resource in the status #132

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 24, 2021
Merged
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
2 changes: 2 additions & 0 deletions api/v1/postgres_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 2 additions & 16 deletions config/crd/bases/database.fits.cloud_postgres.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions controllers/status_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down