// watchSecretes monitors the kubernetes API for modifications and deletions of secrets
// it evicts them from the internal cache
watchSecretes monitors the kubernetes API for modifications and deletions of secrets
it evicts them from the internal cache
// watchSecretes monitors the kubernetes API for modifications and deletions of secrets // it evicts them from the internal cache
func (rm *ResourceManager) watchSecrets() {
	var opts metav1.ListOptions
	w, err := rm.k8sClient.CoreV1().Secrets(v1.NamespaceAll).Watch(opts)
	if err != nil {
		log.Fatal(err)
	}
	for {
		select {
		case ev, ok := <-w.ResultChan():
			if !ok {
				return
			}
			rm.Lock()
			secretKey := rm.getStoreKey(ev.Object.(*v1.Secret).Namespace, ev.Object.(*v1.Secret).Name)
			switch ev.Type {
			case watch.Modified:
				delete(rm.secrets, secretKey)
			case watch.Deleted:
				delete(rm.secrets, secretKey)
			}
			rm.Unlock()
		}
	}
}
func ( rm * ResourceManager ) watchSecrets ( ) { var opts metav1 . ListOptions w , err := rm . k8sClient . CoreV1 ( ) . Secrets ( v1 . NamespaceAll ) . Watch ( opts ) if err != nil { log . Fatal ( err ) } for { select { case ev , ok := <- w . ResultChan ( ) : if ! ok { return } rm . Lock ( ) secretKey := rm . getStoreKey ( ev . Object . ( * v1 . Secret ) . Namespace , ev . Object . ( * v1 . Secret ) . Name ) switch ev . Type { case watch . Modified : delete ( rm . secrets , secretKey ) case watch . Deleted : delete ( rm . secrets , secretKey ) } rm . Unlock ( ) } } }
watchSecretes monitors the kubernetes API for modifications and deletions of secrets
it evicts them from the internal cache
watchSecretes monitors the kubernetes API for modifications and deletions of secrets it evicts them from the internal cache