v1alpha1

package
v0.9.0-alpha.5 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2024 License: AGPL-3.0 Imports: 13 Imported by: 4

Documentation

Overview

+k8s:deepcopy-gen=package,register +k8s:openapi-gen=true +groupName=workloads.kubeblocks.io

Package v1alpha1 contains API Schema definitions for the workloads v1alpha1 API group +kubebuilder:object:generate=true +groupName=workloads.kubeblocks.io

Index

Constants

View Source
const (
	ReplicatedStateMachineKind = "ReplicatedStateMachine"
)

Variables

View Source
var (
	// GroupVersion is group version used to register these objects
	GroupVersion = schema.GroupVersion{Group: "workloads.kubeblocks.io", Version: "v1alpha1"}

	// SchemeBuilder is used to add go types to the GroupVersionKind scheme
	SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}

	// AddToScheme adds the types in this group-version to the given scheme.
	AddToScheme = SchemeBuilder.AddToScheme
)
View Source
var SchemeGroupVersion = GroupVersion

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 AccessMode

type AccessMode string

AccessMode defines SVC access mode enums. +enum

const (
	ReadWriteMode AccessMode = "ReadWrite"
	ReadonlyMode  AccessMode = "Readonly"
	NoneMode      AccessMode = "None"
)

type Action

type Action struct {
	// Refers to the utility image that contains the command which can be utilized to retrieve or process role information.
	//
	// +optional
	Image string `json:"image,omitempty"`

	// A set of instructions that will be executed within the Container to retrieve or process role information. This field is required.
	//
	// +kubebuilder:validation:Required
	Command []string `json:"command"`

	// Additional parameters used to perform specific statements. This field is optional.
	//
	// +optional
	Args []string `json:"args,omitempty"`
}

func (*Action) DeepCopy

func (in *Action) DeepCopy() *Action

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

func (*Action) DeepCopyInto

func (in *Action) DeepCopyInto(out *Action)

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

type Credential

type Credential struct {
	// Defines the user's name for the credential.
	// The corresponding environment variable will be KB_RSM_USERNAME.
	//
	// +kubebuilder:validation:Required
	Username CredentialVar `json:"username"`

	// Represents the user's password for the credential.
	// The corresponding environment variable will be KB_RSM_PASSWORD.
	//
	// +kubebuilder:validation:Required
	Password CredentialVar `json:"password"`
}

func (*Credential) DeepCopy

func (in *Credential) DeepCopy() *Credential

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

func (*Credential) DeepCopyInto

func (in *Credential) DeepCopyInto(out *Credential)

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

type CredentialVar

type CredentialVar struct {
	// Specifies the value of the environment variable. This field is optional and defaults to an empty string.
	// The value can include variable references in the format $(VAR_NAME) which will be expanded using previously defined environment variables in the container and any service environment variables.
	//
	// If a variable cannot be resolved, the reference in the input string will remain unchanged.
	// Double $$ can be used to escape the $(VAR_NAME) syntax, resulting in a single $ and producing the string literal "$(VAR_NAME)".
	// Escaped references will not be expanded, regardless of whether the variable exists or not.
	//
	// +optional
	Value string `json:"value,omitempty"`

	// Defines the source for the environment variable's value. This field is optional and cannot be used if the 'Value' field is not empty.
	//
	// +optional
	ValueFrom *corev1.EnvVarSource `json:"valueFrom,omitempty"`
}

func (*CredentialVar) DeepCopy

func (in *CredentialVar) DeepCopy() *CredentialVar

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

func (*CredentialVar) DeepCopyInto

func (in *CredentialVar) DeepCopyInto(out *CredentialVar)

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

type MemberStatus

type MemberStatus struct {
	// Represents the name of the pod.
	//
	// +kubebuilder:validation:Required
	// +kubebuilder:default=Unknown
	PodName string `json:"podName"`

	// Defines the role of the replica in the cluster.
	ReplicaRole `json:"role"`

	// Indicates whether it is required for the replica set manager (rsm) to have at least one primary pod ready.
	//
	// +optional
	ReadyWithoutPrimary bool `json:"readyWithoutPrimary"`
}

func (*MemberStatus) DeepCopy

func (in *MemberStatus) DeepCopy() *MemberStatus

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

func (*MemberStatus) DeepCopyInto

func (in *MemberStatus) DeepCopyInto(out *MemberStatus)

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

type MemberUpdateStrategy added in v0.7.0

type MemberUpdateStrategy string

MemberUpdateStrategy defines Cluster Component update strategy. +enum

const (
	SerialUpdateStrategy             MemberUpdateStrategy = "Serial"
	BestEffortParallelUpdateStrategy MemberUpdateStrategy = "BestEffortParallel"
	ParallelUpdateStrategy           MemberUpdateStrategy = "Parallel"
)

type MembershipReconfiguration

type MembershipReconfiguration struct {
	// Specifies the environment variables that can be used in all following Actions:
	// - KB_RSM_USERNAME: Represents the username part of the credential
	// - KB_RSM_PASSWORD: Represents the password part of the credential
	// - KB_RSM_LEADER_HOST: Represents the leader host
	// - KB_RSM_TARGET_HOST: Represents the target host
	// - KB_RSM_SERVICE_PORT: Represents the service port
	//
	// Defines the action to perform a switchover.
	// If the Image is not configured, the latest [BusyBox](https://busybox.net/) image will be used.
	//
	// +optional
	SwitchoverAction *Action `json:"switchoverAction,omitempty"`

	// Defines the action to add a member.
	// If the Image is not configured, the Image from the previous non-nil action will be used.
	//
	// +optional
	MemberJoinAction *Action `json:"memberJoinAction,omitempty"`

	// Defines the action to remove a member.
	// If the Image is not configured, the Image from the previous non-nil action will be used.
	//
	// +optional
	MemberLeaveAction *Action `json:"memberLeaveAction,omitempty"`

	// Defines the action to trigger the new member to start log syncing.
	// If the Image is not configured, the Image from the previous non-nil action will be used.
	//
	// +optional
	LogSyncAction *Action `json:"logSyncAction,omitempty"`

	// Defines the action to inform the cluster that the new member can join voting now.
	// If the Image is not configured, the Image from the previous non-nil action will be used.
	//
	// +optional
	PromoteAction *Action `json:"promoteAction,omitempty"`
}

func (*MembershipReconfiguration) DeepCopy

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

func (*MembershipReconfiguration) DeepCopyInto

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

type NodeAssignment added in v0.8.0

type NodeAssignment struct {
	// Specifies the identifier for the statefulSet requiring node allocation.
	//
	// +optional
	Name string `json:"name,omitempty"`

	// Provides comprehensive details of the node to be assigned to the statefulSet.
	//
	// +optional
	NodeSpec NodeSpec `json:"nodeSpec,omitempty"`
}

func (*NodeAssignment) DeepCopy added in v0.8.0

func (in *NodeAssignment) DeepCopy() *NodeAssignment

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

func (*NodeAssignment) DeepCopyInto added in v0.8.0

func (in *NodeAssignment) DeepCopyInto(out *NodeAssignment)

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

type NodeSpec added in v0.8.0

type NodeSpec struct {
	// Represents the name of the node. This is a unique identifier within the cluster and is used to identify the specific node for scheduling, reporting, and other tasks.
	//
	// +optional
	NodeName types.NodeName `json:"nodeName,omitempty"`
}

func (*NodeSpec) DeepCopy added in v0.8.0

func (in *NodeSpec) DeepCopy() *NodeSpec

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

func (*NodeSpec) DeepCopyInto added in v0.8.0

func (in *NodeSpec) DeepCopyInto(out *NodeSpec)

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

type ReplicaRole

type ReplicaRole struct {

	// Defines the role name of the replica.
	//
	// +kubebuilder:validation:Required
	// +kubebuilder:default=leader
	Name string `json:"name"`

	// Specifies the service capabilities of this member.
	//
	// +kubebuilder:validation:Required
	// +kubebuilder:default=ReadWrite
	// +kubebuilder:validation:Enum={None, Readonly, ReadWrite}
	AccessMode AccessMode `json:"accessMode"`

	// Indicates if this member has voting rights.
	//
	// +kubebuilder:default=true
	// +optional
	CanVote bool `json:"canVote"`

	// Determines if this member is the leader.
	//
	// +kubebuilder:default=false
	// +optional
	IsLeader bool `json:"isLeader"`
}

func (*ReplicaRole) DeepCopy

func (in *ReplicaRole) DeepCopy() *ReplicaRole

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

func (*ReplicaRole) DeepCopyInto

func (in *ReplicaRole) DeepCopyInto(out *ReplicaRole)

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

type ReplicatedStateMachine

type ReplicatedStateMachine struct {
	// The metadata for the type, like API version and kind.
	metav1.TypeMeta `json:",inline"`

	// Contains the metadata for the particular object, such as name, namespace, labels, and annotations.
	metav1.ObjectMeta `json:"metadata,omitempty"`

	// Defines the desired state of the state machine. It includes the configuration details for the state machine.
	//
	Spec ReplicatedStateMachineSpec `json:"spec,omitempty"`

	// Represents the current information about the state machine. This data may be out of date.
	//
	Status ReplicatedStateMachineStatus `json:"status,omitempty"`
}

ReplicatedStateMachine is the Schema for the replicatedstatemachines API.

func (*ReplicatedStateMachine) DeepCopy

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

func (*ReplicatedStateMachine) DeepCopyInto

func (in *ReplicatedStateMachine) DeepCopyInto(out *ReplicatedStateMachine)

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

func (*ReplicatedStateMachine) DeepCopyObject

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

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

func (*ReplicatedStateMachine) Default

func (r *ReplicatedStateMachine) Default()

Default implements webhook.Defaulter so a webhook will be registered for the type

func (*ReplicatedStateMachine) SetupWebhookWithManager

func (r *ReplicatedStateMachine) SetupWebhookWithManager(mgr ctrl.Manager) error

func (*ReplicatedStateMachine) ValidateCreate

func (r *ReplicatedStateMachine) ValidateCreate() (admission.Warnings, error)

ValidateCreate implements webhook.Validator so a webhook will be registered for the type

func (*ReplicatedStateMachine) ValidateDelete

func (r *ReplicatedStateMachine) ValidateDelete() (admission.Warnings, error)

ValidateDelete implements webhook.Validator so a webhook will be registered for the type

func (*ReplicatedStateMachine) ValidateUpdate

func (r *ReplicatedStateMachine) ValidateUpdate(old runtime.Object) (admission.Warnings, error)

ValidateUpdate implements webhook.Validator so a webhook will be registered for the type

type ReplicatedStateMachineList

type ReplicatedStateMachineList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []ReplicatedStateMachine `json:"items"`
}

ReplicatedStateMachineList contains a list of ReplicatedStateMachine

func (*ReplicatedStateMachineList) DeepCopy

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

func (*ReplicatedStateMachineList) DeepCopyInto

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

func (*ReplicatedStateMachineList) DeepCopyObject

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

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

type ReplicatedStateMachineSpec

type ReplicatedStateMachineSpec struct {
	// Specifies the desired number of replicas of the given Template.
	// These replicas are instantiations of the same Template, with each having a consistent identity.
	// Defaults to 1 if unspecified.
	// +kubebuilder:default=1
	// +kubebuilder:validation:Minimum=0
	// +optional
	Replicas *int32 `json:"replicas,omitempty"`

	// Defines the minimum number of seconds a newly created pod should be ready
	// without any of its container crashing to be considered available.
	// Defaults to 0, meaning the pod will be considered available as soon as it is ready.
	// +kubebuilder:default=0
	// +kubebuilder:validation:Minimum=0
	// +optional
	MinReadySeconds int32 `json:"minReadySeconds,omitempty"`

	// Represents a label query over pods that should match the replica count.
	// It must match the pod template's labels.
	// More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors
	Selector *metav1.LabelSelector `json:"selector"`

	// Refers to the name of the service that governs this StatefulSet.
	// This service must exist before the StatefulSet and is responsible for
	// the network identity of the set. Pods get DNS/hostnames that follow a specific pattern.
	ServiceName string `json:"serviceName"`

	// Defines the behavior of a service spec.
	// Provides read-write service.
	// https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
	// +kubebuilder:pruning:PreserveUnknownFields
	// +optional
	Service *corev1.Service `json:"service,omitempty"`

	// Defines Alternative Services selector pattern specifier.
	// Can be used for creating Readonly service.
	// +optional
	AlternativeServices []corev1.Service `json:"alternativeServices,omitempty"`

	Template corev1.PodTemplateSpec `json:"template"`

	// Represents a list of claims that pods are allowed to reference.
	// The ReplicatedStateMachine controller is responsible for mapping network identities to
	// claims in a way that maintains the identity of a pod. Every claim in
	// this list must have at least one matching (by name) volumeMount in one
	// container in the template. A claim in this list takes precedence over
	// any volumes in the template, with the same name.
	// +optional
	VolumeClaimTemplates []corev1.PersistentVolumeClaim `json:"volumeClaimTemplates,omitempty"`

	// Controls how pods are created during initial scale up,
	// when replacing pods on nodes, or when scaling down.
	//
	// The default policy is `OrderedReady`, where pods are created in increasing order and the controller waits until each pod is ready before
	// continuing. When scaling down, the pods are removed in the opposite order.
	// The alternative policy is `Parallel` which will create pods in parallel
	// to match the desired scale without waiting, and on scale down will delete
	// all pods at once.
	//
	// +optional
	PodManagementPolicy appsv1.PodManagementPolicyType `json:"podManagementPolicy,omitempty"`

	// Indicates the StatefulSetUpdateStrategy that will be
	// employed to update Pods in the RSM when a revision is made to
	// Template.
	// UpdateStrategy.Type will be set to appsv1.OnDeleteStatefulSetStrategyType if MemberUpdateStrategy is not nil
	UpdateStrategy appsv1.StatefulSetUpdateStrategy `json:"updateStrategy,omitempty"`

	// A list of roles defined in the system.
	// +optional
	Roles []ReplicaRole `json:"roles,omitempty"`

	// Provides method to probe role.
	// +optional
	RoleProbe *RoleProbe `json:"roleProbe,omitempty"`

	// Provides actions to do membership dynamic reconfiguration.
	// +optional
	MembershipReconfiguration *MembershipReconfiguration `json:"membershipReconfiguration,omitempty"`

	// Members(Pods) update strategy.
	//
	// - serial: update Members one by one that guarantee minimum component unavailable time.
	// - bestEffortParallel: update Members in parallel that guarantee minimum component un-writable time.
	// - parallel: force parallel
	//
	// +kubebuilder:validation:Enum={Serial,BestEffortParallel,Parallel}
	// +optional
	MemberUpdateStrategy *MemberUpdateStrategy `json:"memberUpdateStrategy,omitempty"`

	// Indicates that the rsm is paused, meaning the reconciliation of this rsm object will be paused.
	// +optional
	Paused bool `json:"paused,omitempty"`

	// Credential used to connect to DB engine
	// +optional
	Credential *Credential `json:"credential,omitempty"`

	// Defines the policy to generate sts using rsm. Passed from cluster.
	// ToSts: rsm transform to statefulSet
	// ToPod: rsm transform to pod
	// +kubebuilder:validation:Required
	// +kubebuilder:default=ToSts
	// +optional
	RsmTransformPolicy RsmTransformPolicy `json:"rsmTransformPolicy,omitempty"`

	// Defines the expected assignment of nodes.
	// +optional
	NodeAssignment []NodeAssignment `json:"nodeAssignment,omitempty"`
}

ReplicatedStateMachineSpec defines the desired state of ReplicatedStateMachine

func (*ReplicatedStateMachineSpec) DeepCopy

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

func (*ReplicatedStateMachineSpec) DeepCopyInto

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

type ReplicatedStateMachineStatus

type ReplicatedStateMachineStatus struct {
	appsv1.StatefulSetStatus `json:",inline"`

	// Defines the initial number of pods (members) when the cluster is first initialized.
	// This value is set to spec.Replicas at the time of object creation and remains constant thereafter.
	InitReplicas int32 `json:"initReplicas"`

	// Represents the number of pods (members) that have already reached the MembersStatus during the cluster initialization stage.
	// This value remains constant once it equals InitReplicas.
	//
	// +optional
	ReadyInitReplicas int32 `json:"readyInitReplicas,omitempty"`

	// When not empty, indicates the version of the Replicated State Machine (RSM) used to generate the underlying workload.
	//
	// +optional
	CurrentGeneration int64 `json:"currentGeneration,omitempty"`

	// Provides the status of each member in the cluster.
	//
	// +optional
	MembersStatus []MemberStatus `json:"membersStatus,omitempty"`
}

ReplicatedStateMachineStatus defines the observed state of ReplicatedStateMachine

func (*ReplicatedStateMachineStatus) DeepCopy

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

func (*ReplicatedStateMachineStatus) DeepCopyInto

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

type RoleProbe added in v0.7.0

type RoleProbe struct {
	// Specifies the builtin handler name to use to probe the role of the main container.
	// Available handlers include: mysql, postgres, mongodb, redis, etcd, kafka.
	// Use CustomHandler to define a custom role probe function if none of the built-in handlers meet the requirement.
	//
	// +optional
	BuiltinHandler *string `json:"builtinHandlerName,omitempty"`

	// Defines a custom method for role probing.
	// If the BuiltinHandler meets the requirement, use it instead.
	// Actions defined here are executed in series.
	// Upon completion of all actions, the final output should be a single string representing the role name defined in spec.Roles.
	// The latest [BusyBox](https://busybox.net/) image will be used if Image is not configured.
	// Environment variables can be used in Command:
	// - v_KB_RSM_LAST_STDOUT: stdout from the last action, watch for 'v_' prefix
	// - KB_RSM_USERNAME: username part of the credential
	// - KB_RSM_PASSWORD: password part of the credential
	//
	// +optional
	CustomHandler []Action `json:"customHandler,omitempty"`

	// Specifies the number of seconds to wait after the container has started before initiating role probing.
	//
	// +kubebuilder:default=0
	// +kubebuilder:validation:Minimum=0
	// +optional
	InitialDelaySeconds int32 `json:"initialDelaySeconds,omitempty"`

	// Specifies the number of seconds after which the probe times out.
	//
	// +kubebuilder:default=1
	// +kubebuilder:validation:Minimum=1
	// +optional
	TimeoutSeconds int32 `json:"timeoutSeconds,omitempty"`

	// Specifies the frequency (in seconds) of probe execution.
	//
	// +kubebuilder:default=2
	// +kubebuilder:validation:Minimum=1
	// +optional
	PeriodSeconds int32 `json:"periodSeconds,omitempty"`

	// Specifies the minimum number of consecutive successes for the probe to be considered successful after having failed.
	//
	// +kubebuilder:default=1
	// +kubebuilder:validation:Minimum=1
	// +optional
	SuccessThreshold int32 `json:"successThreshold,omitempty"`

	// Specifies the minimum number of consecutive failures for the probe to be considered failed after having succeeded.
	//
	// +kubebuilder:default=3
	// +kubebuilder:validation:Minimum=1
	// +optional
	FailureThreshold int32 `json:"failureThreshold,omitempty"`

	// Specifies the method for updating the pod role label.
	//
	// +kubebuilder:default=ReadinessProbeEventUpdate
	// +kubebuilder:validation:Enum={ReadinessProbeEventUpdate, DirectAPIServerEventUpdate}
	// +optional
	RoleUpdateMechanism RoleUpdateMechanism `json:"roleUpdateMechanism,omitempty"`
}

RoleProbe defines how to observe role

func (*RoleProbe) DeepCopy added in v0.7.0

func (in *RoleProbe) DeepCopy() *RoleProbe

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

func (*RoleProbe) DeepCopyInto added in v0.7.0

func (in *RoleProbe) DeepCopyInto(out *RoleProbe)

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

type RoleUpdateMechanism added in v0.7.0

type RoleUpdateMechanism string

RoleUpdateMechanism defines the way how pod role label being updated. +enum

const (
	ReadinessProbeEventUpdate  RoleUpdateMechanism = "ReadinessProbeEventUpdate"
	DirectAPIServerEventUpdate RoleUpdateMechanism = "DirectAPIServerEventUpdate"
)

type RsmTransformPolicy added in v0.8.0

type RsmTransformPolicy string

RsmTransformPolicy defines rsm transform type ToSts and ToPod is supported +enum +kubebuilder:validation:Enum={ToPod,ToSts}

const (
	ToSts RsmTransformPolicy = "ToSts"
	ToPod RsmTransformPolicy = "ToPod"
)

Jump to

Keyboard shortcuts

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