Skip to content

Commit dd22b9d

Browse files
authored
fix: credential provider response secret ownership (#709)
**What problem does this PR solve?**: Saw that the owner was not getting correctly set on image credential Secret. **Which issue(s) this PR fixes**: Fixes # **How Has This Been Tested?**: <!-- Please describe the tests that you ran to verify your changes. Provide output from the tests and any manual steps needed to replicate the tests. --> **Special notes for your reviewer**: <!-- Use this to provide any additional information to the reviewers. This may include: - Best way to review the PR. - Where the author wants the most review attention on. - etc. -->
1 parent e8f5fd1 commit dd22b9d

File tree

1 file changed

+3
-4
lines changed
  • pkg/handlers/generic/mutation/imageregistries/credentials

1 file changed

+3
-4
lines changed

pkg/handlers/generic/mutation/imageregistries/credentials/inject.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -368,16 +368,15 @@ func createSecretIfNeeded(
368368
)
369369
}
370370
if credentialsSecret != nil {
371-
if err := client.ServerSideApply(ctx, c, credentialsSecret, client.ForceOwnership); err != nil {
372-
return fmt.Errorf("failed to apply Image Registry Credentials Secret: %w", err)
373-
}
374-
375371
if err = controllerutil.SetOwnerReference(cluster, credentialsSecret, c.Scheme()); err != nil {
376372
return fmt.Errorf(
377373
"failed to set owner reference on Image Registry Credentials Secret: %w",
378374
err,
379375
)
380376
}
377+
if err := client.ServerSideApply(ctx, c, credentialsSecret, client.ForceOwnership); err != nil {
378+
return fmt.Errorf("failed to apply Image Registry Credentials Secret: %w", err)
379+
}
381380
}
382381

383382
return nil

0 commit comments

Comments
 (0)