This repository has been archived by the owner on Jul 26, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 404
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add status subresource with last sync and generation tracking (#…
…133) * feat: add status subresource with last sync and generation tracking - Remove excessive polls by tracking last sync on external secrets resource - Track generation to poll when resource is modified - Show status when using `kubectl get externalsecrets` NOTE: This requires additional RBAC privileges! Squashed: - fix: move metrics success call so failures doesn't emit double metrics - refactor: use factory for poller in daemon to reduce dependency passthru
- Loading branch information
1 parent
238ebd6
commit 8db1749
Showing
9 changed files
with
488 additions
and
149 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
'use strict' | ||
|
||
const Poller = require('./poller') | ||
|
||
class PollerFactory { | ||
/** | ||
* Create PollerFactory. | ||
* @param {Object} backends - Backends for fetching secret properties. | ||
* @param {Object} kubeClient - Client for interacting with kubernetes cluster. | ||
* @param {Object} metrics - Metrics client | ||
* @param {Object} customResourceManifest - CRD manifest | ||
* @param {Object} logger - Logger for logging stuff. | ||
* @param {number} pollerIntervalMilliseconds - Interval time in milliseconds for polling secret properties. | ||
*/ | ||
constructor ({ | ||
backends, | ||
kubeClient, | ||
metrics, | ||
pollerIntervalMilliseconds, | ||
customResourceManifest, | ||
logger | ||
}) { | ||
this._logger = logger | ||
this._metrics = metrics | ||
this._backends = backends | ||
this._kubeClient = kubeClient | ||
this._pollerIntervalMilliseconds = pollerIntervalMilliseconds | ||
this._customResourceManifest = customResourceManifest | ||
} | ||
|
||
/** | ||
* Create poller | ||
* @param {Object} externalSecret - External Secret custom resource oject | ||
*/ | ||
createPoller ({ externalSecret }) { | ||
const poller = new Poller({ | ||
backends: this._backends, | ||
intervalMilliseconds: this._pollerIntervalMilliseconds, | ||
kubeClient: this._kubeClient, | ||
logger: this._logger, | ||
metrics: this._metrics, | ||
customResourceManifest: this._customResourceManifest, | ||
externalSecret | ||
}) | ||
|
||
return poller | ||
} | ||
} | ||
|
||
module.exports = PollerFactory |
Oops, something went wrong.