@@ -63,19 +63,23 @@ func init() {
6363// controllers watch Secrets — credentials, bootstrap data and the bastion
6464// cloud-init — and a watch only needs an object's identity to enqueue a
6565// reconcile, never its contents, so caching credential bytes in memory buys
66- // nothing and exposes them to anything that can read the process.
66+ // nothing and exposes them to anything that can read the process. Managed
67+ // fields go with them: nothing here reads them, and they are usually the
68+ // largest part of what is left once the data is gone.
6769//
6870// Deliberately no label selector on the entry, unlike Cluster API's own
69- // equivalent in internal/setup: the Secrets this provider watches carry no
70- // common label, so restricting the cache by one would silently stop the
71- // watches from firing rather than only hardening them.
71+ // equivalent in internal/setup. Cluster API only watches Secrets it stamps
72+ // itself, whereas the credentials and bastion cloud-init Secrets here are
73+ // created by the user and carry no labels, so a selector would silently stop
74+ // those watches from firing rather than only hardening the cache.
7275func managerCacheOptions () cache.Options {
7376 return cache.Options {
7477 ByObject : map [client.Object ]cache.ByObject {
7578 & corev1.Secret {}: {
7679 Transform : func (in any ) (any , error ) {
7780 if secret , ok := in .(* corev1.Secret ); ok {
7881 secret .Data = nil
82+ secret .SetManagedFields (nil )
7983 }
8084 return in , nil
8185 },
0 commit comments