Skip to content

Commit

Permalink
Document why we are using WatchesMetadata() for Secrets
Browse files Browse the repository at this point in the history
  • Loading branch information
benashz committed Dec 10, 2024
1 parent c17c40e commit 9f2f611
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
5 changes: 5 additions & 0 deletions controllers/hcpvaultsecretsapp_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,11 @@ func (r *HCPVaultSecretsAppReconciler) SetupWithManager(mgr ctrl.Manager, opts c
&secretsv1beta1.SecretTransformation{},
NewEnqueueRefRequestsHandlerST(r.referenceCache, nil),
).
// In order to reduce the operator's memory usage, we only watch for the
// Secret's metadata. That is sufficient for us to know when a Secret is
// deleted. If we ever need to access to the Secret's data, we can always fetch
// it from the API server in a RequestHandler, selectively based on the Secret's
// labels.
WatchesMetadata(
&corev1.Secret{},
&enqueueOnDeletionRequestHandler{
Expand Down
5 changes: 5 additions & 0 deletions controllers/vaultdynamicsecret_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,11 @@ func (r *VaultDynamicSecretReconciler) SetupWithManager(mgr ctrl.Manager, opts c
&secretsv1beta1.SecretTransformation{},
NewEnqueueRefRequestsHandlerST(r.referenceCache, r.SyncRegistry),
).
// In order to reduce the operator's memory usage, we only watch for the
// Secret's metadata. That is sufficient for us to know when a Secret is
// deleted. If we ever need to access to the Secret's data, we can always fetch
// it from the API server in a RequestHandler, selectively based on the Secret's
// labels.
WatchesMetadata(
&corev1.Secret{},
&enqueueOnDeletionRequestHandler{
Expand Down
5 changes: 5 additions & 0 deletions controllers/vaultpkisecret_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,11 @@ func (r *VaultPKISecretReconciler) SetupWithManager(mgr ctrl.Manager, opts contr
&secretsv1beta1.SecretTransformation{},
NewEnqueueRefRequestsHandlerST(r.referenceCache, r.SyncRegistry),
).
// In order to reduce the operator's memory usage, we only watch for the
// Secret's metadata. That is sufficient for us to know when a Secret is
// deleted. If we ever need to access to the Secret's data, we can always fetch
// it from the API server in a RequestHandler, selectively based on the Secret's
// labels.
WatchesMetadata(
&corev1.Secret{},
&enqueueOnDeletionRequestHandler{
Expand Down
5 changes: 5 additions & 0 deletions controllers/vaultstaticsecret_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,11 @@ func (r *VaultStaticSecretReconciler) SetupWithManager(mgr ctrl.Manager, opts co
&secretsv1beta1.SecretTransformation{},
NewEnqueueRefRequestsHandlerST(r.referenceCache, nil),
).
// In order to reduce the operator's memory usage, we only watch for the
// Secret's metadata. That is sufficient for us to know when a Secret is
// deleted. If we ever need to access to the Secret's data, we can always fetch
// it from the API server in a RequestHandler, selectively based on the Secret's
// labels.
WatchesMetadata(
&corev1.Secret{},
&enqueueOnDeletionRequestHandler{
Expand Down

0 comments on commit 9f2f611

Please sign in to comment.