Skip to content

Commit

Permalink
fix(operator): Watch for CredentialsRequests on CCOAuthEnv only (#13299)
Browse files Browse the repository at this point in the history
  • Loading branch information
periklis committed Jul 4, 2024
1 parent 0f9088b commit 7fc926e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
8 changes: 5 additions & 3 deletions operator/controllers/loki/lokistack_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,11 @@ func (r *LokiStackReconciler) buildController(bld k8s.Builder) error {
}

if r.FeatureGates.OpenShift.Enabled {
bld = bld.
Owns(&routev1.Route{}, updateOrDeleteOnlyPred).
Owns(&cloudcredentialv1.CredentialsRequest{}, updateOrDeleteOnlyPred)
bld = bld.Owns(&routev1.Route{}, updateOrDeleteOnlyPred)

if r.FeatureGates.OpenShift.TokenCCOAuthEnv {
bld = bld.Owns(&cloudcredentialv1.CredentialsRequest{}, updateOrDeleteOnlyPred)
}

if r.FeatureGates.OpenShift.ClusterTLSPolicy {
bld = bld.Watches(&openshiftconfigv1.APIServer{}, r.enqueueAllLokiStacksHandler(), updateOrDeleteOnlyPred)
Expand Down
5 changes: 3 additions & 2 deletions operator/controllers/loki/lokistack_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ func TestLokiStackController_RegisterOwnedResourcesForUpdateOrDeleteOnly(t *test
{
obj: &routev1.Route{},
index: 10,
ownCallsCount: 12,
ownCallsCount: 11,
featureGates: configv1.FeatureGates{
OpenShift: configv1.OpenShiftFeatureGates{
Enabled: true,
Expand All @@ -175,7 +175,8 @@ func TestLokiStackController_RegisterOwnedResourcesForUpdateOrDeleteOnly(t *test
ownCallsCount: 12,
featureGates: configv1.FeatureGates{
OpenShift: configv1.OpenShiftFeatureGates{
Enabled: true,
Enabled: true,
TokenCCOAuthEnv: true,
},
},
pred: updateOrDeleteOnlyPred,
Expand Down

0 comments on commit 7fc926e

Please sign in to comment.