resource

package
v0.0.0-...-c0ae054 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: Apache-2.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GeneratePodProtector

func GeneratePodProtector(
	sourceObject SourceObject,
	rqmt RequiredProtector,
) (*podseidonv1a1.PodProtector, error)

Types

type RequiredProtector

type RequiredProtector interface {
	Name() string
	Spec() (podseidonv1a1.PodProtectorSpec, error)
}

type SourceObject

type SourceObject interface {
	metav1.Object

	// Mutates the receiver, setting the wrapped object to a new deep clone.
	//
	// By default, the source object shares object reference with the informer cache.
	// MakeDeepCopy must be called before mutating the data in `Object`.
	MakeDeepCopy()

	// Back-references the type definition that provided this object.
	TypeDef() TypeDef

	// Computes all protectors required for this object.
	GetRequiredProtectors(ctx context.Context) []RequiredProtector

	// Writes the local state of the object to apiserver.
	//
	// If the operation is successful, the local copy in the receiver is updated to the new version on the apiserver,
	// including the new resource version, generation, updated fields from webhooks, etc.
	// Thus, SourceObject may be more updated than the informer.
	Update(ctx context.Context, options metav1.UpdateOptions) error
}

Performs type-agnostic operations on an object.

type TypeDef

type TypeDef interface {
	GroupVersionResource() schema.GroupVersionResource
	GroupVersionKind() schema.GroupVersionKind
}

type TypeProvider

type TypeProvider interface {
	TypeDef

	// Retrieves the named object from informer cache.
	GetObject(ctx context.Context, nsName types.NamespacedName) SourceObject

	// The underlying informer can push reconcile events to the handler.
	//
	// The NamespacedName is the name of the underlying workload.
	AddEventHandler(handler func(types.NamespacedName)) error

	// Adds prerequisite conditions (e.g. informer sync) before the worker can start running.
	AddPrereqs(prereqs map[string]worker.Prereq)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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