type Manager … type simpleSecretManager … // NewSimpleSecretManager creates a new SecretManager instance. func NewSimpleSecretManager(kubeClient clientset.Interface) Manager { … } func (s *simpleSecretManager) GetSecret(namespace, name string) (*v1.Secret, error) { … } func (s *simpleSecretManager) RegisterPod(pod *v1.Pod) { … } func (s *simpleSecretManager) UnregisterPod(pod *v1.Pod) { … } type secretManager … func (s *secretManager) GetSecret(namespace, name string) (*v1.Secret, error) { … } func (s *secretManager) RegisterPod(pod *v1.Pod) { … } func (s *secretManager) UnregisterPod(pod *v1.Pod) { … } func getSecretNames(pod *v1.Pod) sets.Set[string] { … } const defaultTTL … // NewCachingSecretManager creates a manager that keeps a cache of all secrets // necessary for registered pods. // It implements the following logic: // - whenever a pod is created or updated, the cached versions of all secrets // are invalidated // - every GetObject() call tries to fetch the value from local cache; if it is // not there, invalidated or too old, we fetch it from apiserver and refresh the // value in cache; otherwise it is just fetched from cache func NewCachingSecretManager(kubeClient clientset.Interface, getTTL manager.GetObjectTTLFunc) Manager { … } // NewWatchingSecretManager creates a manager that keeps a cache of all secrets // necessary for registered pods. // It implements the following logic: // - whenever a pod is created or updated, we start individual watches for all // referenced objects that aren't referenced from other registered pods // - every GetObject() returns a value from local cache propagated via watches func NewWatchingSecretManager(kubeClient clientset.Interface, resyncInterval time.Duration) Manager { … }