Skip to content

Commit

Permalink
secret needed after readiness check of space
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfHammer committed Oct 16, 2024
1 parent b221a53 commit bfed7bd
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions internal/controllers/serviceinstance_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,18 +150,11 @@ func (r *ServiceInstanceReconciler) Reconcile(ctx context.Context, req ctrl.Requ
Name: space.GetSpec().AuthSecretName,
}
}

spaceGuid := space.GetSpec().Guid
if spaceGuid == "" {
spaceGuid = space.GetStatus().SpaceGuid
}

// Retrieve referenced space secret containing credentials for accessing CF
spaceSecret := &corev1.Secret{}
if err := r.Get(ctx, spaceSecretName, spaceSecret); err != nil {
return ctrl.Result{}, errors.Wrapf(err, "failed to get Secret containing space credentials, secret name: %s", spaceSecretName)
}

// Require readiness of space unless in deletion case
if serviceInstance.DeletionTimestamp.IsZero() {
if !space.IsReady() {
Expand All @@ -175,6 +168,12 @@ func (r *ServiceInstanceReconciler) Reconcile(ctx context.Context, req ctrl.Requ
}
}

// Retrieve referenced space secret containing credentials for accessing CF
spaceSecret := &corev1.Secret{}
if err := r.Get(ctx, spaceSecretName, spaceSecret); err != nil {
return ctrl.Result{}, errors.Wrapf(err, "failed to get Secret containing space credentials, secret name: %s", spaceSecretName)
}

// Build client for accessing CF
var spaceClient facade.SpaceClient
if spaceGuid != "" {
Expand Down

0 comments on commit bfed7bd

Please sign in to comment.