v1alpha1

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2022 License: Apache-2.0 Imports: 6 Imported by: 15

Documentation

Overview

+k8s:deepcopy-gen=package,register +groupName=scheduling.kcp.dev +k8s:openapi-gen=true

Index

Constants

View Source
const (
	// LocationLabelsStringAnnotationKey is the label key for the label holding a string
	// representation of the location labels in order to use them in a table column in the CLI.
	LocationLabelsStringAnnotationKey = "scheduling.kcp.dev/labels"

	// PlacementAnnotationKey is the label key for the label holding a PlacementAnnotation struct.
	PlacementAnnotationKey = "scheduling.kcp.dev/placement"
)
View Source
const (
	// PlacementPending is the phase that the location has not been selected for this placement.
	PlacementPending = "Pending"

	// PlacementUnbound is the phase that the location has been selected by the placement, but
	// no namespace is bound to this placement yet.
	PlacementUnbound = "Unbound"

	// PlacementBound is the phase that the location has been selected by the placement, and at
	// least one namespace has been bound to this placement.
	PlacementBound = "Bound"
)
View Source
const (
	// PlacementReady is a condition type for placement representing that the placement is ready
	// for scheduling. The placement is NOT ready when location cannot be found for the placement,
	// or the selected location does not match the placement spec.
	PlacementReady conditionsv1alpha1.ConditionType = "Ready"

	// LocationNotFoundReason is a reason for PlacementReady condition that a location cannot be
	// found for this placement.
	LocationNotFoundReason = "LocationNotFound"

	// LocationInvalidReason is a reason for PlacementReady condition that a location is not valid
	// for this placement anymore.
	LocationInvalidReason = "LocationInvalid"

	// LocationNotMatchReason is a reason for PlacementReady condition that no matched location for
	// this placement can be found.
	LocationNotMatchReason = "LocationNoMatch"
)

Variables

View Source
var (
	SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
	AddToScheme   = SchemeBuilder.AddToScheme
)
View Source
var SchemeGroupVersion = schema.GroupVersion{Group: scheduling.GroupName, Version: "v1alpha1"}

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 back 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 AvailableSelectorLabel

type AvailableSelectorLabel struct {
	// key is the name of the label.
	//
	// +required
	// +kubebuilder:Required
	Key LabelKey `json:"key"`

	// values are the possible values for this labels.
	//
	// +kubebuilder:validation:MinItems=1
	// +required
	// +kubebuilder:Required
	// +listType=set
	Values []LabelValue `json:"values"`

	// description is a human readable description of the label.
	//
	// +optional
	Description string `json:"description,omitempty"`
}

AvailableSelectorLabel specifies a label with key name and possible values.

func (*AvailableSelectorLabel) DeepCopy

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

func (*AvailableSelectorLabel) DeepCopyInto

func (in *AvailableSelectorLabel) DeepCopyInto(out *AvailableSelectorLabel)

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

type GroupVersionResource

type GroupVersionResource struct {
	// group is the name of an API group.
	//
	// +kubebuilder:validation:Pattern=`^(|[a-z0-9]([-a-z0-9]*[a-z0-9](\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?)$`
	// +kubebuilder:validation:Enum="workload.kcp.dev"
	// +optional
	Group string `json:"group,omitempty"`

	// version is the version of the API.
	//
	// +kubebuilder:validation:Pattern=`^[a-z][-a-z0-9]*[a-z0-9]$`
	// +kubebuilder:validation:MinLength:1
	// +kubebuilder:validation:Enum="v1alpha1"
	// +required
	// +kubebuilder:Required
	Version string `json:"version"`

	// resource is the name of the resource.
	// +kubebuilder:validation:Pattern=`^[a-z][-a-z0-9]*[a-z0-9]$`
	// +kubebuilder:validation:MinLength:1
	// +kubebuilder:validation:Enum="synctargets"
	// +required
	// +kubebuilder:Required
	Resource string `json:"resource"`
}

GroupVersionResource unambiguously identifies a resource.

func (*GroupVersionResource) DeepCopy

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

func (*GroupVersionResource) DeepCopyInto

func (in *GroupVersionResource) DeepCopyInto(out *GroupVersionResource)

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

type LabelKey

type LabelKey string

LabelKey is a key for a label.

+kubebuilder:validation:Pattern=`^([a-z0-9]([-a-z0-9]*[a-z0-9](\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?/)?([a-zA-Z0-9][-a-zA-Z0-9_.]{0,61})?[a-zA-Z0-9]$` +kubebuilder:validation:MaxLength=255

type LabelValue

type LabelValue string

LabelValue specifies a value of a label.

+kubebuilder:validation:Pattern=`^(|([a-z0-9]([-a-z0-9]*[a-z0-9](\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?/)?([a-zA-Z0-9][-a-zA-Z0-9_.]{0,61})?[a-zA-Z0-9])$` +kubebuilder:validation:MaxLength=63

type Location

type Location struct {
	metav1.TypeMeta `json:",inline"`
	// +optional
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec LocationSpec `json:"spec,omitempty"`

	// +optional
	Status LocationStatus `json:"status,omitempty"`
}

Location represents a set of instances of a scheduling resource type acting a target of scheduling.

The location is chosen by the user (in the future) through a Placement object, while the instance is chosen by the scheduler depending on considerations like load or available resources, or further node selectors specified by the user.

+crd +genclient +genclient:nonNamespaced +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +kubebuilder:subresource:status +kubebuilder:resource:scope=Cluster,categories=kcp +kubebuilder:printcolumn:name="Resource",type=string,JSONPath=`.spec.resource.resource`,description="Type of the workspace" +kubebuilder:printcolumn:name="Available",type=string,JSONPath=`.status.availableInstances`,description="Available instances in this location" +kubebuilder:printcolumn:name="Instances",type=string,JSONPath=`.status.instances`,description="Instances in this location" +kubebuilder:printcolumn:name="Labels",type=string,JSONPath=`.metadata.annotations['scheduling\.kcp\.dev/labels']`,description="The common labels of this location" +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"

func (*Location) DeepCopy

func (in *Location) DeepCopy() *Location

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

func (*Location) DeepCopyInto

func (in *Location) DeepCopyInto(out *Location)

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

func (*Location) DeepCopyObject

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

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

type LocationList

type LocationList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata"`

	Items []Location `json:"items"`
}

LocationList is a list of locations.

+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

func (*LocationList) DeepCopy

func (in *LocationList) DeepCopy() *LocationList

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

func (*LocationList) DeepCopyInto

func (in *LocationList) DeepCopyInto(out *LocationList)

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

func (*LocationList) DeepCopyObject

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

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

type LocationReference

type LocationReference struct {
	// path is an absolute reference to a workspace, e.g. root:org:ws. The workspace must
	// be some ancestor or a child of some ancestor.
	//
	// +required
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:Pattern:="^root(:[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$"
	Path string `json:"path"`

	// Name of the Location.
	//
	// +required
	// +kubebuilder:validation:Required
	// +kube:validation:MinLength=1
	LocationName string `json:"locationName"`
}

LocationReference describes a loaction that are provided in the specified Workspace.

func (*LocationReference) DeepCopy

func (in *LocationReference) DeepCopy() *LocationReference

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

func (*LocationReference) DeepCopyInto

func (in *LocationReference) DeepCopyInto(out *LocationReference)

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

type LocationSpec

type LocationSpec struct {
	// resource is the group-version-resource of the instances that are subject to this location.
	//
	// +required
	// +kubebuilder:Required
	Resource GroupVersionResource `json:"resource"`

	// description is a human-readable description of the location.
	//
	// +optional
	Description string `json:"description,omitempty"`

	// availableSelectorLabels is a list of labels that can be used to select an
	// instance at this location in a placement object.
	//
	// +listType=map
	// +listMapKey=key
	AvailableSelectorLabels []AvailableSelectorLabel `json:"availableSelectorLabels,omitempty"`

	// instanceSelector chooses the instances that will be part of this location.
	//
	// Note that these labels are not what is shown in the Location objects to
	// the user. Depending on context, both will match or won't match.
	//
	// +optional
	InstanceSelector *metav1.LabelSelector `json:"instanceSelector,omitempty"`
}

LocationSpec holds the desired state of the Location.

func (*LocationSpec) DeepCopy

func (in *LocationSpec) DeepCopy() *LocationSpec

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

func (*LocationSpec) DeepCopyInto

func (in *LocationSpec) DeepCopyInto(out *LocationSpec)

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

type LocationStatus

type LocationStatus struct {
	// instances is the number of actual instances at this location.
	Instances *uint32 `json:"instances,omitempty"`

	// available is the number of actual instances that are available at this location.
	AvailableInstances *uint32 `json:"availableInstances,omitempty"`
}

LocationStatus defines the observed state of Location.

func (*LocationStatus) DeepCopy

func (in *LocationStatus) DeepCopy() *LocationStatus

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

func (*LocationStatus) DeepCopyInto

func (in *LocationStatus) DeepCopyInto(out *LocationStatus)

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

type Placement

type Placement struct {
	metav1.TypeMeta `json:",inline"`
	// +optional
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec PlacementSpec `json:"spec,omitempty"`

	// +optional
	Status PlacementStatus `json:"status,omitempty"`
}

Placement defines a selection rule to choose ONE location for MULTIPLE namespaces in a workspace.

placement is in Pending state initially. When a location is selected by the placement, the placement turns to Unbound state. In Pending or Unbound state, the selection rule can be updated to select another location. When the a namespace is annotated by another controller or user with the key of "scheduling.kcp.dev/placement", the namespace will pick one placement, and this placement is transfered to Bound state. Any update to spec of the placement is ignored in Bound state and reflected in the conditions. The placement will turn back to Unbound state when no namespace uses this placement any more.

+crd +genclient +genclient:nonNamespaced +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +kubebuilder:subresource:status +kubebuilder:resource:scope=Cluster,categories=kcp +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"

func (*Placement) DeepCopy

func (in *Placement) DeepCopy() *Placement

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

func (*Placement) DeepCopyInto

func (in *Placement) DeepCopyInto(out *Placement)

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

func (*Placement) DeepCopyObject

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

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

func (*Placement) GetConditions

func (in *Placement) GetConditions() conditionsv1alpha1.Conditions

func (*Placement) SetConditions

func (in *Placement) SetConditions(c conditionsv1alpha1.Conditions)

type PlacementList

type PlacementList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata"`

	Items []Placement `json:"items"`
}

PlacementList is a list of locations.

+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

func (*PlacementList) DeepCopy

func (in *PlacementList) DeepCopy() *PlacementList

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

func (*PlacementList) DeepCopyInto

func (in *PlacementList) DeepCopyInto(out *PlacementList)

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

func (*PlacementList) DeepCopyObject

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

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

type PlacementPhase

type PlacementPhase string

type PlacementSpec

type PlacementSpec struct {
	// loacationSelectors represents a slice of label selector to select a location, these label selectors
	// are logically ORed.
	LocationSelectors []metav1.LabelSelector `json:"locationSelectors,omitempty"`

	// locationResource is the group-version-resource of the instances that are subject to the locations to select.
	//
	// +required
	// +kubebuilder:Required
	LocationResource GroupVersionResource `json:"locationResource"`

	// namespaceSelector is a label selector to select ns. It match all ns by default, but can be specified to
	// a certain set of ns.
	// +optional
	NamespaceSelector *metav1.LabelSelector `json:"namespaceSelector,omitempty"`

	// locationWorkspace is an absolute reference to a workspace for the location. If it is not set, the workspace of
	// APIBinding will be used.
	// +optional
	// +kubebuilder:validation:Pattern:="^root(:[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$"
	LocationWorkspace string `json:"locationWorkspace,omitempty"`
}

func (*PlacementSpec) DeepCopy

func (in *PlacementSpec) DeepCopy() *PlacementSpec

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

func (*PlacementSpec) DeepCopyInto

func (in *PlacementSpec) DeepCopyInto(out *PlacementSpec)

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

type PlacementStatus

type PlacementStatus struct {
	// phase is the current phase of the placement
	//
	// +kubebuilder:default=Pending
	// +kubebuilder:validation:Enum=Pending;Bound;Unbound
	Phase PlacementPhase `json:"phase,omitempty"`

	// selectedLocation is the location that a picked by this placement.
	// +optional
	SelectedLocation *LocationReference `json:"selectedLocation,omitempty"`

	// Current processing state of the Placement.
	// +optional
	Conditions conditionsv1alpha1.Conditions `json:"conditions,omitempty"`
}

func (*PlacementStatus) DeepCopy

func (in *PlacementStatus) DeepCopy() *PlacementStatus

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

func (*PlacementStatus) DeepCopyInto

func (in *PlacementStatus) DeepCopyInto(out *PlacementStatus)

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

Jump to

Keyboard shortcuts

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