Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
fixed issue with controller always adding route bindable to OperandBi…
…ndInfo because Route type was a struct and not a point, so could not be nil

Signed-off-by: Henry H Li <[email protected]>
  • Loading branch information
bitscuit committed Nov 2, 2023
commit b62540008c7b133bdd50b2d1da1d170101b9e695
4 changes: 2 additions & 2 deletions api/v1alpha1/operandbindinfo_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const (
BindInfoFailed BindInfoPhase = "Failed"
BindInfoInit BindInfoPhase = "Initialized"
BindInfoUpdating BindInfoPhase = "Updating"
BindInfoWaiting BindInfoPhase = "Waiting for Secret and/or Configmap from provider"
BindInfoWaiting BindInfoPhase = "Waiting for Bindable resource from provider. One of: Secret, ConfigMap, Route, or Service"
)

// OperandBindInfoSpec defines the desired state of OperandBindInfo.
Expand Down Expand Up @@ -75,7 +75,7 @@ type Bindable struct {
// Route data will shared by copying it into a configmap which is then
// created in the target namespace
// +optional
Route Route `json:"route,omitempty"`
Route *Route `json:"route,omitempty"`
}

// Route represents the name and data inside an OpenShift route.
Expand Down
6 changes: 5 additions & 1 deletion api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 7 additions & 5 deletions controllers/operandbindinfo/operandbindinfo_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,12 +212,14 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (_ ctrl.Re

if isRouteAPI {
// Copy Route data into configmap and share configmap
requeueRoute, err := r.copyRoute(ctx, binding.Route, "", operandNamespace, bindRequest.Namespace, key, bindInfoInstance, requestInstance)
if err != nil {
merr.Add(err)
continue
if binding.Route != nil {
requeueRoute, err := r.copyRoute(ctx, *binding.Route, "", operandNamespace, bindRequest.Namespace, key, bindInfoInstance, requestInstance)
if err != nil {
merr.Add(err)
continue
}
requeue = requeue || requeueRoute
}
requeue = requeue || requeueRoute
}
}
}
Expand Down