Documentation ¶
Overview ¶
Package v1alpha1 contains API Schema definitions for the workloads v1alpha1 API group +kubebuilder:object:generate=true +groupName=workloads.kubeblocks.io
Index ¶
- Variables
- func Resource(resource string) schema.GroupResource
- type AccessMode
- type Action
- type Credential
- type CredentialVar
- type MemberStatus
- type MemberUpdateStrategy
- type MembershipReconfiguration
- type ReplicaRole
- type ReplicatedStateMachine
- func (in *ReplicatedStateMachine) DeepCopy() *ReplicatedStateMachine
- func (in *ReplicatedStateMachine) DeepCopyInto(out *ReplicatedStateMachine)
- func (in *ReplicatedStateMachine) DeepCopyObject() runtime.Object
- func (r *ReplicatedStateMachine) Default()
- func (r *ReplicatedStateMachine) SetupWebhookWithManager(mgr ctrl.Manager) error
- func (r *ReplicatedStateMachine) ValidateCreate() (admission.Warnings, error)
- func (r *ReplicatedStateMachine) ValidateDelete() (admission.Warnings, error)
- func (r *ReplicatedStateMachine) ValidateUpdate(old runtime.Object) (admission.Warnings, error)
- type ReplicatedStateMachineList
- type ReplicatedStateMachineSpec
- type ReplicatedStateMachineStatus
- type RoleProbe
- type RoleUpdateMechanism
Constants ¶
This section is empty.
Variables ¶
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 )
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 { // utility image contains command that can be used to retrieve of process role info // +optional Image string `json:"image,omitempty"` // Command will be executed in Container to retrieve or process role info // +kubebuilder:validation:Required Command []string `json:"command"` }
func (*Action) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Action.
func (*Action) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type Credential ¶
type Credential struct { // Username // variable name will be KB_RSM_USERNAME // +kubebuilder:validation:Required Username CredentialVar `json:"username"` // Password // variable name 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 { // Variable references $(VAR_NAME) are expanded // using the 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 be unchanged. Double $$ are reduced // to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. // "$$(VAR_NAME)" will produce the string literal "$(VAR_NAME)". // Escaped references will never be expanded, regardless of whether the variable // exists or not. // Defaults to "". // +optional Value string `json:"value,omitempty"` // Source for the environment variable's value. Cannot be used if value 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 { // PodName pod name. // +kubebuilder:validation:Required // +kubebuilder:default=Unknown PodName string `json:"podName"` ReplicaRole `json:"role"` }
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 { // SwitchoverAction specifies how to do switchover // latest [BusyBox](https://busybox.net/) image will be used if Image not configured // +optional SwitchoverAction *Action `json:"switchoverAction,omitempty"` // MemberJoinAction specifies how to add member // previous none-nil action's Image wil be used if not configured // +optional MemberJoinAction *Action `json:"memberJoinAction,omitempty"` // MemberLeaveAction specifies how to remove member // previous none-nil action's Image wil be used if not configured // +optional MemberLeaveAction *Action `json:"memberLeaveAction,omitempty"` // LogSyncAction specifies how to trigger the new member to start log syncing // previous none-nil action's Image wil be used if not configured // +optional LogSyncAction *Action `json:"logSyncAction,omitempty"` // PromoteAction specifies how to tell the cluster that the new member can join voting now // previous none-nil action's Image wil be used if not configured // +optional PromoteAction *Action `json:"promoteAction,omitempty"` }
func (*MembershipReconfiguration) DeepCopy ¶
func (in *MembershipReconfiguration) DeepCopy() *MembershipReconfiguration
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MembershipReconfiguration.
func (*MembershipReconfiguration) DeepCopyInto ¶
func (in *MembershipReconfiguration) DeepCopyInto(out *MembershipReconfiguration)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type ReplicaRole ¶
type ReplicaRole struct { // Name, role name. // +kubebuilder:validation:Required // +kubebuilder:default=leader Name string `json:"name"` // AccessMode, what service this member capable. // +kubebuilder:validation:Required // +kubebuilder:default=ReadWrite // +kubebuilder:validation:Enum={None, Readonly, ReadWrite} AccessMode AccessMode `json:"accessMode"` // CanVote, whether this member has voting rights // +kubebuilder:default=true // +optional CanVote bool `json:"canVote"` // IsLeader, whether 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 { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` Spec ReplicatedStateMachineSpec `json:"spec,omitempty"` Status ReplicatedStateMachineStatus `json:"status,omitempty"` }
ReplicatedStateMachine is the Schema for the replicatedstatemachines API.
func (*ReplicatedStateMachine) DeepCopy ¶
func (in *ReplicatedStateMachine) DeepCopy() *ReplicatedStateMachine
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 ¶
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 ¶
func (in *ReplicatedStateMachineList) DeepCopy() *ReplicatedStateMachineList
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReplicatedStateMachineList.
func (*ReplicatedStateMachineList) DeepCopyInto ¶
func (in *ReplicatedStateMachineList) DeepCopyInto(out *ReplicatedStateMachineList)
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 { // replicas is the desired number of replicas of the given Template. // These are replicas in the sense that they are instantiations of the // same Template, but individual replicas also have a consistent identity. // If unspecified, defaults to 1. // +kubebuilder:default=1 // +kubebuilder:validation:Minimum=0 // +optional Replicas *int32 `json:"replicas,omitempty"` // selector is 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"` // serviceName is 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 the // pattern: pod-specific-string.serviceName.default.svc.cluster.local // where "pod-specific-string" is managed by the StatefulSet controller. ServiceName string `json:"serviceName"` // service 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"` // AlternativeServices 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"` // volumeClaimTemplates is 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"` // podManagementPolicy 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 (pod-0, then // pod-1, etc) and the controller will wait 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"` // updateStrategy 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"` // Roles, a list of roles defined in the system. // +optional Roles []ReplicaRole `json:"roles,omitempty"` // RoleProbe provides method to probe role. // +optional RoleProbe *RoleProbe `json:"roleProbe,omitempty"` // MembershipReconfiguration provides actions to do membership dynamic reconfiguration. // +optional MembershipReconfiguration *MembershipReconfiguration `json:"membershipReconfiguration,omitempty"` // MemberUpdateStrategy, Members(Pods) update strategy. // serial: update Members one by one that guarantee minimum component unavailable time. // Learner -> Follower(with AccessMode=none) -> Follower(with AccessMode=readonly) -> Follower(with AccessMode=readWrite) -> Leader // bestEffortParallel: update Members in parallel that guarantee minimum component un-writable time. // Learner, Follower(minority) in parallel -> Follower(majority) -> Leader, keep majority online all the time. // parallel: force parallel // +kubebuilder:validation:Enum={Serial,BestEffortParallel,Parallel} // +optional MemberUpdateStrategy *MemberUpdateStrategy `json:"memberUpdateStrategy,omitempty"` // Credential used to connect to DB engine // +optional Credential *Credential `json:"credential,omitempty"` }
ReplicatedStateMachineSpec defines the desired state of ReplicatedStateMachine
func (*ReplicatedStateMachineSpec) DeepCopy ¶
func (in *ReplicatedStateMachineSpec) DeepCopy() *ReplicatedStateMachineSpec
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReplicatedStateMachineSpec.
func (*ReplicatedStateMachineSpec) DeepCopyInto ¶
func (in *ReplicatedStateMachineSpec) DeepCopyInto(out *ReplicatedStateMachineSpec)
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"` // InitReplicas is the number of pods(members) when cluster first initialized // it's set to spec.Replicas at object creation time and never changes InitReplicas int32 `json:"initReplicas"` // ReadyInitReplicas is the number of pods(members) already in MembersStatus in the cluster initialization stage // will never change once equals to InitReplicas // +optional ReadyInitReplicas int32 `json:"readyInitReplicas,omitempty"` // CurrentGeneration, if not empty, indicates the version of the RSM used to generate the underlying workload // +optional CurrentGeneration int64 `json:"currentGeneration,omitempty"` // members' status. // +optional MembersStatus []MemberStatus `json:"membersStatus,omitempty"` }
ReplicatedStateMachineStatus defines the observed state of ReplicatedStateMachine
func (*ReplicatedStateMachineStatus) DeepCopy ¶
func (in *ReplicatedStateMachineStatus) DeepCopy() *ReplicatedStateMachineStatus
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReplicatedStateMachineStatus.
func (*ReplicatedStateMachineStatus) DeepCopyInto ¶
func (in *ReplicatedStateMachineStatus) DeepCopyInto(out *ReplicatedStateMachineStatus)
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 { // ProbeActions define Actions to be taken in serial. // after all actions done, the final output should be a single string of the role name defined in spec.Roles // latest [BusyBox](https://busybox.net/) image will be used if Image not configured // Environment variables can be used in Command: // - v_KB_RSM_LAST_STDOUT stdout from last action, watch 'v_' prefixed // - KB_RSM_USERNAME username part of credential // - KB_RSM_PASSWORD password part of credential // +kubebuilder:validation:Required ProbeActions []Action `json:"probeActions"` // Number of seconds after the container has started before role probe has started. // +kubebuilder:default=0 // +kubebuilder:validation:Minimum=0 // +optional InitialDelaySeconds int32 `json:"initialDelaySeconds,omitempty"` // Number of seconds after which the probe times out. // Defaults to 1 second. Minimum value is 1. // +kubebuilder:default=1 // +kubebuilder:validation:Minimum=1 // +optional TimeoutSeconds int32 `json:"timeoutSeconds,omitempty"` // How often (in seconds) to perform the probe. // Default to 2 seconds. Minimum value is 1. // +kubebuilder:default=2 // +kubebuilder:validation:Minimum=1 // +optional PeriodSeconds int32 `json:"periodSeconds,omitempty"` // Minimum consecutive successes for the probe to be considered successful after having failed. // Defaults to 1. Minimum value is 1. // +kubebuilder:default=1 // +kubebuilder:validation:Minimum=1 // +optional SuccessThreshold int32 `json:"successThreshold,omitempty"` // Minimum consecutive failures for the probe to be considered failed after having succeeded. // Defaults to 3. Minimum value is 1. // +kubebuilder:default=3 // +kubebuilder:validation:Minimum=1 // +optional FailureThreshold int32 `json:"failureThreshold,omitempty"` // RoleUpdateMechanism specifies the way how pod role label being updated. // +kubebuilder:default=None // +kubebuilder:validation:Enum={ReadinessProbeEventUpdate, DirectAPIServerEventUpdate, None} // +optional RoleUpdateMechanism RoleUpdateMechanism `json:"roleUpdateMechanism,omitempty"` }
RoleProbe defines how to observe role
func (*RoleProbe) DeepCopy ¶ added in v0.7.0
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RoleProbe.
func (*RoleProbe) DeepCopyInto ¶ added in v0.7.0
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" NoneUpdate RoleUpdateMechanism = "None" )