Skip to content

Commit de1f390

Browse files
committed
Remove unnecessary abstraction
1 parent 1bc266e commit de1f390

File tree

2 files changed

+4
-14
lines changed

2 files changed

+4
-14
lines changed

controllers/postgres_controller.go

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,9 @@ func (r *PostgresReconciler) Reconcile(ctx context.Context, req ctrl.Request) (c
138138
log.Info("finalizer added")
139139
}
140140

141-
// Check if zalando dependencies are installed. If not, install them.
142-
if err := r.ensureZalandoDependencies(ctx, instance); err != nil {
141+
if err := r.CreateOrUpdateOperator(ctx, instance); err != nil {
143142
r.recorder.Eventf(instance, "Warning", "Error", "failed to install operator: %v", err)
144-
return ctrl.Result{}, fmt.Errorf("error while ensuring Zalando dependencies: %w", err)
143+
return ctrl.Result{}, fmt.Errorf("error while installing zalando dependencies: %w", err)
145144
}
146145

147146
if err := r.createOrUpdateZalandoPostgresql(ctx, instance, log); err != nil {
@@ -231,15 +230,6 @@ func (r *PostgresReconciler) createOrUpdateZalandoPostgresql(ctx context.Context
231230
return nil
232231
}
233232

234-
// ensureZalandoDependencies makes sure Zalando resources are installed in the service-cluster.
235-
func (r *PostgresReconciler) ensureZalandoDependencies(ctx context.Context, p *pg.Postgres) error {
236-
if err := r.InstallOrUpdateOperator(ctx, p); err != nil {
237-
return fmt.Errorf("error while installing zalando dependencies: %w", err)
238-
}
239-
240-
return nil
241-
}
242-
243233
func (r *PostgresReconciler) isManagedByUs(obj *pg.Postgres) bool {
244234
if obj.Spec.PartitionID != r.PartitionID {
245235
return false

pkg/operatormanager/operatormanager.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ func New(CtrlClient client.Client, conf *rest.Config, fileName string, scheme *r
104104
}, nil
105105
}
106106

107-
// InstallOrUpdateOperator installs or updates the operator Stored in `OperatorManager`
108-
func (m *OperatorManager) InstallOrUpdateOperator(ctx context.Context, instance *pg.Postgres) error {
107+
// CreateOrUpdateOperator installs or updates the operator Stored in `OperatorManager`
108+
func (m *OperatorManager) CreateOrUpdateOperator(ctx context.Context, instance *pg.Postgres) error {
109109
namespace := instance.ToPeripheralResourceNamespace()
110110

111111
// Make sure the namespace exists.

0 commit comments

Comments
 (0)