kubernetes

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

README

types/kubernetes

The types/kubernetes package contains interfaces that allow types/resource interfaces to work with the Kubernetes Resource Model (KRM).

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HasConditions

type HasConditions interface {
	// Conditions returns a collection of Conditionss
	Conditions() []*metav1.Condition
	// ReplaceConditions replaces the resource's set of Condition structs with
	// the supplied slice of Conditions.
	ReplaceConditions([]*metav1.Condition)
}

HasConditions describes a thing that can set and retrieve Condition objects.

type Mapper

type Mapper interface {
	manager.Manager
	// EmptyObject returns the empty Kubernetes controller-runtime.Object
	// representation for the Kind of Resource mapped with this Mapper
	EmptyObject() client.Object
	// ToObject returns the Kubernetes controller-runtime.Object representation
	// of the supplied Resource
	ToObject(Resource) client.Object
	// FromObject returns the Resource from the supplied Kubernetes
	// controller-runtime.Object
	FromObject(client.Object) Resource
	// Resource returns the Resource matching the supplied Kubernetes Namespace
	// and Name
	Resource(
		context.Context,
		client.Reader,
		types.NamespacedName,
	) (Resource, error)
	// ResolveReferences finds if there are any Reference field(s) present
	// inside the Resource and attempts to resolve those reference field(s)
	// into target field(s).
	//
	// It returns an error if the Resource's reference field(s) cannot be
	// resolved.
	//
	// NOTE: This method also adds/updates the ConditionTypeReferencesResolved
	// for the Resource.
	ResolveReferences(
		context.Context,
		client.Reader,
		Resource,
	) error
}

Mapper provides methods that marry the Kubernetes client semantics and Kubernetes Resource Model with the cloud service-level CRUD interface.

type Resource

type Resource interface {
	resource.Resource
	HasConditions
	// IsBeingDeleted returns true if the Kubernetes resource has a non-zero
	// deletion timestamp
	IsBeingDeleted() bool
	// SetObjectMeta sets the ObjectMeta field for the resource
	SetObjectMeta(meta metav1.ObjectMeta)
	// DeepCopy will return a copy of the resource
	DeepCopy() Resource
	// LateInitialize merges any late-initialized fields from the supplied
	// Resource into this Resource.
	//
	// This method will initialize any optional fields which were not provided
	// by the k8s user but were defaulted by the cloud service.  If there are
	// no such fields to be initialized, no changes are made to the Resource.
	//
	// NOTE: This method also adds/updates the ConditionTypeLateInitialized for
	// the Resource.
	LateInitialize(
		context.Context,
		Resource,
	) error
}

Resource represents a custom resource object in the Kubernetes API that corresponds to a resource in an cloud service API.

Jump to

Keyboard shortcuts

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