v1alpha1

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2025 License: Apache-2.0 Imports: 7 Imported by: 3

Documentation

Overview

Package v1alpha1 contains API Schema definitions for the sharding v1alpha1 API group +kubebuilder:object:generate=true +groupName=sharding.timebertt.dev

Index

Constants

View Source
const (
	// NamespaceSystem is the namespace where the sharding system components run.
	NamespaceSystem = "sharding-system"
	// AppControllerSharding is the value for the "app.kubernetes.io/name" label used for objects related to controller
	// sharding.
	AppControllerSharding = "controller-sharding"

	// LabelClusterRing is the label on objects that identifies the ClusterRing that the object belongs to.
	LabelClusterRing = alphaPrefix + "clusterring"
	// LabelState is the label on Lease objects that reflects the state of a shard for observability purposes.
	// This label is maintained by the shardlease controller.
	LabelState = alphaPrefix + "state"
	// LabelShardPrefix is the qualified prefix for a label on sharded objects that holds the name of the responsible
	// shard within a ring. Use LabelShard to compute the full label key for a ring.
	LabelShardPrefix = "shard." + alphaPrefix
	// LabelDrainPrefix is the qualified prefix for a label on sharded objects that instructs the responsible shard within
	// a ring to stop reconciling the object and remove both the shard and drain label. Use LabelDrain to compute the full
	// label key for a ring.
	LabelDrainPrefix = "drain." + alphaPrefix

	// IdentityShardLeaseController is the identity that the shardlease controller uses to acquire leases of unavailable
	// shards.
	IdentityShardLeaseController = "shardlease-controller"

	// KindClusterRing is the kind string for ClusterRings used in label keys.
	KindClusterRing = "clusterring"
)
View Source
const (
	// ClusterRingReady is the condition type for the "Ready" condition on ClusterRings.
	ClusterRingReady = "Ready"
)
View Source
const GroupName = "sharding.timebertt.dev"

GroupName is the group name used in this package.

Variables

View Source
var (
	// SchemeBuilder is a new Scheme Builder which registers our API.
	SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
	// AddToScheme is a reference to the Scheme Builder's AddToScheme function.
	AddToScheme = SchemeBuilder.AddToScheme
)
View Source
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"}

SchemeGroupVersion is group version used to register these objects

Functions

func LabelDrain

func LabelDrain(kind string, namespace, name string) string

LabelDrain returns the label on sharded objects that instructs the responsible shard within a ring to stop reconciling the object and remove both the shard and drain label.

func LabelShard

func LabelShard(kind string, namespace, name string) string

LabelShard returns the label on sharded objects that holds the name of the responsible shard within a ring.

func RingSuffix

func RingSuffix(kind string, namespace, name string) string

RingSuffix returns the label key for a given ring kind and key that is appended to a qualified prefix.

Types

type ClusterRing

type ClusterRing struct {
	metav1.TypeMeta `json:",inline"`
	// Standard object's metadata.
	// +optional
	metav1.ObjectMeta `json:"metadata,omitempty"`
	// Spec contains the specification of the desired behavior of the ClusterRing.
	// +optional
	Spec ClusterRingSpec `json:"spec,omitempty"`
	// Status contains the most recently observed status of the ClusterRing.
	// +optional
	Status ClusterRingStatus `json:"status,omitempty"`
}

ClusterRing declares a virtual ring of sharded controller instances. The specified objects are distributed across shards of this ring on the cluster-scope (i.e., objects in all namespaces). Hence, the "Cluster" prefix.

func (*ClusterRing) DeepCopy

func (in *ClusterRing) DeepCopy() *ClusterRing

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

func (*ClusterRing) DeepCopyInto

func (in *ClusterRing) DeepCopyInto(out *ClusterRing)

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

func (*ClusterRing) DeepCopyObject

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

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

func (*ClusterRing) LabelDrain

func (c *ClusterRing) LabelDrain() string

LabelDrain returns the label on sharded objects that instructs the responsible shard within this ClusterRing to stop reconciling the object and remove both the shard and drain label.

func (*ClusterRing) LabelShard

func (c *ClusterRing) LabelShard() string

LabelShard returns the label on sharded objects that holds the name of the responsible shard within this ClusterRing.

func (*ClusterRing) LeaseSelector

func (c *ClusterRing) LeaseSelector() labels.Selector

LeaseSelector returns a label selector for selecting shard Lease objects belonging to this ClusterRing.

func (*ClusterRing) RingResources

func (c *ClusterRing) RingResources() []RingResource

RingResources returns the the list of resources that are distributed across shards in this ClusterRing.

type ClusterRingList

type ClusterRingList struct {
	metav1.TypeMeta `json:",inline"`
	// Standard list metadata.
	// +optional
	metav1.ListMeta `json:"metadata,omitempty"`
	// Items is the list of ClusterRings.
	Items []ClusterRing `json:"items"`
}

ClusterRingList contains a list of ClusterRings.

func (*ClusterRingList) DeepCopy

func (in *ClusterRingList) DeepCopy() *ClusterRingList

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

func (*ClusterRingList) DeepCopyInto

func (in *ClusterRingList) DeepCopyInto(out *ClusterRingList)

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

func (*ClusterRingList) DeepCopyObject

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

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

type ClusterRingSpec

type ClusterRingSpec struct {
	// Resources specifies the list of resources that are distributed across shards in this ClusterRing.
	// +optional
	// +listType=map
	// +listMapKey=group
	// +listMapKey=resource
	Resources []RingResource `json:"resources,omitempty"`
	// NamespaceSelector overwrites the webhook configs' namespaceSelector.
	// If set, this selector should exclude the kube-system and sharding-system namespaces.
	// If omitted, the default namespaceSelector from the SharderConfig is used.
	// Note: changing/unsetting this selector will not remove labels from objects in namespaces that were previously
	// included.
	// +optional
	NamespaceSelector *metav1.LabelSelector `json:"namespaceSelector,omitempty"`
}

ClusterRingSpec defines the desired state of a ClusterRing.

func (*ClusterRingSpec) DeepCopy

func (in *ClusterRingSpec) DeepCopy() *ClusterRingSpec

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

func (*ClusterRingSpec) DeepCopyInto

func (in *ClusterRingSpec) DeepCopyInto(out *ClusterRingSpec)

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

type ClusterRingStatus

type ClusterRingStatus struct {
	// The generation observed by the ClusterRing controller.
	// +optional
	ObservedGeneration int64 `json:"observedGeneration,omitempty"`
	// Shards is the total number of shards of this ring.
	Shards int32 `json:"shards"`
	// AvailableShards is the total number of available shards of this ring.
	AvailableShards int32 `json:"availableShards"`
	// Conditions represents the observations of a foo's current state.
	// Known .status.conditions.type are: "Available", "Progressing", and "Degraded"
	// +listType=map
	// +listMapKey=type
	// +optional
	Conditions []metav1.Condition `json:"conditions,omitempty"`
}

ClusterRingStatus defines the observed state of a ClusterRing.

func (*ClusterRingStatus) DeepCopy

func (in *ClusterRingStatus) DeepCopy() *ClusterRingStatus

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

func (*ClusterRingStatus) DeepCopyInto

func (in *ClusterRingStatus) DeepCopyInto(out *ClusterRingStatus)

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

type RingResource

type RingResource struct {
	// GroupResource specifies the resource that is distributed across shards in a ring.
	// This resource is the controller's main resource, i.e., the resource of which it updates the object status.
	metav1.GroupResource `json:",inline"`

	// ControlledResources are additional resources that are distributed across shards in the ClusterRing.
	// These resources are controlled by the controller's main resource, i.e., they have an owner reference with
	// controller=true back to the GroupResource of this RingResource.
	// Typically, the controller also watches objects of this resource and enqueues the owning object (of the main
	// resource) whenever the status of a controlled object changes.
	// +optional
	// +listType=map
	// +listMapKey=group
	// +listMapKey=resource
	ControlledResources []metav1.GroupResource `json:"controlledResources,omitempty"`
}

RingResource specifies a resource along with controlled resources that is distributed across shards in a ring.

func (*RingResource) DeepCopy

func (in *RingResource) DeepCopy() *RingResource

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

func (*RingResource) DeepCopyInto

func (in *RingResource) DeepCopyInto(out *RingResource)

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