v1alpha1

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2025 License: Apache-2.0 Imports: 4 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"

	// LabelControllerRing is the label on objects that identifies the ControllerRing that the object belongs to.
	LabelControllerRing = alphaPrefix + "controllerring"
	// 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"
)
View Source
const (
	// ControllerRingReady is the condition type for the "Ready" condition on ControllerRings.
	ControllerRingReady = "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(ringName 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(ringName string) string

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

Types

type ControllerRing added in v0.9.0

type ControllerRing 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 ControllerRing.
	// +optional
	Spec ControllerRingSpec `json:"spec,omitempty"`
	// Status contains the most recently observed status of the ControllerRing.
	// +optional
	Status ControllerRingStatus `json:"status,omitempty"`
}

ControllerRing declares a virtual ring of sharded controller instances. Objects of the specified resources are distributed across shards of this ring. Objects in all namespaces are considered unless a namespaceSelector is specified.

func (*ControllerRing) DeepCopy added in v0.9.0

func (in *ControllerRing) DeepCopy() *ControllerRing

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

func (*ControllerRing) DeepCopyInto added in v0.9.0

func (in *ControllerRing) DeepCopyInto(out *ControllerRing)

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

func (*ControllerRing) DeepCopyObject added in v0.9.0

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

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

func (*ControllerRing) LabelDrain added in v0.9.0

func (c *ControllerRing) LabelDrain() string

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

func (*ControllerRing) LabelShard added in v0.9.0

func (c *ControllerRing) LabelShard() string

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

func (*ControllerRing) LeaseSelector added in v0.9.0

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

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

func (*ControllerRing) RingResources added in v0.9.0

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

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

type ControllerRingList added in v0.9.0

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

ControllerRingList contains a list of ControllerRings.

func (*ControllerRingList) DeepCopy added in v0.9.0

func (in *ControllerRingList) DeepCopy() *ControllerRingList

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

func (*ControllerRingList) DeepCopyInto added in v0.9.0

func (in *ControllerRingList) DeepCopyInto(out *ControllerRingList)

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

func (*ControllerRingList) DeepCopyObject added in v0.9.0

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

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

type ControllerRingSpec added in v0.9.0

type ControllerRingSpec struct {
	// Resources specifies the list of resources that are distributed across shards in this ControllerRing.
	// +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"`
}

ControllerRingSpec defines the desired state of a ControllerRing.

func (*ControllerRingSpec) DeepCopy added in v0.9.0

func (in *ControllerRingSpec) DeepCopy() *ControllerRingSpec

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

func (*ControllerRingSpec) DeepCopyInto added in v0.9.0

func (in *ControllerRingSpec) DeepCopyInto(out *ControllerRingSpec)

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

type ControllerRingStatus added in v0.9.0

type ControllerRingStatus struct {
	// The generation observed by the ControllerRing 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"`
}

ControllerRingStatus defines the observed state of a ControllerRing.

func (*ControllerRingStatus) DeepCopy added in v0.9.0

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

func (*ControllerRingStatus) DeepCopyInto added in v0.9.0

func (in *ControllerRingStatus) DeepCopyInto(out *ControllerRingStatus)

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 ControllerRing.
	// 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