Skip to content

Commit

Permalink
Fix CI tests
Browse files Browse the repository at this point in the history
  • Loading branch information
harishsurf committed Nov 29, 2023
1 parent eb41bef commit 0444c3b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
8 changes: 8 additions & 0 deletions controllers/quay/features.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,8 @@ func (r *QuayRegistryReconciler) checkRoutesAvailable(
// NOTE: The `route` component is unique because we allow users to set the
// `SERVER_HOSTNAME` field instead of controlling the entire fieldgroup. This
// value is then passed to the created `Route` using a Kustomize variable.

// REFACTOR: The below `qctx` obj setting the hostname should be put in a separate function.
var config map[string]interface{}
if err := yaml.Unmarshal(bundle.Data["config.yaml"], &config); err != nil {
return fmt.Errorf("unable to parse config.yaml: %w", err)
Expand All @@ -209,6 +211,12 @@ func (r *QuayRegistryReconciler) checkRoutesAvailable(
qctx.ServerHostname = fieldGroup.ServerHostname
}

// If route is unmanaged, skip routes check
routeManaged := v1.ComponentIsManaged(quay.Spec.Components, v1.ComponentRoute)
if !routeManaged {
return nil
}

fakeRoute := v1.EnsureOwnerReference(
quay,
&routev1.Route{
Expand Down
22 changes: 9 additions & 13 deletions controllers/quay/quayregistry_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -497,19 +497,15 @@ func (r *QuayRegistryReconciler) Reconcile(ctx context.Context, req ctrl.Request
)
}

routeManaged := v1.ComponentIsManaged(updatedQuay.Spec.Components, v1.ComponentRoute)
tlsManaged := v1.ComponentIsManaged(updatedQuay.Spec.Components, v1.ComponentTLS)
if routeManaged || tlsManaged {
if err := r.checkRoutesAvailable(ctx, quayContext, updatedQuay, cbundle); err != nil {
return r.reconcileWithCondition(
ctx,
&quay,
v1.ConditionTypeRolloutBlocked,
metav1.ConditionTrue,
v1.ConditionReasonRouteComponentDependencyError,
fmt.Sprintf("could not check for `Routes` API: %s", err),
)
}
if err := r.checkRoutesAvailable(ctx, quayContext, updatedQuay, cbundle); err != nil {
return r.reconcileWithCondition(
ctx,
&quay,
v1.ConditionTypeRolloutBlocked,
metav1.ConditionTrue,
v1.ConditionReasonRouteComponentDependencyError,
fmt.Sprintf("could not check for `Routes` API: %s", err),
)
}

osmanaged := v1.ComponentIsManaged(updatedQuay.Spec.Components, v1.ComponentObjectStorage)
Expand Down

0 comments on commit 0444c3b

Please sign in to comment.