Skip to content
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

Trigger status update #531

Draft
wants to merge 30 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
76e1e12
Downgrade deps
eberlep Sep 8, 2023
e0fe157
Add new field
eberlep Sep 8, 2023
b9c90b6
Initial implementation of dedicated IP
eberlep Sep 8, 2023
3467927
update status controller as well
eberlep Sep 8, 2023
446d187
cleanup + logging
eberlep Sep 8, 2023
c2bc24d
cleanup
eberlep Sep 8, 2023
0955128
Merge remote-tracking branch 'origin' into dedicated_ip_addresses
eberlep Oct 16, 2023
a0f21d8
Use "" for deletion but ignore nil
eberlep Oct 17, 2023
48c76e3
Revert "Use "" for deletion but ignore nil"
eberlep Oct 17, 2023
3b5a097
Merge remote-tracking branch 'origin' into dedicated_ip_addresses
eberlep Oct 18, 2023
e83e6c5
Merge remote-tracking branch 'origin' into dedicated_ip_addresses
eberlep Oct 18, 2023
afa9cb5
Add todo/comment
eberlep Oct 19, 2023
8c96142
Check if the IP could actually be assigned before updating the status
eberlep Oct 19, 2023
32d8b22
Use correct errror variable
eberlep Oct 19, 2023
09cdabf
Add support for dedicatedLoadBalancerPort
eberlep Oct 19, 2023
cb9a75b
Add support for dedicatedLoadBalancerPort
eberlep Oct 19, 2023
0d24222
Replace the whole spec
eberlep Oct 19, 2023
3d53286
Replace the whole spec
eberlep Oct 19, 2023
1bd8c4a
Refactor
eberlep Oct 19, 2023
6cd7cb9
Add support for additional sockets in status
eberlep Oct 19, 2023
9f3debe
Reworked the Status Socket handling to keep existing replications going
eberlep Oct 19, 2023
42b5d41
Apply suggestions from code review
eberlep Oct 20, 2023
480d476
Move consts for DedicatedLoadBalancerIP tags to postgreslet
eberlep Oct 23, 2023
4252f4a
capitalization
eberlep Oct 23, 2023
d02ebd9
Merge branch 'dedicated_ip_addresses' of https://github.com/fi-ts/pos…
eberlep Oct 23, 2023
b9272a5
capitalization
eberlep Oct 23, 2023
4a2ec76
Trigger status_controller when reconciling the postgres resource (e.g…
eberlep Oct 23, 2023
c659649
Merge remote-tracking branch 'origin' into trigger_status_update
eberlep Oct 23, 2023
79714a6
Support deletion of additionalSockets
eberlep Oct 23, 2023
24530e7
reset additional sockets if neccessary
eberlep Oct 23, 2023
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
4 changes: 4 additions & 0 deletions api/v1/postgres_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ const (
BackupConfigLabelName string = "postgres.database.fits.cloud/is-backup"
// BackupConfigKey defines the key under which the BackupConfig is stored in the data map.
BackupConfigKey = "config"
// LastReconciledLabelName Name of the last reconciled label
LastReconciledLabelName string = "postgres.database.fits.cloud/last-reconciled"
// SharedBufferParameterKey defines the key under which the shared buffer size is stored in the parameters map. Defined by the postgres-operator/patroni
SharedBufferParameterKey = "shared_buffers"
// StandbyKey defines the key under which the standby configuration is stored in the CR. Defined by the postgres-operator/patroni
Expand Down Expand Up @@ -612,6 +614,8 @@ func (p *Postgres) ToUnstructuredZalandoPostgresql(z *zalando.Postgresql, c *cor
// Add the newly introduced label only here, not in p.ToZalandoPostgresqlMatchingLabels() (so that the selectors using p.ToZalandoPostgresqlMatchingLabels() will still work untill all postgres resources have that new label)
// TODO once all the custom resources have that new label, move this part to p.ToZalandoPostgresqlMatchingLabels()
z.Labels[PartitionIDLabelName] = p.Spec.PartitionID
// Add/update the LastReconciled label
z.Labels[LastReconciledLabelName] = fmt.Sprint(time.Now().Unix())

z.Spec.NumberOfInstances = p.Spec.NumberOfInstances
z.Spec.PostgresqlParam.PgVersion = p.Spec.Version
Expand Down
4 changes: 4 additions & 0 deletions controllers/status_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ func (r *StatusReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctr
log.Info("unable to fetch the shared LoadBalancer to update postgres status socket")
owner.Status.Socket = pg.Socket{}
}
// reset additional sockets
owner.Status.AdditionalSockets = []pg.Socket{}

if err := r.CtrlClient.Status().Update(ctx, owner); err != nil {
return ctrl.Result{}, fmt.Errorf("failed to update simple postgres status socket: %w", err)
Expand Down Expand Up @@ -145,6 +147,7 @@ func (r *StatusReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctr
log.Info("using dedicated loadbalancer as additional status socket")
} else {
log.Info("failed to use dedicated loadbalancer as additional status socket")
owner.Status.AdditionalSockets = []pg.Socket{}
}

} else {
Expand All @@ -160,6 +163,7 @@ func (r *StatusReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctr
log.Info("failed to use dedicated loadbalancer as primary status socket")
owner.Status.Socket = pg.Socket{}
}
owner.Status.AdditionalSockets = []pg.Socket{}
}

// actually perform the status update
Expand Down