Documentation ¶
Index ¶
- func FindContainer(podSpec *corev1.PodSpec, name string) *corev1.Container
- type ClientHelper
- type NamespacedObjectManager
- func (m *NamespacedObjectManager) AddManagedObject(name string, placeholder client.Object)
- func (m *NamespacedObjectManager) CleanupNamespace(ctx context.Context)
- func (m *NamespacedObjectManager) Exists(obj client.Object) bool
- func (m *NamespacedObjectManager) FetchAll(ctx context.Context) error
- func (m *NamespacedObjectManager) TryDelete(ctx context.Context, obj client.Object)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ClientHelper ¶
ClientHelper includes a kube client with some additional helper functions
func (*ClientHelper) CreateOwned ¶
CreateOwned is an helper function that creates an object, sets owner reference and writes info & errors logs
func (*ClientHelper) UpdateOwned ¶
UpdateOwned is an helper function that updates an object, sets owner reference and writes info & errors logs
type NamespacedObjectManager ¶
type NamespacedObjectManager struct { Namespace string PreviousNamespace string // contains filtered or unexported fields }
NamespacedObjectManager provides some helpers to manage (fetch, delete) namespace-scoped objects
func NewNamespacedObjectManager ¶
func NewNamespacedObjectManager(cl client.Client, ns, prevNS string) *NamespacedObjectManager
func (*NamespacedObjectManager) AddManagedObject ¶
func (m *NamespacedObjectManager) AddManagedObject(name string, placeholder client.Object)
AddManagedObject should be used to register managed objects to be fetched by FetchAll, or deleted when namespace changes This is only for namespace-scoped objects that are installed in the desired namespace (in FlowCollector CRD: spec.namespace) Cluster-scope objects, or objects installed in a different namespace (e.g. OVS configmap) should not be registered with this function.
func (*NamespacedObjectManager) CleanupNamespace ¶
func (m *NamespacedObjectManager) CleanupNamespace(ctx context.Context)
CleanupNamespace removes all managed objects (registered using AddManagedObject) from the previous namespace.
func (*NamespacedObjectManager) Exists ¶
func (m *NamespacedObjectManager) Exists(obj client.Object) bool
Exists returns true if the provided object isn't nil and was successfully fetched previously with FetchAll
func (*NamespacedObjectManager) FetchAll ¶
func (m *NamespacedObjectManager) FetchAll(ctx context.Context) error
FetchAll fetches all managed objects (registered using AddManagedObject) in the current namespace. Placeholders are filled with fetched resources. Resources not found are flagged internally.