reconcilers

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 7, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindContainer

func FindContainer(podSpec *corev1.PodSpec, name string) *corev1.Container

FindContainer searches in pod containers one that matches the provided name

Types

type ClientHelper

type ClientHelper struct {
	client.Client
	SetControllerReference func(client.Object) error
}

ClientHelper includes a kube client with some additional helper functions

func (*ClientHelper) CreateOwned

func (c *ClientHelper) CreateOwned(ctx context.Context, obj client.Object) error

CreateOwned is an helper function that creates an object, sets owner reference and writes info & errors logs

func (*ClientHelper) UpdateOwned

func (c *ClientHelper) UpdateOwned(ctx context.Context, old, obj client.Object) error

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.

func (*NamespacedObjectManager) TryDelete

func (m *NamespacedObjectManager) TryDelete(ctx context.Context, obj client.Object)

TryDelete is an helper function that tries to delete the provided object previously loaded using FetchAll.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL