Documentation ¶
Index ¶
- func AddNS(ctx context.Context, nDB *NamespaceDB, client client.Client, ...) error
- func EnsureSNSInDB(ctx context.Context, sns *objectcontext.ObjectContext, nDB *NamespaceDB) error
- func LocateNS(nsList corev1.NamespaceList, nsName string) *corev1.Namespace
- func MigrateNSHierarchy(ctx context.Context, ndb *NamespaceDB, client client.Client, snsName string, ...) error
- func NSListUp(ns corev1.Namespace, rootNS string, nsList corev1.NamespaceList) ([]corev1.Namespace, error)
- type NamespaceDB
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddNS ¶
func AddNS(ctx context.Context, nDB *NamespaceDB, client client.Client, sns *danav1.Subnamespace) error
AddNS adds a namespace to its key if such exist, otherwise it checks whether the namespace should be the key itself and adds it to the DB.
func EnsureSNSInDB ¶
func EnsureSNSInDB(ctx context.Context, sns *objectcontext.ObjectContext, nDB *NamespaceDB) error
EnsureSNSInDB ensures subnamespace in db if it should be.
func LocateNS ¶
func LocateNS(nsList corev1.NamespaceList, nsName string) *corev1.Namespace
LocateNS locates a namespace by name in a given namespace list.
func MigrateNSHierarchy ¶
func MigrateNSHierarchy(ctx context.Context, ndb *NamespaceDB, client client.Client, snsName string, destNSName string) error
MigrateNSHierarchy migrates namespace and its children hierarchy from one key to another key.
Types ¶
type NamespaceDB ¶
type NamespaceDB struct {
// contains filtered or unexported fields
}
NamespaceDB is an in-memory DB that contains a map with a key that is a string representing the first namespace in a hierarchy that is bound to a CRQ and not RQ, and a value that is a slice of all namespaces which are under this particular key in the hierarchy.
func (*NamespaceDB) DeleteKey ¶
func (ndb *NamespaceDB) DeleteKey(key string)
DeleteKey deletes a key from the database.
func (*NamespaceDB) Key ¶
func (ndb *NamespaceDB) Key(ns string) string
Key retrieves the key that the provided namespace belongs to.
func (*NamespaceDB) KeyCount ¶
func (ndb *NamespaceDB) KeyCount(key string) int
KeyCount returns the number of namespaces that belong to a specific key.