Skip to content

Commit cd26fa5

Browse files
Merge pull request #1973 from mpatlasov/OCPBUGS-58254-CredentialsRequestController-do-not-sync-if-Unmanaged
OCPBUGS-58254: CredentialsRequestController: do not sync if the state is not Managed
2 parents 60108c9 + 09c8e01 commit cd26fa5

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

pkg/operator/csi/credentialsrequestcontroller/credentials_request_controller.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ func (c CredentialsRequestController) sync(ctx context.Context, syncContext fact
8989
if err != nil {
9090
return err
9191
}
92+
if spec.ManagementState != opv1.Managed {
93+
return nil
94+
}
9295

9396
sync, err := shouldSync(c.operatorLister)
9497
if err != nil {

pkg/operator/csi/credentialsrequestcontroller/credentials_request_controller_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,9 @@ func TestSync(t *testing.T) {
131131
unstructured.SetNestedField(cr.Object, tc.inputSecretProvisioned, "status", "provisioned")
132132
dynamicClient.credentialRequest = cr
133133

134-
operatorClient := v1helpers.NewFakeOperatorClient(&opv1.OperatorSpec{}, &opv1.OperatorStatus{}, nil)
134+
operatorClient := v1helpers.NewFakeOperatorClient(&opv1.OperatorSpec{
135+
ManagementState: opv1.Managed,
136+
}, &opv1.OperatorStatus{}, nil)
135137
recorder := events.NewInMemoryRecorder("test", clocktesting.NewFakePassiveClock(time.Now()))
136138
controller := NewCredentialsRequestController(
137139
controllerName,

0 commit comments

Comments
 (0)