Skip to content

fix: do not run ApplyTemplate for immutable secrets in mutationFunc#5110

Merged
Skarlso merged 1 commit intoexternal-secrets:mainfrom
jakobmoellerdev:fix/4976
Aug 8, 2025
Merged

fix: do not run ApplyTemplate for immutable secrets in mutationFunc#5110
Skarlso merged 1 commit intoexternal-secrets:mainfrom
jakobmoellerdev:fix/4976

Conversation

@jakobmoellerdev
Copy link
Copy Markdown
Contributor

Problem Statement

When reconciling a recently created ExternalSecret it is possible that the Status subresource is not in the cache causing this condition to fail. The operator will then try and fail to update an immutable ExternalSecret.

Related Issue

fix #4976

To verify fix, see reproducer at #4976 (comment)

Proposed Changes

This makes sure that mutationFunc only calls ApplyTemplate (and updates the Secret) when the secret under check is freshly created and not immutable. Previously, it always ran the ApplyTemplate and that lead to races.

Checklist

  • I have read the contribution guidelines
    • I would like to get some input on how to best test this apart from the manual reproducer. After that I can also automate the test.
  • All commits are signed with git commit --signoff
  • My changes have reasonable test coverage
  • All tests pass with make test
  • I ensured my PR is ready for review with make reviewable

This makes sure that `mutationFunc` only calls ApplyTemplate (and updates the Secret) when the secret under check is freshly created and not immutable. Previously, it always ran the ApplyTemplate and that lead to races.

fix external-secrets#4976

To verify fix, see reproducer at external-secrets#4976 (comment)

Signed-off-by: Jakob Möller <jakob.moeller@sap.com>
@jakobmoellerdev jakobmoellerdev requested a review from a team as a code owner August 8, 2025 15:07
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Aug 8, 2025

@Skarlso Skarlso requested review from Skarlso and removed request for knelasevero August 8, 2025 15:09
@Skarlso
Copy link
Copy Markdown
Contributor

Skarlso commented Aug 8, 2025

/ok-to-test sha=b427491cdc91aba222ec572c6ea730c8eccf850f

@eso-service-account-app
Copy link
Copy Markdown
Contributor

[Bot] - ✅ e2e for b427491cdc91aba222ec572c6ea730c8eccf850f passed

@Skarlso Skarlso merged commit df939d8 into external-secrets:main Aug 8, 2025
20 checks passed
alliseeisgold pushed a commit to alliseeisgold/external-secrets that referenced this pull request Aug 25, 2025
…external-secrets#5110)

This makes sure that `mutationFunc` only calls ApplyTemplate (and updates the Secret) when the secret under check is freshly created and not immutable. Previously, it always ran the ApplyTemplate and that lead to races.

fix external-secrets#4976

To verify fix, see reproducer at external-secrets#4976 (comment)

Signed-off-by: Jakob Möller <jakob.moeller@sap.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SecretSyncedError when creating immutable ExternalSecret

2 participants