Documentation ¶
Index ¶
- Constants
- Variables
- func DemandCustomResourceDefinition(webhook *v1.WebhookClientConfig, ...) *v1.CustomResourceDefinition
- func DemandCustomResourceDefinitionName() string
- func DemandGroupVersionResource() schema.GroupVersionResource
- func Kind(kind string) schema.GroupKind
- func Resource(resource string) schema.GroupResource
- type Demand
- type DemandList
- type DemandPhase
- type DemandSpec
- type DemandStatus
- type DemandUnit
- type ResourceList
- type Zone
Constants ¶
const ( // DemandPhaseEmpty is the state of a demand object when it is first created DemandPhaseEmpty DemandPhase = "" // DemandPhasePending is the state a demand object is in when Scaler has acknowledged it but has not yet taken // action to fulfill the demand DemandPhasePending DemandPhase = "pending" // DemandPhaseFulfilled is the state a demand object is in when Scaler has taken action and the action has completed // to fulfill the demand. At this point, it is expected that there is capacity to meet the demand the object represents DemandPhaseFulfilled DemandPhase = "fulfilled" // DemandPhaseCannotFulfill is the state a demand object is in when Scaler is unable to satisfy the demand. This is // possible if the demand contains a single unit that is larger than the instance group is configured to use, or if // the instance group has reached its maximum capacity and cannot allocate more DemandPhaseCannotFulfill DemandPhase = "cannot-fulfill" // ResourceCPU is the name of CPU resource. ResourceCPU corev1.ResourceName = corev1.ResourceCPU // ResourceMemory is the name of Memory resource. ResourceMemory corev1.ResourceName = corev1.ResourceMemory // ResourceNvidiaGPU is the name of Nvidia GPU resource. ResourceNvidiaGPU corev1.ResourceName = "nvidia.com/gpu" )
const GroupName = "scaler.palantir.com"
GroupName used for resources from this package.
Variables ¶
var ( // SchemeBuilder is a runtime SchemaBuilder SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) // AddToScheme is a SchemaBuilder AddToSchema function AddToScheme = SchemeBuilder.AddToScheme )
var ( // AllDemandPhases is a list of all phases that a demand object could be in AllDemandPhases = []DemandPhase{ DemandPhaseEmpty, DemandPhasePending, DemandPhaseFulfilled, DemandPhaseCannotFulfill, } // AllSupportedResources is a list of all resources that the demand object supports AllSupportedResources = []corev1.ResourceName{ ResourceCPU, ResourceMemory, ResourceNvidiaGPU, } )
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha2"}
SchemeGroupVersion represents the kubernetes schema.GroupVersion for the demand resource
Functions ¶
func DemandCustomResourceDefinition ¶
func DemandCustomResourceDefinition(webhook *v1.WebhookClientConfig, supportedVersions ...v1.CustomResourceDefinitionVersion) *v1.CustomResourceDefinition
DemandCustomResourceDefinition returns the CustomResourceDefinition for the demand resource. Webhook provided has to support conversions between v1alpha2 and all the versions in the supportedVersions array.
func DemandCustomResourceDefinitionName ¶
func DemandCustomResourceDefinitionName() string
DemandCustomResourceDefinitionName returns the demand resource name as a string
func DemandGroupVersionResource ¶ added in v0.2.14
func DemandGroupVersionResource() schema.GroupVersionResource
DemandGroupVersionResource returns the schema.GroupVersionResource for the demand resource
func Resource ¶
func Resource(resource string) schema.GroupResource
Resource returns the schema.GroupResource for the demand resource
Types ¶
type Demand ¶
type Demand struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` Spec DemandSpec `json:"spec,omitempty"` Status DemandStatus `json:"status,omitempty"` }
Demand represents currently unschedulable resources.
func (*Demand) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Demand.
func (*Demand) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*Demand) DeepCopyObject ¶
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
type DemandList ¶
type DemandList struct { metav1.TypeMeta `json:",inline"` metav1.ListMeta `json:"metadata"` Items []Demand `json:"items"` }
DemandList is a list of Demand resources
func (*DemandList) DeepCopy ¶
func (in *DemandList) DeepCopy() *DemandList
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DemandList.
func (*DemandList) DeepCopyInto ¶
func (in *DemandList) DeepCopyInto(out *DemandList)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*DemandList) DeepCopyObject ¶
func (in *DemandList) DeepCopyObject() runtime.Object
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
type DemandPhase ¶
type DemandPhase string
DemandPhase type declares that the value is a Demands phase
type DemandSpec ¶
type DemandSpec struct { Units []DemandUnit `json:"units"` InstanceGroup string `json:"instance-group"` // IsLongLived changes the lifecycle for a demand from // ephemeral and immutable to long-lived and mutable. // This is useful to set a buffer in an instance-group: // an amount of compute resources that is left unused // but ready for quick reservation should there be need. IsLongLived bool `json:"is-long-lived"` // EnforceSingleZoneScheduling indicates this demand must // be satisfied in a single zone. EnforceSingleZoneScheduling bool `json:"enforce-single-zone-scheduling"` // Zone indicates the zone where the Demand should be fulfilled. // If this parameter is not set, the Demand can be fulfilled in any zone. Zone *Zone `json:"zone,omitempty"` }
DemandSpec represents the units and status of a Demand resource
func (*DemandSpec) DeepCopy ¶
func (in *DemandSpec) DeepCopy() *DemandSpec
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DemandSpec.
func (*DemandSpec) DeepCopyInto ¶
func (in *DemandSpec) DeepCopyInto(out *DemandSpec)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type DemandStatus ¶
type DemandStatus struct { // Phase denotes the demand phase. Phase DemandPhase `json:"phase"` // LastTransitionTime denotes the last transition time of the demand phase. // If left empty, defaults to the creation time of the demand. // +optional LastTransitionTime metav1.Time `json:"last-transition-time,omitempty"` // FulfilledZone is the zone that was scaled up to satisfy this demand. Note this is only populated for // single zone demands, and it does not guarantee that the demand resources will be scheduled in this zone. FulfilledZone string `json:"fulfilled-zone,omitempty"` }
DemandStatus represents the status a demand object is in
func (*DemandStatus) DeepCopy ¶
func (in *DemandStatus) DeepCopy() *DemandStatus
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DemandStatus.
func (*DemandStatus) DeepCopyInto ¶
func (in *DemandStatus) DeepCopyInto(out *DemandStatus)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type DemandUnit ¶
type DemandUnit struct { Resources ResourceList `json:"resources"` Count int `json:"count"` // PodNamesByNamespace contains the name and namespace of the pods that will occupy the space requested by // the demand object. // This field is optional and used for deduplication. PodNamesByNamespace map[string][]string `json:"pod-names-by-namespace,omitempty"` }
DemandUnit represents a single unit of demand as a count of resources requirements
func (*DemandUnit) DeepCopy ¶
func (in *DemandUnit) DeepCopy() *DemandUnit
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DemandUnit.
func (*DemandUnit) DeepCopyInto ¶
func (in *DemandUnit) DeepCopyInto(out *DemandUnit)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type ResourceList ¶
type ResourceList map[corev1.ResourceName]resource.Quantity
ResourceList is a set of (resource name, quantity) pairs.
func (*ResourceList) CPU ¶
func (r *ResourceList) CPU() *resource.Quantity
CPU returns the CPU demand if specified.
func (ResourceList) DeepCopy ¶
func (in ResourceList) DeepCopy() ResourceList
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceList.
func (ResourceList) DeepCopyInto ¶
func (in ResourceList) DeepCopyInto(out *ResourceList)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*ResourceList) Memory ¶
func (r *ResourceList) Memory() *resource.Quantity
Memory returns the Memory demand if specified.
func (*ResourceList) NvidiaGPU ¶
func (r *ResourceList) NvidiaGPU() *resource.Quantity
NvidiaGPU returns the GPU demand if specified.