Skip to content

Commit

Permalink
fix: authz patch injection feature precondition uses correct namespac…
Browse files Browse the repository at this point in the history
…e value (opendatahub-io#1135)

* fix: fixes authz patch injection feature precondition

If the authorization provider namespace is not specified in the DSCI the
default is constructed to be `application-namespace-auth-provider`, e.g.
`opendatahub-auth-provider`.

With the opendatahub-io#1052 refactoring, the regression has been introduced where the value is
directly read from the spec instead of being dynamically constructed
based on the rule described above.

This is manifested with the following error, as the feature mistakenly
waits for pods across all namespaces (because of list option for
namespace being `corev1.NamespaceAll == ""`). This obviously rarely is
true, especially for large clusters.

```json
Failed applying [enable-proxy-injection-in-authorino-deployment]: 1 error occurred:
* client rate limiter Wait returned an error: context deadline exceeded
```

leading to failure of reconciling this feature.

The fix is to read the namespace from `FeatureData` instead, where the defaulting
logic is defined.

Fixes https://issues.redhat.com/browse/RHOAIENG-10268

* Update controllers/dscinitialization/servicemesh_setup.go

Co-authored-by: Wen Zhou <wenzhou@redhat.com>

---------

Co-authored-by: Wen Zhou <wenzhou@redhat.com>
  • Loading branch information
bartoszmajsak and zdtsw authored Jul 23, 2024
1 parent 101272c commit 7034768
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion controllers/dscinitialization/servicemesh_setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,12 @@ func (r *DSCInitializationReconciler) authorizationFeatures(instance *dsciv1.DSC
).
PreConditions(
func(ctx context.Context, f *feature.Feature) error {
return feature.WaitForPodsToBeReady(serviceMeshSpec.Auth.Namespace)(ctx, f)
namespace, err := servicemesh.FeatureData.Authorization.Namespace.Extract(f)
if err != nil {
return fmt.Errorf("failed trying to resolve authorization provider namespace for feature '%s': %w", f.Name, err)
}

return feature.WaitForPodsToBeReady(namespace)(ctx, f)
},
).
WithData(servicemesh.FeatureData.ControlPlane.Define(&instance.Spec).AsAction()).
Expand Down

0 comments on commit 7034768

Please sign in to comment.