v1alpha1

package
v0.5.0-alpha.0 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2022 License: Apache-2.0 Imports: 8 Imported by: 21

Documentation

Overview

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

Index

Constants

View Source
const (
	// InternalClusterDeletionTimestampAnnotationPrefix is the prefix of the annotation
	//
	//   deletion.internal.workloads.kcp.dev/<workload-cluster-name>
	//
	// on upstream resources storing the timestamp when the workload cluster resource
	// state was changed to "Delete". The syncer will see this timestamp as the deletion
	// timestamp of the object.
	//
	// The format is RFC3339.
	//
	// TODO(sttts): use workload-cluster-uid instead of workload-cluster-name
	InternalClusterDeletionTimestampAnnotationPrefix = "deletion.internal.workloads.kcp.dev/"

	// ClusterFinalizerAnnotationPrefix is the prefix of the annotation
	//
	//   finalizers.workloads.kcp.dev/<workload-cluster-name>
	//
	// on upstream resources storing a comma-separated list of finalizer names that are set on
	// the workload cluster resource in the view of the syncer. This blocks the deletion of the
	// resource on that workload cluster. External (custom) controllers can set this annotation
	// create back-pressure on the resource.
	//
	// TODO(sttts): use workload-cluster-uid instead of workload-cluster-name
	ClusterFinalizerAnnotationPrefix = "finalizers.workloads.kcp.dev/"

	// InternalClusterResourceStateLabelPrefix is the prefix of the label
	//
	//   state.internal.workloads.kcp.dev/<workload-cluster-name>
	//
	// on upstream resources storing the state of the workload cluster syncer state machine.
	// The workload controllers will set this label and the syncer will react and drive the
	// life-cycle of the synced objects on the workload cluster.
	//
	// The format is a string, namely:
	// - "": the object is assigned, but the syncer will ignore the object. A coordination
	//       controller will have to set the value to "Sync" after initializion in order to
	//       start the sync process.
	// - "Sync": the object is assigned and the syncer will start the sync process.
	//
	// While being in "Sync" state, a deletion timestamp in deletion.internal.workloads.kcp.dev/<workload-cluster-name>
	// will signal the start of the deletion process of the object. During the deletion process
	// the object will stay in "Sync" state. The syncer will block deletion while
	// finalizers.workloads.kcp.dev/<workload-cluster-name> exists and is non-empty, and it
	// will eventually remove state.internal.workloads.kcp.dev/<workload-cluster-name> after
	// the object has been deleted downstream.
	//
	// The workload controllers will consider the object deleted from the workload cluster when
	// the label is removed. They then set the placement state to "Unbound".
	InternalClusterResourceStateLabelPrefix = "state.internal.workloads.kcp.dev/"

	// InternalClusterStatusAnnotationPrefix is the prefix of the annotation
	//
	//   experimental.status.workloads.kcp.dev/<workload-cluster-name>
	//
	// on upstream resources storing the status of the downstream resource per workload cluster.
	// Note that this is experimental and will disappear in the future without prior notice. It
	// is used temporarily in the case that a resource is scheduled to multiple workload clusters.
	//
	// The format is JSON.
	InternalClusterStatusAnnotationPrefix = "experimental.status.workloads.kcp.dev/"

	// ClusterSpecDiffAnnotationPrefix is the prefix of the annotation
	//
	//   experimental.spec-diff.workloads.kcp.dev/<workload-cluster-name>
	//
	// on upstream resources storing the desired spec diffs to be applied to the resource when syncing
	// down to the <workload-cluster-name>. This feature requires the "Advanced Scheduling" feature gate
	// to be enabled.
	//
	// The patch will be applied to the resource Spec field of the resource, so the JSON root path is the
	// resource's Spec field.
	//
	// The format for the value of this annotation is: JSON Patch (https://tools.ietf.org/html/rfc6902).
	ClusterSpecDiffAnnotationPrefix = "experimental.spec-diff.workloads.kcp.dev/"

	// InternalDownstreamClusterLabel is a label with the upstream cluster name applied on the downstream cluster
	// instead of state.internal.workloads.kcp.dev/<workload-cluster-name> which is used upstream.
	InternalDownstreamClusterLabel = "internal.workloads.kcp.dev/cluster"

	// SchedulingDisabledLabel on a namespace with value "true" disables workload placement and scheduling.
	SchedulingDisabledLabel = "experimental.workloads.kcp.dev/scheduling-disabled"

	// WorkspaceSchedulableLabel on a workspace enables scheduling for the contents
	// of the workspace. It is applied by default to workspaces of type `Universal`.
	WorkspaceSchedulableLabel = "workloads.kcp.dev/schedulable"
)
View Source
const (
	// SyncerReady means the syncer is ready to transfer resources between KCP and the WorkloadCluster.
	SyncerReady conditionsv1alpha1.ConditionType = "SyncerReady"

	// APIImporterReady means the APIImport component is ready to import APIs from the WorkloadCluster.
	APIImporterReady conditionsv1alpha1.ConditionType = "APIImporterReady"

	// HeartbeatHealthy means the HeartbeatManager has seen a heartbeat for the WorkloadCluster within the expected interval.
	HeartbeatHealthy conditionsv1alpha1.ConditionType = "HeartbeatHealthy"

	// WorkloadClusterUnknownReason documents a WorkloadCluster which readiness is unknown.
	WorkloadClusterUnknownReason = "WorkloadClusterStatusUnknown"

	// WorkloadClusterReadyReason documents a WorkloadCluster that is ready.
	WorkloadClusterReadyReason = "WorkloadClusterReady"

	// WorkloadClusterNotReadyReason documents a WorkloadCluster is not ready, when the "readyz" check returns false.
	WorkloadClusterNotReadyReason = "WorkloadClusterNotReady"

	// WorkloadClusterUnreachableReason documents the WorkloadCluster state when the Syncer is unable to reach the WorkloadCluster "readyz" API endpoint
	WorkloadClusterUnreachableReason = "WorkloadClusterUnreachable"

	// ErrorStartingSyncerReason indicates that the Syncer failed to start.
	ErrorStartingSyncerReason = "ErrorStartingSyncer"

	// ErrorInstallingSyncerReason indicates that the Syncer failed to install.
	ErrorInstallingSyncerReason = "ErrorInstallingSyncer"

	// InvalidKubeConfigReason indicates that the Syncer failed to start because the KubeConfig is invalid.
	InvalidKubeConfigReason = "InvalidKubeConfig"

	// ErrorCreatingClientReason indicates that there has been an error trying to create a kubernetes client from given a KubeConfig.
	ErrorCreatingClientReason = "ErrorCreatingClient"

	// ErrorStartingAPIImporterReason indicates an error starting the API Importer.
	ErrorStartingAPIImporterReason = "ErrorStartingAPIImporter"

	// ErrorHeartbeatMissedReason indicates that a heartbeat update was not received within the configured threshold.
	ErrorHeartbeatMissedReason = "ErrorHeartbeat"
)

Conditions and ConditionReasons for the kcp WorkloadCluster object.

Variables

View Source
var (
	SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
	AddToScheme   = SchemeBuilder.AddToScheme
)
View Source
var SchemeGroupVersion = schema.GroupVersion{Group: workload.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 ResourceState

type ResourceState string
const (
	// ResourceStatePending is the initial state of a resource after placement onto
	// workload cluster. Either some workload controller or some external coordination
	// controller will set this to "Sync" when the resource is ready to be synced.
	ResourceStatePending ResourceState = ""
	// ResourceStateSync is the state of a resource when it is synced to the workload cluster.
	// This includes the deletion process until the resource is deleted downstream and the
	// syncer removes the state.internal.workloads.kcp.dev/<workload-cluster-name> label.
	ResourceStateSync ResourceState = "Sync"
)

func GetResourceState

func GetResourceState(obj metav1.Object, cluster string) (state ResourceState, valid bool)

GetResourceState returns the state of the resource for the given workload cluster, and whether the state value is a valid state. A missing label is considered invalid.

type VirtualWorkspace

type VirtualWorkspace struct {
	// URL is the URL of the syncer virtual workspace.
	//
	// +kubebuilder:validation:MinLength=1
	// +kubebuilder:format:URL
	// +required
	URL string `json:"url"`
}

func (*VirtualWorkspace) DeepCopy

func (in *VirtualWorkspace) DeepCopy() *VirtualWorkspace

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

func (*VirtualWorkspace) DeepCopyInto

func (in *VirtualWorkspace) DeepCopyInto(out *VirtualWorkspace)

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

type WorkloadCluster

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

	// Spec holds the desired state.
	// +optional
	Spec WorkloadClusterSpec `json:"spec,omitempty"`

	// Status communicates the observed state.
	// +optional
	Status WorkloadClusterStatus `json:"status,omitempty"`
}

WorkloadCluster describes a member cluster capable of running workloads.

+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="Location",type="string",JSONPath=`.metadata.name`,priority=1 +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=`.status.conditions[?(@.type=="Ready")].status`,priority=2 +kubebuilder:printcolumn:name="Synced API resources",type="string",JSONPath=`.status.syncedResources`,priority=3

func (*WorkloadCluster) DeepCopy

func (in *WorkloadCluster) DeepCopy() *WorkloadCluster

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

func (*WorkloadCluster) DeepCopyInto

func (in *WorkloadCluster) DeepCopyInto(out *WorkloadCluster)

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

func (*WorkloadCluster) DeepCopyObject

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

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

func (*WorkloadCluster) GetConditions

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

func (*WorkloadCluster) SetConditions

func (in *WorkloadCluster) SetConditions(conditions conditionsv1alpha1.Conditions)

type WorkloadClusterList

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

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

WorkloadClusterList is a list of WorkloadCluster resources

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

func (*WorkloadClusterList) DeepCopy

func (in *WorkloadClusterList) DeepCopy() *WorkloadClusterList

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

func (*WorkloadClusterList) DeepCopyInto

func (in *WorkloadClusterList) DeepCopyInto(out *WorkloadClusterList)

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

func (*WorkloadClusterList) DeepCopyObject

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

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

type WorkloadClusterSpec

type WorkloadClusterSpec struct {
	// Unschedulable controls cluster schedulability of new workloads. By
	// default, cluster is schedulable.
	// +optional
	// +kubebuilder:default=false
	Unschedulable bool `json:"unschedulable"`

	// EvictAfter controls cluster schedulability of new and existing workloads.
	// After the EvictAfter time, any workload scheduled to the cluster
	// will be unassigned from the cluster.
	// By default, workloads scheduled to the cluster are not evicted.
	EvictAfter *metav1.Time `json:"evictAfter,omitempty"`
}

WorkloadClusterSpec holds the desired state of the WorkloadCluster (from the client).

func (*WorkloadClusterSpec) DeepCopy

func (in *WorkloadClusterSpec) DeepCopy() *WorkloadClusterSpec

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

func (*WorkloadClusterSpec) DeepCopyInto

func (in *WorkloadClusterSpec) DeepCopyInto(out *WorkloadClusterSpec)

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

type WorkloadClusterStatus

type WorkloadClusterStatus struct {

	// Allocatable represents the resources that are available for scheduling.
	// +optional
	Allocatable *corev1.ResourceList `json:"allocatable,omitempty"`

	// Capacity represents the total resources of the cluster.
	// +optional
	Capacity *corev1.ResourceList `json:"capacity,omitempty"`

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

	// +optional
	SyncedResources []string `json:"syncedResources,omitempty"`

	// A timestamp indicating when the syncer last reported status.
	// +optional
	LastSyncerHeartbeatTime *metav1.Time `json:"lastSyncerHeartbeatTime,omitempty"`

	// VirtualWorkspaces contains all syncer virtual workspace URLs.
	// +optional
	VirtualWorkspaces []VirtualWorkspace `json:"virtualWorkspaces,omitempty"`
}

WorkloadClusterStatus communicates the observed state of the WorkloadCluster (from the controller).

func (*WorkloadClusterStatus) DeepCopy

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

func (*WorkloadClusterStatus) DeepCopyInto

func (in *WorkloadClusterStatus) DeepCopyInto(out *WorkloadClusterStatus)

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