Skip to content

Clarify the implications of setting refreshInterval to 0#4567

Merged
gusfcarvalho merged 2 commits intoexternal-secrets:mainfrom
exaV:patch-1
Mar 20, 2025
Merged

Clarify the implications of setting refreshInterval to 0#4567
gusfcarvalho merged 2 commits intoexternal-secrets:mainfrom
exaV:patch-1

Conversation

@exaV
Copy link
Copy Markdown
Contributor

@exaV exaV commented Mar 19, 2025

Problem Statement

What is the problem you're trying to solve?

The documentation is very clear about when an ExternalSecret is updated, but it differs from the implementation in case
spec.refreshInterval is set to 0. Somewhat surprisingly (to me at least) even setting the annotation from the FAQ kubectl annotate es my-es force-sync=$(date +%s) --overwrite is skipped when spec.refreshInterval is 0

This change was introduced with #4086 and confirmed in the discussion here #3979

Proposed Changes

If this behaviour is not considered a bug, then the documentation should to mention it explicitly.

Checklist

  • I have read the contribution guidelines
  • 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

@exaV exaV requested a review from a team as a code owner March 19, 2025 14:50
@exaV exaV requested a review from gusfcarvalho March 19, 2025 14:50
@gusfcarvalho
Copy link
Copy Markdown
Member

Hi @exaV !

The first rule below is exactly that - Emphasis on is not '0':

* the `spec.refreshInterval` has passed and is not `0`

What made this documentation unclear to you when you read it?
IMO - we should add this to the rules session as opposed to a left out comment saying all rules are invalid, specially when thats not the case.

@exaV
Copy link
Copy Markdown
Contributor Author

exaV commented Mar 19, 2025

Thanks for the quick reply! The way the rules are currently written implies any of the three rules can trigger an update (independently of the other rules), but that does not happen in practice if refreshInterval is 0. I also wondered a bit at first if all three rules had to be met, but that would imply you'd have to change the ExternalSecret's spec for any change to take effect which is certainly not the case.

We could also change the wording to something like the following:

The `Kind=Secret` is updated when:

* the `spec.refreshInterval` has passed and is not `0`
* the `ExternalSecret`'s `labels` or `annotations` are changed and `spec.refreshInterval` is not `0`
* the `ExternalSecret`'s `spec` has been changed and `spec.refreshInterval` is not `0`

Or we could move it to the first sentence:

The `Kind=Secret` is updated when one of the following conditions is met and `spec.refreshInterval` is not `0`:

* the `spec.refreshInterval` has passed
* the `ExternalSecret`'s `labels` or `annotations` are changed
* the `ExternalSecret`'s `spec` has been changed

@gusfcarvalho
Copy link
Copy Markdown
Member

Or we could move it to the first sentence:

The Kind=Secret is updated when one of the following conditions is met and spec.refreshInterval is not 0:

  • the spec.refreshInterval has passed
  • the ExternalSecret's labels or annotations are changed
  • the ExternalSecret's spec has been changed

I like that! let's do it! Thanks for your contribution

…behaviour

If `spec.refreshInterval` is `0` the `Kind=Secret` is never updated, even if annotations or spec changes.

Signed-off-by: Patrick Del Conte <p.del.conte@hotmail.ch>
@gusfcarvalho
Copy link
Copy Markdown
Member

Thanks for your contribution!! 🙏🏾🙏🏾🙌🏾

@gusfcarvalho gusfcarvalho merged commit 7470307 into external-secrets:main Mar 20, 2025
8 of 12 checks passed
@sonarqubecloud
Copy link
Copy Markdown

ivankatliarchuk added a commit to gofogo/external-secrets-fork that referenced this pull request Mar 20, 2025
* main:
  Clarify that setting `spec.refreshInterval` to 0 disables all update behaviour (external-secrets#4567)
  Helm: disable ClusterPushSecret reconciler when using scoped RBAC (external-secrets#4571)
  Exclude unused resources from rbac (external-secrets#4572)
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.

2 participants