Documentation ¶
Overview ¶
Package v1alpha1 contains API Schema definitions for the workloads v1alpha1 API group +kubebuilder:object:generate=true +groupName=workloads.kubeblocks.io
Index ¶
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 )
Functions ¶
This section is empty.
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"` }
type ConsensusMemberStatus ¶
type ConsensusMemberStatus struct { // PodName pod name. // +kubebuilder:validation:Required // +kubebuilder:default=Unknown PodName string `json:"podName"` ConsensusRole `json:"role"` }
type ConsensusRole ¶
type ConsensusRole 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"` }
type ConsensusSet ¶
type ConsensusSet struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` Spec ConsensusSetSpec `json:"spec,omitempty"` Status ConsensusSetStatus `json:"status,omitempty"` }
ConsensusSet is the Schema for the consensussets API
func (*ConsensusSet) Default ¶
func (r *ConsensusSet) Default()
Default implements webhook.Defaulter so a webhook will be registered for the type
func (*ConsensusSet) SetupWebhookWithManager ¶
func (r *ConsensusSet) SetupWebhookWithManager(mgr ctrl.Manager) error
func (*ConsensusSet) ValidateCreate ¶
func (r *ConsensusSet) ValidateCreate() error
ValidateCreate implements webhook.Validator so a webhook will be registered for the type
func (*ConsensusSet) ValidateDelete ¶
func (r *ConsensusSet) ValidateDelete() error
ValidateDelete implements webhook.Validator so a webhook will be registered for the type
func (*ConsensusSet) ValidateUpdate ¶
func (r *ConsensusSet) ValidateUpdate(old runtime.Object) error
ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
type ConsensusSetList ¶
type ConsensusSetList struct { metav1.TypeMeta `json:",inline"` metav1.ListMeta `json:"metadata,omitempty"` Items []ConsensusSet `json:"items"` }
ConsensusSetList contains a list of ConsensusSet
type ConsensusSetSpec ¶
type ConsensusSetSpec struct { // Replicas defines number of Pods // +kubebuilder:default=1 // +kubebuilder:validation:Minimum=0 // +optional Replicas int32 `json:"replicas,omitempty"` // 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 // +kubebuilder:validation:Required Service corev1.ServiceSpec `json:"service"` Template corev1.PodTemplateSpec `json:"template"` // volumeClaimTemplates is a list of claims that pods are allowed to reference. // The ConsensusSet 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"` // Roles, a list of roles defined in this consensus system. // +kubebuilder:validation:Required Roles []ConsensusRole `json:"roles"` // RoleObservation provides method to observe role. // +kubebuilder:validation:Required RoleObservation RoleObservation `json:"roleObservation"` // MembershipReconfiguration provides actions to do membership dynamic reconfiguration. // +optional MembershipReconfiguration *MembershipReconfiguration `json:"membershipReconfiguration,omitempty"` // UpdateStrategy, Pods update strategy. // serial: update Pods 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 Pods 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:default=Serial // +kubebuilder:validation:Enum={Serial,BestEffortParallel,Parallel} // +optional UpdateStrategy UpdateStrategy `json:"updateStrategy,omitempty"` // Credential used to connect to DB engine // +optional Credential *Credential `json:"credential,omitempty"` }
ConsensusSetSpec defines the desired state of ConsensusSet
type ConsensusSetStatus ¶
type ConsensusSetStatus 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"` // members' status. // +optional MembersStatus []ConsensusMemberStatus `json:"membersStatus,omitempty"` }
ConsensusSetStatus defines the observed state of ConsensusSet
type Credential ¶
type Credential struct { // Username // variable name will be KB_CONSENSUS_SET_USERNAME // +kubebuilder:validation:Required Username CredentialVar `json:"username"` // Password // variable name will be KB_CONSENSUS_SET_PASSWORD // +kubebuilder:validation:Required Password CredentialVar `json:"password"` }
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"` }
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"` }
type RoleObservation ¶
type RoleObservation struct { // ObservationActions 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_CONSENSUS_SET_LAST_STDOUT stdout from last action, watch 'v_' prefixed // - KB_CONSENSUS_SET_USERNAME username part of credential // - KB_CONSENSUS_SET_PASSWORD password part of credential // +kubebuilder:validation:Required ObservationActions []Action `json:"observationActions"` // Number of seconds after the container has started before role observation has started. // +kubebuilder:default=0 // +kubebuilder:validation:Minimum=0 // +optional InitialDelaySeconds int32 `json:"initialDelaySeconds,omitempty"` // Number of seconds after which the observation 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 observation. // 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 observation 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 observation 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"` }
RoleObservation defines how to observe role
type UpdateStrategy ¶
type UpdateStrategy string
UpdateStrategy defines Cluster Component update strategy. +enum
const ( SerialUpdateStrategy UpdateStrategy = "Serial" BestEffortParallelUpdateStrategy UpdateStrategy = "BestEffortParallel" ParallelUpdateStrategy UpdateStrategy = "Parallel" )