storeSelectedNamespaces replaces the current snapshot with one built from ns. It is the only mutator of selectedNamespacesCache and is called only from the namespace controller's informer goroutine (or from tests for setup).
(ns []string)
| 69 | // It is the only mutator of selectedNamespacesCache and is called only from |
| 70 | // the namespace controller's informer goroutine (or from tests for setup). |
| 71 | func storeSelectedNamespaces(ns []string) { |
| 72 | m := make(map[string]struct{}, len(ns)) |
| 73 | for _, n := range ns { |
| 74 | m[n] = struct{}{} |
| 75 | } |
| 76 | selectedNamespacesCache.Store(m) |
| 77 | } |
| 78 | |
| 79 | // loadSelectedNamespacesList returns the current namespace names as a slice. |
| 80 | // Intended for use in tests where slice-based assertions are more convenient. |
no outgoing calls