v1alpha1

package
v0.6.2-beta.1 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2023 License: AGPL-3.0 Imports: 11 Imported by: 2

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

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 {
	// 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

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 {
	// 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 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

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 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

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() error

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

func (*ReplicatedStateMachine) ValidateDelete

func (r *ReplicatedStateMachine) ValidateDelete() error

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

func (*ReplicatedStateMachine) ValidateUpdate

func (r *ReplicatedStateMachine) ValidateUpdate(old runtime.Object) 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 {
	// 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 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"`

	// Roles, a list of roles defined in the system.
	// +kubebuilder:validation:Required
	Roles []ReplicaRole `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"`
}

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"`

	// 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 []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 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_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
	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.
	// 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

func (*RoleObservation) DeepCopy

func (in *RoleObservation) DeepCopy() *RoleObservation

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

func (*RoleObservation) DeepCopyInto

func (in *RoleObservation) DeepCopyInto(out *RoleObservation)

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

type UpdateStrategy

type UpdateStrategy string

UpdateStrategy defines Cluster Component update strategy. +enum

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

Jump to

Keyboard shortcuts

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