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

Fix product backend usages controller #743

Merged
merged 2 commits into from
May 4, 2022
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
1 change: 0 additions & 1 deletion apis/apps/v1alpha1/zz_generated.deepcopy.go

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

1 change: 0 additions & 1 deletion apis/capabilities/v1alpha1/zz_generated.deepcopy.go

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

1 change: 0 additions & 1 deletion apis/capabilities/v1beta1/zz_generated.deepcopy.go

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

2 changes: 1 addition & 1 deletion controllers/capabilities/application_plan_reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ func (a *applicationPlanReconciler) findID(ref capabilitiesv1beta1.MetricMethodR
} else {
backendEntity, ok := a.backendRemoteIndex.FindBySystemName(*ref.BackendSystemName)
if !ok {
panic(fmt.Sprintf("Backend SystemName %s not found in backend index", *ref.BackendSystemName))
return 0, fmt.Errorf("Backend SystemName %s not found in 3scale backend index", *ref.BackendSystemName)
}
metricID, err = backendEntity.FindMethodMetricIDBySystemName(ref.SystemName)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions controllers/capabilities/backend_usages.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func (t *ProductThreescaleReconciler) syncBackendUsage(_ interface{}) error {
// backend usage ID should exist in the backend list
backend, ok := t.backendRemoteIndex.FindByID(existing.Element.BackendAPIID)
if !ok {
panic(fmt.Sprintf("Backend ID %d not found in backend index", existing.Element.BackendAPIID))
return fmt.Errorf("Backend ID %d not found in 3scale backend index", existing.Element.BackendAPIID)
}
existingKeys = append(existingKeys, backend.SystemName())
existingMap[backend.SystemName()] = existing.Element
Expand Down Expand Up @@ -90,7 +90,7 @@ func (t *ProductThreescaleReconciler) syncBackendUsage(_ interface{}) error {
// Thus, existing Backend entities should contain desired systemName
backend, ok := t.backendRemoteIndex.FindBySystemName(backendSystemName)
if !ok {
panic(fmt.Sprintf("Backend SystemName %s not found in backend index", backendSystemName))
return fmt.Errorf("Backend SystemName %s not found in 3scale backend index", backendSystemName)
}
desiredNewList = append(desiredNewList, newBackendUsageData{
spec: t.resource.Spec.BackendUsages[backendSystemName],
Expand Down