Skip to content
This repository has been archived by the owner on Jul 26, 2022. It is now read-only.

feat: refresh secret on delete when polling is disabled #413

Closed

Conversation

mksh
Copy link

@mksh mksh commented Jun 21, 2020

Right now the only way to use kubernetes-external-secrets with some providers in certain circumstances, is to set environment variable DISABLE_POLLING: true, which will lead to no-op on every _poll().

For example, using AWS SSM Parameter Store backend provider with several hundred of ExternalSecret instances provisioned via that provider leads to rate limit errors within AWS API.

See #211 and #156 for more background on this scenario.

In the case if DISABLE_POLLING set to true, there is no way to refresh internal Secret instance after it is created by ExternalSecret for the first time, other than completely removing and then re-creating ExternalSecret.

This is not convenient in the case if ExternalSecret instance is controlled by Helm/FluxCD, and might lead to deployment inconsistencies.

This patch allows for refreshing ExternalSecret instance in case if Secret instance was removed. It is achieved by tracking names of present Secret instances across all namespaces, and making the poll in case if for some ExternalSecret the corresponding Secret instance is missing.

This patch is non-intrusive, and the new behavior is executed only in case if environment variable POLL_INTERNAL_SECRETS is set.

@mksh mksh force-pushed the feature/refresh-on-delete branch 4 times, most recently from c833f0f to b1190b6 Compare June 21, 2020 22:03
Copy link
Member

@Flydiverny Flydiverny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this feature makes sense to add. And would kind of align with other behaviours, like pods being recreated when deleted or so.

I'll have to dig thru the code abit more.

@@ -11,7 +11,7 @@ metadata:
rules:
- apiGroups: [""]
resources: ["secrets"]
verbs: ["create", "update"]
verbs: ["create", "update"{{ with (index .Values.env "POLL_INTERNAL_SECRETS") }}, "list"{{ end}}]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be if instead of with ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, changed

@github-actions
Copy link

This pr is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 30 days.

@github-actions
Copy link

github-actions bot commented May 2, 2021

This pr is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 30 days.

@github-actions github-actions bot added the Stale label May 2, 2021
@mksh
Copy link
Author

mksh commented May 17, 2021

@Flydiverny

I had just updated my patch with recent master code, and it seems to be working fine for my use-case, and all auto-tests do pass.

If we can get this reviewed and merged into 8x series, it would be very appreciated !

@github-actions github-actions bot removed the Stale label May 18, 2021
@github-actions
Copy link

This pr is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 30 days.

@github-actions github-actions bot added the Stale label Aug 17, 2021
@github-actions github-actions bot closed this Sep 16, 2021
@Flydiverny Flydiverny reopened this Sep 16, 2021
@github-actions github-actions bot closed this Oct 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants