Documentation
¶
Overview ¶
+k8s:deepcopy-gen=package,register +groupName=workload.kcp.dev +k8s:openapi-gen=true
Index ¶
Constants ¶
const ( // SyncerReady means the syncer is ready to transfer resources between KCP and the SyncTarget. SyncerReady conditionsv1alpha1.ConditionType = "SyncerReady" // APIImporterReady means the APIImport component is ready to import APIs from the SyncTarget. APIImporterReady conditionsv1alpha1.ConditionType = "APIImporterReady" // HeartbeatHealthy means the HeartbeatManager has seen a heartbeat for the SyncTarget within the expected interval. HeartbeatHealthy conditionsv1alpha1.ConditionType = "HeartbeatHealthy" // SyncTargetUnknownReason documents a SyncTarget which readiness is unknown. SyncTargetUnknownReason = "SyncTargetStatusUnknown" // SyncTargetReadyReason documents a SyncTarget that is ready. SyncTargetReadyReason = "SyncTargetReady" // SyncTargetNotReadyReason documents a SyncTarget is not ready, when the "readyz" check returns false. SyncTargetNotReadyReason = "SyncTargetNotReady" // SyncTargetUnreachableReason documents the SyncTarget state when the Syncer is unable to reach the SyncTarget "readyz" API endpoint SyncTargetUnreachableReason = "SyncTargetUnreachable" // 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 SyncTarget object.
const ( // InternalClusterDeletionTimestampAnnotationPrefix is the prefix of the annotation // // deletion.internal.workload.kcp.dev/<sync-target-name> // // on upstream resources storing the timestamp when the sync target 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 sync-target-uid instead of sync-target-name InternalClusterDeletionTimestampAnnotationPrefix = "deletion.internal.workload.kcp.dev/" // ClusterFinalizerAnnotationPrefix is the prefix of the annotation // // finalizers.workload.kcp.dev/<sync-target-name> // // on upstream resources storing a comma-separated list of finalizer names that are set on // the sync target resource in the view of the syncer. This blocks the deletion of the // resource on that sync target. External (custom) controllers can set this annotation // create back-pressure on the resource. // // TODO(sttts): use sync-target-uid instead of sync-target-name ClusterFinalizerAnnotationPrefix = "finalizers.workload.kcp.dev/" // ClusterResourceStateLabelPrefix is the prefix of the label // // state.workload.kcp.dev/<sync-target-name> // // on upstream resources storing the state of the sync target 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 sync target. // // 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.workload.kcp.dev/<sync-target-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.workload.kcp.dev/<sync-target-name> exists and is non-empty, and it // will eventually remove state.workload.kcp.dev/<sync-target-name> after // the object has been deleted downstream. // // The workload controllers will consider the object deleted from the sync target when // the label is removed. They then set the placement state to "Unbound". ClusterResourceStateLabelPrefix = "state.workload.kcp.dev/" // InternalClusterStatusAnnotationPrefix is the prefix of the annotation // // experimental.status.workload.kcp.dev/<sync-target-name> // // on upstream resources storing the status of the downstream resource per sync target. // 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 sync targets. // // The format is JSON. InternalClusterStatusAnnotationPrefix = "experimental.status.workload.kcp.dev/" // ClusterSpecDiffAnnotationPrefix is the prefix of the annotation // // experimental.spec-diff.workload.kcp.dev/<sync-target-name> // // on upstream resources storing the desired spec diffs to be applied to the resource when syncing // down to the <sync-target-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.workload.kcp.dev/" // InternalDownstreamClusterLabel is a label with the upstream cluster name applied on the downstream cluster // instead of state.workload.kcp.dev/<sync-target-name> which is used upstream. InternalDownstreamClusterLabel = "internal.workload.kcp.dev/cluster" // AnnotationSkipDefaultObjectCreation is the annotation key for an apiexport or apibinding indicating the other default resources // has been created already. If the created default resource is deleted, it will not be recreated. AnnotationSkipDefaultObjectCreation = "workload.kcp.dev/skip-default-object-creation" )
Variables ¶
var ( SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) AddToScheme = SchemeBuilder.AddToScheme )
var SchemeGroupVersion = schema.GroupVersion{Group: workload.GroupName, Version: "v1alpha1"}
SchemeGroupVersion is group version used to register these objects
Functions ¶
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 // a sync target. 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 sync target. // This includes the deletion process until the resource is deleted downstream and the // syncer removes the state.workload.kcp.dev/<sync-target-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 sync target, and whether the state value is a valid state. A missing label is considered invalid.
type SyncTarget ¶
type SyncTarget struct {
metav1.TypeMeta `json:",inline"`
// +optional
metav1.ObjectMeta `json:"metadata,omitempty"`
// Spec holds the desired state.
// +optional
Spec SyncTargetSpec `json:"spec,omitempty"`
// Status communicates the observed state.
// +optional
Status SyncTargetStatus `json:"status,omitempty"`
}
SyncTarget 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 (*SyncTarget) DeepCopy ¶
func (in *SyncTarget) DeepCopy() *SyncTarget
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SyncTarget.
func (*SyncTarget) DeepCopyInto ¶
func (in *SyncTarget) DeepCopyInto(out *SyncTarget)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*SyncTarget) DeepCopyObject ¶
func (in *SyncTarget) DeepCopyObject() runtime.Object
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (*SyncTarget) GetConditions ¶
func (in *SyncTarget) GetConditions() conditionsv1alpha1.Conditions
func (*SyncTarget) SetConditions ¶
func (in *SyncTarget) SetConditions(conditions conditionsv1alpha1.Conditions)
type SyncTargetList ¶
type SyncTargetList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata"`
Items []SyncTarget `json:"items"`
}
SyncTargetList is a list of SyncTarget resources
+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
func (*SyncTargetList) DeepCopy ¶
func (in *SyncTargetList) DeepCopy() *SyncTargetList
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SyncTargetList.
func (*SyncTargetList) DeepCopyInto ¶
func (in *SyncTargetList) DeepCopyInto(out *SyncTargetList)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*SyncTargetList) DeepCopyObject ¶
func (in *SyncTargetList) DeepCopyObject() runtime.Object
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
type SyncTargetSpec ¶
type SyncTargetSpec 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"`
}
SyncTargetSpec holds the desired state of the SyncTarget (from the client).
func (*SyncTargetSpec) DeepCopy ¶
func (in *SyncTargetSpec) DeepCopy() *SyncTargetSpec
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SyncTargetSpec.
func (*SyncTargetSpec) DeepCopyInto ¶
func (in *SyncTargetSpec) DeepCopyInto(out *SyncTargetSpec)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type SyncTargetStatus ¶
type SyncTargetStatus 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 SyncTarget.
// +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"`
}
SyncTargetStatus communicates the observed state of the SyncTarget (from the controller).
func (*SyncTargetStatus) DeepCopy ¶
func (in *SyncTargetStatus) DeepCopy() *SyncTargetStatus
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SyncTargetStatus.
func (*SyncTargetStatus) DeepCopyInto ¶
func (in *SyncTargetStatus) DeepCopyInto(out *SyncTargetStatus)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
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.