resource

package
v1.28.14 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2024 License: Apache-2.0 Imports: 5 Imported by: 3

Documentation

Overview

Package resource contains the latest (or "internal") version of the Kubernetes resource API objects.

Index

Constants

View Source
const AllocationResultResourceHandlesMaxSize = 32

AllocationResultResourceHandlesMaxSize represents the maximum number of entries in allocation.resourceHandles.

View Source
const GroupName = "resource.k8s.io"

GroupName is the group name use in this package

View Source
const PodSchedulingNodeListMaxSize = 128

PodSchedulingNodeListMaxSize defines the maximum number of entries in the node lists that are stored in PodSchedulingContext objects. This limit is part of the API.

View Source
const ResourceClaimReservedForMaxSize = 32

ReservedForMaxSize is the maximum number of entries in claim.status.reservedFor.

View Source
const ResourceHandleDataMaxSize = 16 * 1024

ResourceHandleDataMaxSize represents the maximum size of resourceHandle.data.

Variables

View Source
var (
	// SchemeBuilder object to register various known types
	SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)

	// AddToScheme represents a func that can be used to apply all the registered
	// funcs in a scheme
	AddToScheme = SchemeBuilder.AddToScheme
)
View Source
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: runtime.APIVersionInternal}

SchemeGroupVersion is group version used to register these objects

Functions

func Kind

func Kind(kind string) schema.GroupKind

Kind takes an unqualified kind and returns a Group qualified GroupKind

func Resource

func Resource(resource string) schema.GroupResource

Resource takes an unqualified resource and returns a Group qualified GroupResource

Types

type AllocationMode

type AllocationMode string

AllocationMode describes whether a ResourceClaim gets allocated immediately when it gets created (AllocationModeImmediate) or whether allocation is delayed until it is needed for a Pod (AllocationModeWaitForFirstConsumer). Other modes might get added in the future.

const (
	// When a ResourceClaim has AllocationModeWaitForFirstConsumer, allocation is
	// delayed until a Pod gets scheduled that needs the ResourceClaim. The
	// scheduler will consider all resource requirements of that Pod and
	// trigger allocation for a node that fits the Pod.
	AllocationModeWaitForFirstConsumer AllocationMode = "WaitForFirstConsumer"

	// When a ResourceClaim has AllocationModeImmediate, allocation starts
	// as soon as the ResourceClaim gets created. This is done without
	// considering the needs of Pods that will use the ResourceClaim
	// because those Pods are not known yet.
	AllocationModeImmediate AllocationMode = "Immediate"
)

type AllocationResult

type AllocationResult struct {
	// ResourceHandles contain the state associated with an allocation that
	// should be maintained throughout the lifetime of a claim. Each
	// ResourceHandle contains data that should be passed to a specific kubelet
	// plugin once it lands on a node. This data is returned by the driver
	// after a successful allocation and is opaque to Kubernetes. Driver
	// documentation may explain to users how to interpret this data if needed.
	//
	// Setting this field is optional. It has a maximum size of 32 entries.
	// If null (or empty), it is assumed this allocation will be processed by a
	// single kubelet plugin with no ResourceHandle data attached. The name of
	// the kubelet plugin invoked will match the DriverName set in the
	// ResourceClaimStatus this AllocationResult is embedded in.
	//
	// +listType=atomic
	// +optional
	ResourceHandles []ResourceHandle

	// This field will get set by the resource driver after it has allocated
	// the resource to inform the scheduler where it can schedule Pods using
	// the ResourceClaim.
	//
	// Setting this field is optional. If null, the resource is available
	// everywhere.
	// +optional
	AvailableOnNodes *core.NodeSelector

	// Shareable determines whether the resource supports more
	// than one consumer at a time.
	// +optional
	Shareable bool
}

AllocationResult contains attributes of an allocated resource.

func (*AllocationResult) DeepCopy

func (in *AllocationResult) DeepCopy() *AllocationResult

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AllocationResult.

func (*AllocationResult) DeepCopyInto

func (in *AllocationResult) DeepCopyInto(out *AllocationResult)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type PodSchedulingContext added in v1.27.0

type PodSchedulingContext struct {
	metav1.TypeMeta
	// Standard object metadata
	// +optional
	metav1.ObjectMeta

	// Spec describes where resources for the Pod are needed.
	Spec PodSchedulingContextSpec

	// Status describes where resources for the Pod can be allocated.
	Status PodSchedulingContextStatus
}

PodSchedulingContext objects hold information that is needed to schedule a Pod with ResourceClaims that use "WaitForFirstConsumer" allocation mode.

This is an alpha type and requires enabling the DynamicResourceAllocation feature gate.

func (*PodSchedulingContext) DeepCopy added in v1.27.0

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodSchedulingContext.

func (*PodSchedulingContext) DeepCopyInto added in v1.27.0

func (in *PodSchedulingContext) DeepCopyInto(out *PodSchedulingContext)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*PodSchedulingContext) DeepCopyObject added in v1.27.0

func (in *PodSchedulingContext) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type PodSchedulingContextList added in v1.27.0

type PodSchedulingContextList struct {
	metav1.TypeMeta
	// Standard list metadata
	// +optional
	metav1.ListMeta

	// Items is the list of PodSchedulingContext objects.
	Items []PodSchedulingContext
}

PodSchedulingContextList is a collection of Pod scheduling objects.

func (*PodSchedulingContextList) DeepCopy added in v1.27.0

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodSchedulingContextList.

func (*PodSchedulingContextList) DeepCopyInto added in v1.27.0

func (in *PodSchedulingContextList) DeepCopyInto(out *PodSchedulingContextList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*PodSchedulingContextList) DeepCopyObject added in v1.27.0

func (in *PodSchedulingContextList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type PodSchedulingContextSpec added in v1.27.0

type PodSchedulingContextSpec struct {
	// SelectedNode is the node for which allocation of ResourceClaims that
	// are referenced by the Pod and that use "WaitForFirstConsumer"
	// allocation is to be attempted.
	SelectedNode string

	// PotentialNodes lists nodes where the Pod might be able to run.
	//
	// The size of this field is limited to 128. This is large enough for
	// many clusters. Larger clusters may need more attempts to find a node
	// that suits all pending resources. This may get increased in the
	// future, but not reduced.
	// +optional
	PotentialNodes []string
}

PodSchedulingContextSpec describes where resources for the Pod are needed.

func (*PodSchedulingContextSpec) DeepCopy added in v1.27.0

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodSchedulingContextSpec.

func (*PodSchedulingContextSpec) DeepCopyInto added in v1.27.0

func (in *PodSchedulingContextSpec) DeepCopyInto(out *PodSchedulingContextSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type PodSchedulingContextStatus added in v1.27.0

type PodSchedulingContextStatus struct {
	// ResourceClaims describes resource availability for each
	// pod.spec.resourceClaim entry where the corresponding ResourceClaim
	// uses "WaitForFirstConsumer" allocation mode.
	// +optional
	ResourceClaims []ResourceClaimSchedulingStatus
}

PodSchedulingContextStatus describes where resources for the Pod can be allocated.

func (*PodSchedulingContextStatus) DeepCopy added in v1.27.0

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodSchedulingContextStatus.

func (*PodSchedulingContextStatus) DeepCopyInto added in v1.27.0

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ResourceClaim

type ResourceClaim struct {
	metav1.TypeMeta
	// Standard object metadata
	// +optional
	metav1.ObjectMeta

	// Spec describes the desired attributes of a resource that then needs
	// to be allocated. It can only be set once when creating the
	// ResourceClaim.
	Spec ResourceClaimSpec

	// Status describes whether the resource is available and with which
	// attributes.
	// +optional
	Status ResourceClaimStatus
}

ResourceClaim describes which resources are needed by a resource consumer. Its status tracks whether the resource has been allocated and what the resulting attributes are.

This is an alpha type and requires enabling the DynamicResourceAllocation feature gate.

func (*ResourceClaim) DeepCopy

func (in *ResourceClaim) DeepCopy() *ResourceClaim

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceClaim.

func (*ResourceClaim) DeepCopyInto

func (in *ResourceClaim) DeepCopyInto(out *ResourceClaim)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*ResourceClaim) DeepCopyObject

func (in *ResourceClaim) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type ResourceClaimConsumerReference

type ResourceClaimConsumerReference struct {
	// APIGroup is the group for the resource being referenced. It is
	// empty for the core API. This matches the group in the APIVersion
	// that is used when creating the resources.
	// +optional
	APIGroup string
	// Resource is the type of resource being referenced, for example "pods".
	Resource string
	// Name is the name of resource being referenced.
	Name string
	// UID identifies exactly one incarnation of the resource.
	UID types.UID
}

ResourceClaimConsumerReference contains enough information to let you locate the consumer of a ResourceClaim. The user must be a resource in the same namespace as the ResourceClaim.

func (*ResourceClaimConsumerReference) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceClaimConsumerReference.

func (*ResourceClaimConsumerReference) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ResourceClaimList

type ResourceClaimList struct {
	metav1.TypeMeta
	// Standard list metadata
	// +optional
	metav1.ListMeta

	// Items is the list of resource claims.
	Items []ResourceClaim
}

ResourceClaimList is a collection of claims.

func (*ResourceClaimList) DeepCopy

func (in *ResourceClaimList) DeepCopy() *ResourceClaimList

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceClaimList.

func (*ResourceClaimList) DeepCopyInto

func (in *ResourceClaimList) DeepCopyInto(out *ResourceClaimList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*ResourceClaimList) DeepCopyObject

func (in *ResourceClaimList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type ResourceClaimParametersReference

type ResourceClaimParametersReference struct {
	// APIGroup is the group for the resource being referenced. It is
	// empty for the core API. This matches the group in the APIVersion
	// that is used when creating the resources.
	// +optional
	APIGroup string
	// Kind is the type of resource being referenced. This is the same
	// value as in the parameter object's metadata, for example "ConfigMap".
	Kind string
	// Name is the name of resource being referenced.
	Name string
}

ResourceClaimParametersReference contains enough information to let you locate the parameters for a ResourceClaim. The object must be in the same namespace as the ResourceClaim.

func (*ResourceClaimParametersReference) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceClaimParametersReference.

func (*ResourceClaimParametersReference) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ResourceClaimSchedulingStatus

type ResourceClaimSchedulingStatus struct {
	// Name matches the pod.spec.resourceClaims[*].Name field.
	Name string

	// UnsuitableNodes lists nodes that the ResourceClaim cannot be
	// allocated for.
	//
	// The size of this field is limited to 128, the same as for
	// PodSchedulingSpec.PotentialNodes. This may get increased in the
	// future, but not reduced.
	// +optional
	UnsuitableNodes []string
}

ResourceClaimSchedulingStatus contains information about one particular ResourceClaim with "WaitForFirstConsumer" allocation mode.

func (*ResourceClaimSchedulingStatus) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceClaimSchedulingStatus.

func (*ResourceClaimSchedulingStatus) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ResourceClaimSpec

type ResourceClaimSpec struct {
	// ResourceClassName references the driver and additional parameters
	// via the name of a ResourceClass that was created as part of the
	// driver deployment.
	ResourceClassName string

	// ParametersRef references a separate object with arbitrary parameters
	// that will be used by the driver when allocating a resource for the
	// claim.
	//
	// The object must be in the same namespace as the ResourceClaim.
	// +optional
	ParametersRef *ResourceClaimParametersReference

	// Allocation can start immediately or when a Pod wants to use the
	// resource. "WaitForFirstConsumer" is the default.
	// +optional
	AllocationMode AllocationMode
}

ResourceClaimSpec defines how a resource is to be allocated.

func (*ResourceClaimSpec) DeepCopy

func (in *ResourceClaimSpec) DeepCopy() *ResourceClaimSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceClaimSpec.

func (*ResourceClaimSpec) DeepCopyInto

func (in *ResourceClaimSpec) DeepCopyInto(out *ResourceClaimSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ResourceClaimStatus

type ResourceClaimStatus struct {
	// DriverName is a copy of the driver name from the ResourceClass at
	// the time when allocation started.
	// +optional
	DriverName string

	// Allocation is set by the resource driver once a resource or set of
	// resources has been allocated successfully. If this is not specified, the
	// resources have not been allocated yet.
	// +optional
	Allocation *AllocationResult

	// ReservedFor indicates which entities are currently allowed to use
	// the claim. A Pod which references a ResourceClaim which is not
	// reserved for that Pod will not be started.
	//
	// There can be at most 32 such reservations. This may get increased in
	// the future, but not reduced.
	// +optional
	ReservedFor []ResourceClaimConsumerReference

	// DeallocationRequested indicates that a ResourceClaim is to be
	// deallocated.
	//
	// The driver then must deallocate this claim and reset the field
	// together with clearing the Allocation field.
	//
	// While DeallocationRequested is set, no new consumers may be added to
	// ReservedFor.
	// +optional
	DeallocationRequested bool
}

ResourceClaimStatus tracks whether the resource has been allocated and what the resulting attributes are.

func (*ResourceClaimStatus) DeepCopy

func (in *ResourceClaimStatus) DeepCopy() *ResourceClaimStatus

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceClaimStatus.

func (*ResourceClaimStatus) DeepCopyInto

func (in *ResourceClaimStatus) DeepCopyInto(out *ResourceClaimStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ResourceClaimTemplate

type ResourceClaimTemplate struct {
	metav1.TypeMeta
	// Standard object metadata
	// +optional
	metav1.ObjectMeta

	// Describes the ResourceClaim that is to be generated.
	//
	// This field is immutable. A ResourceClaim will get created by the
	// control plane for a Pod when needed and then not get updated
	// anymore.
	Spec ResourceClaimTemplateSpec
}

ResourceClaimTemplate is used to produce ResourceClaim objects.

func (*ResourceClaimTemplate) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceClaimTemplate.

func (*ResourceClaimTemplate) DeepCopyInto

func (in *ResourceClaimTemplate) DeepCopyInto(out *ResourceClaimTemplate)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*ResourceClaimTemplate) DeepCopyObject

func (in *ResourceClaimTemplate) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type ResourceClaimTemplateList

type ResourceClaimTemplateList struct {
	metav1.TypeMeta
	// Standard list metadata
	// +optional
	metav1.ListMeta

	// Items is the list of resource claim templates.
	Items []ResourceClaimTemplate
}

ResourceClaimTemplateList is a collection of claim templates.

func (*ResourceClaimTemplateList) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceClaimTemplateList.

func (*ResourceClaimTemplateList) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*ResourceClaimTemplateList) DeepCopyObject

func (in *ResourceClaimTemplateList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type ResourceClaimTemplateSpec

type ResourceClaimTemplateSpec struct {
	// ObjectMeta may contain labels and annotations that will be copied into the PVC
	// when creating it. No other fields are allowed and will be rejected during
	// validation.
	// +optional
	metav1.ObjectMeta

	// Spec for the ResourceClaim. The entire content is copied unchanged
	// into the ResourceClaim that gets created from this template. The
	// same fields as in a ResourceClaim are also valid here.
	Spec ResourceClaimSpec
}

ResourceClaimTemplateSpec contains the metadata and fields for a ResourceClaim.

func (*ResourceClaimTemplateSpec) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceClaimTemplateSpec.

func (*ResourceClaimTemplateSpec) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ResourceClass

type ResourceClass struct {
	metav1.TypeMeta
	// Standard object metadata
	// +optional
	metav1.ObjectMeta

	// DriverName defines the name of the dynamic resource driver that is
	// used for allocation of a ResourceClaim that uses this class.
	//
	// Resource drivers have a unique name in forward domain order
	// (acme.example.com).
	DriverName string

	// ParametersRef references an arbitrary separate object that may hold
	// parameters that will be used by the driver when allocating a
	// resource that uses this class. A dynamic resource driver can
	// distinguish between parameters stored here and and those stored in
	// ResourceClaimSpec.
	// +optional
	ParametersRef *ResourceClassParametersReference

	// Only nodes matching the selector will be considered by the scheduler
	// when trying to find a Node that fits a Pod when that Pod uses
	// a ResourceClaim that has not been allocated yet.
	//
	// Setting this field is optional. If null, all nodes are candidates.
	// +optional
	SuitableNodes *core.NodeSelector
}

ResourceClass is used by administrators to influence how resources are allocated.

This is an alpha type and requires enabling the DynamicResourceAllocation feature gate.

func (*ResourceClass) DeepCopy

func (in *ResourceClass) DeepCopy() *ResourceClass

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceClass.

func (*ResourceClass) DeepCopyInto

func (in *ResourceClass) DeepCopyInto(out *ResourceClass)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*ResourceClass) DeepCopyObject

func (in *ResourceClass) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type ResourceClassList

type ResourceClassList struct {
	metav1.TypeMeta
	// Standard list metadata
	// +optional
	metav1.ListMeta

	// Items is the list of resource classes.
	Items []ResourceClass
}

ResourceClassList is a collection of classes.

func (*ResourceClassList) DeepCopy

func (in *ResourceClassList) DeepCopy() *ResourceClassList

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceClassList.

func (*ResourceClassList) DeepCopyInto

func (in *ResourceClassList) DeepCopyInto(out *ResourceClassList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*ResourceClassList) DeepCopyObject

func (in *ResourceClassList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type ResourceClassParametersReference

type ResourceClassParametersReference struct {
	// APIGroup is the group for the resource being referenced. It is
	// empty for the core API. This matches the group in the APIVersion
	// that is used when creating the resources.
	// +optional
	APIGroup string
	// Kind is the type of resource being referenced. This is the same
	// value as in the parameter object's metadata.
	Kind string
	// Name is the name of resource being referenced.
	Name string
	// Namespace that contains the referenced resource. Must be empty
	// for cluster-scoped resources and non-empty for namespaced
	// resources.
	// +optional
	Namespace string
}

ResourceClassParametersReference contains enough information to let you locate the parameters for a ResourceClass.

func (*ResourceClassParametersReference) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceClassParametersReference.

func (*ResourceClassParametersReference) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ResourceHandle added in v1.27.0

type ResourceHandle struct {
	// DriverName specifies the name of the resource driver whose kubelet
	// plugin should be invoked to process this ResourceHandle's data once it
	// lands on a node. This may differ from the DriverName set in
	// ResourceClaimStatus this ResourceHandle is embedded in.
	DriverName string

	// Data contains the opaque data associated with this ResourceHandle. It is
	// set by the controller component of the resource driver whose name
	// matches the DriverName set in the ResourceClaimStatus this
	// ResourceHandle is embedded in. It is set at allocation time and is
	// intended for processing by the kubelet plugin whose name matches
	// the DriverName set in this ResourceHandle.
	//
	// The maximum size of this field is 16KiB. This may get increased in the
	// future, but not reduced.
	// +optional
	Data string
}

ResourceHandle holds opaque resource data for processing by a specific kubelet plugin.

func (*ResourceHandle) DeepCopy added in v1.27.0

func (in *ResourceHandle) DeepCopy() *ResourceHandle

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceHandle.

func (*ResourceHandle) DeepCopyInto added in v1.27.0

func (in *ResourceHandle) DeepCopyInto(out *ResourceHandle)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

Directories

Path Synopsis
Package install installs the resource API, making it available as an option to all of the API encoding/decoding machinery.
Package install installs the resource API, making it available as an option to all of the API encoding/decoding machinery.
Package v1alpha2 is the v1alpha2 version of the resource API.
Package v1alpha2 is the v1alpha2 version of the resource API.

Jump to

Keyboard shortcuts

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