v1alpha1

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2024 License: AGPL-3.0 Imports: 38 Imported by: 20

Documentation

Overview

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

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

Package v1alpha1 contains API Schema definitions for the apps v1alpha1 API group

Index

Constants

View Source
const (
	// condition types
	ConditionTypeCancelled          = "Cancelled"
	ConditionTypeWaitForProgressing = "WaitForProgressing"
	ConditionTypeValidated          = "Validated"
	ConditionTypeSucceed            = "Succeed"
	ConditionTypeFailed             = "Failed"
	ConditionTypeAborted            = "Aborted"
	ConditionTypeRestarting         = "Restarting"
	ConditionTypeVerticalScaling    = "VerticalScaling"
	ConditionTypeHorizontalScaling  = "HorizontalScaling"
	ConditionTypeVolumeExpanding    = "VolumeExpanding"
	ConditionTypeReconfigure        = "Reconfigure"
	ConditionTypeSwitchover         = "Switchover"
	ConditionTypeStop               = "Stopping"
	ConditionTypeStart              = "Starting"
	ConditionTypeVersionUpgrading   = "VersionUpgrading"
	ConditionTypeExpose             = "Exposing"
	ConditionTypeDataScript         = "ExecuteDataScript"
	ConditionTypeBackup             = "Backup"
	ConditionTypeInstanceRebuilding = "InstancesRebuilding"
	ConditionTypeCustomOperation    = "CustomOperation"

	ReasonReconfigurePersisting    = "ReconfigurePersisting"
	ReasonReconfigurePersisted     = "ReconfigurePersisted"
	ReasonReconfigureFailed        = "ReconfigureFailed"
	ReasonReconfigureRestartFailed = "ReconfigureRestartFailed"
	ReasonReconfigureRestart       = "ReconfigureRestarted"
	ReasonReconfigureNoChanged     = "ReconfigureNoChanged"
	ReasonReconfigureSucceed       = "ReconfigureSucceed"
	ReasonReconfigureRunning       = "ReconfigureRunning"
	ReasonClusterPhaseMismatch     = "ClusterPhaseMismatch"
	ReasonOpsTypeNotSupported      = "OpsTypeNotSupported"
	ReasonValidateFailed           = "ValidateFailed"
	ReasonClusterNotFound          = "ClusterNotFound"
	ReasonOpsRequestFailed         = "OpsRequestFailed"
	ReasonOpsCanceling             = "Canceling"
	ReasonOpsCancelFailed          = "CancelFailed"
	ReasonOpsCancelSucceed         = "CancelSucceed"
	ReasonOpsCancelByController    = "CancelByController"
)
View Source
const (
	APIVersion            = "apps.kubeblocks.io/v1alpha1"
	ClusterVersionKind    = "ClusterVersion"
	ClusterDefinitionKind = "ClusterDefinition"
	ClusterKind           = "Cluster"
	ComponentKind         = "Component"
	OpsRequestKind        = "OpsRequestKind"
)
View Source
const (
	// define the cluster condition type
	ConditionTypeHaltRecovery        = "HaltRecovery"        // ConditionTypeHaltRecovery describe Halt recovery processing stage
	ConditionTypeProvisioningStarted = "ProvisioningStarted" // ConditionTypeProvisioningStarted the operator starts resource provisioning to create or change the cluster
	ConditionTypeApplyResources      = "ApplyResources"      // ConditionTypeApplyResources the operator start to apply resources to create or change the cluster
	ConditionTypeReplicasReady       = "ReplicasReady"       // ConditionTypeReplicasReady all pods of components are ready
	ConditionTypeReady               = "Ready"               // ConditionTypeReady all components are running
	ConditionTypeSwitchoverPrefix    = "Switchover-"         // ConditionTypeSwitchoverPrefix component status condition of switchover
)
View Source
const (
	KBAccountInvalid        KBAccountType = 0
	KBAccountAdmin                        = 1
	KBAccountDataprotection               = 1 << 1
	KBAccountProbe                        = 1 << 2
	KBAccountMonitor                      = 1 << 3
	KBAccountReplicator                   = 1 << 4
	KBAccountMAX                          = KBAccountReplicator // KBAccountMAX indicates the max value of KBAccountType, used for validation.
)

System accounts represented in bit.

View Source
const DefaultRoleProbeTimeoutAfterPodsReady int32 = 60

DefaultRoleProbeTimeoutAfterPodsReady the default role probe timeout for application when all pods of component are ready. default values are 60 seconds.

View Source
const (
	KBSwitchoverCandidateInstanceForAnyPod = "*"
)

Variables

View Source
var (
	// GroupVersion is group version used to register these objects
	GroupVersion = schema.GroupVersion{Group: "apps.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 (
	ErrWorkloadTypeIsUnknown   = errors.New("workloadType is unknown")
	ErrWorkloadTypeIsStateless = errors.New("workloadType should not be stateless")
	ErrNotMatchingCompDef      = errors.New("not matching componentDefRef")
)
View Source
var DefaultLeader = ConsensusMember{
	Name:       "leader",
	AccessMode: ReadWrite,
}
View Source
var (

	// OpsRequestBehaviourMapper records the opsRequest behaviour according to the OpsType.
	OpsRequestBehaviourMapper = map[OpsType]OpsRequestBehaviour{}
)

log is for logging in this package.

View Source
var SchemeGroupVersion = GroupVersion

SchemeGroupVersion is group version used to register these objects.

View Source
var WorkloadTypes = []string{"Stateless", "Stateful", "Consensus", "Replication"}

Functions

func ComponentPodsAreReady added in v0.6.0

func ComponentPodsAreReady(podsAreReady *bool) bool

ComponentPodsAreReady checks if the pods of component are ready.

func GetInstanceTemplateName added in v0.9.0

func GetInstanceTemplateName(clusterName, componentName, instanceName string) string

GetInstanceTemplateName get the instance template name by instance name.

func NewAbortedCondition added in v0.9.0

func NewAbortedCondition(message string) *metav1.Condition

NewAbortedCondition creates a condition for aborted phase.

func NewBackupCondition added in v0.7.0

func NewBackupCondition(ops *OpsRequest) *metav1.Condition

NewBackupCondition creates a condition that the OpsRequest backup the cluster.

func NewCancelFailedCondition added in v0.6.0

func NewCancelFailedCondition(ops *OpsRequest, err error) *metav1.Condition

NewCancelFailedCondition creates a condition for canceling failed.

func NewCancelSucceedCondition added in v0.6.0

func NewCancelSucceedCondition(opsName string) *metav1.Condition

NewCancelSucceedCondition creates a condition for canceling successfully.

func NewCancelingCondition added in v0.6.0

func NewCancelingCondition(ops *OpsRequest) *metav1.Condition

NewCancelingCondition the controller is canceling the OpsRequest

func NewDataScriptCondition added in v0.6.0

func NewDataScriptCondition(ops *OpsRequest) *metav1.Condition

func NewExposingCondition

func NewExposingCondition(ops *OpsRequest) *metav1.Condition

func NewFailedCondition

func NewFailedCondition(ops *OpsRequest, err error) *metav1.Condition

NewFailedCondition creates a condition that the OpsRequest processing failed

func NewHorizontalScalingCondition

func NewHorizontalScalingCondition(ops *OpsRequest) *metav1.Condition

NewHorizontalScalingCondition creates a condition that the OpsRequest starts to horizontal scale cluster

func NewInstancesRebuildingCondition added in v0.8.3

func NewInstancesRebuildingCondition(ops *OpsRequest) *metav1.Condition

NewInstancesRebuildingCondition creates a condition that the operation starts to rebuild the instances.

func NewReconfigureCondition

func NewReconfigureCondition(ops *OpsRequest) *metav1.Condition

NewReconfigureCondition creates a condition that the OpsRequest updating component configuration

func NewReconfigureFailedCondition

func NewReconfigureFailedCondition(ops *OpsRequest, err error) *metav1.Condition

NewReconfigureFailedCondition creates a condition for the failed reconfigure.

func NewReconfigureRunningCondition

func NewReconfigureRunningCondition(ops *OpsRequest, conditionType string, configSpecName string, info ...string) *metav1.Condition

NewReconfigureRunningCondition creates a condition that the OpsRequest reconfigure workflow

func NewRestartingCondition

func NewRestartingCondition(ops *OpsRequest) *metav1.Condition

NewRestartingCondition creates a condition that the operation starts to restart components

func NewRestoreCondition added in v0.8.0

func NewRestoreCondition(ops *OpsRequest) *metav1.Condition

NewRestoreCondition creates a condition that the OpsRequest restore the cluster.

func NewStartCondition

func NewStartCondition(ops *OpsRequest) *metav1.Condition

NewStartCondition creates a condition that the OpsRequest starts the cluster.

func NewStopCondition

func NewStopCondition(ops *OpsRequest) *metav1.Condition

NewStopCondition creates a condition that the OpsRequest starts to stop the cluster.

func NewSucceedCondition

func NewSucceedCondition(ops *OpsRequest) *metav1.Condition

NewSucceedCondition creates a condition that the controller has successfully processed the OpsRequest

func NewSwitchoveringCondition added in v0.6.0

func NewSwitchoveringCondition(generation int64, message string) *metav1.Condition

NewSwitchoveringCondition creates a condition that the operation starts to switchover components

func NewUpgradingCondition

func NewUpgradingCondition(ops *OpsRequest) *metav1.Condition

NewUpgradingCondition creates a condition that the OpsRequest starts to upgrade the cluster version

func NewValidateFailedCondition

func NewValidateFailedCondition(reason, message string) *metav1.Condition

NewValidateFailedCondition creates a condition for operation validation failure.

func NewValidatePassedCondition

func NewValidatePassedCondition(opsRequestName string) *metav1.Condition

NewValidatePassedCondition creates a condition for operation validation to pass.

func NewVerticalScalingCondition

func NewVerticalScalingCondition(ops *OpsRequest) *metav1.Condition

NewVerticalScalingCondition creates a condition that the OpsRequest starts to vertical scale cluster

func NewVolumeExpandingCondition

func NewVolumeExpandingCondition(ops *OpsRequest) *metav1.Condition

NewVolumeExpandingCondition creates a condition that the OpsRequest starts to expand volume

func NewWaitForProcessingCondition added in v0.8.0

func NewWaitForProcessingCondition(ops *OpsRequest) *metav1.Condition

NewWaitForProcessingCondition waits the controller to process the opsRequest.

func RegisterWebhookManager

func RegisterWebhookManager(mgr manager.Manager)

func Resource added in v0.6.0

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 the modes of access granted to the SVC. The modes can be `None`, `Readonly`, or `ReadWrite`.

+enum +kubebuilder:validation:Enum={None,Readonly,ReadWrite}

const (
	// ReadWrite permits both read and write operations.
	ReadWrite AccessMode = "ReadWrite"

	// Readonly allows only read operations.
	Readonly AccessMode = "Readonly"

	// None implies no access.
	None AccessMode = "None"
)

type AccountName

type AccountName string

AccountName defines system account names. +enum +kubebuilder:validation:Enum={kbadmin,kbdataprotection,kbprobe,kbmonitoring,kbreplicator}

const (
	AdminAccount          AccountName = "kbadmin"
	DataprotectionAccount AccountName = "kbdataprotection"
	ProbeAccount          AccountName = "kbprobe"
	MonitorAccount        AccountName = "kbmonitoring"
	ReplicatorAccount     AccountName = "kbreplicator"
)

func (AccountName) GetAccountID

func (r AccountName) GetAccountID() KBAccountType

type Action added in v0.8.0

type Action struct {
	// Specifies the container image to be used for running the Action.
	//
	// When specified, a dedicated container will be created using this image to execute the Action.
	// This field is mutually exclusive with the `container` field; only one of them should be provided.
	//
	// This field cannot be updated.
	//
	// +optional
	Image string `json:"image,omitempty"`

	// Defines the command to run.
	//
	// This field cannot be updated.
	//
	// +optional
	Exec *ExecAction `json:"exec,omitempty"`

	// Specifies the HTTP request to perform.
	//
	// This field cannot be updated.
	//
	// Note: HTTPAction is to be implemented in future version.
	//
	// +optional
	HTTP *HTTPAction `json:"http,omitempty"`

	// Represents a list of environment variables that will be injected into the container.
	// These variables enable the container to adapt its behavior based on the environment it's running in.
	//
	// This field cannot be updated.
	//
	// +optional
	// +patchMergeKey=name
	// +patchStrategy=merge
	Env []corev1.EnvVar `json:"env,omitempty" patchStrategy:"merge" patchMergeKey:"name"`

	// Defines the criteria used to select the target Pod(s) for executing the Action.
	// This is useful when there is no default target replica identified.
	// It allows for precise control over which Pod(s) the Action should run in.
	//
	// This field cannot be updated.
	//
	// Note: This field is reserved for future use and is not currently active.
	//
	// +optional
	TargetPodSelector TargetPodSelector `json:"targetPodSelector,omitempty"`

	// Used in conjunction with the `targetPodSelector` field to refine the selection of target pod(s) for Action execution.
	// The impact of this field depends on the `targetPodSelector` value:
	//
	// - When `targetPodSelector` is set to `Any` or `All`, this field will be ignored.
	// - When `targetPodSelector` is set to `Role`, only those replicas whose role matches the `matchingKey`
	//   will be selected for the Action.
	//
	// This field cannot be updated.
	//
	// Note: This field is reserved for future use and is not currently active.
	//
	// +optional
	MatchingKey string `json:"matchingKey,omitempty"`

	// Defines the name of the container within the target Pod where the action will be executed.
	//
	// This name must correspond to one of the containers defined in `componentDefinition.spec.runtime`.
	// If this field is not specified, the default behavior is to use the first container listed in
	// `componentDefinition.spec.runtime`.
	//
	// This field cannot be updated.
	//
	// Note: This field is reserved for future use and is not currently active.
	//
	// +optional
	Container string `json:"container,omitempty"`

	// Specifies the maximum duration in seconds that the Action is allowed to run.
	//
	// If the Action does not complete within this time frame, it will be terminated.
	//
	// This field cannot be updated.
	//
	// +kubebuilder:default=0
	// +optional
	TimeoutSeconds int32 `json:"timeoutSeconds,omitempty"`

	// Defines the strategy to be taken when retrying the Action after a failure.
	//
	// It specifies the conditions under which the Action should be retried and the limits to apply,
	// such as the maximum number of retries and backoff strategy.
	//
	// This field cannot be updated.
	//
	// +optional
	RetryPolicy *RetryPolicy `json:"retryPolicy,omitempty"`

	// Specifies the state that the cluster must reach before the Action is executed.
	// Currently, this is only applicable to the `postProvision` action.
	//
	// The conditions are as follows:
	//
	// - `Immediately`: Executed right after the Component object is created.
	//   The readiness of the Component and its resources is not guaranteed at this stage.
	// - `RuntimeReady`: The Action is triggered after the Component object has been created and all associated
	//   runtime resources (e.g. Pods) are in a ready state.
	// - `ComponentReady`: The Action is triggered after the Component itself is in a ready state.
	//   This process does not affect the readiness state of the Component or the Cluster.
	// - `ClusterReady`: The Action is executed after the Cluster is in a ready state.
	//   This execution does not alter the Component or the Cluster's state of readiness.
	//
	// This field cannot be updated.
	//
	// +optional
	PreCondition *PreConditionType `json:"preCondition,omitempty"`
}

Action defines a customizable hook or procedure tailored for different database engines, designed to be invoked at predetermined points within the lifecycle of a Component instance. It provides a modular and extensible way to customize a Component's behavior through the execution of defined actions.

Available Action triggers include:

  • `postProvision`: Defines the hook to be executed after the creation of a Component, with `preCondition` specifying when the action should be fired relative to the Component's lifecycle stages: `Immediately`, `RuntimeReady`, `ComponentReady`, and `ClusterReady`.
  • `preTerminate`: Defines the hook to be executed before terminating a Component.
  • `roleProbe`: Defines the procedure which is invoked regularly to assess the role of replicas.
  • `switchover`: Defines the procedure for a controlled transition of leadership from the current leader to a new replica. This approach aims to minimize downtime and maintain availability in systems with a leader-follower topology, such as during planned maintenance or upgrades on the current leader node.
  • `memberJoin`: Defines the procedure to add a new replica to the replication group.
  • `memberLeave`: Defines the method to remove a replica from the replication group.
  • `readOnly`: Defines the procedure to switch a replica into the read-only state.
  • `readWrite`: Defines the procedure to transition a replica from the read-only state back to the read-write state.
  • `dataDump`: Defines the procedure to export the data from a replica.
  • `dataLoad`: Defines the procedure to import data into a replica.
  • `reconfigure`: Defines the procedure that update a replica with new configuration.
  • `accountProvision`: Defines the procedure to generate a new database account.

Actions can be executed in different ways:

  • ExecAction: Executes a command inside a container. which may run as a K8s job or be executed inside the Lorry sidecar container, depending on the implementation. Future implementations will standardize execution within Lorry. A set of predefined environment variables are available and can be leveraged within the `exec.command` to access context information such as details about pods, components, the overall cluster state, or database connection credentials. These variables provide a dynamic and context-aware mechanism for script execution.
  • HTTPAction: Performs an HTTP request. HTTPAction is to be implemented in future version.
  • GRPCAction: In future version, Actions will support initiating gRPC calls. This allows developers to implement Actions using plugins written in programming language like Go, providing greater flexibility and extensibility.

An action is considered successful on returning 0, or HTTP 200 for status HTTP(s) Actions. Any other return value or HTTP status codes indicate failure, and the action may be retried based on the configured retry policy.

  • If an action exceeds the specified timeout duration, it will be terminated, and the action is considered failed.
  • If an action produces any data as output, it should be written to stdout, or included in the HTTP response payload for HTTP(s) actions.
  • If an action encounters any errors, error messages should be written to stderr, or detailed in the HTTP response with the appropriate non-200 status code.

func (*Action) DeepCopy added in v0.8.0

func (in *Action) DeepCopy() *Action

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

func (*Action) DeepCopyInto added in v0.8.0

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

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

type ActionTask added in v0.9.0

type ActionTask struct {
	// Represents the name of the task.
	// +kubebuilder:validation:Required
	ObjectKey string `json:"objectKey"`

	// Represents the namespace where the task is deployed.
	// +kubebuilder:validation:Required
	Namespace string `json:"namespace"`

	// Indicates the current status of the task, including "Processing", "Failed", "Succeed".
	// +kubebuilder:validation:Required
	Status ActionTaskStatus `json:"status"`

	// The name of the Pod that the task is associated with or operates on.
	// +optional
	TargetPodName string `json:"targetPodName,omitempty"`

	// The count of retry attempts made for this task.
	// +optional
	Retries int32 `json:"retries,omitempty"`
}

func (*ActionTask) DeepCopy added in v0.9.0

func (in *ActionTask) DeepCopy() *ActionTask

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

func (*ActionTask) DeepCopyInto added in v0.9.0

func (in *ActionTask) DeepCopyInto(out *ActionTask)

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

type ActionTaskStatus added in v0.9.0

type ActionTaskStatus string

ActionTaskStatus defines the status of the task. +enum +kubebuilder:validation:Enum={Processing,Failed,Succeed}

const (
	ProcessingActionTaskStatus ActionTaskStatus = "Processing"
	FailedActionTaskStatus     ActionTaskStatus = "Failed"
	SucceedActionTaskStatus    ActionTaskStatus = "Succeed"
)

type Affinity

type Affinity struct {
	// Specifies the anti-affinity level of Pods within a Component.
	// It determines how pods should be spread across nodes to improve availability and performance.
	// It can have the following values: `Preferred` and `Required`.
	// The default value is `Preferred`.
	//
	// +kubebuilder:default=Preferred
	// +optional
	PodAntiAffinity PodAntiAffinity `json:"podAntiAffinity,omitempty"`

	// Represents the key of node labels used to define the topology domain for Pod anti-affinity
	// and Pod spread constraints.
	//
	// In K8s, a topology domain is a set of nodes that have the same value for a specific label key.
	// Nodes with labels containing any of the specified TopologyKeys and identical values are considered
	// to be in the same topology domain.
	//
	// Note: The concept of topology in the context of K8s TopologyKeys is different from the concept of
	// topology in the ClusterDefinition.
	//
	// When a Pod has anti-affinity or spread constraints specified, Kubernetes will attempt to schedule the
	// Pod on nodes with different values for the specified TopologyKeys.
	// This ensures that Pods are spread across different topology domains, promoting high availability and
	// reducing the impact of node failures.
	//
	// Some well-known label keys, such as `kubernetes.io/hostname` and `topology.kubernetes.io/zone`,
	// are often used as TopologyKey.
	// These keys represent the hostname and zone of a node, respectively.
	// By including these keys in the TopologyKeys list, Pods will be spread across nodes with
	// different hostnames or zones.
	//
	// In addition to the well-known keys, users can also specify custom label keys as TopologyKeys.
	// This allows for more flexible and custom topology definitions based on the specific needs
	// of the application or environment.
	//
	// The TopologyKeys field is a slice of strings, where each string represents a label key.
	// The order of the keys in the slice does not matter.
	//
	// +listType=set
	// +optional
	TopologyKeys []string `json:"topologyKeys,omitempty"`

	// Indicates the node labels that must be present on nodes for pods to be scheduled on them.
	// It is a map where the keys are the label keys and the values are the corresponding label values.
	// Pods will only be scheduled on nodes that have all the specified labels with the corresponding values.
	//
	// For example, if NodeLabels is set to {"nodeType": "ssd", "environment": "production"},
	// pods will only be scheduled on nodes that have both the "nodeType" label with value "ssd"
	// and the "environment" label with value "production".
	//
	// This field allows users to control Pod placement based on specific node labels.
	// It can be used to ensure that Pods are scheduled on nodes with certain characteristics,
	// such as specific hardware (e.g., SSD), environment (e.g., production, staging),
	// or any other custom labels assigned to nodes.
	//
	// +optional
	NodeLabels map[string]string `json:"nodeLabels,omitempty"`

	// Determines the level of resource isolation between Pods.
	// It can have the following values: `SharedNode` and `DedicatedNode`.
	//
	// - SharedNode: Allow that multiple Pods may share the same node, which is the default behavior of K8s.
	// - DedicatedNode: Each Pod runs on a dedicated node, ensuring that no two Pods share the same node.
	//   In other words, if a Pod is already running on a node, no other Pods will be scheduled on that node.
	//   Which provides a higher level of isolation and resource guarantee for Pods.
	//
	//  The default value is `SharedNode`.
	//
	// +kubebuilder:default=SharedNode
	// +optional
	Tenancy TenancyType `json:"tenancy,omitempty"`
}

func (*Affinity) DeepCopy added in v0.6.0

func (in *Affinity) DeepCopy() *Affinity

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

func (*Affinity) DeepCopyInto added in v0.6.0

func (in *Affinity) DeepCopyInto(out *Affinity)

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

type AvailabilityPolicyType added in v0.6.0

type AvailabilityPolicyType string

AvailabilityPolicyType defines the type of availability policy to be applied for cluster affinity, influencing how resources are distributed across zones or nodes for high availability and resilience.

+enum +kubebuilder:validation:Enum={zone,node,none}

const (
	// AvailabilityPolicyZone specifies that resources should be distributed across different availability zones.
	// This policy aims to ensure high availability and protect against zone failures, spreading the resources to reduce
	// the risk of simultaneous downtime.
	AvailabilityPolicyZone AvailabilityPolicyType = "zone"

	// AvailabilityPolicyNode specifies that resources should be distributed across different nodes within the same zone.
	// This policy aims to provide resilience against node failures, ensuring that the failure of a single node does not
	// impact the overall service availability.
	AvailabilityPolicyNode AvailabilityPolicyType = "node"

	// AvailabilityPolicyNone specifies that no specific availability policy is applied.
	// Resources may not be explicitly distributed for high availability, potentially concentrating them in a single
	// zone or node based on other scheduling decisions.
	AvailabilityPolicyNone AvailabilityPolicyType = "none"
)

type Backup added in v0.9.0

type Backup struct {
	// Specifies the name of the Backup custom resource.
	//
	// +optional
	BackupName string `json:"backupName,omitempty"`

	// Indicates the name of the BackupPolicy applied to perform this Backup.
	//
	// +optional
	BackupPolicyName string `json:"backupPolicyName,omitempty"`

	// Specifies the name of BackupMethod.
	// The specified BackupMethod must be defined in the BackupPolicy.
	//
	// +optional
	BackupMethod string `json:"backupMethod,omitempty"`

	// Determines whether the backup contents stored in backup repository
	// should be deleted when the Backup custom resource is deleted.
	// Supported values are `Retain` and `Delete`.
	// - `Retain` means that the backup content and its physical snapshot on backup repository are kept.
	// - `Delete` means that the backup content and its physical snapshot on backup repository are deleted.
	// +kubebuilder:validation:Enum=Delete;Retain
	// +kubebuilder:default=Delete
	// +optional
	DeletionPolicy string `json:"deletionPolicy,omitempty"`

	// Determines the duration for which the Backup custom resources should be retained.
	//
	// The controller will automatically remove all Backup objects that are older than the specified RetentionPeriod.
	// For example, RetentionPeriod of `30d` will keep only the Backup objects of last 30 days.
	// Sample duration format:
	//
	// - years: 2y
	// - months: 6mo
	// - days: 30d
	// - hours: 12h
	// - minutes: 30m
	//
	// You can also combine the above durations. For example: 30d12h30m.
	// If not set, the Backup objects will be kept forever.
	//
	// If the `deletionPolicy` is set to 'Delete', then the associated backup data will also be deleted
	// along with the Backup object.
	// Otherwise, only the Backup custom resource will be deleted.
	//
	// +optional
	RetentionPeriod string `json:"retentionPeriod,omitempty"`

	// If the specified BackupMethod is incremental, `parentBackupName` is required.
	//
	// +optional
	ParentBackupName string `json:"parentBackupName,omitempty"`
}

func (*Backup) DeepCopy added in v0.9.0

func (in *Backup) DeepCopy() *Backup

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

func (*Backup) DeepCopyInto added in v0.9.0

func (in *Backup) DeepCopyInto(out *Backup)

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

type BackupMethod added in v0.7.0

type BackupMethod struct {
	// Specifies the name of dataprotection.BackupMethod.
	dpv1alpha1.BackupMethod `json:",inline"`

	// If set, specifies the method for selecting the replica to be backed up using the criteria defined here.
	// If this field is not set, the selection method specified in `backupPolicy.target` is used.
	//
	// This field provides a way to override the global `backupPolicy.target` setting for specific BackupMethod.
	//
	// +optional
	Target *TargetInstance `json:"target"`

	// Specifies a mapping of an environment variable key to the appropriate version of the tool image
	// required for backups, as determined by ClusterVersion and ComponentDefinition.
	// The environment variable is then injected into the container executing the backup task.
	//
	// +optional
	EnvMapping []EnvMappingVar `json:"envMapping,omitempty"`
}

func (*BackupMethod) DeepCopy added in v0.7.0

func (in *BackupMethod) DeepCopy() *BackupMethod

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

func (*BackupMethod) DeepCopyInto added in v0.7.0

func (in *BackupMethod) DeepCopyInto(out *BackupMethod)

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

type BackupPolicy

type BackupPolicy struct {
	// Specifies the name of ClusterComponentDefinition defined in the ClusterDefinition.
	// Must comply with the IANA Service Naming rule.
	//
	// Deprecated since v0.9, should use `componentDefs` instead.
	// This field is maintained for backward compatibility and its use is discouraged.
	// Existing usage should be updated to the current preferred approach to avoid compatibility issues in future releases.
	//
	// +kubebuilder:validation:MaxLength=22
	// +kubebuilder:validation:Pattern:=`^[a-z]([a-z0-9\-]*[a-z0-9])?$`
	// +optional
	ComponentDefRef string `json:"componentDefRef,omitempty"`

	// Specifies a list of names of ComponentDefinitions that the specified ClusterDefinition references.
	// They should be different versions of definitions of the same component,
	// thus allowing them to share a single BackupPolicy.
	// Each name must adhere to the IANA Service Naming rule.
	//
	// +optional
	ComponentDefs []string `json:"componentDefs,omitempty"`

	// Defines the selection criteria of instance to be backed up, and the connection credential to be used
	// during the backup process.
	//
	// +optional
	Target TargetInstance `json:"target"`

	// Defines the execution plans for backup tasks, specifying when and how backups should occur,
	// and the retention period of backup files.
	//
	// +optional
	Schedules []SchedulePolicy `json:"schedules,omitempty"`

	// Defines an array of BackupMethods to be used.
	//
	// +kubebuilder:validation:Required
	BackupMethods []BackupMethod `json:"backupMethods"`

	// Specifies the maximum number of retry attempts for a backup before it is considered a failure.
	//
	// +optional
	// +kubebuilder:default=2
	// +kubebuilder:validation:Minimum=0
	// +kubebuilder:validation:Maximum=10
	BackoffLimit *int32 `json:"backoffLimit,omitempty"`
}

BackupPolicy is the template corresponding to a specified ComponentDefinition or to a group of ComponentDefinitions that are different versions of definitions of the same component.

func (*BackupPolicy) DeepCopy added in v0.6.0

func (in *BackupPolicy) DeepCopy() *BackupPolicy

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

func (*BackupPolicy) DeepCopyInto added in v0.6.0

func (in *BackupPolicy) DeepCopyInto(out *BackupPolicy)

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

type BackupPolicyTemplate

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

	// The metadata for the BackupPolicyTemplate object, including name, namespace, labels, and annotations.
	metav1.ObjectMeta `json:"metadata,omitempty"`

	// Defines the desired state of the BackupPolicyTemplate.
	Spec BackupPolicyTemplateSpec `json:"spec,omitempty"`

	// Populated by the system, it represents the current information about the BackupPolicyTemplate.
	Status BackupPolicyTemplateStatus `json:"status,omitempty"`
}

BackupPolicyTemplate should be provided by addon developers and is linked to a ClusterDefinition and its associated ComponentDefinitions. It is responsible for generating BackupPolicies for Components that require backup operations, also determining the suitable backup methods and strategies. This template is automatically selected based on the specified ClusterDefinition and ComponentDefinitions when a Cluster is created.

+genclient +genclient:nonNamespaced +k8s:openapi-gen=true +kubebuilder:object:root=true +kubebuilder:subresource:status +kubebuilder:resource:categories={kubeblocks},scope=Cluster,shortName=bpt +kubebuilder:printcolumn:name="CLUSTER-DEFINITION",type="string",JSONPath=".spec.clusterDefinitionRef",description="ClusterDefinition referenced by cluster." +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp"

func (*BackupPolicyTemplate) DeepCopy added in v0.6.0

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

func (*BackupPolicyTemplate) DeepCopyInto added in v0.6.0

func (in *BackupPolicyTemplate) DeepCopyInto(out *BackupPolicyTemplate)

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

func (*BackupPolicyTemplate) DeepCopyObject added in v0.6.0

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

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

type BackupPolicyTemplateList

type BackupPolicyTemplateList struct {
	// Contains the metadata for the API objects, including the Kind and Version of the object.
	metav1.TypeMeta `json:",inline"`

	// Contains the metadata for the list objects, including the continue and remainingItemCount for the list.
	metav1.ListMeta `json:"metadata,omitempty"`

	// Contains the list of BackupPolicyTemplate.
	Items []BackupPolicyTemplate `json:"items"`
}

BackupPolicyTemplateList contains a list of BackupPolicyTemplate

func (*BackupPolicyTemplateList) DeepCopy added in v0.6.0

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

func (*BackupPolicyTemplateList) DeepCopyInto added in v0.6.0

func (in *BackupPolicyTemplateList) DeepCopyInto(out *BackupPolicyTemplateList)

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

func (*BackupPolicyTemplateList) DeepCopyObject added in v0.6.0

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

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

type BackupPolicyTemplateSpec

type BackupPolicyTemplateSpec struct {
	// Specifies the name of a ClusterDefinition.
	// This is an immutable attribute that cannot be changed after creation.
	// And this field is deprecated since v0.9, consider using the ComponentDef instead.
	//
	// +kubebuilder:validation:Pattern:=`^[a-z0-9]([a-z0-9\.\-]*[a-z0-9])?$`
	// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="clusterDefinitionRef is immutable"
	// +kubebuilder:deprecatedversion:warning="This field has been deprecated since 0.9.0, consider using the ComponentDef instead"
	ClusterDefRef string `json:"clusterDefinitionRef,omitempty"`

	// Represents an array of BackupPolicy templates, with each template corresponding to a specified ComponentDefinition
	// or to a group of ComponentDefinitions that are different versions of definitions of the same component.
	//
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MinItems=1
	BackupPolicies []BackupPolicy `json:"backupPolicies"`

	// Specifies a unique identifier for the BackupPolicyTemplate.
	//
	// This identifier will be used as the suffix of the name of automatically generated BackupPolicy.
	// This prevents unintended overwriting of BackupPolicies due to name conflicts when multiple BackupPolicyTemplates
	// are present.
	// For instance, using "backup-policy" for regular backups and "backup-policy-hscale" for horizontal-scale ops
	// can differentiate the policies.
	//
	// +optional
	// +kubebuilder:validation:MaxLength=20
	Identifier string `json:"identifier,omitempty"`
}

BackupPolicyTemplateSpec contains the settings in a BackupPolicyTemplate.

func (*BackupPolicyTemplateSpec) DeepCopy added in v0.6.0

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

func (*BackupPolicyTemplateSpec) DeepCopyInto added in v0.6.0

func (in *BackupPolicyTemplateSpec) DeepCopyInto(out *BackupPolicyTemplateSpec)

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

type BackupPolicyTemplateStatus

type BackupPolicyTemplateStatus struct {
}

BackupPolicyTemplateStatus defines the observed state of BackupPolicyTemplate.

func (*BackupPolicyTemplateStatus) DeepCopy added in v0.6.0

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

func (*BackupPolicyTemplateStatus) DeepCopyInto added in v0.6.0

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

type BackupRefSpec

type BackupRefSpec struct {
	// Refers to a reference backup that needs to be restored.
	// +optional
	Ref RefNamespaceName `json:"ref,omitempty"`
}

func (*BackupRefSpec) DeepCopy added in v0.6.0

func (in *BackupRefSpec) DeepCopy() *BackupRefSpec

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

func (*BackupRefSpec) DeepCopyInto added in v0.6.0

func (in *BackupRefSpec) DeepCopyInto(out *BackupRefSpec)

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

type BackupStatusUpdateStage

type BackupStatusUpdateStage string

BackupStatusUpdateStage defines the stage of backup status update.

+enum +kubebuilder:validation:Enum={pre,post}

type BaseBackupType

type BaseBackupType string

BaseBackupType the base backup type, keep synchronized with the BaseBackupType of the data protection API.

+enum +kubebuilder:validation:Enum={full,snapshot}

type BuiltinActionHandlerType added in v0.8.0

type BuiltinActionHandlerType string

BuiltinActionHandlerType defines build-in action handlers provided by Lorry, including:

- `mysql` - `wesql` - `oceanbase` - `redis` - `mongodb` - `etcd` - `postgresql` - `official-postgresql` - `apecloud-postgresql` - `polardbx` - `custom` - `unknown`

const (
	MySQLBuiltinActionHandler              BuiltinActionHandlerType = "mysql"
	WeSQLBuiltinActionHandler              BuiltinActionHandlerType = "wesql"
	OceanbaseBuiltinActionHandler          BuiltinActionHandlerType = "oceanbase"
	RedisBuiltinActionHandler              BuiltinActionHandlerType = "redis"
	MongoDBBuiltinActionHandler            BuiltinActionHandlerType = "mongodb"
	ETCDBuiltinActionHandler               BuiltinActionHandlerType = "etcd"
	PostgresqlBuiltinActionHandler         BuiltinActionHandlerType = "postgresql"
	OfficialPostgresqlBuiltinActionHandler BuiltinActionHandlerType = "official-postgresql"
	ApeCloudPostgresqlBuiltinActionHandler BuiltinActionHandlerType = "apecloud-postgresql"
	PolarDBXBuiltinActionHandler           BuiltinActionHandlerType = "polardbx"
	CustomActionHandler                    BuiltinActionHandlerType = "custom"
	UnknownBuiltinActionHandler            BuiltinActionHandlerType = "unknown"
)

type CPUConstraint

type CPUConstraint struct {
	// The maximum count of vcpu cores, [Min, Max] defines a range for valid vcpu cores, and the value in this range
	// must be multiple times of Step. It's useful to define a large number of valid values without defining them one by
	// one. Please see the documentation for Step for some examples.
	// If Slots is specified, Max, Min, and Step are ignored
	// +optional
	Max *resource.Quantity `json:"max,omitempty"`

	// The minimum count of vcpu cores, [Min, Max] defines a range for valid vcpu cores, and the value in this range
	// must be multiple times of Step. It's useful to define a large number of valid values without defining them one by
	// one. Please see the documentation for Step for some examples.
	// If Slots is specified, Max, Min, and Step are ignored
	// +optional
	Min *resource.Quantity `json:"min,omitempty"`

	// The minimum granularity of vcpu cores, [Min, Max] defines a range for valid vcpu cores and the value in this range must be
	// multiple times of Step.
	// For example:
	// 1. Min is 2, Max is 8, Step is 2, and the valid vcpu core is {2, 4, 6, 8}.
	// 2. Min is 0.5, Max is 2, Step is 0.5, and the valid vcpu core is {0.5, 1, 1.5, 2}.
	// +optional
	Step *resource.Quantity `json:"step,omitempty"`

	// The valid vcpu cores, it's useful if you want to define valid vcpu cores explicitly.
	// If Slots is specified, Max, Min, and Step are ignored
	// +optional
	Slots []resource.Quantity `json:"slots,omitempty"`
}

func (*CPUConstraint) DeepCopy added in v0.6.0

func (in *CPUConstraint) DeepCopy() *CPUConstraint

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

func (*CPUConstraint) DeepCopyInto added in v0.6.0

func (in *CPUConstraint) DeepCopyInto(out *CPUConstraint)

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

type ClassDefRef

type ClassDefRef struct {
	// Specifies the name of the ComponentClassDefinition.
	//
	// +kubebuilder:validation:MaxLength=63
	// +kubebuilder:validation:Pattern:=`^[a-z0-9]([a-z0-9\.\-]*[a-z0-9])?$`
	// +optional
	Name string `json:"name,omitempty"`

	// Defines the name of the class that is defined in the ComponentClassDefinition.
	//
	// +kubebuilder:validation:Required
	Class string `json:"class"`
}

ClassDefRef is deprecated since v0.9.

func (*ClassDefRef) DeepCopy added in v0.6.0

func (in *ClassDefRef) DeepCopy() *ClassDefRef

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

func (*ClassDefRef) DeepCopyInto added in v0.6.0

func (in *ClassDefRef) DeepCopyInto(out *ClassDefRef)

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

type Cluster

type Cluster struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   ClusterSpec   `json:"spec,omitempty"`
	Status ClusterStatus `json:"status,omitempty"`
}

Cluster offers a unified management interface for a wide variety of database and storage systems:

- Relational databases: MySQL, PostgreSQL, MariaDB - NoSQL databases: Redis, MongoDB - KV stores: ZooKeeper, etcd - Analytics systems: ElasticSearch, OpenSearch, ClickHouse, Doris, StarRocks, Solr - Message queues: Kafka, Pulsar - Distributed SQL: TiDB, OceanBase - Vector databases: Qdrant, Milvus, Weaviate - Object storage: Minio

KubeBlocks utilizes an abstraction layer to encapsulate the characteristics of these diverse systems. A Cluster is composed of multiple Components, each defined by vendors or KubeBlocks Addon developers via ComponentDefinition, arranged in Directed Acyclic Graph (DAG) topologies. The topologies, defined in a ClusterDefinition, coordinate reconciliation across Cluster's lifecycle phases: Creating, Running, Updating, Stopping, Stopped, Deleting. Lifecycle management ensures that each Component operates in harmony, executing appropriate actions at each lifecycle stage.

For sharded-nothing architecture, the Cluster supports managing multiple shards, each shard managed by a separate Component, supporting dynamic resharding.

The Cluster object is aimed to maintain the overall integrity and availability of a database cluster, serves as the central control point, abstracting the complexity of multiple-component management, and providing a unified interface for cluster-wide operations.

func (*Cluster) DeepCopy added in v0.6.0

func (in *Cluster) DeepCopy() *Cluster

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

func (*Cluster) DeepCopyInto added in v0.6.0

func (in *Cluster) DeepCopyInto(out *Cluster)

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

func (*Cluster) DeepCopyObject added in v0.6.0

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

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

func (*Cluster) GetVolumeClaimNames

func (r *Cluster) GetVolumeClaimNames(compName string, claimNames ...string) []string

GetVolumeClaimNames gets all PVC names of component compName.

r.Spec.GetComponentByName(compName).VolumeClaimTemplates[*].Name will be used if no claimNames provided

nil return if: 1. component compName not found or 2. len(VolumeClaimTemplates)==0 or 3. any claimNames not found

func (Cluster) IsDeleting added in v0.6.0

func (r Cluster) IsDeleting() bool

func (Cluster) IsStatusUpdating added in v0.6.0

func (r Cluster) IsStatusUpdating() bool

func (Cluster) IsUpdating added in v0.6.0

func (r Cluster) IsUpdating() bool

func (*Cluster) SetupWebhookWithManager

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

func (*Cluster) ValidateCreate

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

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

func (*Cluster) ValidateDelete

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

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

func (*Cluster) ValidateUpdate

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

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

type ClusterBackup added in v0.6.0

type ClusterBackup struct {
	// Specifies whether automated backup is enabled for the Cluster.
	//
	// +kubebuilder:default=false
	// +optional
	Enabled *bool `json:"enabled,omitempty"`

	// Determines the duration to retain backups. Backups older than this period are automatically removed.
	//
	// For example, RetentionPeriod of `30d` will keep only the backups of last 30 days.
	// Sample duration format:
	//
	// - years: 	2y
	// - months: 	6mo
	// - days: 		30d
	// - hours: 	12h
	// - minutes: 	30m
	//
	// You can also combine the above durations. For example: 30d12h30m.
	// Default value is 7d.
	//
	// +kubebuilder:default="7d"
	// +optional
	RetentionPeriod dpv1alpha1.RetentionPeriod `json:"retentionPeriod,omitempty"`

	// Specifies the backup method to use, as defined in backupPolicy.
	//
	// +kubebuilder:validation:Required
	Method string `json:"method"`

	// The cron expression for the schedule. The timezone is in UTC. See https://en.wikipedia.org/wiki/Cron.
	//
	// +optional
	CronExpression string `json:"cronExpression,omitempty"`

	// Specifies the maximum time in minutes that the system will wait to start a missed backup job.
	// If the scheduled backup time is missed for any reason, the backup job must start within this deadline.
	// Values must be between 0 (immediate execution) and 1440 (one day).
	//
	// +kubebuilder:validation:Minimum=0
	// +kubebuilder:validation:Maximum=1440
	// +optional
	StartingDeadlineMinutes *int64 `json:"startingDeadlineMinutes,omitempty"`

	// Specifies the name of the backupRepo. If not set, the default backupRepo will be used.
	//
	// +optional
	RepoName string `json:"repoName,omitempty"`

	// Specifies whether to enable point-in-time recovery.
	//
	// +kubebuilder:default=false
	// +optional
	PITREnabled *bool `json:"pitrEnabled,omitempty"`
}

func (*ClusterBackup) DeepCopy added in v0.6.0

func (in *ClusterBackup) DeepCopy() *ClusterBackup

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

func (*ClusterBackup) DeepCopyInto added in v0.6.0

func (in *ClusterBackup) DeepCopyInto(out *ClusterBackup)

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

type ClusterComponentDefinition deprecated

type ClusterComponentDefinition struct {
	// This name could be used as default name of `cluster.spec.componentSpecs.name`, and needs to conform with same
	// validation rules as `cluster.spec.componentSpecs.name`, currently complying with IANA Service Naming rule.
	// This name will apply to cluster objects as the value of label "apps.kubeblocks.io/component-name".
	//
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MaxLength=22
	// +kubebuilder:validation:Pattern:=`^[a-z]([a-z0-9\-]*[a-z0-9])?$`
	Name string `json:"name"`

	// Description of the component definition.
	//
	// +optional
	Description string `json:"description,omitempty"`

	// Defines the type of the workload.
	//
	// - `Stateless` describes stateless applications.
	// - `Stateful` describes common stateful applications.
	// - `Consensus` describes applications based on consensus protocols, such as raft and paxos.
	// - `Replication` describes applications based on the primary-secondary data replication protocol.
	//
	// +kubebuilder:validation:Required
	WorkloadType WorkloadType `json:"workloadType"`

	// Defines well-known database component name, such as mongos(mongodb), proxy(redis), mariadb(mysql).
	//
	// +optional
	CharacterType string `json:"characterType,omitempty"`

	// Defines the template of configurations.
	//
	// +patchMergeKey=name
	// +patchStrategy=merge,retainKeys
	// +listType=map
	// +listMapKey=name
	// +optional
	ConfigSpecs []ComponentConfigSpec `json:"configSpecs,omitempty"`

	// Defines the template of scripts.
	//
	// +patchMergeKey=name
	// +patchStrategy=merge,retainKeys
	// +listType=map
	// +listMapKey=name
	// +optional
	ScriptSpecs []ComponentTemplateSpec `json:"scriptSpecs,omitempty"`

	// Settings for health checks.
	//
	// +optional
	Probes *ClusterDefinitionProbes `json:"probes,omitempty"`

	// Specify the logging files which can be observed and configured by cluster users.
	//
	// +patchMergeKey=name
	// +patchStrategy=merge,retainKeys
	// +listType=map
	// +listMapKey=name
	// +optional
	LogConfigs []LogConfig `json:"logConfigs,omitempty" patchStrategy:"merge,retainKeys" patchMergeKey:"name"`

	// Defines the pod spec template of component.
	//
	// +kubebuilder:pruning:PreserveUnknownFields
	// +optional
	PodSpec *corev1.PodSpec `json:"podSpec,omitempty"`

	// Defines the service spec.
	//
	// +optional
	Service *ServiceSpec `json:"service,omitempty"`

	// Defines spec for `Stateless` workloads.
	//
	// +kubebuilder:deprecatedversion:warning="This field is deprecated from KB 0.7.0, use RSMSpec instead."
	// +optional
	StatelessSpec *StatelessSetSpec `json:"statelessSpec,omitempty"`

	// Defines spec for `Stateful` workloads.
	//
	// +kubebuilder:deprecatedversion:warning="This field is deprecated from KB 0.7.0, use RSMSpec instead."
	// +optional
	StatefulSpec *StatefulSetSpec `json:"statefulSpec,omitempty"`

	// Defines spec for `Consensus` workloads. It's required if the workload type is `Consensus`.
	//
	// +kubebuilder:deprecatedversion:warning="This field is deprecated from KB 0.7.0, use RSMSpec instead."
	// +optional
	ConsensusSpec *ConsensusSetSpec `json:"consensusSpec,omitempty"`

	// Defines spec for `Replication` workloads.
	//
	// +kubebuilder:deprecatedversion:warning="This field is deprecated from KB 0.7.0, use RSMSpec instead."
	// +optional
	ReplicationSpec *ReplicationSetSpec `json:"replicationSpec,omitempty"`

	// Defines workload spec of this component.
	// From KB 0.7.0, RSM(InstanceSetSpec) will be the underlying CR which powers all kinds of workload in KB.
	// RSM is an enhanced stateful workload extension dedicated for heavy-state workloads like databases.
	//
	// +optional
	RSMSpec *RSMSpec `json:"rsmSpec,omitempty"`

	// Defines the behavior of horizontal scale.
	//
	// +optional
	HorizontalScalePolicy *HorizontalScalePolicy `json:"horizontalScalePolicy,omitempty"`

	// Defines system accounts needed to manage the component, and the statement to create them.
	//
	// +optional
	SystemAccounts *SystemAccountSpec `json:"systemAccounts,omitempty"`

	// Used to describe the purpose of the volumes mapping the name of the VolumeMounts in the PodSpec.Container field,
	// such as data volume, log volume, etc. When backing up the volume, the volume can be correctly backed up according
	// to the volumeType.
	//
	// For example:
	//
	// - `name: data, type: data` means that the volume named `data` is used to store `data`.
	// - `name: binlog, type: log` means that the volume named `binlog` is used to store `log`.
	//
	// NOTE: When volumeTypes is not defined, the backup function will not be supported, even if a persistent volume has
	// been specified.
	//
	// +listType=map
	// +listMapKey=name
	// +optional
	VolumeTypes []VolumeTypeSpec `json:"volumeTypes,omitempty"`

	// Used for custom label tags which you want to add to the component resources.
	//
	// +listType=map
	// +listMapKey=key
	// +optional
	CustomLabelSpecs []CustomLabelSpec `json:"customLabelSpecs,omitempty"`

	// Defines command to do switchover.
	// In particular, when workloadType=Replication, the command defined in switchoverSpec will only be executed under
	// the condition of cluster.componentSpecs[x].SwitchPolicy.type=Noop.
	//
	// +optional
	SwitchoverSpec *SwitchoverSpec `json:"switchoverSpec,omitempty"`

	// Defines the command to be executed when the component is ready, and the command will only be executed once after
	// the component becomes ready.
	//
	// +optional
	PostStartSpec *PostStartAction `json:"postStartSpec,omitempty"`

	// Defines settings to do volume protect.
	//
	// +optional
	VolumeProtectionSpec *VolumeProtectionSpec `json:"volumeProtectionSpec,omitempty"`

	// Used to inject values from other components into the current component. Values will be saved and updated in a
	// configmap and mounted to the current component.
	//
	// +patchMergeKey=componentDefName
	// +patchStrategy=merge,retainKeys
	// +listType=map
	// +listMapKey=componentDefName
	// +optional
	ComponentDefRef []ComponentDefRef `json:"componentDefRef,omitempty" patchStrategy:"merge" patchMergeKey:"componentDefName"`

	// Used to declare the service reference of the current component.
	//
	// +optional
	ServiceRefDeclarations []ServiceRefDeclaration `json:"serviceRefDeclarations,omitempty"`

	// Defines the metrics exporter.
	//
	// +optional
	Exporter *Exporter `json:"exporter,omitempty"`

	// Deprecated since v0.9
	// monitor is monitoring config which provided by provider.
	//
	// +kubebuilder:deprecatedversion:warning="This field has been deprecated since 0.10.0"
	// +optional
	Monitor *MonitorConfig `json:"monitor,omitempty"`
}

ClusterComponentDefinition defines a Component within a ClusterDefinition but is deprecated and has been replaced by ComponentDefinition.

Deprecated: Use ComponentDefinition instead. This type is deprecated as of version 0.8.

+kubebuilder:validation:XValidation:rule="has(self.workloadType) && self.workloadType == 'Consensus' ? (has(self.consensusSpec) || has(self.rsmSpec)) : !has(self.consensusSpec)",message="componentDefs.consensusSpec(deprecated) or componentDefs.rsmSpec(recommended) is required when componentDefs.workloadType is Consensus, and forbidden otherwise"

func (*ClusterComponentDefinition) DeepCopy added in v0.6.0

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

func (*ClusterComponentDefinition) DeepCopyInto added in v0.6.0

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

func (*ClusterComponentDefinition) GetCommonStatefulSpec added in v0.6.0

func (r *ClusterComponentDefinition) GetCommonStatefulSpec() (*StatefulSetSpec, error)

func (*ClusterComponentDefinition) GetStatefulSetWorkload added in v0.6.0

func (r *ClusterComponentDefinition) GetStatefulSetWorkload() StatefulSetWorkload

func (*ClusterComponentDefinition) IsStatelessWorkload added in v0.6.0

func (r *ClusterComponentDefinition) IsStatelessWorkload() bool

type ClusterComponentPhase

type ClusterComponentPhase string

ClusterComponentPhase defines the phase of a cluster component as represented in cluster.status.components.phase field.

+enum +kubebuilder:validation:Enum={Creating,Running,Updating,Stopping,Stopped,Deleting,Failed,Abnormal}

const (
	// CreatingClusterCompPhase indicates the component is being created.
	CreatingClusterCompPhase ClusterComponentPhase = "Creating"

	// RunningClusterCompPhase indicates the component has more than zero replicas, and all pods are up-to-date and
	// in a 'Running' state.
	RunningClusterCompPhase ClusterComponentPhase = "Running"

	// UpdatingClusterCompPhase indicates the component has more than zero replicas, and there are no failed pods,
	// it is currently being updated.
	UpdatingClusterCompPhase ClusterComponentPhase = "Updating"

	// StoppingClusterCompPhase indicates the component has zero replicas, and there are pods that are terminating.
	StoppingClusterCompPhase ClusterComponentPhase = "Stopping"

	// StoppedClusterCompPhase indicates the component has zero replicas, and all pods have been deleted.
	StoppedClusterCompPhase ClusterComponentPhase = "Stopped"

	// DeletingClusterCompPhase indicates the component is currently being deleted.
	DeletingClusterCompPhase ClusterComponentPhase = "Deleting"

	// FailedClusterCompPhase indicates the component has more than zero replicas, but there are some failed pods.
	// The component is not functioning.
	FailedClusterCompPhase ClusterComponentPhase = "Failed"

	// AbnormalClusterCompPhase indicates the component has more than zero replicas, but there are some failed pods.
	// The component is functioning, but it is in a fragile state.
	AbnormalClusterCompPhase ClusterComponentPhase = "Abnormal"
)

func GetComponentTerminalPhases

func GetComponentTerminalPhases() []ClusterComponentPhase

GetComponentTerminalPhases return Cluster's component terminal phases.

func GetComponentUpRunningPhase added in v0.6.0

func GetComponentUpRunningPhase() []ClusterComponentPhase

GetComponentUpRunningPhase returns component running or partially running phases.

type ClusterComponentService

type ClusterComponentService struct {
	// References the ComponentService name defined in the `componentDefinition.spec.services[*].name`.
	//
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MaxLength=25
	Name string `json:"name"`

	// Determines how the Service is exposed. Valid options are `ClusterIP`, `NodePort`, and `LoadBalancer`.
	//
	// - `ClusterIP` allocates a Cluster-internal IP address for load-balancing to endpoints.
	//    Endpoints are determined by the selector or if that is not specified,
	//    they are determined by manual construction of an Endpoints object or EndpointSlice objects.
	// - `NodePort` builds on ClusterIP and allocates a port on every node which routes to the same endpoints as the ClusterIP.
	// - `LoadBalancer` builds on NodePort and creates an external load-balancer (if supported in the current cloud)
	//    which routes to the same endpoints as the ClusterIP.
	//
	// Note: although K8s Service type allows the 'ExternalName' type, it is not a valid option for ClusterComponentService.
	//
	// For more info, see:
	// https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types.
	//
	// +kubebuilder:default=ClusterIP
	// +kubebuilder:validation:Enum={ClusterIP,NodePort,LoadBalancer}
	// +kubebuilder:pruning:PreserveUnknownFields
	// +optional
	ServiceType corev1.ServiceType `json:"serviceType,omitempty"`

	// If ServiceType is LoadBalancer, cloud provider related parameters can be put here.
	// More info: https://kubernetes.io/docs/concepts/services-networking/service/#loadbalancer.
	//
	// +optional
	Annotations map[string]string `json:"annotations,omitempty"`

	// Indicates whether to generate individual Services for each Pod.
	// If set to true, a separate Service will be created for each Pod in the Cluster.
	//
	// +optional
	PodService *bool `json:"podService,omitempty"`
}

func (*ClusterComponentService) DeepCopy added in v0.6.0

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

func (*ClusterComponentService) DeepCopyInto added in v0.6.0

func (in *ClusterComponentService) DeepCopyInto(out *ClusterComponentService)

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

type ClusterComponentSpec

type ClusterComponentSpec struct {
	// Specifies the Component's name.
	// It's part of the Service DNS name and must comply with the IANA service naming rule.
	// The name is optional when ClusterComponentSpec is used as a template (e.g., in `shardingSpec`),
	// but required otherwise.
	//
	// +kubebuilder:validation:MaxLength=22
	// +kubebuilder:validation:Pattern:=`^[a-z]([a-z0-9\-]*[a-z0-9])?$`
	// TODO +kubebuilder:validation:XValidation:rule="self == oldSelf",message="name is immutable"
	// +optional
	Name string `json:"name"`

	// References a ClusterComponentDefinition defined in the `clusterDefinition.spec.componentDef` field.
	// Must comply with the IANA service naming rule.
	//
	// Deprecated since v0.9,
	// because defining Components in `clusterDefinition.spec.componentDef` field has been deprecated.
	// This field is replaced by the `componentDef` field, use `componentDef` instead.
	// This field is maintained for backward compatibility and its use is discouraged.
	// Existing usage should be updated to the current preferred approach to avoid compatibility issues in future releases.
	//
	// +kubebuilder:validation:MaxLength=22
	// +kubebuilder:validation:Pattern:=`^[a-z]([a-z0-9\-]*[a-z0-9])?$`
	// TODO +kubebuilder:validation:XValidation:rule="self == oldSelf",message="componentDefRef is immutable"
	// +kubebuilder:deprecatedversion:warning="This field has been deprecated since 0.9.0, consider using the ComponentDef instead"
	// +optional
	ComponentDefRef string `json:"componentDefRef,omitempty"`

	// References the name of a ComponentDefinition object.
	// The ComponentDefinition specifies the behavior and characteristics of the Component.
	// If both `componentDefRef` and `componentDef` are provided,
	// the `componentDef` will take precedence over `componentDefRef`.
	//
	// +kubebuilder:validation:MaxLength=64
	// +kubebuilder:validation:Pattern:=`^[a-z0-9]([a-z0-9\.\-]*[a-z0-9])?$`
	// +optional
	ComponentDef string `json:"componentDef,omitempty"`

	// ServiceVersion specifies the version of the Service expected to be provisioned by this Component.
	// The version should follow the syntax and semantics of the "Semantic Versioning" specification (http://semver.org/).
	// If no version is specified, the latest available version will be used.
	//
	// +kubebuilder:validation:MaxLength=32
	// +optional
	ServiceVersion string `json:"serviceVersion,omitempty"`

	// References the class defined in ComponentClassDefinition.
	//
	// Deprecated since v0.9.
	// This field is maintained for backward compatibility and its use is discouraged.
	// Existing usage should be updated to the current preferred approach to avoid compatibility issues in future releases.
	//
	// +kubebuilder:deprecatedversion:warning="Due to the lack of practical use cases, this field is deprecated from KB 0.9.0."
	// +optional
	ClassDefRef *ClassDefRef `json:"classDefRef,omitempty"`

	// Defines a list of ServiceRef for a Component, enabling access to both external services and
	// Services provided by other Clusters.
	//
	// Types of services:
	//
	// - External services: Not managed by KubeBlocks or managed by a different KubeBlocks operator;
	//   Require a ServiceDescriptor for connection details.
	// - Services provided by a Cluster: Managed by the same KubeBlocks operator;
	//   identified using Cluster, Component and Service names.
	//
	// ServiceRefs with identical `serviceRef.name` in the same Cluster are considered the same.
	//
	// Example:
	// “`yaml
	// serviceRefs:
	//   - name: "redis-sentinel"
	//     serviceDescriptor:
	//       name: "external-redis-sentinel"
	//   - name: "postgres-cluster"
	//     clusterServiceSelector:
	//       cluster: "my-postgres-cluster"
	//       service:
	//         component: "postgresql"
	// “`
	// The example above includes ServiceRefs to an external Redis Sentinel service and a PostgreSQL Cluster.
	//
	// +optional
	ServiceRefs []ServiceRef `json:"serviceRefs,omitempty"`

	// Specifies which types of logs should be collected for the Component.
	// The log types are defined in the `componentDefinition.spec.logConfigs` field with the LogConfig entries.
	//
	// The elements in the `enabledLogs` array correspond to the names of the LogConfig entries.
	// For example, if the `componentDefinition.spec.logConfigs` defines LogConfig entries with
	// names "slow_query_log" and "error_log",
	// you can enable the collection of these logs by including their names in the `enabledLogs` array:
	// “`yaml
	// enabledLogs:
	// - slow_query_log
	// - error_log
	// “`
	//
	// +listType=set
	// +optional
	EnabledLogs []string `json:"enabledLogs,omitempty"`

	// Specifies Labels to override or add for underlying Pods.
	//
	// +optional
	Labels map[string]string `json:"labels,omitempty"`

	// Specifies Annotations to override or add for underlying Pods.
	//
	// +optional
	Annotations map[string]string `json:"annotations,omitempty"`

	// List of environment variables to add.
	// These environment variables will be placed after the environment variables declared in the Pod.
	//
	// +optional
	Env []corev1.EnvVar `json:"env,omitempty"`

	// Specifies the desired number of replicas in the Component for enhancing availability and durability, or load balancing.
	//
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:Minimum=0
	// +kubebuilder:default=1
	Replicas int32 `json:"replicas"`

	// Specifies a group of affinity scheduling rules for the Component.
	// It allows users to control how the Component's Pods are scheduled onto nodes in the K8s cluster.
	//
	// +optional
	Affinity *Affinity `json:"affinity,omitempty"`

	// Allows Pods to be scheduled onto nodes with matching taints.
	// Each toleration in the array allows the Pod to tolerate node taints based on
	// specified `key`, `value`, `effect`, and `operator`.
	//
	// - The `key`, `value`, and `effect` identify the taint that the toleration matches.
	// - The `operator` determines how the toleration matches the taint.
	//
	// Pods with matching tolerations are allowed to be scheduled on tainted nodes, typically reserved for specific purposes.
	//
	// +kubebuilder:pruning:PreserveUnknownFields
	// +optional
	Tolerations []corev1.Toleration `json:"tolerations,omitempty"`

	// Specifies the resources required by the Component.
	// It allows defining the CPU, memory requirements and limits for the Component's containers.
	//
	// +kubebuilder:pruning:PreserveUnknownFields
	// +optional
	Resources corev1.ResourceRequirements `json:"resources,omitempty"`

	// Specifies a list of PersistentVolumeClaim templates that represent the storage requirements for the Component.
	// Each template specifies the desired characteristics of a persistent volume, such as storage class,
	// size, and access modes.
	// These templates are used to dynamically provision persistent volumes for the Component.
	//
	// +patchMergeKey=name
	// +patchStrategy=merge,retainKeys
	// +optional
	VolumeClaimTemplates []ClusterComponentVolumeClaimTemplate `json:"volumeClaimTemplates,omitempty" patchStrategy:"merge,retainKeys" patchMergeKey:"name"`

	// List of volumes to override.
	//
	// +optional
	Volumes []corev1.Volume `json:"volumes,omitempty"`

	// Overrides services defined in referenced ComponentDefinition and expose endpoints that can be accessed by clients.
	//
	// +optional
	Services []ClusterComponentService `json:"services,omitempty"`

	// Overrides system accounts defined in referenced ComponentDefinition.
	//
	// +optional
	SystemAccounts []ComponentSystemAccount `json:"systemAccounts,omitempty"`

	// Defines the strategy for switchover and failover when workloadType is Replication.
	//
	// Deprecated since v0.9.
	// This field is maintained for backward compatibility and its use is discouraged.
	// Existing usage should be updated to the current preferred approach to avoid compatibility issues in future releases.
	//
	// +kubebuilder:deprecatedversion:warning="This field has been deprecated since 0.9.0"
	// +optional
	SwitchPolicy *ClusterSwitchPolicy `json:"switchPolicy,omitempty"`

	// A boolean flag that indicates whether the Component should use Transport Layer Security (TLS)
	// for secure communication.
	// When set to true, the Component will be configured to use TLS encryption for its network connections.
	// This ensures that the data transmitted between the Component and its clients or other Components is encrypted
	// and protected from unauthorized access.
	// If TLS is enabled, the Component may require additional configuration, such as specifying TLS certificates and keys,
	// to properly set up the secure communication channel.
	//
	// +optional
	TLS bool `json:"tls,omitempty"`

	// Specifies the configuration for the TLS certificates issuer.
	// It allows defining the issuer name and the reference to the secret containing the TLS certificates and key.
	// The secret should contain the CA certificate, TLS certificate, and private key in the specified keys.
	// Required when TLS is enabled.
	//
	// +optional
	Issuer *Issuer `json:"issuer,omitempty"`

	// Specifies the name of the ServiceAccount required by the running Component.
	// This ServiceAccount is used to grant necessary permissions for the Component's Pods to interact
	// with other Kubernetes resources, such as modifying Pod labels or sending events.
	//
	// Defaults:
	// If not specified, KubeBlocks automatically assigns a default ServiceAccount named "kb-{cluster.name}",
	// bound to a default role installed together with KubeBlocks.
	//
	// Future Changes:
	// Future versions might change the default ServiceAccount creation strategy to one per Component,
	// potentially revising the naming to "kb-{cluster.name}-{component.name}".
	//
	// Users can override the automatic ServiceAccount assignment by explicitly setting the name of
	// an existed ServiceAccount in this field.
	//
	// +optional
	ServiceAccountName string `json:"serviceAccountName,omitempty"`

	// Defines the update strategy for the Component.
	//
	// Deprecated since v0.9.
	// This field is maintained for backward compatibility and its use is discouraged.
	// Existing usage should be updated to the current preferred approach to avoid compatibility issues in future releases.
	//
	// +kubebuilder:deprecatedversion:warning="This field has been deprecated since 0.9.0"
	// +optional
	UpdateStrategy *UpdateStrategy `json:"updateStrategy,omitempty"`

	// Allows users to specify custom ConfigMaps and Secrets to be mounted as volumes
	// in the Cluster's Pods.
	// This is useful in scenarios where users need to provide additional resources to the Cluster, such as:
	//
	// - Mounting custom scripts or configuration files during Cluster startup.
	// - Mounting Secrets as volumes to provide sensitive information, like S3 AK/SK, to the Cluster.
	//
	// +optional
	UserResourceRefs *UserResourceRefs `json:"userResourceRefs,omitempty"`

	// Allows for the customization of configuration values for each instance within a Component.
	// An instance represent a single replica (Pod and associated K8s resources like PVCs, Services, and ConfigMaps).
	// While instances typically share a common configuration as defined in the ClusterComponentSpec,
	// they can require unique settings in various scenarios:
	//
	// For example:
	// - A database Component might require different resource allocations for primary and secondary instances,
	//   with primaries needing more resources.
	// - During a rolling upgrade, a Component may first update the image for one or a few instances,
	//   and then update the remaining instances after verifying that the updated instances are functioning correctly.
	//
	// InstanceTemplate allows for specifying these unique configurations per instance.
	// Each instance's name is constructed using the pattern: $(component.name)-$(template.name)-$(ordinal),
	// starting with an ordinal of 0.
	// It is crucial to maintain unique names for each InstanceTemplate to avoid conflicts.
	//
	// The sum of replicas across all InstanceTemplates should not exceed the total number of replicas specified for the Component.
	// Any remaining replicas will be generated using the default template and will follow the default naming rules.
	//
	// +optional
	// +patchMergeKey=name
	// +patchStrategy=merge,retainKeys
	// +listType=map
	// +listMapKey=name
	Instances []InstanceTemplate `json:"instances,omitempty" patchStrategy:"merge,retainKeys" patchMergeKey:"name"`

	// Specifies the names of instances to be transitioned to offline status.
	//
	// Marking an instance as offline results in the following:
	//
	// 1. The associated Pod is stopped, and its PersistentVolumeClaim (PVC) is retained for potential
	//    future reuse or data recovery, but it is no longer actively used.
	// 2. The ordinal number assigned to this instance is preserved, ensuring it remains unique
	//    and avoiding conflicts with new instances.
	//
	// Setting instances to offline allows for a controlled scale-in process, preserving their data and maintaining
	// ordinal consistency within the Cluster.
	// Note that offline instances and their associated resources, such as PVCs, are not automatically deleted.
	// The administrator must manually manage the cleanup and removal of these resources when they are no longer needed.
	//
	// +optional
	OfflineInstances []string `json:"offlineInstances,omitempty"`

	// Determines whether metrics exporter information is annotated on the Component's headless Service.
	//
	// If set to true, the following annotations will not be patched into the Service:
	//
	// - "monitor.kubeblocks.io/path"
	// - "monitor.kubeblocks.io/port"
	// - "monitor.kubeblocks.io/scheme"
	//
	// These annotations allow the Prometheus installed by KubeBlocks to discover and scrape metrics from the exporter.
	//
	// +optional
	DisableExporter *bool `json:"disableExporter,omitempty"`

	// Deprecated since v0.9
	// Determines whether metrics exporter information is annotated on the Component's headless Service.
	//
	// If set to true, the following annotations will be patched into the Service:
	//
	// - "monitor.kubeblocks.io/path"
	// - "monitor.kubeblocks.io/port"
	// - "monitor.kubeblocks.io/scheme"
	//
	// These annotations allow the Prometheus installed by KubeBlocks to discover and scrape metrics from the exporter.
	//
	// +optional
	// +kubebuilder:deprecatedversion:warning="This field has been deprecated since 0.10.0"
	Monitor *bool `json:"monitor,omitempty"`
}

ClusterComponentSpec defines the specification of a Component within a Cluster. TODO +kubebuilder:validation:XValidation:rule="!has(oldSelf.componentDefRef) || has(self.componentDefRef)", message="componentDefRef is required once set" TODO +kubebuilder:validation:XValidation:rule="!has(oldSelf.componentDef) || has(self.componentDef)", message="componentDef is required once set"

func (*ClusterComponentSpec) DeepCopy added in v0.6.0

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

func (*ClusterComponentSpec) DeepCopyInto added in v0.6.0

func (in *ClusterComponentSpec) DeepCopyInto(out *ClusterComponentSpec)

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

func (*ClusterComponentSpec) GetDisableExporter added in v0.9.0

func (r *ClusterComponentSpec) GetDisableExporter() *bool

func (*ClusterComponentSpec) ToVolumeClaimTemplates

func (r *ClusterComponentSpec) ToVolumeClaimTemplates() []corev1.PersistentVolumeClaimTemplate

ToVolumeClaimTemplates convert r.VolumeClaimTemplates to []corev1.PersistentVolumeClaimTemplate.

type ClusterComponentStatus

type ClusterComponentStatus struct {
	// Specifies the current state of the Component.
	Phase ClusterComponentPhase `json:"phase,omitempty"`

	// Records detailed information about the Component in its current phase.
	// The keys are either podName, deployName, or statefulSetName, formatted as 'ObjectKind/Name'.
	//
	// +optional
	Message ComponentMessageMap `json:"message,omitempty"`

	// Checks if all Pods of the Component are ready.
	//
	// +optional
	PodsReady *bool `json:"podsReady,omitempty"`

	// Indicates the time when all Component Pods became ready.
	// This is the readiness time of the last Component Pod.
	//
	// +optional
	PodsReadyTime *metav1.Time `json:"podsReadyTime,omitempty"`

	// Represents the status of the members.
	//
	// +optional
	MembersStatus []workloads.MemberStatus `json:"membersStatus,omitempty"`
}

ClusterComponentStatus records Component status.

func (*ClusterComponentStatus) DeepCopy added in v0.6.0

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

func (*ClusterComponentStatus) DeepCopyInto added in v0.6.0

func (in *ClusterComponentStatus) DeepCopyInto(out *ClusterComponentStatus)

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

func (ClusterComponentStatus) GetMessage

GetMessage gets message map deep copy object.

func (ClusterComponentStatus) GetObjectMessage

func (r ClusterComponentStatus) GetObjectMessage(objectKind, objectName string) string

GetObjectMessage gets the k8s workload message in component status message map

func (*ClusterComponentStatus) SetMessage

func (r *ClusterComponentStatus) SetMessage(messageMap ComponentMessageMap)

SetMessage overrides message map object.

func (*ClusterComponentStatus) SetObjectMessage

func (r *ClusterComponentStatus) SetObjectMessage(objectKind, objectName, message string)

SetObjectMessage sets K8s workload message to component status message map.

type ClusterComponentVersion

type ClusterComponentVersion struct {
	// Specifies a reference to one of the cluster component definition names in the ClusterDefinition API (spec.componentDefs.name).
	//
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MaxLength=63
	// +kubebuilder:validation:Pattern:=`^[a-z0-9]([a-z0-9\.\-]*[a-z0-9])?$`
	ComponentDefRef string `json:"componentDefRef"`

	// Defines a configuration extension mechanism to handle configuration differences between versions.
	// The configTemplateRefs field, in conjunction with the configTemplateRefs in the ClusterDefinition, determines
	// the final configuration file.
	//
	// +patchMergeKey=name
	// +patchStrategy=merge,retainKeys
	// +listType=map
	// +listMapKey=name
	// +optional
	ConfigSpecs []ComponentConfigSpec `json:"configSpecs,omitempty" patchStrategy:"merge,retainKeys" patchMergeKey:"name"`

	// Defines the image for the component to connect to databases or engines.
	// This overrides the `image` and `env` attributes defined in clusterDefinition.spec.componentDefs.systemAccountSpec.cmdExecutorConfig.
	// To clear default environment settings, set systemAccountSpec.cmdExecutorConfig.env to an empty list.
	//
	// +optional
	SystemAccountSpec *SystemAccountShortSpec `json:"systemAccountSpec,omitempty"`

	// Defines the context for container images for component versions.
	// This value replaces the values in clusterDefinition.spec.componentDefs.podSpec.[initContainers | containers].
	VersionsCtx VersionsContext `json:"versionsContext"`

	// Defines the images for the component to perform a switchover.
	// This overrides the image and env attributes defined in clusterDefinition.spec.componentDefs.SwitchoverSpec.CommandExecutorEnvItem.
	//
	// +optional
	SwitchoverSpec *SwitchoverShortSpec `json:"switchoverSpec,omitempty"`
}

ClusterComponentVersion is an application version component spec.

Deprecated since v0.9. This struct is maintained for backward compatibility and its use is discouraged.

func (*ClusterComponentVersion) DeepCopy added in v0.6.0

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

func (*ClusterComponentVersion) DeepCopyInto added in v0.6.0

func (in *ClusterComponentVersion) DeepCopyInto(out *ClusterComponentVersion)

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

type ClusterComponentVolumeClaimTemplate

type ClusterComponentVolumeClaimTemplate struct {
	// Refers to the name of a volumeMount defined in either:
	//
	// - `componentDefinition.spec.runtime.containers[*].volumeMounts`
	// - `clusterDefinition.spec.componentDefs[*].podSpec.containers[*].volumeMounts` (deprecated)
	//
	// The value of `name` must match the `name` field of a volumeMount specified in the corresponding `volumeMounts` array.
	//
	// +kubebuilder:validation:Required
	Name string `json:"name"`

	// Defines the desired characteristics of a PersistentVolumeClaim that will be created for the volume
	// with the mount name specified in the `name` field.
	//
	// When a Pod is created for this ClusterComponent, a new PVC will be created based on the specification
	// defined in the `spec` field. The PVC will be associated with the volume mount specified by the `name` field.
	//
	// +optional
	Spec PersistentVolumeClaimSpec `json:"spec,omitempty"`
}

func (*ClusterComponentVolumeClaimTemplate) DeepCopy added in v0.6.0

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

func (*ClusterComponentVolumeClaimTemplate) DeepCopyInto added in v0.6.0

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

type ClusterDefinition

type ClusterDefinition struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   ClusterDefinitionSpec   `json:"spec,omitempty"`
	Status ClusterDefinitionStatus `json:"status,omitempty"`
}

ClusterDefinition defines the topology for databases or storage systems, offering a variety of topological configurations to meet diverse deployment needs and scenarios.

It includes a list of Components, each linked to a ComponentDefinition, which enhances reusability and reduce redundancy. For example, widely used components such as etcd and Zookeeper can be defined once and reused across multiple ClusterDefinitions, simplifying the setup of new systems.

Additionally, ClusterDefinition also specifies the sequence of startup, upgrade, and shutdown for Components, ensuring a controlled and predictable management of component lifecycles.

func (*ClusterDefinition) DeepCopy added in v0.6.0

func (in *ClusterDefinition) DeepCopy() *ClusterDefinition

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

func (*ClusterDefinition) DeepCopyInto added in v0.6.0

func (in *ClusterDefinition) DeepCopyInto(out *ClusterDefinition)

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

func (*ClusterDefinition) DeepCopyObject added in v0.6.0

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

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

func (*ClusterDefinition) Default

func (r *ClusterDefinition) Default()

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

func (*ClusterDefinition) GetComponentDefByName

func (r *ClusterDefinition) GetComponentDefByName(compDefName string) *ClusterComponentDefinition

GetComponentDefByName gets component definition from ClusterDefinition with compDefName

func (*ClusterDefinition) SetupWebhookWithManager

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

func (*ClusterDefinition) ValidateCreate

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

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

func (*ClusterDefinition) ValidateDelete

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

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

func (*ClusterDefinition) ValidateEnabledLogConfigs

func (r *ClusterDefinition) ValidateEnabledLogConfigs(compDefName string, enabledLogs []string) []string

ValidateEnabledLogConfigs validates enabledLogs against component compDefName, and returns the invalid logNames undefined in ClusterDefinition.

func (*ClusterDefinition) ValidateUpdate

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

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

type ClusterDefinitionList

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

ClusterDefinitionList contains a list of ClusterDefinition

func (*ClusterDefinitionList) DeepCopy added in v0.6.0

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

func (*ClusterDefinitionList) DeepCopyInto added in v0.6.0

func (in *ClusterDefinitionList) DeepCopyInto(out *ClusterDefinitionList)

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

func (*ClusterDefinitionList) DeepCopyObject added in v0.6.0

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

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

type ClusterDefinitionProbe

type ClusterDefinitionProbe struct {
	// How often (in seconds) to perform the probe.
	//
	// +kubebuilder:default=1
	// +kubebuilder:validation:Minimum=1
	PeriodSeconds int32 `json:"periodSeconds,omitempty"`

	// Number of seconds after which the probe times out. Defaults to 1 second.
	//
	// +kubebuilder:default=1
	// +kubebuilder:validation:Minimum=1
	TimeoutSeconds int32 `json:"timeoutSeconds,omitempty"`

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

	// Commands used to execute for probe.
	//
	// +optional
	Commands *ClusterDefinitionProbeCMDs `json:"commands,omitempty"`
}

ClusterDefinitionProbe is deprecated since v0.8.

func (*ClusterDefinitionProbe) DeepCopy added in v0.6.0

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

func (*ClusterDefinitionProbe) DeepCopyInto added in v0.6.0

func (in *ClusterDefinitionProbe) DeepCopyInto(out *ClusterDefinitionProbe)

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

type ClusterDefinitionProbeCMDs

type ClusterDefinitionProbeCMDs struct {
	// Defines write checks that are executed on the probe sidecar.
	//
	// +optional
	Writes []string `json:"writes,omitempty"`

	// Defines read checks that are executed on the probe sidecar.
	//
	// +optional
	Queries []string `json:"queries,omitempty"`
}

ClusterDefinitionProbeCMDs is deprecated since v0.8.

func (*ClusterDefinitionProbeCMDs) DeepCopy added in v0.6.0

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

func (*ClusterDefinitionProbeCMDs) DeepCopyInto added in v0.6.0

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

type ClusterDefinitionProbes

type ClusterDefinitionProbes struct {
	// Specifies the probe used for checking the running status of the component.
	//
	// +optional
	RunningProbe *ClusterDefinitionProbe `json:"runningProbe,omitempty"`

	// Specifies the probe used for checking the status of the component.
	//
	// +optional
	StatusProbe *ClusterDefinitionProbe `json:"statusProbe,omitempty"`

	// Specifies the probe used for checking the role of the component.
	//
	// +kubebuilder:deprecatedversion:warning="This field is deprecated from KB 0.7.0, use RSMSpec instead."
	// +optional
	RoleProbe *ClusterDefinitionProbe `json:"roleProbe,omitempty"`

	// Defines the timeout (in seconds) for the role probe after all pods of the component are ready.
	// The system will check if the application is available in the pod.
	// If pods exceed the InitializationTimeoutSeconds time without a role label, this component will enter the
	// Failed/Abnormal phase.
	//
	// Note that this configuration will only take effect if the component supports RoleProbe
	// and will not affect the life cycle of the pod. default values are 60 seconds.
	//
	// +kubebuilder:validation:Minimum=30
	// +optional
	RoleProbeTimeoutAfterPodsReady int32 `json:"roleProbeTimeoutAfterPodsReady,omitempty"`
}

ClusterDefinitionProbes is deprecated since v0.8.

func (*ClusterDefinitionProbes) DeepCopy added in v0.6.0

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

func (*ClusterDefinitionProbes) DeepCopyInto added in v0.6.0

func (in *ClusterDefinitionProbes) DeepCopyInto(out *ClusterDefinitionProbes)

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

type ClusterDefinitionSpec

type ClusterDefinitionSpec struct {
	// Specifies the well-known database type, such as mysql, redis, or mongodb.
	//
	// Deprecated since v0.9.
	// This field is maintained for backward compatibility and its use is discouraged.
	// Existing usage should be updated to the current preferred approach to avoid compatibility issues in future releases.
	//
	// +kubebuilder:validation:MaxLength=24
	// +kubebuilder:validation:Pattern:=`^[a-z0-9]([a-z0-9\-]*[a-z0-9])?$`
	// +kubebuilder:deprecatedversion:warning="This field has been deprecated since 0.9.0"
	// +optional
	Type string `json:"type,omitempty"`

	// Provides the definitions for the cluster components.
	//
	// Deprecated since v0.9.
	// Components should now be individually defined using ComponentDefinition and
	// collectively referenced via `topology.components`.
	// This field is maintained for backward compatibility and its use is discouraged.
	// Existing usage should be updated to the current preferred approach to avoid compatibility issues in future releases.
	//
	// +kubebuilder:deprecatedversion:warning="This field has been deprecated since 0.9.0"
	// +patchMergeKey=name
	// +patchStrategy=merge,retainKeys
	// +listType=map
	// +listMapKey=name
	// +optional
	ComponentDefs []ClusterComponentDefinition `json:"componentDefs" patchStrategy:"merge,retainKeys" patchMergeKey:"name"`

	// Connection credential template used for creating a connection credential secret for cluster objects.
	//
	// Built-in objects are:
	//
	// - `$(RANDOM_PASSWD)` random 8 characters.
	// - `$(STRONG_RANDOM_PASSWD)` random 16 characters, with mixed cases, digits and symbols.
	// - `$(UUID)` generate a random UUID v4 string.
	// - `$(UUID_B64)` generate a random UUID v4 BASE64 encoded string.
	// - `$(UUID_STR_B64)` generate a random UUID v4 string then BASE64 encoded.
	// - `$(UUID_HEX)` generate a random UUID v4 HEX representation.
	// - `$(HEADLESS_SVC_FQDN)` headless service FQDN placeholder, value pattern is `$(CLUSTER_NAME)-$(1ST_COMP_NAME)-headless.$(NAMESPACE).svc`,
	//    where 1ST_COMP_NAME is the 1st component that provide `ClusterDefinition.spec.componentDefs[].service` attribute;
	// - `$(SVC_FQDN)` service FQDN placeholder, value pattern is `$(CLUSTER_NAME)-$(1ST_COMP_NAME).$(NAMESPACE).svc`,
	//    where 1ST_COMP_NAME is the 1st component that provide `ClusterDefinition.spec.componentDefs[].service` attribute;
	// - `$(SVC_PORT_{PORT-NAME})` is ServicePort's port value with specified port name, i.e, a servicePort JSON struct:
	//    `{"name": "mysql", "targetPort": "mysqlContainerPort", "port": 3306}`, and `$(SVC_PORT_mysql)` in the
	//    connection credential value is 3306.
	//
	// Deprecated since v0.9.
	// This field is maintained for backward compatibility and its use is discouraged.
	// Existing usage should be updated to the current preferred approach to avoid compatibility issues in future releases.
	//
	// +kubebuilder:deprecatedversion:warning="This field has been deprecated since 0.9.0"
	// +optional
	ConnectionCredential map[string]string `json:"connectionCredential,omitempty"`

	// Topologies defines all possible topologies within the cluster.
	//
	// +kubebuilder:validation:MinItems=1
	// +kubebuilder:validation:MaxItems=128
	// +optional
	Topologies []ClusterTopology `json:"topologies,omitempty"`
}

ClusterDefinitionSpec defines the desired state of ClusterDefinition.

func (*ClusterDefinitionSpec) DeepCopy added in v0.6.0

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

func (*ClusterDefinitionSpec) DeepCopyInto added in v0.6.0

func (in *ClusterDefinitionSpec) DeepCopyInto(out *ClusterDefinitionSpec)

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

type ClusterDefinitionStatus

type ClusterDefinitionStatus struct {
	// Represents the most recent generation observed for this ClusterDefinition.
	//
	// +optional
	ObservedGeneration int64 `json:"observedGeneration,omitempty"`

	// Specifies the current phase of the ClusterDefinition. Valid values are `empty`, `Available`, `Unavailable`.
	// When `Available`, the ClusterDefinition is ready and can be referenced by related objects.
	Phase Phase `json:"phase,omitempty"`

	// Provides additional information about the current phase.
	//
	// +optional
	Message string `json:"message,omitempty"`

	// Topologies this ClusterDefinition supported.
	//
	// +optional
	Topologies string `json:"topologies,omitempty"`

	// The service references declared by this ClusterDefinition.
	//
	// +optional
	ServiceRefs string `json:"serviceRefs,omitempty"`
}

ClusterDefinitionStatus defines the observed state of ClusterDefinition

func (*ClusterDefinitionStatus) DeepCopy added in v0.6.0

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

func (*ClusterDefinitionStatus) DeepCopyInto added in v0.6.0

func (in *ClusterDefinitionStatus) DeepCopyInto(out *ClusterDefinitionStatus)

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

func (ClusterDefinitionStatus) GetTerminalPhases

func (r ClusterDefinitionStatus) GetTerminalPhases() []Phase

type ClusterList

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

ClusterList contains a list of Cluster.

func (*ClusterList) DeepCopy added in v0.6.0

func (in *ClusterList) DeepCopy() *ClusterList

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

func (*ClusterList) DeepCopyInto added in v0.6.0

func (in *ClusterList) DeepCopyInto(out *ClusterList)

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

func (*ClusterList) DeepCopyObject added in v0.6.0

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

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

type ClusterNetwork added in v0.6.0

type ClusterNetwork struct {
	// Indicates whether the host network can be accessed. By default, this is set to false.
	//
	// +kubebuilder:default=false
	// +optional
	HostNetworkAccessible bool `json:"hostNetworkAccessible,omitempty"`

	// Indicates whether the network is accessible to the public. By default, this is set to false.
	//
	// +kubebuilder:default=false
	// +optional
	PubliclyAccessible bool `json:"publiclyAccessible,omitempty"`
}

ClusterNetwork is deprecated since v0.9.

func (*ClusterNetwork) DeepCopy added in v0.6.0

func (in *ClusterNetwork) DeepCopy() *ClusterNetwork

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

func (*ClusterNetwork) DeepCopyInto added in v0.6.0

func (in *ClusterNetwork) DeepCopyInto(out *ClusterNetwork)

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

type ClusterObjectReference added in v0.8.0

type ClusterObjectReference struct {
	// CompDef specifies the definition used by the component that the referent object resident in.
	// If not specified, the component itself will be used.
	//
	// +optional
	CompDef string `json:"compDef,omitempty"`

	// Name of the referent object.
	//
	// +optional
	Name string `json:"name,omitempty"`

	// Specify whether the object must be defined.
	//
	// +optional
	Optional *bool `json:"optional,omitempty"`

	// This option defines the behavior when multiple component objects match the specified @CompDef.
	// If not provided, an error will be raised when handling multiple matches.
	//
	// +optional
	MultipleClusterObjectOption *MultipleClusterObjectOption `json:"multipleClusterObjectOption,omitempty"`
}

ClusterObjectReference defines information to let you locate the referenced object inside the same Cluster.

func (*ClusterObjectReference) DeepCopy added in v0.8.0

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

func (*ClusterObjectReference) DeepCopyInto added in v0.8.0

func (in *ClusterObjectReference) DeepCopyInto(out *ClusterObjectReference)

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

type ClusterPhase

type ClusterPhase string

ClusterPhase defines the phase of the Cluster within the .status.phase field.

+enum +kubebuilder:validation:Enum={Creating,Running,Updating,Stopping,Stopped,Deleting,Failed,Abnormal}

const (
	// CreatingClusterPhase represents all components are in `Creating` phase.
	CreatingClusterPhase ClusterPhase = "Creating"

	// RunningClusterPhase represents all components are in `Running` phase, indicates that the cluster is functioning properly.
	RunningClusterPhase ClusterPhase = "Running"

	// UpdatingClusterPhase represents all components are in `Creating`, `Running` or `Updating` phase, and at least one
	// component is in `Creating` or `Updating` phase, indicates that the cluster is undergoing an update.
	UpdatingClusterPhase ClusterPhase = "Updating"

	// StoppingClusterPhase represents at least one component is in `Stopping` phase, indicates that the cluster is in
	// the process of stopping.
	StoppingClusterPhase ClusterPhase = "Stopping"

	// StoppedClusterPhase represents all components are in `Stopped` phase, indicates that the cluster has stopped and
	// is not providing any functionality.
	StoppedClusterPhase ClusterPhase = "Stopped"

	// DeletingClusterPhase indicates the cluster is being deleted.
	DeletingClusterPhase ClusterPhase = "Deleting"

	// FailedClusterPhase represents all components are in `Failed` phase, indicates that the cluster is unavailable.
	FailedClusterPhase ClusterPhase = "Failed"

	// AbnormalClusterPhase represents some components are in `Failed` or `Abnormal` phase, indicates that the cluster
	// is in a fragile state and troubleshooting is required.
	AbnormalClusterPhase ClusterPhase = "Abnormal"
)

func GetClusterUpRunningPhases

func GetClusterUpRunningPhases() []ClusterPhase

GetClusterUpRunningPhases returns Cluster running or partially running phases.

func GetReconfiguringRunningPhases added in v0.6.0

func GetReconfiguringRunningPhases() []ClusterPhase

GetReconfiguringRunningPhases return Cluster running or partially running phases.

type ClusterResourceConstraintSelector added in v0.6.0

type ClusterResourceConstraintSelector struct {
	// clusterDefRef is the name of the cluster definition.
	// +kubebuilder:validation:Required
	ClusterDefRef string `json:"clusterDefRef"`

	// selector is used to bind the resource constraint to components.
	// +listType=map
	// +listMapKey=componentDefRef
	// +kubebuilder:validation:Required
	Components []ComponentResourceConstraintSelector `json:"components"`
}

func (*ClusterResourceConstraintSelector) DeepCopy added in v0.6.0

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

func (*ClusterResourceConstraintSelector) DeepCopyInto added in v0.6.0

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

type ClusterResources added in v0.6.0

type ClusterResources struct {
	// Specifies the amount of CPU resource the Cluster needs.
	// For more information, refer to: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
	//
	// +optional
	CPU resource.Quantity `json:"cpu,omitempty"`

	// Specifies the amount of memory resource the Cluster needs.
	// For more information, refer to: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
	//
	// +optional
	Memory resource.Quantity `json:"memory,omitempty"`
}

ClusterResources is deprecated since v0.9.

func (*ClusterResources) DeepCopy added in v0.6.0

func (in *ClusterResources) DeepCopy() *ClusterResources

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

func (*ClusterResources) DeepCopyInto added in v0.6.0

func (in *ClusterResources) DeepCopyInto(out *ClusterResources)

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

type ClusterService added in v0.8.0

type ClusterService struct {
	Service `json:",inline"`

	// Extends the ServiceSpec.Selector by allowing the specification of a sharding name, which is defined in
	// `cluster.spec.shardingSpecs[*].name`, to be used as a selector for the service.
	// Note that this and the `componentSelector` are mutually exclusive and cannot be set simultaneously.
	//
	// +optional
	ShardingSelector string `json:"shardingSelector,omitempty"`

	// Extends the ServiceSpec.Selector by allowing the specification of a component, to be used as a selector for the service.
	// Note that this and the `shardingSelector` are mutually exclusive and cannot be set simultaneously.
	//
	// +optional
	ComponentSelector string `json:"componentSelector,omitempty"`
}

ClusterService defines a service that is exposed externally, allowing entities outside the cluster to access it. For example, external applications, or other Clusters. And another Cluster managed by the same KubeBlocks operator can resolve the address exposed by a ClusterService using the `serviceRef` field.

When a Component needs to access another Cluster's ClusterService using the `serviceRef` field, it must also define the service type and version information in the `componentDefinition.spec.serviceRefDeclarations` section.

func (*ClusterService) DeepCopy added in v0.8.0

func (in *ClusterService) DeepCopy() *ClusterService

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

func (*ClusterService) DeepCopyInto added in v0.8.0

func (in *ClusterService) DeepCopyInto(out *ClusterService)

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

type ClusterSpec

type ClusterSpec struct {
	// Specifies the name of the ClusterDefinition to use when creating a Cluster.
	//
	// This field enables users to create a Cluster based on a specific ClusterDefinition.
	// Which, in conjunction with the `topology` field, determine:
	//
	// - The Components to be included in the Cluster.
	// - The sequences in which the Components are created, updated, and terminate.
	//
	// This facilitates multiple-components management with predefined ClusterDefinition.
	//
	// Users with advanced requirements can bypass this general setting and specify more precise control over
	// the composition of the Cluster by directly referencing specific ComponentDefinitions for each component
	// within `componentSpecs[*].componentDef`.
	//
	// If this field is not provided, each component must be explicitly defined in `componentSpecs[*].componentDef`.
	//
	// Note: Once set, this field cannot be modified; it is immutable.
	//
	// +kubebuilder:validation:MaxLength=63
	// +kubebuilder:validation:Pattern:=`^[a-z0-9]([a-z0-9\.\-]*[a-z0-9])?$`
	// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="clusterDefinitionRef is immutable"
	// +optional
	ClusterDefRef string `json:"clusterDefinitionRef,omitempty"`

	// Refers to the ClusterVersion name.
	//
	// Deprecated since v0.9, use ComponentVersion instead.
	// This field is maintained for backward compatibility and its use is discouraged.
	// Existing usage should be updated to the current preferred approach to avoid compatibility issues in future releases.
	//
	// +kubebuilder:validation:MaxLength=63
	// +kubebuilder:validation:Pattern:=`^[a-z0-9]([a-z0-9\.\-]*[a-z0-9])?$`
	// +kubebuilder:deprecatedversion:warning="This field has been deprecated since 0.9.0"
	// +optional
	ClusterVersionRef string `json:"clusterVersionRef,omitempty"`

	// Specifies the name of the ClusterTopology to be used when creating the Cluster.
	//
	// This field defines which set of Components, as outlined in the ClusterDefinition, will be used to
	// construct the Cluster based on the named topology.
	// The ClusterDefinition may list multiple topologies under `clusterdefinition.spec.topologies[*]`,
	// each tailored to different use cases or environments.
	//
	// If `topology` is not specified, the Cluster will use the default topology defined in the ClusterDefinition.
	//
	// Note: Once set during the Cluster creation, the `topology` field cannot be modified.
	// It establishes the initial composition and structure of the Cluster and is intended for one-time configuration.
	//
	// +kubebuilder:validation:MaxLength=32
	// +optional
	Topology string `json:"topology,omitempty"`

	// Specifies the behavior when a Cluster is deleted.
	// It defines how resources, data, and backups associated with a Cluster are managed during termination.
	// Choose a policy based on the desired level of resource cleanup and data preservation:
	//
	// - `DoNotTerminate`: Prevents deletion of the Cluster. This policy ensures that all resources remain intact.
	// - `Halt`: Deletes Cluster resources like Pods and Services but retains Persistent Volume Claims (PVCs),
	//   allowing for data preservation while stopping other operations.
	// - `Delete`: Extends the `Halt` policy by also removing PVCs, leading to a thorough cleanup while
	//   removing all persistent data.
	// - `WipeOut`: An aggressive policy that deletes all Cluster resources, including volume snapshots and
	//   backups in external storage.
	//   This results in complete data removal and should be used cautiously, primarily in non-production environments
	//   to avoid irreversible data loss.
	//
	// Warning: Choosing an inappropriate termination policy can result in data loss.
	// The `WipeOut` policy is particularly risky in production environments due to its irreversible nature.
	//
	// +kubebuilder:validation:Required
	TerminationPolicy TerminationPolicyType `json:"terminationPolicy"`

	// Specifies a list of ShardingSpec objects that manage the sharding topology for Cluster Components.
	// Each ShardingSpec organizes components into shards, with each shard corresponding to a Component.
	// Components within a shard are all based on a common ClusterComponentSpec template, ensuring uniform configurations.
	//
	// This field supports dynamic resharding by facilitating the addition or removal of shards
	// through the `shards` field in ShardingSpec.
	//
	// Note: `shardingSpecs` and `componentSpecs` cannot both be empty; at least one must be defined to configure a Cluster.
	//
	// +patchMergeKey=name
	// +patchStrategy=merge,retainKeys
	// +listType=map
	// +listMapKey=name
	// +kubebuilder:validation:MinItems=1
	// +kubebuilder:validation:MaxItems=128
	// +optional
	ShardingSpecs []ShardingSpec `json:"shardingSpecs,omitempty"`

	// Specifies a list of ClusterComponentSpec objects used to define the individual Components that make up a Cluster.
	// This field allows for detailed configuration of each Component within the Cluster.
	//
	// Note: `shardingSpecs` and `componentSpecs` cannot both be empty; at least one must be defined to configure a Cluster.
	//
	// +kubebuilder:validation:MinItems=1
	// +kubebuilder:validation:MaxItems=128
	// +kubebuilder:validation:XValidation:rule="self.all(x, size(self.filter(c, c.name == x.name)) == 1)",message="duplicated component"
	// +kubebuilder:validation:XValidation:rule="self.all(x, size(self.filter(c, has(c.componentDef))) == 0) || self.all(x, size(self.filter(c, has(c.componentDef))) == size(self))",message="two kinds of definition API can not be used simultaneously"
	// +optional
	ComponentSpecs []ClusterComponentSpec `json:"componentSpecs,omitempty" patchStrategy:"merge,retainKeys" patchMergeKey:"name"`

	// Defines a list of additional Services that are exposed by a Cluster.
	// This field allows Services of selected Components, either from `componentSpecs` or `shardingSpecs` to be exposed,
	// alongside Services defined with ComponentService.
	//
	// Services defined here can be referenced by other clusters using the ServiceRefClusterSelector.
	//
	// +kubebuilder:pruning:PreserveUnknownFields
	// +optional
	Services []ClusterService `json:"services,omitempty"`

	// Defines a set of node affinity scheduling rules for the Cluster's Pods.
	// This field helps control the placement of Pods on nodes within the Cluster.
	//
	// +optional
	Affinity *Affinity `json:"affinity,omitempty"`

	// An array that specifies tolerations attached to the Cluster's Pods,
	// allowing them to be scheduled onto nodes with matching taints.
	//
	// +kubebuilder:pruning:PreserveUnknownFields
	// +optional
	Tolerations []corev1.Toleration `json:"tolerations,omitempty"`

	// Specifies runtimeClassName for all Pods managed by this Cluster.
	//
	// +optional
	RuntimeClassName *string `json:"runtimeClassName,omitempty"`

	// Specifies the backup configuration of the Cluster.
	//
	// +optional
	Backup *ClusterBackup `json:"backup,omitempty"`

	// Describes how Pods are distributed across node.
	//
	// Deprecated since v0.9.
	// This field is maintained for backward compatibility and its use is discouraged.
	// Existing usage should be updated to the current preferred approach to avoid compatibility issues in future releases.
	//
	// +kubebuilder:deprecatedversion:warning="This field has been deprecated since 0.9.0"
	// +optional
	Tenancy TenancyType `json:"tenancy,omitempty"`

	// Describes the availability policy, including zone, node, and none.
	//
	// Deprecated since v0.9.
	// This field is maintained for backward compatibility and its use is discouraged.
	// Existing usage should be updated to the current preferred approach to avoid compatibility issues in future releases.
	//
	// +kubebuilder:deprecatedversion:warning="This field has been deprecated since 0.9.0"
	// +optional
	AvailabilityPolicy AvailabilityPolicyType `json:"availabilityPolicy,omitempty"`

	// Specifies the replicas of the first componentSpec, if the replicas of the first componentSpec is specified,
	// this value will be ignored.
	//
	// Deprecated since v0.9.
	// This field is maintained for backward compatibility and its use is discouraged.
	// Existing usage should be updated to the current preferred approach to avoid compatibility issues in future releases.
	//
	// +kubebuilder:deprecatedversion:warning="This field has been deprecated since 0.9.0"
	// +optional
	Replicas *int32 `json:"replicas,omitempty"`

	// Specifies the resources of the first componentSpec, if the resources of the first componentSpec is specified,
	// this value will be ignored.
	//
	// Deprecated since v0.9.
	// This field is maintained for backward compatibility and its use is discouraged.
	// Existing usage should be updated to the current preferred approach to avoid compatibility issues in future releases.
	//
	// +kubebuilder:deprecatedversion:warning="This field has been deprecated since 0.9.0"
	// +optional
	Resources ClusterResources `json:"resources,omitempty"`

	// Specifies the storage of the first componentSpec, if the storage of the first componentSpec is specified,
	// this value will be ignored.
	//
	// Deprecated since v0.9.
	// This field is maintained for backward compatibility and its use is discouraged.
	// Existing usage should be updated to the current preferred approach to avoid compatibility issues in future releases.
	//
	// +kubebuilder:deprecatedversion:warning="This field has been deprecated since 0.9.0"
	// +optional
	Storage ClusterStorage `json:"storage,omitempty"`

	// The configuration of network.
	//
	// Deprecated since v0.9.
	// This field is maintained for backward compatibility and its use is discouraged.
	// Existing usage should be updated to the current preferred approach to avoid compatibility issues in future releases.
	//
	// +kubebuilder:deprecatedversion:warning="This field has been deprecated since 0.9.0"
	// +optional
	Network *ClusterNetwork `json:"network,omitempty"`
}

ClusterSpec defines the desired state of Cluster.

func (*ClusterSpec) DeepCopy added in v0.6.0

func (in *ClusterSpec) DeepCopy() *ClusterSpec

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

func (*ClusterSpec) DeepCopyInto added in v0.6.0

func (in *ClusterSpec) DeepCopyInto(out *ClusterSpec)

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

func (ClusterSpec) GetComponentByName

func (r ClusterSpec) GetComponentByName(componentName string) *ClusterComponentSpec

GetComponentByName gets component by name.

func (ClusterSpec) GetComponentDefRefName

func (r ClusterSpec) GetComponentDefRefName(componentName string) string

GetComponentDefRefName gets the name of referenced component definition.

func (ClusterSpec) GetDefNameMappingComponents

func (r ClusterSpec) GetDefNameMappingComponents() map[string][]ClusterComponentSpec

GetDefNameMappingComponents returns ComponentDefRef name mapping ClusterComponentSpec.

func (ClusterSpec) GetShardingByName added in v0.9.0

func (r ClusterSpec) GetShardingByName(shardingName string) *ShardingSpec

func (ClusterSpec) ValidateEnabledLogs

func (r ClusterSpec) ValidateEnabledLogs(cd *ClusterDefinition) error

ValidateEnabledLogs validates enabledLogs config in cluster.yaml, and returns metav1.Condition when detecting invalid values.

type ClusterStatus

type ClusterStatus struct {
	// The most recent generation number of the Cluster object that has been observed by the controller.
	//
	// +optional
	ObservedGeneration int64 `json:"observedGeneration,omitempty"`

	// The current phase of the Cluster includes:
	// `Creating`, `Running`, `Updating`, `Stopping`, `Stopped`, `Deleting`, `Failed`, `Abnormal`.
	//
	// +optional
	Phase ClusterPhase `json:"phase,omitempty"`

	// Provides additional information about the current phase.
	//
	// +optional
	Message string `json:"message,omitempty"`

	// Records the current status information of all Components within the Cluster.
	//
	// +optional
	Components map[string]ClusterComponentStatus `json:"components,omitempty"`

	// Represents the generation number of the referenced ClusterDefinition.
	//
	// +optional
	ClusterDefGeneration int64 `json:"clusterDefGeneration,omitempty"`

	// Represents a list of detailed status of the Cluster object.
	// Each condition in the list provides real-time information about certain aspect of the Cluster object.
	//
	// This field is crucial for administrators and developers to monitor and respond to changes within the Cluster.
	// It provides a history of state transitions and a snapshot of the current state that can be used for
	// automated logic or direct inspection.
	//
	// +optional
	Conditions []metav1.Condition `json:"conditions,omitempty"`
}

ClusterStatus defines the observed state of the Cluster.

func (*ClusterStatus) DeepCopy added in v0.6.0

func (in *ClusterStatus) DeepCopy() *ClusterStatus

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

func (*ClusterStatus) DeepCopyInto added in v0.6.0

func (in *ClusterStatus) DeepCopyInto(out *ClusterStatus)

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

func (*ClusterStatus) SetComponentStatus

func (r *ClusterStatus) SetComponentStatus(name string, status ClusterComponentStatus)

SetComponentStatus does safe operation on ClusterStatus.Components map object update.

type ClusterStorage added in v0.6.0

type ClusterStorage struct {
	// Specifies the amount of storage the Cluster needs.
	// For more information, refer to: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
	//
	// +optional
	Size resource.Quantity `json:"size,omitempty"`
}

ClusterStorage is deprecated since v0.9.

func (*ClusterStorage) DeepCopy added in v0.6.0

func (in *ClusterStorage) DeepCopy() *ClusterStorage

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

func (*ClusterStorage) DeepCopyInto added in v0.6.0

func (in *ClusterStorage) DeepCopyInto(out *ClusterStorage)

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

type ClusterSwitchPolicy

type ClusterSwitchPolicy struct {
	// Type specifies the type of switch policy to be applied.
	//
	// +kubebuilder:validation:Required
	// +kubebuilder:default=Noop
	// +optional
	Type SwitchPolicyType `json:"type"`
}

ClusterSwitchPolicy defines the switch policy for a Cluster.

Deprecated since v0.9.

func (*ClusterSwitchPolicy) DeepCopy added in v0.6.0

func (in *ClusterSwitchPolicy) DeepCopy() *ClusterSwitchPolicy

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

func (*ClusterSwitchPolicy) DeepCopyInto added in v0.6.0

func (in *ClusterSwitchPolicy) DeepCopyInto(out *ClusterSwitchPolicy)

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

type ClusterTopology added in v0.9.0

type ClusterTopology struct {
	// Name is the unique identifier for the cluster topology.
	// Cannot be updated.
	//
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MaxLength=32
	Name string `json:"name"`

	// Components specifies the components in the topology.
	//
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MinItems=1
	// +kubebuilder:validation:MaxItems=128
	Components []ClusterTopologyComponent `json:"components"`

	// Specifies the sequence in which components within a cluster topology are
	// started, stopped, and upgraded.
	// This ordering is crucial for maintaining the correct dependencies and operational flow across components.
	//
	// +optional
	Orders *ClusterTopologyOrders `json:"orders,omitempty"`

	// Default indicates whether this topology serves as the default configuration.
	// When set to true, this topology is automatically used unless another is explicitly specified.
	//
	// +optional
	Default bool `json:"default,omitempty"`
}

ClusterTopology represents the definition for a specific cluster topology.

func (*ClusterTopology) DeepCopy added in v0.9.0

func (in *ClusterTopology) DeepCopy() *ClusterTopology

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

func (*ClusterTopology) DeepCopyInto added in v0.9.0

func (in *ClusterTopology) DeepCopyInto(out *ClusterTopology)

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

type ClusterTopologyComponent added in v0.9.0

type ClusterTopologyComponent struct {
	// Defines the unique identifier of the component within the cluster topology.
	// It follows IANA Service naming rules and is used as part of the Service's DNS name.
	// The name must start with a lowercase letter, can contain lowercase letters, numbers,
	// and hyphens, and must end with a lowercase letter or number.
	//
	// Cannot be updated once set.
	//
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MaxLength=16
	// +kubebuilder:validation:Pattern:=`^[a-z]([a-z0-9\-]*[a-z0-9])?$`
	Name string `json:"name"`

	// Specifies the name or prefix of the ComponentDefinition custom resource(CR) that
	// defines the Component's characteristics and behavior.
	//
	// When a prefix is used, the system selects the ComponentDefinition CR with the latest version that matches the prefix.
	// This approach allows:
	//
	// 1. Precise selection by providing the exact name of a ComponentDefinition CR.
	// 2. Flexible and automatic selection of the most up-to-date ComponentDefinition CR by specifying a prefix.
	//
	// Once set, this field cannot be updated.
	//
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MaxLength=64
	CompDef string `json:"compDef"`
}

ClusterTopologyComponent defines a Component within a ClusterTopology.

func (*ClusterTopologyComponent) DeepCopy added in v0.9.0

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

func (*ClusterTopologyComponent) DeepCopyInto added in v0.9.0

func (in *ClusterTopologyComponent) DeepCopyInto(out *ClusterTopologyComponent)

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

type ClusterTopologyOrders added in v0.9.0

type ClusterTopologyOrders struct {
	// Specifies the order for creating and initializing components.
	// This is designed for components that depend on one another. Components without dependencies can be grouped together.
	//
	// Components that can be provisioned independently or have no dependencies can be listed together in the same stage,
	// separated by commas.
	//
	// +optional
	Provision []string `json:"provision,omitempty"`

	// Outlines the order for stopping and deleting components.
	// This sequence is designed for components that require a graceful shutdown or have interdependencies.
	//
	// Components that can be terminated independently or have no dependencies can be listed together in the same stage,
	// separated by commas.
	//
	// +optional
	Terminate []string `json:"terminate,omitempty"`

	// Update determines the order for updating components' specifications, such as image upgrades or resource scaling.
	// This sequence is designed for components that have dependencies or require specific update procedures.
	//
	// Components that can be updated independently or have no dependencies can be listed together in the same stage,
	// separated by commas.
	//
	// +optional
	Update []string `json:"update,omitempty"`
}

ClusterTopologyOrders manages the lifecycle of components within a cluster by defining their provisioning, terminating, and updating sequences. It organizes components into stages or groups, where each group indicates a set of components that can be managed concurrently. These groups are processed sequentially, allowing precise control based on component dependencies and requirements.

func (*ClusterTopologyOrders) DeepCopy added in v0.9.0

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

func (*ClusterTopologyOrders) DeepCopyInto added in v0.9.0

func (in *ClusterTopologyOrders) DeepCopyInto(out *ClusterTopologyOrders)

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

type ClusterVersion deprecated

type ClusterVersion struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   ClusterVersionSpec   `json:"spec,omitempty"`
	Status ClusterVersionStatus `json:"status,omitempty"`
}

ClusterVersion is the Schema for the ClusterVersions API.

Deprecated: ClusterVersion has been replaced by ComponentVersion since v0.9. This struct is maintained for backward compatibility and its use is discouraged.

func (*ClusterVersion) DeepCopy added in v0.6.0

func (in *ClusterVersion) DeepCopy() *ClusterVersion

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

func (*ClusterVersion) DeepCopyInto added in v0.6.0

func (in *ClusterVersion) DeepCopyInto(out *ClusterVersion)

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

func (*ClusterVersion) DeepCopyObject added in v0.6.0

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

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

func (*ClusterVersion) GetInconsistentComponentsInfo

func (r *ClusterVersion) GetInconsistentComponentsInfo(clusterDef *ClusterDefinition) ([]string, []string)

GetInconsistentComponentsInfo get clusterVersion invalid component name and no containers component compared with clusterDefinitionDef

func (*ClusterVersion) SetupWebhookWithManager

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

func (*ClusterVersion) ValidateCreate

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

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

func (*ClusterVersion) ValidateDelete

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

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

func (*ClusterVersion) ValidateUpdate

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

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

type ClusterVersionList

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

ClusterVersionList contains a list of ClusterVersion.

func (*ClusterVersionList) DeepCopy added in v0.6.0

func (in *ClusterVersionList) DeepCopy() *ClusterVersionList

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

func (*ClusterVersionList) DeepCopyInto added in v0.6.0

func (in *ClusterVersionList) DeepCopyInto(out *ClusterVersionList)

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

func (*ClusterVersionList) DeepCopyObject added in v0.6.0

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

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

type ClusterVersionSpec

type ClusterVersionSpec struct {
	// Specifies a reference to the ClusterDefinition.
	//
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:Pattern:=`^[a-z0-9]([a-z0-9\.\-]*[a-z0-9])?$`
	ClusterDefinitionRef string `json:"clusterDefinitionRef"`

	// Contains a list of versioning contexts for the components' containers.
	//
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MinItems=1
	// +patchMergeKey=componentDefRef
	// +patchStrategy=merge,retainKeys
	// +listType=map
	// +listMapKey=componentDefRef
	ComponentVersions []ClusterComponentVersion `json:"componentVersions" patchStrategy:"merge,retainKeys" patchMergeKey:"componentDefRef"`
}

ClusterVersionSpec defines the desired state of ClusterVersion.

Deprecated since v0.9. This struct is maintained for backward compatibility and its use is discouraged.

func (*ClusterVersionSpec) DeepCopy added in v0.6.0

func (in *ClusterVersionSpec) DeepCopy() *ClusterVersionSpec

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

func (*ClusterVersionSpec) DeepCopyInto added in v0.6.0

func (in *ClusterVersionSpec) DeepCopyInto(out *ClusterVersionSpec)

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

func (ClusterVersionSpec) GetDefNameMappingComponents

func (r ClusterVersionSpec) GetDefNameMappingComponents() map[string]*ClusterComponentVersion

GetDefNameMappingComponents returns ComponentDefRef name mapping ClusterComponentVersion.

type ClusterVersionStatus

type ClusterVersionStatus struct {
	// The current phase of the ClusterVersion.
	//
	// +optional
	Phase Phase `json:"phase,omitempty"`

	// Provides additional information about the current phase.
	//
	// +optional
	Message string `json:"message,omitempty"`

	// The generation number that has been observed by the controller.
	//
	// +optional
	ObservedGeneration int64 `json:"observedGeneration,omitempty"`

	// The generation number of the ClusterDefinition that is currently being referenced.
	//
	// +optional
	ClusterDefGeneration int64 `json:"clusterDefGeneration,omitempty"`
}

ClusterVersionStatus defines the observed state of ClusterVersion.

Deprecated since v0.9. This struct is maintained for backward compatibility and its use is discouraged.

func (*ClusterVersionStatus) DeepCopy added in v0.6.0

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

func (*ClusterVersionStatus) DeepCopyInto added in v0.6.0

func (in *ClusterVersionStatus) DeepCopyInto(out *ClusterVersionStatus)

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

func (ClusterVersionStatus) GetTerminalPhases

func (r ClusterVersionStatus) GetTerminalPhases() []Phase

type CmdExecutorConfig

type CmdExecutorConfig struct {
	CommandExecutorEnvItem `json:",inline"`
	CommandExecutorItem    `json:",inline"`
}

CmdExecutorConfig specifies how to perform creation and deletion statements.

Deprecated since v0.8.

func (*CmdExecutorConfig) DeepCopy added in v0.6.0

func (in *CmdExecutorConfig) DeepCopy() *CmdExecutorConfig

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

func (*CmdExecutorConfig) DeepCopyInto added in v0.6.0

func (in *CmdExecutorConfig) DeepCopyInto(out *CmdExecutorConfig)

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

type CommandExecutorEnvItem

type CommandExecutorEnvItem struct {
	// Specifies the image used to execute the command.
	//
	// +kubebuilder:validation:Required
	Image string `json:"image"`

	// A list of environment variables that will be injected into the command execution context.
	//
	// +kubebuilder:pruning:PreserveUnknownFields
	// +patchMergeKey=name
	// +patchStrategy=merge,retainKeys
	// +optional
	Env []corev1.EnvVar `json:"env,omitempty" patchStrategy:"merge" patchMergeKey:"name"`
}

CommandExecutorEnvItem is deprecated since v0.8.

func (*CommandExecutorEnvItem) DeepCopy added in v0.6.0

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

func (*CommandExecutorEnvItem) DeepCopyInto added in v0.6.0

func (in *CommandExecutorEnvItem) DeepCopyInto(out *CommandExecutorEnvItem)

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

type CommandExecutorItem

type CommandExecutorItem struct {
	// The command to be executed.
	//
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MinItems=1
	Command []string `json:"command"`

	// Additional parameters used in the execution of the command.
	//
	// +optional
	Args []string `json:"args,omitempty"`
}

CommandExecutorItem is deprecated since v0.8.

func (*CommandExecutorItem) DeepCopy added in v0.6.0

func (in *CommandExecutorItem) DeepCopy() *CommandExecutorItem

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

func (*CommandExecutorItem) DeepCopyInto added in v0.6.0

func (in *CommandExecutorItem) DeepCopyInto(out *CommandExecutorItem)

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

type CompletionProbe added in v0.9.0

type CompletionProbe struct {
	// Specifies the number of seconds to wait after the resource has been patched before initiating completion probes.
	// The default value is 5 seconds, with a minimum value of 1.
	// +kubebuilder:validation:Minimum=1
	// +kubebuilder:default=5
	// +optional
	InitialDelaySeconds int32 `json:"initialDelaySeconds,omitempty"`

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

	// Specifies the frequency (in seconds) at which the probe should be performed.
	// The default value is 5 seconds, with a minimum value of 1.
	// +kubebuilder:validation:Minimum=1
	// +kubebuilder:default=5
	// +optional
	PeriodSeconds int32 `json:"periodSeconds,omitempty"`

	// Executes expressions regularly, based on the value of PeriodSeconds, to determine if the action has been completed.
	// +kubebuilder:validation:Required
	MatchExpressions MatchExpressions `json:"matchExpressions"`
}

func (*CompletionProbe) DeepCopy added in v0.9.0

func (in *CompletionProbe) DeepCopy() *CompletionProbe

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

func (*CompletionProbe) DeepCopyInto added in v0.9.0

func (in *CompletionProbe) DeepCopyInto(out *CompletionProbe)

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

type Component added in v0.8.0

type Component struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   ComponentSpec   `json:"spec,omitempty"`
	Status ComponentStatus `json:"status,omitempty"`
}

Component is a fundamental building block of a Cluster object. For example, a Redis Cluster can include Components like 'redis', 'sentinel', and potentially a proxy like 'twemproxy'.

The Component object is responsible for managing the lifecycle of all replicas within a Cluster component, It supports a wide range of operations including provisioning, stopping, restarting, termination, upgrading, configuration changes, vertical and horizontal scaling, failover, switchover, cross-node migration, scheduling configuration, exposing Services, managing system accounts, enabling/disabling exporter, and configuring log collection.

Component is an internal sub-object derived from the user-submitted Cluster object. It is designed primarily to be used by the KubeBlocks controllers, users are discouraged from modifying Component objects directly and should use them only for monitoring Component statuses.

func (*Component) DeepCopy added in v0.8.0

func (in *Component) DeepCopy() *Component

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

func (*Component) DeepCopyInto added in v0.8.0

func (in *Component) DeepCopyInto(out *Component)

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

func (*Component) DeepCopyObject added in v0.8.0

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

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

func (*Component) Default added in v0.8.0

func (r *Component) Default()

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

func (*Component) SetupWebhookWithManager added in v0.8.0

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

func (*Component) ValidateCreate added in v0.8.0

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

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

func (*Component) ValidateDelete added in v0.8.0

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

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

func (*Component) ValidateUpdate added in v0.8.0

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

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

type ComponentClass

type ComponentClass struct {
	// name is the class name
	// +optional
	Name string `json:"name,omitempty"`

	// args are variable's value
	// +optional
	Args []string `json:"args,omitempty"`

	// the CPU of the class
	// +optional
	CPU resource.Quantity `json:"cpu,omitempty"`

	// the memory of the class
	// +optional
	Memory resource.Quantity `json:"memory,omitempty"`
}

func (*ComponentClass) Cmp added in v0.6.0

func (r *ComponentClass) Cmp(b *ComponentClass) int

func (*ComponentClass) DeepCopy added in v0.6.0

func (in *ComponentClass) DeepCopy() *ComponentClass

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

func (*ComponentClass) DeepCopyInto added in v0.6.0

func (in *ComponentClass) DeepCopyInto(out *ComponentClass)

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

func (*ComponentClass) ToResourceRequirements

func (r *ComponentClass) ToResourceRequirements() corev1.ResourceRequirements

type ComponentClassDefinition

type ComponentClassDefinition struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   ComponentClassDefinitionSpec   `json:"spec,omitempty"`
	Status ComponentClassDefinitionStatus `json:"status,omitempty"`
}

ComponentClassDefinition is the Schema for the componentclassdefinitions API

func (*ComponentClassDefinition) DeepCopy added in v0.6.0

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

func (*ComponentClassDefinition) DeepCopyInto added in v0.6.0

func (in *ComponentClassDefinition) DeepCopyInto(out *ComponentClassDefinition)

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

func (*ComponentClassDefinition) DeepCopyObject added in v0.6.0

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

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

type ComponentClassDefinitionList

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

ComponentClassDefinitionList contains a list of ComponentClassDefinition

func (*ComponentClassDefinitionList) DeepCopy added in v0.6.0

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

func (*ComponentClassDefinitionList) DeepCopyInto added in v0.6.0

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

func (*ComponentClassDefinitionList) DeepCopyObject added in v0.6.0

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

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

type ComponentClassDefinitionSpec

type ComponentClassDefinitionSpec struct {
	// group defines a list of class series that conform to the same constraint.
	// +optional
	Groups []ComponentClassGroup `json:"groups,omitempty"`
}

ComponentClassDefinitionSpec defines the desired state of ComponentClassDefinition

func (*ComponentClassDefinitionSpec) DeepCopy added in v0.6.0

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

func (*ComponentClassDefinitionSpec) DeepCopyInto added in v0.6.0

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

type ComponentClassDefinitionStatus

type ComponentClassDefinitionStatus struct {
	// observedGeneration is the most recent generation observed for this
	// ComponentClassDefinition. It corresponds to the ComponentClassDefinition's generation, which is
	// updated on mutation by the API Server.
	// +optional
	ObservedGeneration int64 `json:"observedGeneration,omitempty"`

	// classes is the list of classes that have been observed for this ComponentClassDefinition
	Classes []ComponentClass `json:"classes,omitempty"`
}

ComponentClassDefinitionStatus defines the observed state of ComponentClassDefinition

func (*ComponentClassDefinitionStatus) DeepCopy added in v0.6.0

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

func (*ComponentClassDefinitionStatus) DeepCopyInto added in v0.6.0

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

type ComponentClassGroup

type ComponentClassGroup struct {
	// template is a class definition template that uses the Go template syntax and allows for variable declaration.
	// When defining a class in Series, specifying the variable's value is sufficient, as the complete class
	// definition will be generated through rendering the template.
	//
	// For example:
	//
	// “`yaml
	// template: |
	//	 cpu: "{{ or .cpu 1 }}"
	//	 memory: "{{ or .memory 4 }}Gi"
	// “`
	//
	// +optional
	Template string `json:"template,omitempty"`

	// vars defines the variables declared in the template and will be used to generating the complete class definition by
	// render the template.
	// +listType=set
	// +optional
	Vars []string `json:"vars,omitempty"`

	// series is a series of class definitions.
	// +optional
	Series []ComponentClassSeries `json:"series,omitempty"`
}

func (*ComponentClassGroup) DeepCopy added in v0.6.0

func (in *ComponentClassGroup) DeepCopy() *ComponentClassGroup

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

func (*ComponentClassGroup) DeepCopyInto added in v0.6.0

func (in *ComponentClassGroup) DeepCopyInto(out *ComponentClassGroup)

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

type ComponentClassSeries

type ComponentClassSeries struct {
	// namingTemplate is a template that uses the Go template syntax and allows for referencing variables defined
	// in ComponentClassGroup.Template. This enables dynamic generation of class names.
	// For example:
	// name: "general-{{ .cpu }}c{{ .memory }}g"
	// +optional
	NamingTemplate string `json:"namingTemplate,omitempty"`

	// classes are definitions of classes that come in two forms. In the first form, only ComponentClass.Args
	// need to be defined, and the complete class definition is generated by rendering the ComponentClassGroup.Template
	// and Name. In the second form, the Name, CPU and Memory must be defined.
	// +optional
	Classes []ComponentClass `json:"classes,omitempty"`
}

func (*ComponentClassSeries) DeepCopy added in v0.6.0

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

func (*ComponentClassSeries) DeepCopyInto added in v0.6.0

func (in *ComponentClassSeries) DeepCopyInto(out *ComponentClassSeries)

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

type ComponentConfigSpec

type ComponentConfigSpec struct {
	ComponentTemplateSpec `json:",inline"`

	// Specifies the configuration files within the ConfigMap that support dynamic updates.
	//
	// A configuration template (provided in the form of a ConfigMap) may contain templates for multiple
	// configuration files.
	// Each configuration file corresponds to a key in the ConfigMap.
	// Some of these configuration files may support dynamic modification and reloading without requiring
	// a pod restart.
	//
	// If empty or omitted, all configuration files in the ConfigMap are assumed to support dynamic updates,
	// and ConfigConstraint applies to all keys.
	//
	// +listType=set
	// +optional
	Keys []string `json:"keys,omitempty"`

	// Specifies the secondary rendered config spec for pod-specific customization.
	//
	// The template is rendered inside the pod (by the "config-manager" sidecar container) and merged with the main
	// template's render result to generate the final configuration file.
	//
	// This field is intended to handle scenarios where different pods within the same Component have
	// varying configurations. It allows for pod-specific customization of the configuration.
	//
	// Note: This field will be deprecated in future versions, and the functionality will be moved to
	// `cluster.spec.componentSpecs[*].instances[*]`.
	//
	// +kubebuilder:deprecatedversion:warning="This field has been deprecated since 0.9.0 and will be removed in 0.10.0"
	// +optional
	LegacyRenderedConfigSpec *LegacyRenderedTemplateSpec `json:"legacyRenderedConfigSpec,omitempty"`

	// Specifies the name of the referenced configuration constraints object.
	//
	// +kubebuilder:validation:MaxLength=63
	// +kubebuilder:validation:Pattern:=`^[a-z0-9]([a-z0-9\.\-]*[a-z0-9])?$`
	// +optional
	ConfigConstraintRef string `json:"constraintRef,omitempty"`

	// Specifies the containers to inject the ConfigMap parameters as environment variables.
	//
	// This is useful when application images accept parameters through environment variables and
	// generate the final configuration file in the startup script based on these variables.
	//
	// This field allows users to specify a list of container names, and KubeBlocks will inject the environment
	// variables converted from the ConfigMap into these designated containers. This provides a flexible way to
	// pass the configuration items from the ConfigMap to the container without modifying the image.
	//
	// Deprecated: `asEnvFrom` has been deprecated since 0.9.0 and will be removed in 0.10.0.
	// Use `injectEnvTo` instead.
	//
	// +kubebuilder:deprecatedversion:warning="This field has been deprecated since 0.9.0 and will be removed in 0.10.0"
	// +listType=set
	// +optional
	AsEnvFrom []string `json:"asEnvFrom,omitempty"`

	// Specifies the containers to inject the ConfigMap parameters as environment variables.
	//
	// This is useful when application images accept parameters through environment variables and
	// generate the final configuration file in the startup script based on these variables.
	//
	// This field allows users to specify a list of container names, and KubeBlocks will inject the environment
	// variables converted from the ConfigMap into these designated containers. This provides a flexible way to
	// pass the configuration items from the ConfigMap to the container without modifying the image.
	//
	//
	// +listType=set
	// +optional
	InjectEnvTo []string `json:"injectEnvTo,omitempty"`

	// Specifies whether the configuration needs to be re-rendered after v-scale or h-scale operations to reflect changes.
	//
	// In some scenarios, the configuration may need to be updated to reflect the changes in resource allocation
	// or cluster topology. Examples:
	//
	// - Redis: adjust maxmemory after v-scale operation.
	// - MySQL: increase max connections after v-scale operation.
	// - Zookeeper: update zoo.cfg with new node addresses after h-scale operation.
	//
	// +listType=set
	// +optional
	ReRenderResourceTypes []RerenderResourceType `json:"reRenderResourceTypes,omitempty"`
}

func (*ComponentConfigSpec) ContainersInjectedTo added in v0.9.0

func (configSpec *ComponentConfigSpec) ContainersInjectedTo() []string

func (*ComponentConfigSpec) DeepCopy added in v0.6.0

func (in *ComponentConfigSpec) DeepCopy() *ComponentConfigSpec

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

func (*ComponentConfigSpec) DeepCopyInto added in v0.6.0

func (in *ComponentConfigSpec) DeepCopyInto(out *ComponentConfigSpec)

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

func (*ComponentConfigSpec) InjectEnvEnabled added in v0.9.0

func (configSpec *ComponentConfigSpec) InjectEnvEnabled() bool

type ComponentDefRef added in v0.6.0

type ComponentDefRef struct {
	// The name of the componentDef to be selected.
	//
	// +kubebuilder:validation:Required
	ComponentDefName string `json:"componentDefName"`

	// Defines the policy to be followed in case of a failure in finding the component.
	//
	// +kubebuilder:validation:Enum={Ignore,Fail}
	// +default="Ignore"
	// +optional
	FailurePolicy FailurePolicyType `json:"failurePolicy,omitempty"`

	// The values that are to be injected as environment variables into each component.
	//
	// +kbubebuilder:validation:Required
	// +patchMergeKey=name
	// +patchStrategy=merge,retainKeys
	// +listType=map
	// +listMapKey=name
	// +optional
	ComponentRefEnvs []ComponentRefEnv `json:"componentRefEnv" patchStrategy:"merge" patchMergeKey:"name"`
}

ComponentDefRef is used to select the component and its fields to be referenced.

Deprecated since v0.8.

func (*ComponentDefRef) DeepCopy added in v0.6.0

func (in *ComponentDefRef) DeepCopy() *ComponentDefRef

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

func (*ComponentDefRef) DeepCopyInto added in v0.6.0

func (in *ComponentDefRef) DeepCopyInto(out *ComponentDefRef)

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

type ComponentDefinition added in v0.8.0

type ComponentDefinition struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   ComponentDefinitionSpec   `json:"spec,omitempty"`
	Status ComponentDefinitionStatus `json:"status,omitempty"`
}

ComponentDefinition serves as a reusable blueprint for creating Components, encapsulating essential static settings such as Component description, Pod templates, configuration file templates, scripts, parameter lists, injected environment variables and their sources, and event handlers. ComponentDefinition works in conjunction with dynamic settings from the ClusterComponentSpec, to instantiate Components during Cluster creation.

Key aspects that can be defined in a ComponentDefinition include:

- PodSpec template: Specifies the PodSpec template used by the Component. - Configuration templates: Specify the configuration file templates required by the Component. - Scripts: Provide the necessary scripts for Component management and operations. - Storage volumes: Specify the storage volumes and their configurations for the Component. - Pod roles: Outlines various roles of Pods within the Component along with their capabilities. - Exposed Kubernetes Services: Specify the Services that need to be exposed by the Component. - System accounts: Define the system accounts required for the Component. - Monitoring and logging: Configure the exporter and logging settings for the Component.

ComponentDefinitions also enable defining reactive behaviors of the Component in response to events, such as member join/leave, Component addition/deletion, role changes, switch over, and more. This allows for automatic event handling, thus encapsulating complex behaviors within the Component.

Referencing a ComponentDefinition when creating individual Components ensures inheritance of predefined configurations, promoting reusability and consistency across different deployments and cluster topologies.

func (*ComponentDefinition) DeepCopy added in v0.8.0

func (in *ComponentDefinition) DeepCopy() *ComponentDefinition

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

func (*ComponentDefinition) DeepCopyInto added in v0.8.0

func (in *ComponentDefinition) DeepCopyInto(out *ComponentDefinition)

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

func (*ComponentDefinition) DeepCopyObject added in v0.8.0

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

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

func (*ComponentDefinition) Default added in v0.8.0

func (r *ComponentDefinition) Default()

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

func (*ComponentDefinition) SetupWebhookWithManager added in v0.8.0

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

func (*ComponentDefinition) ValidateCreate added in v0.8.0

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

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

func (*ComponentDefinition) ValidateDelete added in v0.8.0

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

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

func (*ComponentDefinition) ValidateUpdate added in v0.8.0

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

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

type ComponentDefinitionList added in v0.8.0

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

ComponentDefinitionList contains a list of ComponentDefinition

func (*ComponentDefinitionList) DeepCopy added in v0.8.0

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

func (*ComponentDefinitionList) DeepCopyInto added in v0.8.0

func (in *ComponentDefinitionList) DeepCopyInto(out *ComponentDefinitionList)

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

func (*ComponentDefinitionList) DeepCopyObject added in v0.8.0

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

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

type ComponentDefinitionSpec added in v0.8.0

type ComponentDefinitionSpec struct {
	// Specifies the name of the Component provider, typically the vendor or developer name.
	// It identifies the entity responsible for creating and maintaining the Component.
	//
	// When specifying the provider name, consider the following guidelines:
	//
	// - Keep the name concise and relevant to the Component.
	// - Use a consistent naming convention across Components from the same provider.
	// - Avoid using trademarked or copyrighted names without proper permission.
	//
	// +kubebuilder:validation:MaxLength=32
	// +optional
	Provider string `json:"provider,omitempty"`

	// Provides a brief and concise explanation of the Component's purpose, functionality, and any relevant details.
	// It serves as a quick reference for users to understand the Component's role and characteristics.
	//
	// +kubebuilder:validation:MaxLength=256
	// +optional
	Description string `json:"description,omitempty"`

	// Defines the type of well-known service protocol that the Component provides.
	// It specifies the standard or widely recognized protocol used by the Component to offer its Services.
	//
	// The `serviceKind` field allows users to quickly identify the type of Service provided by the Component
	// based on common protocols or service types. This information helps in understanding the compatibility,
	// interoperability, and usage of the Component within a system.
	//
	// Some examples of well-known service protocols include:
	//
	// - "MySQL": Indicates that the Component provides a MySQL database service.
	// - "PostgreSQL": Indicates that the Component offers a PostgreSQL database service.
	// - "Redis": Signifies that the Component functions as a Redis key-value store.
	// - "ETCD": Denotes that the Component serves as an ETCD distributed key-value store.
	//
	// The `serviceKind` value is case-insensitive, allowing for flexibility in specifying the protocol name.
	//
	// When specifying the `serviceKind`, consider the following guidelines:
	//
	// - Use well-established and widely recognized protocol names or service types.
	// - Ensure that the `serviceKind` accurately represents the primary service type offered by the Component.
	// - If the Component provides multiple services, choose the most prominent or commonly used protocol.
	// - Limit the `serviceKind` to a maximum of 32 characters for conciseness and readability.
	//
	// Note: The `serviceKind` field is optional and can be left empty if the Component does not fit into a well-known
	// service category or if the protocol is not widely recognized. It is primarily used to convey information about
	// the Component's service type to users and facilitate discovery and integration.
	//
	// The `serviceKind` field is immutable and cannot be updated.
	//
	// +kubebuilder:validation:MaxLength=32
	// +optional
	ServiceKind string `json:"serviceKind,omitempty"`

	// Specifies the version of the Service provided by the Component.
	// It follows the syntax and semantics of the "Semantic Versioning" specification (http://semver.org/).
	//
	// The Semantic Versioning specification defines a version number format of X.Y.Z (MAJOR.MINOR.PATCH), where:
	//
	// - X represents the major version and indicates incompatible API changes.
	// - Y represents the minor version and indicates added functionality in a backward-compatible manner.
	// - Z represents the patch version and indicates backward-compatible bug fixes.
	//
	// Additional labels for pre-release and build metadata are available as extensions to the X.Y.Z format:
	//
	// - Use pre-release labels (e.g., -alpha, -beta) for versions that are not yet stable or ready for production use.
	// - Use build metadata (e.g., +build.1) for additional version information if needed.
	//
	// Examples of valid ServiceVersion values:
	//
	// - "1.0.0"
	// - "2.3.1"
	// - "3.0.0-alpha.1"
	// - "4.5.2+build.1"
	//
	// The `serviceVersion` field is immutable and cannot be updated.
	//
	// +kubebuilder:validation:MaxLength=32
	// +optional
	ServiceVersion string `json:"serviceVersion,omitempty"`

	// Specifies the PodSpec template used in the Component.
	// It includes the following elements:
	//
	// - Init containers
	// - Containers
	//     - Image
	//     - Commands
	//     - Args
	//     - Envs
	//     - Mounts
	//     - Ports
	//     - Security context
	//     - Probes
	//     - Lifecycle
	// - Volumes
	//
	// This field is intended to define static settings that remain consistent across all instantiated Components.
	// Dynamic settings such as CPU and memory resource limits, as well as scheduling settings (affinity,
	// toleration, priority), may vary among different instantiated Components.
	// They should be specified in the `cluster.spec.componentSpecs` (ClusterComponentSpec).
	//
	// Specific instances of a Component may override settings defined here, such as using a different container image
	// or modifying environment variable values.
	// These instance-specific overrides can be specified in `cluster.spec.componentSpecs[*].instances`.
	//
	// This field is immutable and cannot be updated once set.
	//
	// +kubebuilder:pruning:PreserveUnknownFields
	// +kubebuilder:validation:Required
	Runtime corev1.PodSpec `json:"runtime"`

	// Deprecated since v0.9
	// monitor is monitoring config which provided by provider.
	//
	// +kubebuilder:deprecatedversion:warning="This field has been deprecated since 0.10.0"
	// +optional
	Monitor *MonitorConfig `json:"monitor,omitempty"`

	// Defines the built-in metrics exporter container.
	//
	// +optional
	Exporter *Exporter `json:"exporter,omitempty"`

	// Defines variables which are determined after Cluster instantiation and reflect
	// dynamic or runtime attributes of instantiated Clusters.
	// These variables serve as placeholders for setting environment variables in Pods and Actions,
	// or for rendering configuration and script templates before actual values are finalized.
	//
	// These variables are placed in front of the environment variables declared in the Pod if used as
	// environment variables.
	//
	// Variable values can be sourced from:
	//
	// - ConfigMap: Select and extract a value from a specific key within a ConfigMap.
	// - Secret: Select and extract a value from a specific key within a Secret.
	// - HostNetwork: Retrieves values (including ports) from host-network resources.
	// - Service: Retrieves values (including address, port, NodePort) from a selected Service.
	//   Intended to obtain the address of a ComponentService within the same Cluster.
	// - Credential: Retrieves account name and password from a SystemAccount variable.
	// - ServiceRef: Retrieves address, port, account name and password from a selected ServiceRefDeclaration.
	//   Designed to obtain the address bound to a ServiceRef, such as a ClusterService or
	//   ComponentService of another cluster or an external service.
	// - Component: Retrieves values from a selected Component, including replicas and instance name list.
	//
	// This field is immutable.
	//
	// +optional
	Vars []EnvVar `json:"vars,omitempty"`

	// Defines the volumes used by the Component and some static attributes of the volumes.
	// After defining the volumes here, user can reference them in the
	// `cluster.spec.componentSpecs[*].volumeClaimTemplates` field to configure dynamic properties such as
	// volume capacity and storage class.
	//
	// This field allows you to specify the following:
	//
	// - Snapshot behavior: Determines whether a snapshot of the volume should be taken when performing
	//   a snapshot backup of the Component.
	// - Disk high watermark: Sets the high watermark for the volume's disk usage.
	//   When the disk usage reaches the specified threshold, it triggers an alert or action.
	//
	// By configuring these volume behaviors, you can control how the volumes are managed and monitored within the Component.
	//
	// This field is immutable.
	//
	// +optional
	Volumes []ComponentVolume `json:"volumes"`

	// Specifies the host network configuration for the Component.
	//
	// When `hostNetwork` option is enabled, the Pods share the host's network namespace and can directly access
	// the host's network interfaces.
	// This means that if multiple Pods need to use the same port, they cannot run on the same host simultaneously
	// due to port conflicts.
	//
	// The DNSPolicy field in the Pod spec determines how containers within the Pod perform DNS resolution.
	// When using hostNetwork, the operator will set the DNSPolicy to 'ClusterFirstWithHostNet'.
	// With this policy, DNS queries will first go through the K8s cluster's DNS service.
	// If the query fails, it will fall back to the host's DNS settings.
	//
	// If set, the DNS policy will be automatically set to "ClusterFirstWithHostNet".
	//
	// +optional
	HostNetwork *HostNetwork `json:"hostNetwork,omitempty"`

	// Defines additional Services to expose the Component's endpoints.
	//
	// A default headless Service, named `{cluster.name}-{component.name}-headless`, is automatically created
	// for internal Cluster communication.
	//
	// This field enables customization of additional Services to expose the Component's endpoints to
	// other Components within the same or different Clusters, and to external applications.
	// Each Service entry in this list can include properties such as ports, type, and selectors.
	//
	// - For intra-Cluster access, Components can reference Services using variables declared in
	//   `componentDefinition.spec.vars[*].valueFrom.serviceVarRef`.
	// - For inter-Cluster access, reference Services use variables declared in
	//   `componentDefinition.spec.vars[*].valueFrom.serviceRefVarRef`,
	//   and bind Services at Cluster creation time with `clusterComponentSpec.ServiceRef[*].clusterServiceSelector`.
	//
	// This field is immutable.
	//
	// +optional
	Services []ComponentService `json:"services,omitempty"`

	// Specifies the configuration file templates and volume mount parameters used by the Component.
	// It also includes descriptions of the parameters in the ConfigMaps, such as value range limitations.
	//
	// This field specifies a list of templates that will be rendered into Component containers' configuration files.
	// Each template is represented as a ConfigMap and may contain multiple configuration files,
	// with each file being a key in the ConfigMap.
	//
	// The rendered configuration files will be mounted into the Component's containers
	//  according to the specified volume mount parameters.
	//
	// This field is immutable.
	//
	// +patchMergeKey=name
	// +patchStrategy=merge,retainKeys
	// +listType=map
	// +listMapKey=name
	// +optional
	// TODO: support referencing configs from other components or clusters.
	Configs []ComponentConfigSpec `json:"configs,omitempty"`

	// Defines the types of logs generated by instances of the Component and their corresponding file paths.
	// These logs can be collected for further analysis and monitoring.
	//
	// The `logConfigs` field is an optional list of LogConfig objects, where each object represents
	// a specific log type and its configuration.
	// It allows you to specify multiple log types and their respective file paths for the Component.
	//
	// Examples:
	//
	// “`yaml
	//  logConfigs:
	//  - filePathPattern: /data/mysql/log/mysqld-error.log
	//    name: error
	//  - filePathPattern: /data/mysql/log/mysqld.log
	//    name: general
	//  - filePathPattern: /data/mysql/log/mysqld-slowquery.log
	//    name: slow
	// “`
	//
	// This field is immutable.
	//
	// +patchMergeKey=name
	// +patchStrategy=merge,retainKeys
	// +listType=map
	// +listMapKey=name
	// +optional
	LogConfigs []LogConfig `json:"logConfigs,omitempty" patchStrategy:"merge,retainKeys" patchMergeKey:"name"`

	// Specifies groups of scripts, each provided via a ConfigMap, to be mounted as volumes in the container.
	// These scripts can be executed during container startup or via specific actions.
	//
	// Each script group is encapsulated in a ComponentTemplateSpec that includes:
	//
	// - The ConfigMap containing the scripts.
	// - The mount point where the scripts will be mounted inside the container.
	//
	// This field is immutable.
	//
	// +patchMergeKey=name
	// +patchStrategy=merge,retainKeys
	// +listType=map
	// +listMapKey=name
	// +optional
	Scripts []ComponentTemplateSpec `json:"scripts,omitempty"`

	// Defines the namespaced policy rules required by the Component.
	//
	// The `policyRules` field is an array of `rbacv1.PolicyRule` objects that define the policy rules
	// needed by the Component to operate within a namespace.
	// These policy rules determine the permissions and verbs the Component is allowed to perform on
	// Kubernetes resources within the namespace.
	//
	// The purpose of this field is to automatically generate the necessary RBAC roles
	// for the Component based on the specified policy rules.
	// This ensures that the Pods in the Component has appropriate permissions to function.
	//
	// Note: This field is currently non-functional and is reserved for future implementation.
	//
	// This field is immutable.
	//
	// +optional
	PolicyRules []rbacv1.PolicyRule `json:"policyRules,omitempty"`

	// Specifies static labels that will be patched to all Kubernetes resources created for the Component.
	//
	// Note: If a label key in the `labels` field conflicts with any system labels or user-specified labels,
	// it will be silently ignored to avoid overriding higher-priority labels.
	//
	// This field is immutable.
	//
	// +optional
	Labels map[string]string `json:"labels,omitempty"`

	// Specifies static annotations that will be patched to all Kubernetes resources created for the Component.
	//
	// Note: If an annotation key in the `annotations` field conflicts with any system annotations
	// or user-specified annotations, it will be silently ignored to avoid overriding higher-priority annotations.
	//
	// This field is immutable.
	//
	// +optional
	Annotations map[string]string `json:"annotations,omitempty"`

	// Defines the upper limit of the number of replicas supported by the Component.
	//
	// It defines the maximum number of replicas that can be created for the Component.
	// This field allows you to set a limit on the scalability of the Component, preventing it from exceeding a certain number of replicas.
	//
	// This field is immutable.
	//
	// +optional
	ReplicasLimit *ReplicasLimit `json:"replicasLimit,omitempty"`

	// An array of `SystemAccount` objects that define the system accounts needed
	// for the management operations of the Component.
	//
	// Each `SystemAccount` includes:
	//
	// - Account name.
	// - The SQL statement template: Used to create the system account.
	// - Password Source: Either generated based on certain rules or retrieved from a Secret.
	//
	//  Use cases for system accounts typically involve tasks like system initialization, backups, monitoring,
	//  health checks, replication, and other system-level operations.
	//
	// System accounts are distinct from user accounts, although both are database accounts.
	//
	// - **System Accounts**: Created during Cluster setup by the KubeBlocks operator,
	//   these accounts have higher privileges for system management and are fully managed
	//   through a declarative API by the operator.
	// - **User Accounts**: Managed by users or administrator.
	//   User account permissions should follow the principle of least privilege,
	//   granting only the necessary access rights to complete their required tasks.
	//
	// This field is immutable.
	//
	// +optional
	SystemAccounts []SystemAccount `json:"systemAccounts,omitempty"`

	// Specifies the concurrency strategy for updating multiple instances of the Component.
	// Available strategies:
	//
	// - `Serial`: Updates replicas one at a time, ensuring minimal downtime by waiting for each replica to become ready
	//   before updating the next.
	// - `Parallel`: Updates all replicas simultaneously, optimizing for speed but potentially reducing availability
	//   during the update.
	// - `BestEffortParallel`: Updates replicas concurrently with a limit on simultaneous updates to ensure a minimum
	//   number of operational replicas for maintaining quorum.
	//	 For example, in a 5-replica component, updating a maximum of 2 replicas simultaneously keeps
	//	 at least 3 operational for quorum.
	//
	// This field is immutable and defaults to 'Serial'.
	//
	// +kubebuilder:default=Serial
	// +optional
	UpdateStrategy *UpdateStrategy `json:"updateStrategy,omitempty"`

	// InstanceSet controls the creation of pods during initial scale up, replacement of pods on nodes, and scaling down.
	//
	// - `OrderedReady`: Creates pods in increasing order (pod-0, then pod-1, etc). The controller waits until each pod
	// is ready before continuing. Pods are removed in reverse order when scaling down.
	// - `Parallel`: Creates pods in parallel to match the desired scale without waiting. All pods are deleted at once
	// when scaling down.
	//
	// +optional
	PodManagementPolicy *appsv1.PodManagementPolicyType `json:"podManagementPolicy,omitempty"`

	// Enumerate all possible roles assigned to each replica of the Component, influencing its behavior.
	//
	// A replica can have zero to multiple roles.
	// KubeBlocks operator determines the roles of each replica by invoking the `lifecycleActions.roleProbe` method.
	// This action returns a list of roles for each replica, and the returned roles must be predefined in the `roles` field.
	//
	// The roles assigned to a replica can influence various aspects of the Component's behavior, such as:
	//
	// - Service selection: The Component's exposed Services may target replicas based on their roles using `roleSelector`.
	// - Update order: The roles can determine the order in which replicas are updated during a Component update.
	//   For instance, replicas with a "follower" role can be updated first, while the replica with the "leader"
	//   role is updated last. This helps minimize the number of leader changes during the update process.
	//
	// This field is immutable.
	//
	// +optional
	Roles []ReplicaRole `json:"roles,omitempty"`

	// This field has been deprecated since v0.9.
	// This field is maintained for backward compatibility and its use is discouraged.
	// Existing usage should be updated to the current preferred approach to avoid compatibility issues in future releases.
	//
	// This field is immutable.
	//
	// +kubebuilder:default=External
	// +optional
	RoleArbitrator *RoleArbitrator `json:"roleArbitrator,omitempty"`

	// Defines a set of hooks and procedures that customize the behavior of a Component throughout its lifecycle.
	// Actions are triggered at specific lifecycle stages:
	//
	//   - `postProvision`: Defines the hook to be executed after the creation of a Component,
	//     with `preCondition` specifying when the action should be fired relative to the Component's lifecycle stages:
	//     `Immediately`, `RuntimeReady`, `ComponentReady`, and `ClusterReady`.
	//   - `preTerminate`: Defines the hook to be executed before terminating a Component.
	//   - `roleProbe`: Defines the procedure which is invoked regularly to assess the role of replicas.
	//   - `switchover`: Defines the procedure for a controlled transition of leadership from the current leader to a new replica.
	//     This approach aims to minimize downtime and maintain availability in systems with a leader-follower topology,
	//     such as before planned maintenance or upgrades on the current leader node.
	//   - `memberJoin`: Defines the procedure to add a new replica to the replication group.
	//   - `memberLeave`: Defines the method to remove a replica from the replication group.
	//   - `readOnly`: Defines the procedure to switch a replica into the read-only state.
	//   - `readWrite`: transition a replica from the read-only state back to the read-write state.
	//   - `dataDump`: Defines the procedure to export the data from a replica.
	//   - `dataLoad`: Defines the procedure to import data into a replica.
	//   - `reconfigure`: Defines the procedure that update a replica with new configuration file.
	//   - `accountProvision`: Defines the procedure to generate a new database account.
	//
	// This field is immutable.
	//
	// +optional
	LifecycleActions *ComponentLifecycleActions `json:"lifecycleActions,omitempty"`

	// Lists external service dependencies of the Component, including services from other Clusters or outside the K8s environment.
	//
	// This field is immutable.
	//
	// +optional
	ServiceRefDeclarations []ServiceRefDeclaration `json:"serviceRefDeclarations,omitempty"`

	// `minReadySeconds` is the minimum duration in seconds that a new Pod should remain in the ready
	// state without any of its containers crashing to be considered available.
	// This ensures the Pod's stability and readiness to serve requests.
	//
	// A default value of 0 seconds means the Pod is considered available as soon as it enters the ready state.
	//
	// +kubebuilder:validation:Minimum=0
	// +kubebuilder:default=0
	// +optional
	MinReadySeconds int32 `json:"minReadySeconds,omitempty"`
}

func (*ComponentDefinitionSpec) DeepCopy added in v0.8.0

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

func (*ComponentDefinitionSpec) DeepCopyInto added in v0.8.0

func (in *ComponentDefinitionSpec) DeepCopyInto(out *ComponentDefinitionSpec)

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

type ComponentDefinitionStatus added in v0.8.0

type ComponentDefinitionStatus struct {
	// Refers to the most recent generation that has been observed for the ComponentDefinition.
	//
	// +optional
	ObservedGeneration int64 `json:"observedGeneration,omitempty"`

	// Represents the current status of the ComponentDefinition. Valid values include “, `Available`, and `Unavailable`.
	// When the status is `Available`, the ComponentDefinition is ready and can be utilized by related objects.
	//
	// +optional
	Phase Phase `json:"phase,omitempty"`

	// Provides additional information about the current phase.
	//
	// +optional
	Message string `json:"message,omitempty"`
}

ComponentDefinitionStatus defines the observed state of ComponentDefinition.

func (*ComponentDefinitionStatus) DeepCopy added in v0.8.0

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

func (*ComponentDefinitionStatus) DeepCopyInto added in v0.8.0

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

type ComponentInfo added in v0.9.0

type ComponentInfo struct {
	// Specifies the name of the ComponentDefinition.
	// +kubebuilder:validation:MaxLength=32
	// +kubebuilder:validation:Required
	ComponentDefinitionName string `json:"componentDefinitionName"`

	// Specifies the account name associated with the Component.
	// If set, the corresponding account username and password are injected into containers' environment variables
	// `KB_ACCOUNT_USERNAME` and `KB_ACCOUNT_PASSWORD`.
	//
	// +optional
	AccountName string `json:"accountName,omitempty"`

	// Specifies the name of the Service.
	// If set, the service name is injected as the `KB_COMP_SVC_NAME` environment variable in the containers,
	// and each service port is mapped to a corresponding environment variable named `KB_COMP_SVC_PORT_$(portName)`.
	// The `portName` is transformed by replacing '-' with '_' and converting to uppercase.
	//
	// +optional
	ServiceName string `json:"serviceName,omitempty"`
}

func (*ComponentInfo) DeepCopy added in v0.9.0

func (in *ComponentInfo) DeepCopy() *ComponentInfo

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

func (*ComponentInfo) DeepCopyInto added in v0.9.0

func (in *ComponentInfo) DeepCopyInto(out *ComponentInfo)

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

type ComponentLifecycleActions added in v0.8.0

type ComponentLifecycleActions struct {
	// Specifies the hook to be executed after a component's creation.
	//
	// By setting `postProvision.customHandler.preCondition`, you can determine the specific lifecycle stage
	// at which the action should trigger: `Immediately`, `RuntimeReady`, `ComponentReady`, and `ClusterReady`.
	// with `ComponentReady` being the default.
	//
	// The PostProvision Action is intended to run only once.
	//
	// The container executing this action has access to following environment variables:
	//
	// - KB_CLUSTER_POD_IP_LIST: Comma-separated list of the cluster's pod IP addresses (e.g., "podIp1,podIp2").
	// - KB_CLUSTER_POD_NAME_LIST: Comma-separated list of the cluster's pod names (e.g., "pod1,pod2").
	// - KB_CLUSTER_POD_HOST_NAME_LIST: Comma-separated list of host names, each corresponding to a pod in
	//   KB_CLUSTER_POD_NAME_LIST (e.g., "hostName1,hostName2").
	// - KB_CLUSTER_POD_HOST_IP_LIST: Comma-separated list of host IP addresses, each corresponding to a pod in
	//   KB_CLUSTER_POD_NAME_LIST (e.g., "hostIp1,hostIp2").
	//
	// - KB_CLUSTER_COMPONENT_POD_NAME_LIST: Comma-separated list of all pod names within the component
	//   (e.g., "pod1,pod2").
	// - KB_CLUSTER_COMPONENT_POD_IP_LIST: Comma-separated list of pod IP addresses,
	//   matching the order of pods in KB_CLUSTER_COMPONENT_POD_NAME_LIST (e.g., "podIp1,podIp2").
	// - KB_CLUSTER_COMPONENT_POD_HOST_NAME_LIST: Comma-separated list of host names for each pod,
	//   matching the order of pods in KB_CLUSTER_COMPONENT_POD_NAME_LIST (e.g., "hostName1,hostName2").
	// - KB_CLUSTER_COMPONENT_POD_HOST_IP_LIST: Comma-separated list of host IP addresses for each pod,
	//   matching the order of pods in KB_CLUSTER_COMPONENT_POD_NAME_LIST (e.g., "hostIp1,hostIp2").
	//
	// - KB_CLUSTER_COMPONENT_LIST: Comma-separated list of all cluster components (e.g., "comp1,comp2").
	// - KB_CLUSTER_COMPONENT_DELETING_LIST: Comma-separated list of components that are currently being deleted
	//   (e.g., "comp1,comp2").
	// - KB_CLUSTER_COMPONENT_UNDELETED_LIST: Comma-separated list of components that are not being deleted
	//   (e.g., "comp1,comp2").
	//
	// Note: This field is immutable once it has been set.
	//
	// +optional
	PostProvision *LifecycleActionHandler `json:"postProvision,omitempty"`

	// Specifies the hook to be executed prior to terminating a component.
	//
	// The PreTerminate Action is intended to run only once.
	//
	// This action is executed immediately when a scale-down operation for the Component is initiated.
	// The actual termination and cleanup of the Component and its associated resources will not proceed
	// until the PreTerminate action has completed successfully.
	//
	// The container executing this action has access to following environment variables:
	//
	// - KB_CLUSTER_POD_IP_LIST: Comma-separated list of the cluster's pod IP addresses (e.g., "podIp1,podIp2").
	// - KB_CLUSTER_POD_NAME_LIST: Comma-separated list of the cluster's pod names (e.g., "pod1,pod2").
	// - KB_CLUSTER_POD_HOST_NAME_LIST: Comma-separated list of host names, each corresponding to a pod in
	//   KB_CLUSTER_POD_NAME_LIST (e.g., "hostName1,hostName2").
	// - KB_CLUSTER_POD_HOST_IP_LIST: Comma-separated list of host IP addresses, each corresponding to a pod in
	//   KB_CLUSTER_POD_NAME_LIST (e.g., "hostIp1,hostIp2").
	//
	// - KB_CLUSTER_COMPONENT_POD_NAME_LIST: Comma-separated list of all pod names within the component
	//   (e.g., "pod1,pod2").
	// - KB_CLUSTER_COMPONENT_POD_IP_LIST: Comma-separated list of pod IP addresses,
	//   matching the order of pods in KB_CLUSTER_COMPONENT_POD_NAME_LIST (e.g., "podIp1,podIp2").
	// - KB_CLUSTER_COMPONENT_POD_HOST_NAME_LIST: Comma-separated list of host names for each pod,
	//   matching the order of pods in KB_CLUSTER_COMPONENT_POD_NAME_LIST (e.g., "hostName1,hostName2").
	// - KB_CLUSTER_COMPONENT_POD_HOST_IP_LIST: Comma-separated list of host IP addresses for each pod,
	//   matching the order of pods in KB_CLUSTER_COMPONENT_POD_NAME_LIST (e.g., "hostIp1,hostIp2").
	//
	// - KB_CLUSTER_COMPONENT_LIST: Comma-separated list of all cluster components (e.g., "comp1,comp2").
	// - KB_CLUSTER_COMPONENT_DELETING_LIST: Comma-separated list of components that are currently being deleted
	//   (e.g., "comp1,comp2").
	// - KB_CLUSTER_COMPONENT_UNDELETED_LIST: Comma-separated list of components that are not being deleted
	//   (e.g., "comp1,comp2").
	//
	// - KB_CLUSTER_COMPONENT_IS_SCALING_IN: Indicates whether the component is currently scaling in.
	//   If this variable is present and set to "true", it denotes that the component is undergoing a scale-in operation.
	//   During scale-in, data rebalancing is necessary to maintain cluster integrity.
	//   Contrast this with a cluster deletion scenario where data rebalancing is not required as the entire cluster
	//   is being cleaned up.
	//
	// Note: This field is immutable once it has been set.
	//
	// +optional
	PreTerminate *LifecycleActionHandler `json:"preTerminate,omitempty"`

	// Defines the procedure which is invoked regularly to assess the role of replicas.
	//
	// This action is periodically triggered by Lorry at the specified interval to determine the role of each replica.
	// Upon successful execution, the action's output designates the role of the replica,
	// which should match one of the predefined role names within `componentDefinition.spec.roles`.
	// The output is then compared with the previous successful execution result.
	// If a role change is detected, an event is generated to inform the controller,
	// which initiates an update of the replica's role.
	//
	// Defining a RoleProbe Action for a Component is required if roles are defined for the Component.
	// It ensures replicas are correctly labeled with their respective roles.
	// Without this, services that rely on roleSelectors might improperly direct traffic to wrong replicas.
	//
	// The container executing this action has access to following environment variables:
	//
	// - KB_POD_FQDN: The FQDN of the Pod whose role is being assessed.
	// - KB_SERVICE_PORT: The port used by the database service.
	// - KB_SERVICE_USER: The username with the necessary permissions to interact with the database service.
	// - KB_SERVICE_PASSWORD: The corresponding password for KB_SERVICE_USER to authenticate with the database service.
	//
	// Expected output of this action:
	// - On Success: The determined role of the replica, which must align with one of the roles specified
	//   in the component definition.
	// - On Failure: An error message, if applicable, indicating why the action failed.
	//
	// Note: This field is immutable once it has been set.
	//
	// +optional
	RoleProbe *RoleProbe `json:"roleProbe,omitempty"`

	// Defines the procedure for a controlled transition of leadership from the current leader to a new replica.
	// This approach aims to minimize downtime and maintain availability in systems with a leader-follower topology,
	// during events such as planned maintenance or when performing stop, shutdown, restart, or upgrade operations
	// involving the current leader node.
	//
	// The container executing this action has access to following environment variables:
	//
	// - KB_SWITCHOVER_CANDIDATE_NAME: The name of the pod for the new leader candidate, which may not be specified (empty).
	// - KB_SWITCHOVER_CANDIDATE_FQDN: The FQDN of the new leader candidate's pod, which may not be specified (empty).
	// - KB_LEADER_POD_IP: The IP address of the current leader's pod prior to the switchover.
	// - KB_LEADER_POD_NAME: The name of the current leader's pod prior to the switchover.
	// - KB_LEADER_POD_FQDN: The FQDN of the current leader's pod prior to the switchover.
	//
	// The environment variables with the following prefixes are deprecated and will be removed in future releases:
	//
	// - KB_REPLICATION_PRIMARY_POD_
	// - KB_CONSENSUS_LEADER_POD_
	//
	// Note: This field is immutable once it has been set.
	//
	// +optional
	Switchover *ComponentSwitchover `json:"switchover,omitempty"`

	// Defines the procedure to add a new replica to the replication group.
	//
	// This action is initiated after a replica pod becomes ready.
	//
	// The role of the replica (e.g., primary, secondary) will be determined and assigned as part of the action command
	// implementation, or automatically by the database kernel or a sidecar utility like Patroni that implements
	// a consensus algorithm.
	//
	// The container executing this action has access to following environment variables:
	//
	// - KB_SERVICE_PORT: The port used by the database service.
	// - KB_SERVICE_USER: The username with the necessary permissions to interact with the database service.
	// - KB_SERVICE_PASSWORD: The corresponding password for KB_SERVICE_USER to authenticate with the database service.
	// - KB_PRIMARY_POD_FQDN: The FQDN of the primary Pod within the replication group.
	// - KB_MEMBER_ADDRESSES: A comma-separated list of Pod addresses for all replicas in the group.
	// - KB_NEW_MEMBER_POD_NAME: The pod name of the replica being added to the group.
	// - KB_NEW_MEMBER_POD_IP: The IP address of the replica being added to the group.
	//
	// Expected action output:
	// - On Failure: An error message detailing the reason for any failure encountered
	//   during the addition of the new member.
	//
	// For example, to add a new OBServer to an OceanBase Cluster in 'zone1', the following command may be used:
	//
	// “`yaml
	// command:
	// - bash
	// - -c
	// - |
	//    ADDRESS=$(KB_MEMBER_ADDRESSES%%,*)
	//    HOST=$(echo $ADDRESS | cut -d ':' -f 1)
	//    PORT=$(echo $ADDRESS | cut -d ':' -f 2)
	//    CLIENT="mysql -u $KB_SERVICE_USER -p$KB_SERVICE_PASSWORD -P $PORT -h $HOST -e"
	// 	  $CLIENT "ALTER SYSTEM ADD SERVER '$KB_NEW_MEMBER_POD_IP:$KB_SERVICE_PORT' ZONE 'zone1'"
	// “`
	//
	// Note: This field is immutable once it has been set.
	//
	// +optional
	MemberJoin *LifecycleActionHandler `json:"memberJoin,omitempty"`

	// Defines the procedure to remove a replica from the replication group.
	//
	// This action is initiated before remove a replica from the group.
	// The operator will wait for MemberLeave to complete successfully before releasing the replica and cleaning up
	// related Kubernetes resources.
	//
	// The process typically includes updating configurations and informing other group members about the removal.
	// Data migration is generally not part of this action and should be handled separately if needed.
	//
	// The container executing this action has access to following environment variables:
	//
	// - KB_SERVICE_PORT: The port used by the database service.
	// - KB_SERVICE_USER: The username with the necessary permissions to interact with the database service.
	// - KB_SERVICE_PASSWORD: The corresponding password for KB_SERVICE_USER to authenticate with the database service.
	// - KB_PRIMARY_POD_FQDN: The FQDN of the primary Pod within the replication group.
	// - KB_MEMBER_ADDRESSES: A comma-separated list of Pod addresses for all replicas in the group.
	// - KB_LEAVE_MEMBER_POD_NAME: The pod name of the replica being removed from the group.
	// - KB_LEAVE_MEMBER_POD_IP: The IP address of the replica being removed from the group.
	//
	// Expected action output:
	// - On Failure: An error message, if applicable, indicating why the action failed.
	//
	// For example, to remove an OBServer from an OceanBase Cluster in 'zone1', the following command can be executed:
	//
	// “`yaml
	// command:
	// - bash
	// - -c
	// - |
	//    ADDRESS=$(KB_MEMBER_ADDRESSES%%,*)
	//    HOST=$(echo $ADDRESS | cut -d ':' -f 1)
	//    PORT=$(echo $ADDRESS | cut -d ':' -f 2)
	//    CLIENT="mysql -u $KB_SERVICE_USER  -p$KB_SERVICE_PASSWORD -P $PORT -h $HOST -e"
	// 	  $CLIENT "ALTER SYSTEM DELETE SERVER '$KB_LEAVE_MEMBER_POD_IP:$KB_SERVICE_PORT' ZONE 'zone1'"
	// “`
	//
	// Note: This field is immutable once it has been set.
	//
	// +optional
	MemberLeave *LifecycleActionHandler `json:"memberLeave,omitempty"`

	// Defines the procedure to switch a replica into the read-only state.
	//
	// Use Case:
	// This action is invoked when the database's volume capacity nears its upper limit and space is about to be exhausted.
	//
	// The container executing this action has access to following environment variables:
	//
	// - KB_POD_FQDN: The FQDN of the replica pod whose role is being checked.
	// - KB_SERVICE_PORT: The port used by the database service.
	// - KB_SERVICE_USER: The username with the necessary permissions to interact with the database service.
	// - KB_SERVICE_PASSWORD: The corresponding password for KB_SERVICE_USER to authenticate with the database service.
	//
	// Expected action output:
	// - On Failure: An error message, if applicable, indicating why the action failed.
	//
	// Note: This field is immutable once it has been set.
	//
	// +optional
	Readonly *LifecycleActionHandler `json:"readonly,omitempty"`

	// Defines the procedure to transition a replica from the read-only state back to the read-write state.
	//
	// Use Case:
	// This action is used to bring back a replica that was previously in a read-only state,
	// which restricted write operations, to its normal operational state where it can handle
	// both read and write operations.
	//
	// The container executing this action has access to following environment variables:
	//
	// - KB_POD_FQDN: The FQDN of the replica pod whose role is being checked.
	// - KB_SERVICE_PORT: The port used by the database service.
	// - KB_SERVICE_USER: The username with the necessary permissions to interact with the database service.
	// - KB_SERVICE_PASSWORD: The corresponding password for KB_SERVICE_USER to authenticate with the database service.
	//
	// Expected action output:
	// - On Failure: An error message, if applicable, indicating why the action failed.
	//
	// Note: This field is immutable once it has been set.
	//
	// +optional
	Readwrite *LifecycleActionHandler `json:"readwrite,omitempty"`

	// Defines the procedure for exporting the data from a replica.
	//
	// Use Case:
	// This action is intended for initializing a newly created replica with data. It involves exporting data
	// from an existing replica and importing it into the new, empty replica. This is essential for synchronizing
	// the state of replicas across the system.
	//
	// Applicability:
	// Some database engines or associated sidecar applications (e.g., Patroni) may already provide this functionality.
	// In such cases, this action may not be required.
	//
	// The output should be a valid data dump streamed to stdout. It must exclude any irrelevant information to ensure
	// that only the necessary data is exported for import into the new replica.
	//
	// Note: This field is immutable once it has been set.
	//
	// +optional
	DataDump *LifecycleActionHandler `json:"dataDump,omitempty"`

	// Defines the procedure for importing data into a replica.
	//
	// Use Case:
	// This action is intended for initializing a newly created replica with data. It involves exporting data
	// from an existing replica and importing it into the new, empty replica. This is essential for synchronizing
	// the state of replicas across the system.
	//
	// Some database engines or associated sidecar applications (e.g., Patroni) may already provide this functionality.
	// In such cases, this action may not be required.
	//
	// Data should be received through stdin. If any error occurs during the process,
	// the action must be able to guarantee idempotence to allow for retries from the beginning.
	//
	// Note: This field is immutable once it has been set.
	//
	// +optional
	DataLoad *LifecycleActionHandler `json:"dataLoad,omitempty"`

	// Defines the procedure that update a replica with new configuration.
	//
	// Note: This field is immutable once it has been set.
	//
	// This Action is reserved for future versions.
	//
	// +optional
	Reconfigure *LifecycleActionHandler `json:"reconfigure,omitempty"`

	// Defines the procedure to generate a new database account.
	//
	// Use Case:
	// This action is designed to create system accounts that are utilized for replication, monitoring, backup,
	// and other administrative tasks.
	//
	// Note: This field is immutable once it has been set.
	//
	// +optional
	AccountProvision *LifecycleActionHandler `json:"accountProvision,omitempty"`
}

ComponentLifecycleActions defines a collection of Actions for customizing the behavior of a Component.

func (*ComponentLifecycleActions) DeepCopy added in v0.8.0

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

func (*ComponentLifecycleActions) DeepCopyInto added in v0.8.0

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

type ComponentList added in v0.8.0

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

ComponentList contains a list of Component.

func (*ComponentList) DeepCopy added in v0.8.0

func (in *ComponentList) DeepCopy() *ComponentList

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

func (*ComponentList) DeepCopyInto added in v0.8.0

func (in *ComponentList) DeepCopyInto(out *ComponentList)

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

func (*ComponentList) DeepCopyObject added in v0.8.0

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

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

type ComponentMessageMap

type ComponentMessageMap map[string]string

func (ComponentMessageMap) DeepCopy added in v0.6.0

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

func (ComponentMessageMap) DeepCopyInto added in v0.6.0

func (in ComponentMessageMap) DeepCopyInto(out *ComponentMessageMap)

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

func (ComponentMessageMap) SetObjectMessage

func (r ComponentMessageMap) SetObjectMessage(objectKind, objectName, message string)

SetObjectMessage sets k8s workload message to component status message map

type ComponentOps

type ComponentOps struct {
	// Specifies the name of the Component.
	// +kubebuilder:validation:Required
	ComponentName string `json:"componentName"`
}

ComponentOps specifies the Component to be operated on.

func (*ComponentOps) DeepCopy added in v0.6.0

func (in *ComponentOps) DeepCopy() *ComponentOps

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

func (*ComponentOps) DeepCopyInto added in v0.6.0

func (in *ComponentOps) DeepCopyInto(out *ComponentOps)

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

func (ComponentOps) GetComponentName added in v0.9.0

func (c ComponentOps) GetComponentName() string

type ComponentRefEnv added in v0.6.0

type ComponentRefEnv struct {
	// The name of the env, it must be a C identifier.
	//
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:Pattern=`^[A-Za-z_][A-Za-z0-9_]*$`
	Name string `json:"name"`

	// The value of the env.
	//
	// +optional
	Value string `json:"value,omitempty"`

	// The source from which the value of the env.
	//
	// +optional
	ValueFrom *ComponentValueFrom `json:"valueFrom,omitempty"`
}

ComponentRefEnv specifies name and value of an env.

Deprecated since v0.8.

func (*ComponentRefEnv) DeepCopy added in v0.6.0

func (in *ComponentRefEnv) DeepCopy() *ComponentRefEnv

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

func (*ComponentRefEnv) DeepCopyInto added in v0.6.0

func (in *ComponentRefEnv) DeepCopyInto(out *ComponentRefEnv)

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

type ComponentResourceConstraint

type ComponentResourceConstraint struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec ComponentResourceConstraintSpec `json:"spec,omitempty"`
}

ComponentResourceConstraint is the Schema for the componentresourceconstraints API

func (*ComponentResourceConstraint) DeepCopy added in v0.6.0

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

func (*ComponentResourceConstraint) DeepCopyInto added in v0.6.0

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

func (*ComponentResourceConstraint) DeepCopyObject added in v0.6.0

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

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

func (*ComponentResourceConstraint) FindMatchingRules added in v0.6.0

func (c *ComponentResourceConstraint) FindMatchingRules(
	clusterDefRef string,
	componentDefRef string,
	resources corev1.ResourceList) []ResourceConstraintRule

FindMatchingRules find all constraint rules that resource satisfies.

func (*ComponentResourceConstraint) FindRules added in v0.6.0

func (c *ComponentResourceConstraint) FindRules(clusterDefRef, componentDefRef string) []ResourceConstraintRule

FindRules find all constraint rules that the component should conform to based on ClusterDefinition API. TODO(xingran): it will be deprecated in the future, use FindRulesWithCompDef instead.

func (*ComponentResourceConstraint) FindRulesWithCompDef added in v0.8.0

func (c *ComponentResourceConstraint) FindRulesWithCompDef(compDef string) []ResourceConstraintRule

FindRulesWithCompDef find all constraint rules that the component should conform to based on ComponentDefinition API.

func (*ComponentResourceConstraint) MatchClass

func (c *ComponentResourceConstraint) MatchClass(clusterDefRef, componentDefRef string, class *ComponentClass) bool

MatchClass checks if the class meets the constraint rules.

type ComponentResourceConstraintList

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

ComponentResourceConstraintList contains a list of ComponentResourceConstraint

func (*ComponentResourceConstraintList) DeepCopy added in v0.6.0

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

func (*ComponentResourceConstraintList) DeepCopyInto added in v0.6.0

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

func (*ComponentResourceConstraintList) DeepCopyObject added in v0.6.0

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

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

type ComponentResourceConstraintSelector added in v0.6.0

type ComponentResourceConstraintSelector struct {
	// In versions prior to KB 0.8.0, ComponentDefRef is the name of the component definition in the ClusterDefinition.
	// In KB 0.8.0 and later versions, ComponentDefRef is the name of ComponentDefinition.
	// +kubebuilder:validation:Required
	ComponentDefRef string `json:"componentDefRef"`

	// rules are the constraint rules that will be applied to the component.
	// +kubebuilder:validation:Required
	Rules []string `json:"rules"`
}

func (*ComponentResourceConstraintSelector) DeepCopy added in v0.6.0

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

func (*ComponentResourceConstraintSelector) DeepCopyInto added in v0.6.0

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

type ComponentResourceConstraintSpec

type ComponentResourceConstraintSpec struct {
	// Component resource constraint rules.
	// +patchMergeKey=name
	// +patchStrategy=merge,retainKeys
	// +listType=map
	// +listMapKey=name
	// +kubebuilder:validation:Required
	Rules []ResourceConstraintRule `json:"rules"`

	// selector is used to bind the resource constraint to cluster definitions based on ClusterDefinition API.
	// +listType=map
	// +listMapKey=clusterDefRef
	//+kubebuilder:deprecatedversion:warning="This field is deprecated from KB 0.8.0, use ComponentSelector instead."
	// +optional
	Selector []ClusterResourceConstraintSelector `json:"selector,omitempty"`

	// componentSelector is used to bind the resource constraint to components based on ComponentDefinition API.
	// +listType=map
	// +listMapKey=componentDefRef
	// +optional
	ComponentSelector []ComponentResourceConstraintSelector `json:"componentSelector,omitempty"`
}

ComponentResourceConstraintSpec defines the desired state of ComponentResourceConstraint

func (*ComponentResourceConstraintSpec) DeepCopy added in v0.6.0

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

func (*ComponentResourceConstraintSpec) DeepCopyInto added in v0.6.0

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

type ComponentResourceKey

type ComponentResourceKey string

ComponentResourceKey defines the resource key of component, such as pod/pvc. +enum +kubebuilder:validation:Enum={pods}

const PodsCompResourceKey ComponentResourceKey = "pods"

type ComponentService added in v0.8.0

type ComponentService struct {
	Service `json:",inline"`

	// Indicates whether to create a corresponding Service for each Pod of the selected Component.
	// When set to true, a set of Services will be automatically generated for each Pod,
	// and the `roleSelector` field will be ignored.
	//
	// The names of the generated Services will follow the same suffix naming pattern: `$(serviceName)-$(podOrdinal)`.
	// The total number of generated Services will be equal to the number of replicas specified for the Component.
	//
	// Example usage:
	//
	// “`yaml
	// name: my-service
	// serviceName: my-service
	// podService: true
	// disableAutoProvision: true
	// spec:
	//   type: NodePort
	//   ports:
	//   - name: http
	//     port: 80
	//     targetPort: 8080
	// “`
	//
	// In this example, if the Component has 3 replicas, three Services will be generated:
	// - my-service-0: Points to the first Pod (podOrdinal: 0)
	// - my-service-1: Points to the second Pod (podOrdinal: 1)
	// - my-service-2: Points to the third Pod (podOrdinal: 2)
	//
	// Each generated Service will have the specified spec configuration and will target its respective Pod.
	//
	// This feature is useful when you need to expose each Pod of a Component individually, allowing external access
	// to specific instances of the Component.
	//
	// +kubebuilder:default=false
	// +optional
	PodService *bool `json:"podService,omitempty"`

	// Indicates whether the automatic provisioning of the service should be disabled.
	//
	// If set to true, the service will not be automatically created at the component provisioning.
	// Instead, you can enable the creation of this service by specifying it explicitly in the cluster API.
	//
	// +optional
	DisableAutoProvision *bool `json:"disableAutoProvision,omitempty"`
}

ComponentService defines a service that would be exposed as an inter-component service within a Cluster. A Service defined in the ComponentService is expected to be accessed by other Components within the same Cluster.

When a Component needs to use a ComponentService provided by another Component within the same Cluster, it can declare a variable in the `componentDefinition.spec.vars` section and bind it to the specific exposed address of the ComponentService using the `serviceVarRef` field.

func (*ComponentService) DeepCopy added in v0.8.0

func (in *ComponentService) DeepCopy() *ComponentService

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

func (*ComponentService) DeepCopyInto added in v0.8.0

func (in *ComponentService) DeepCopyInto(out *ComponentService)

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

type ComponentSpec added in v0.8.0

type ComponentSpec struct {
	// Specifies the name of the referenced ComponentDefinition.
	//
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MaxLength=64
	CompDef string `json:"compDef"`

	// ServiceVersion specifies the version of the Service expected to be provisioned by this Component.
	// The version should follow the syntax and semantics of the "Semantic Versioning" specification (http://semver.org/).
	//
	// +kubebuilder:validation:MaxLength=32
	// +optional
	ServiceVersion string `json:"serviceVersion,omitempty"`

	// References the class defined in ComponentClassDefinition.
	//
	// Deprecated since v0.9.
	// This field is maintained for backward compatibility and its use is discouraged.
	// Existing usage should be updated to the current preferred approach to avoid compatibility issues in future releases.
	//
	// +kubebuilder:deprecatedversion:warning="Due to the lack of practical use cases, this field is deprecated from KB 0.9.0."
	// +optional
	ClassDefRef *ClassDefRef `json:"classDefRef,omitempty"`

	// Defines a list of ServiceRef for a Component, enabling access to both external services and
	// Services provided by other Clusters.
	//
	// Types of services:
	//
	// - External services: Not managed by KubeBlocks or managed by a different KubeBlocks operator;
	//   Require a ServiceDescriptor for connection details.
	// - Services provided by a Cluster: Managed by the same KubeBlocks operator;
	//   identified using Cluster, Component and Service names.
	//
	// ServiceRefs with identical `serviceRef.name` in the same Cluster are considered the same.
	//
	// Example:
	// “`yaml
	// serviceRefs:
	//   - name: "redis-sentinel"
	//     serviceDescriptor:
	//       name: "external-redis-sentinel"
	//   - name: "postgres-cluster"
	//     clusterServiceSelector:
	//       cluster: "my-postgres-cluster"
	//       service:
	//         component: "postgresql"
	// “`
	// The example above includes ServiceRefs to an external Redis Sentinel service and a PostgreSQL Cluster.
	//
	// +optional
	ServiceRefs []ServiceRef `json:"serviceRefs,omitempty"`

	// Specifies Labels to override or add for underlying Pods.
	//
	// +optional
	Labels map[string]string `json:"labels,omitempty"`

	// Specifies Annotations to override or add for underlying Pods.
	//
	// +optional
	Annotations map[string]string `json:"annotations,omitempty"`

	// List of environment variables to add.
	//
	// +optional
	Env []corev1.EnvVar `json:"env,omitempty"`

	// Specifies the resources required by the Component.
	// It allows defining the CPU, memory requirements and limits for the Component's containers.
	//
	// +kubebuilder:pruning:PreserveUnknownFields
	// +optional
	Resources corev1.ResourceRequirements `json:"resources,omitempty"`

	// Specifies a list of PersistentVolumeClaim templates that define the storage requirements for the Component.
	// Each template specifies the desired characteristics of a persistent volume, such as storage class,
	// size, and access modes.
	// These templates are used to dynamically provision persistent volumes for the Component.
	//
	// +optional
	// +patchMergeKey=name
	// +patchStrategy=merge,retainKeys
	VolumeClaimTemplates []ClusterComponentVolumeClaimTemplate `json:"volumeClaimTemplates,omitempty" patchStrategy:"merge,retainKeys" patchMergeKey:"name"`

	// List of volumes to override.
	//
	// +optional
	Volumes []corev1.Volume `json:"volumes,omitempty"`

	// Overrides Services defined in referenced ComponentDefinition and exposes endpoints that can be accessed
	// by clients.
	//
	// +optional
	Services []ComponentService `json:"services,omitempty"`

	// Overrides system accounts defined in referenced ComponentDefinition.
	//
	// +optional
	SystemAccounts []ComponentSystemAccount `json:"systemAccounts,omitempty"`

	// Specifies the desired number of replicas in the Component for enhancing availability and durability, or load balancing.
	//
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:Minimum=0
	// +kubebuilder:default=1
	Replicas int32 `json:"replicas"`

	// Reserved field for future use.
	//
	// +optional
	Configs []ComponentConfigSpec `json:"configs,omitempty"`

	// Specifies which types of logs should be collected for the Cluster.
	// The log types are defined in the `componentDefinition.spec.logConfigs` field with the LogConfig entries.
	//
	// The elements in the `enabledLogs` array correspond to the names of the LogConfig entries.
	// For example, if the `componentDefinition.spec.logConfigs` defines LogConfig entries with
	// names "slow_query_log" and "error_log",
	// you can enable the collection of these logs by including their names in the `enabledLogs` array:
	// “`yaml
	// enabledLogs:
	// - slow_query_log
	// - error_log
	// “`
	//
	// +listType=set
	// +optional
	EnabledLogs []string `json:"enabledLogs,omitempty"`

	// Specifies the name of the ServiceAccount required by the running Component.
	// This ServiceAccount is used to grant necessary permissions for the Component's Pods to interact
	// with other Kubernetes resources, such as modifying Pod labels or sending events.
	//
	// Defaults:
	// If not specified, KubeBlocks automatically assigns a default ServiceAccount named "kb-{cluster.name}",
	// bound to a default role defined during KubeBlocks installation.
	//
	// Future Changes:
	// Future versions might change the default ServiceAccount creation strategy to one per Component,
	// potentially revising the naming to "kb-{cluster.name}-{component.name}".
	//
	// Users can override the automatic ServiceAccount assignment by explicitly setting the name of
	// an existed ServiceAccount in this field.
	//
	// +optional
	ServiceAccountName string `json:"serviceAccountName,omitempty"`

	// Specifies a group of affinity scheduling rules for the Component.
	// It allows users to control how the Component's Pods are scheduled onto nodes in the Cluster.
	//
	// +optional
	Affinity *Affinity `json:"affinity,omitempty"`

	// Allows Pods to be scheduled onto nodes with matching taints.
	// Each toleration in the array allows the Pod to tolerate node taints based on
	// specified `key`, `value`, `effect`, and `operator`.
	//
	// - The `key`, `value`, and `effect` identify the taint that the toleration matches.
	// - The `operator` determines how the toleration matches the taint.
	//
	// Pods with matching tolerations are allowed to be scheduled on tainted nodes, typically reserved for specific purposes.
	//
	// +optional
	Tolerations []corev1.Toleration `json:"tolerations,omitempty"`

	// Specifies the TLS configuration for the Component, including:
	//
	// - A boolean flag that indicates whether the Component should use Transport Layer Security (TLS) for secure communication.
	// - An optional field that specifies the configuration for the TLS certificates issuer when TLS is enabled.
	//   It allows defining the issuer name and the reference to the secret containing the TLS certificates and key.
	//	 The secret should contain the CA certificate, TLS certificate, and private key in the specified keys.
	//
	// +optional
	TLSConfig *TLSConfig `json:"tlsConfig,omitempty"`

	// Allows for the customization of configuration values for each instance within a Component.
	// An Instance represent a single replica (Pod and associated K8s resources like PVCs, Services, and ConfigMaps).
	// While instances typically share a common configuration as defined in the ClusterComponentSpec,
	// they can require unique settings in various scenarios:
	//
	// For example:
	// - A database Component might require different resource allocations for primary and secondary instances,
	//   with primaries needing more resources.
	// - During a rolling upgrade, a Component may first update the image for one or a few instances,
	//   and then update the remaining instances after verifying that the updated instances are functioning correctly.
	//
	// InstanceTemplate allows for specifying these unique configurations per instance.
	// Each instance's name is constructed using the pattern: $(component.name)-$(template.name)-$(ordinal),
	// starting with an ordinal of 0.
	// It is crucial to maintain unique names for each InstanceTemplate to avoid conflicts.
	//
	// The sum of replicas across all InstanceTemplates should not exceed the total number of Replicas specified for the Component.
	// Any remaining replicas will be generated using the default template and will follow the default naming rules.
	//
	// +optional
	Instances []InstanceTemplate `json:"instances,omitempty" patchStrategy:"merge,retainKeys" patchMergeKey:"name"`

	// Specifies the names of instances to be transitioned to offline status.
	//
	// Marking an instance as offline results in the following:
	//
	// 1. The associated Pod is stopped, and its PersistentVolumeClaim (PVC) is retained for potential
	//    future reuse or data recovery, but it is no longer actively used.
	// 2. The ordinal number assigned to this instance is preserved, ensuring it remains unique
	//    and avoiding conflicts with new instances.
	//
	// Setting instances to offline allows for a controlled scale-in process, preserving their data and maintaining
	// ordinal consistency within the Cluster.
	// Note that offline instances and their associated resources, such as PVCs, are not automatically deleted.
	// The administrator must manually manage the cleanup and removal of these resources when they are no longer needed.
	//
	//
	// +optional
	OfflineInstances []string `json:"offlineInstances,omitempty"`

	// Defines runtimeClassName for all Pods managed by this Component.
	// +optional
	RuntimeClassName *string `json:"runtimeClassName,omitempty"`

	// Determines whether metrics exporter information is annotated on the Component's headless Service.
	//
	// If set to true, the following annotations will not be patched into the Service:
	//
	// - "monitor.kubeblocks.io/path"
	// - "monitor.kubeblocks.io/port"
	// - "monitor.kubeblocks.io/scheme"
	//
	// These annotations allow the Prometheus installed by KubeBlocks to discover and scrape metrics from the exporter.
	//
	// +optional
	DisableExporter *bool `json:"disableExporter,omitempty"`
}

ComponentSpec defines the desired state of Component.

func (*ComponentSpec) DeepCopy added in v0.8.0

func (in *ComponentSpec) DeepCopy() *ComponentSpec

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

func (*ComponentSpec) DeepCopyInto added in v0.8.0

func (in *ComponentSpec) DeepCopyInto(out *ComponentSpec)

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

type ComponentStatus added in v0.8.0

type ComponentStatus struct {
	// Specifies the most recent generation observed for this Component object.
	//
	// +optional
	ObservedGeneration int64 `json:"observedGeneration,omitempty"`

	// Represents a list of detailed status of the Component object.
	// Each condition in the list provides real-time information about certain aspect of the Component object.
	//
	// This field is crucial for administrators and developers to monitor and respond to changes within the Component.
	// It provides a history of state transitions and a snapshot of the current state that can be used for
	// automated logic or direct inspection.
	//
	// +optional
	Conditions []metav1.Condition `json:"conditions,omitempty"`

	// Indicates the current phase of the Component, with each phase indicating specific conditions:
	//
	// - Creating: The initial phase for new Components, transitioning from 'empty'("").
	// - Running: All Pods in a Running state.
	// - Updating: The Component is currently being updated, with no failed Pods present.
	// - Abnormal: Some Pods have failed, indicating a potentially unstable state.
	//   However, the cluster remains available as long as a quorum of members is functioning.
	// - Failed: A significant number of Pods or critical Pods have failed
	//   The cluster may be non-functional or may offer only limited services (e.g, read-only).
	// - Stopping: All Pods are being terminated, with current replica count at zero.
	// - Stopped: All associated Pods have been successfully deleted.
	// - Deleting: The Component is being deleted.
	Phase ClusterComponentPhase `json:"phase,omitempty"`

	// A map that stores detailed message about the Component.
	// Each entry in the map provides insights into specific elements of the Component, such as Pods or workloads.
	//
	// Keys in this map are formatted as `ObjectKind/Name`, where `ObjectKind` could be a type like Pod,
	// and `Name` is the specific name of the object.
	//
	// +optional
	Message ComponentMessageMap `json:"message,omitempty"`
}

ComponentStatus represents the observed state of a Component within the Cluster.

func (*ComponentStatus) DeepCopy added in v0.8.0

func (in *ComponentStatus) DeepCopy() *ComponentStatus

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

func (*ComponentStatus) DeepCopyInto added in v0.8.0

func (in *ComponentStatus) DeepCopyInto(out *ComponentStatus)

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

type ComponentSwitchover added in v0.8.0

type ComponentSwitchover struct {
	// Represents the switchover process for a specified candidate primary or leader instance.
	// Note that only Action.Exec is currently supported, while Action.HTTP is not.
	//
	// +optional
	WithCandidate *Action `json:"withCandidate,omitempty"`

	// Represents a switchover process that does not involve a specific candidate primary or leader instance.
	// As with the previous field, only Action.Exec is currently supported, not Action.HTTP.
	//
	// +optional
	WithoutCandidate *Action `json:"withoutCandidate,omitempty"`

	// Used to define the selectors for the scriptSpecs that need to be referenced.
	// If this field is set, the scripts defined under the 'scripts' field can be invoked or referenced within an Action.
	//
	// This field is deprecated from v0.9.
	// This field is maintained for backward compatibility and its use is discouraged.
	// Existing usage should be updated to the current preferred approach to avoid compatibility issues in future releases.
	//
	// +kubebuilder:deprecatedversion:warning="This field is deprecated from KB 0.9.0"
	// +optional
	ScriptSpecSelectors []ScriptSpecSelector `json:"scriptSpecSelectors,omitempty"`
}

func (*ComponentSwitchover) DeepCopy added in v0.8.0

func (in *ComponentSwitchover) DeepCopy() *ComponentSwitchover

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

func (*ComponentSwitchover) DeepCopyInto added in v0.8.0

func (in *ComponentSwitchover) DeepCopyInto(out *ComponentSwitchover)

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

type ComponentSystemAccount added in v0.9.0

type ComponentSystemAccount struct {
	// The name of the system account.
	//
	// +kubebuilder:validation:Required
	Name string `json:"name"`

	// Specifies the policy for generating the account's password.
	//
	// This field is immutable once set.
	//
	// +optional
	PasswordConfig *PasswordConfig `json:"passwordConfig,omitempty"`

	// Refers to the secret from which data will be copied to create the new account.
	//
	// This field is immutable once set.
	//
	// +optional
	SecretRef *ProvisionSecretRef `json:"secretRef,omitempty"`
}

func (*ComponentSystemAccount) DeepCopy added in v0.9.0

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

func (*ComponentSystemAccount) DeepCopyInto added in v0.9.0

func (in *ComponentSystemAccount) DeepCopyInto(out *ComponentSystemAccount)

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

type ComponentTemplateSpec

type ComponentTemplateSpec struct {
	// Specifies the name of the configuration template.
	//
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MaxLength=63
	// +kubebuilder:validation:Pattern:=`^[a-z0-9]([a-z0-9\.\-]*[a-z0-9])?$`
	Name string `json:"name"`

	// Specifies the name of the referenced configuration template ConfigMap object.
	//
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MaxLength=63
	// +kubebuilder:validation:Pattern:=`^[a-z0-9]([a-z0-9\.\-]*[a-z0-9])?$`
	TemplateRef string `json:"templateRef"`

	// Specifies the namespace of the referenced configuration template ConfigMap object.
	// An empty namespace is equivalent to the "default" namespace.
	// +kubebuilder:validation:MaxLength=63
	// +kubebuilder:validation:Pattern:=`^[a-z0-9]([a-z0-9\-]*[a-z0-9])?$`
	// +kubebuilder:default="default"
	// +optional
	Namespace string `json:"namespace,omitempty"`

	// Refers to the volume name of PodTemplate. The configuration file produced through the configuration
	// template will be mounted to the corresponding volume. Must be a DNS_LABEL name.
	// The volume name must be defined in podSpec.containers[*].volumeMounts.
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MaxLength=63
	// +kubebuilder:validation:Pattern:=`^[a-z]([a-z0-9\-]*[a-z0-9])?$`
	VolumeName string `json:"volumeName"`

	// The operator attempts to set default file permissions for scripts (0555) and configurations (0444).
	// However, certain database engines may require different file permissions.
	// You can specify the desired file permissions here.
	//
	// Must be specified as an octal value between 0000 and 0777 (inclusive),
	// or as a decimal value between 0 and 511 (inclusive).
	// YAML supports both octal and decimal values for file permissions.
	//
	// Please note that this setting only affects the permissions of the files themselves.
	// Directories within the specified path are not impacted by this setting.
	// It's important to be aware that this setting might conflict with other options
	// that influence the file mode, such as fsGroup.
	// In such cases, the resulting file mode may have additional bits set.
	// Refers to documents of k8s.ConfigMapVolumeSource.defaultMode for more information.
	//
	// +optional
	DefaultMode *int32 `json:"defaultMode,omitempty" protobuf:"varint,3,opt,name=defaultMode"`
}

func (*ComponentTemplateSpec) DeepCopy added in v0.6.0

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

func (*ComponentTemplateSpec) DeepCopyInto added in v0.6.0

func (in *ComponentTemplateSpec) DeepCopyInto(out *ComponentTemplateSpec)

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

type ComponentValueFrom added in v0.6.0

type ComponentValueFrom struct {
	// Specifies the source to select. It can be one of three types: `FieldRef`, `ServiceRef`, `HeadlessServiceRef`.
	//
	// +kubebuilder:validation:Enum={FieldRef,ServiceRef,HeadlessServiceRef}
	// +kubebuilder:validation:Required
	Type ComponentValueFromType `json:"type"`

	// The jsonpath of the source to select when the Type is `FieldRef`.
	// Two objects are registered in the jsonpath: `componentDef` and `components`:
	//
	// - `componentDef` is the component definition object specified in `componentRef.componentDefName`.
	// - `components` are the component list objects referring to the component definition object.
	//
	// +optional
	FieldPath string `json:"fieldPath,omitempty"`

	// Defines the format of each headless service address.
	// Three builtin variables can be used as placeholders: `$POD_ORDINAL`, `$POD_FQDN`, `$POD_NAME`
	//
	// - `$POD_ORDINAL` represents the ordinal of the pod.
	// - `$POD_FQDN` represents the fully qualified domain name of the pod.
	// - `$POD_NAME` represents the name of the pod.
	//
	// +kubebuilder:default=="$POD_FQDN"
	// +optional
	Format string `json:"format,omitempty"`

	// The string used to join the values of headless service addresses.
	//
	// +kubebuilder:default=","
	// +optional
	JoinWith string `json:"joinWith,omitempty"`
}

ComponentValueFrom is deprecated since v0.8.

func (*ComponentValueFrom) DeepCopy added in v0.6.0

func (in *ComponentValueFrom) DeepCopy() *ComponentValueFrom

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

func (*ComponentValueFrom) DeepCopyInto added in v0.6.0

func (in *ComponentValueFrom) DeepCopyInto(out *ComponentValueFrom)

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

type ComponentValueFromType added in v0.6.0

type ComponentValueFromType string

ComponentValueFromType specifies the type of component value from which the data is derived.

Deprecated since v0.8.

+enum +kubebuilder:validation:Enum={FieldRef,ServiceRef,HeadlessServiceRef}

const (
	// FromFieldRef refers to the value of a specific field in the object.
	FromFieldRef ComponentValueFromType = "FieldRef"
	// FromServiceRef refers to a service within the same namespace as the object.
	FromServiceRef ComponentValueFromType = "ServiceRef"
	// FromHeadlessServiceRef refers to a headless service within the same namespace as the object.
	FromHeadlessServiceRef ComponentValueFromType = "HeadlessServiceRef"
)

type ComponentVarSelector added in v0.9.0

type ComponentVarSelector struct {
	// The Component to select from.
	ClusterObjectReference `json:",inline"`

	ComponentVars `json:",inline"`
}

ComponentVarSelector selects a var from a Component.

func (*ComponentVarSelector) DeepCopy added in v0.9.0

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

func (*ComponentVarSelector) DeepCopyInto added in v0.9.0

func (in *ComponentVarSelector) DeepCopyInto(out *ComponentVarSelector)

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

type ComponentVars added in v0.9.0

type ComponentVars struct {
	// Reference to the name of the Component object.
	//
	// +optional
	ComponentName *VarOption `json:"componentName,omitempty"`

	// Reference to the replicas of the component.
	//
	// +optional
	Replicas *VarOption `json:"replicas,omitempty"`

	// Reference to the instanceName list of the component.
	// and the value will be presented in the following format: instanceName1,instanceName2,...
	//
	// +optional
	InstanceNames *VarOption `json:"instanceNames,omitempty"`

	// Reference to the pod FQDN list of the component.
	// The value will be presented in the following format: FQDN1,FQDN2,...
	//
	// +optional
	PodFQDNs *VarOption `json:"podFQDNs,omitempty"`
}

func (*ComponentVars) DeepCopy added in v0.9.0

func (in *ComponentVars) DeepCopy() *ComponentVars

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

func (*ComponentVars) DeepCopyInto added in v0.9.0

func (in *ComponentVars) DeepCopyInto(out *ComponentVars)

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

type ComponentVersion added in v0.9.0

type ComponentVersion struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   ComponentVersionSpec   `json:"spec,omitempty"`
	Status ComponentVersionStatus `json:"status,omitempty"`
}

ComponentVersion is the Schema for the componentversions API

func (*ComponentVersion) DeepCopy added in v0.9.0

func (in *ComponentVersion) DeepCopy() *ComponentVersion

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

func (*ComponentVersion) DeepCopyInto added in v0.9.0

func (in *ComponentVersion) DeepCopyInto(out *ComponentVersion)

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

func (*ComponentVersion) DeepCopyObject added in v0.9.0

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

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

func (*ComponentVersion) Default added in v0.9.0

func (r *ComponentVersion) Default()

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

func (*ComponentVersion) SetupWebhookWithManager added in v0.9.0

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

func (*ComponentVersion) ValidateCreate added in v0.9.0

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

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

func (*ComponentVersion) ValidateDelete added in v0.9.0

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

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

func (*ComponentVersion) ValidateUpdate added in v0.9.0

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

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

type ComponentVersionCompatibilityRule added in v0.9.0

type ComponentVersionCompatibilityRule struct {
	// CompDefs specifies names for the component definitions associated with this ComponentVersion.
	// Each name in the list can represent an exact name, or a name prefix.
	//
	// For example:
	//
	// - "mysql-8.0.30-v1alpha1": Matches the exact name "mysql-8.0.30-v1alpha1"
	// - "mysql-8.0.30": Matches all names starting with "mysql-8.0.30"
	//
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MinItems=1
	// +kubebuilder:validation:MaxItems=128
	CompDefs []string `json:"compDefs"`

	// Releases is a list of identifiers for the releases.
	//
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MinItems=1
	// +kubebuilder:validation:MaxItems=128
	Releases []string `json:"releases"`
}

ComponentVersionCompatibilityRule defines the compatibility between a set of component definitions and a set of releases.

func (*ComponentVersionCompatibilityRule) DeepCopy added in v0.9.0

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

func (*ComponentVersionCompatibilityRule) DeepCopyInto added in v0.9.0

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

type ComponentVersionList added in v0.9.0

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

ComponentVersionList contains a list of ComponentVersion

func (*ComponentVersionList) DeepCopy added in v0.9.0

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

func (*ComponentVersionList) DeepCopyInto added in v0.9.0

func (in *ComponentVersionList) DeepCopyInto(out *ComponentVersionList)

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

func (*ComponentVersionList) DeepCopyObject added in v0.9.0

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

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

type ComponentVersionRelease added in v0.9.0

type ComponentVersionRelease struct {
	// Name is a unique identifier for this release.
	// Cannot be updated.
	//
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MaxLength=32
	Name string `json:"name"`

	// Changes provides information about the changes made in this release.
	//
	// +kubebuilder:validation:MaxLength=256
	// +optional
	Changes string `json:"changes,omitempty"`

	// ServiceVersion defines the version of the well-known service that the component provides.
	// The version should follow the syntax and semantics of the "Semantic Versioning" specification (http://semver.org/).
	// If the release is used, it will serve as the service version for component instances, overriding the one defined in the component definition.
	// Cannot be updated.
	//
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MaxLength=32
	ServiceVersion string `json:"serviceVersion"`

	// Images define the new images for different containers within the release.
	//
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MinProperties=1
	// +kubebuilder:validation:MaxProperties=128
	// +kubebuilder:validation:XValidation:rule="self.all(key, size(key) <= 32)",message="Container name may not exceed maximum length of 32 characters"
	// +kubebuilder:validation:XValidation:rule="self.all(key, size(self[key]) <= 256)",message="Image name may not exceed maximum length of 256 characters"
	Images map[string]string `json:"images"`
}

ComponentVersionRelease represents a release of component instances within a ComponentVersion.

func (*ComponentVersionRelease) DeepCopy added in v0.9.0

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

func (*ComponentVersionRelease) DeepCopyInto added in v0.9.0

func (in *ComponentVersionRelease) DeepCopyInto(out *ComponentVersionRelease)

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

type ComponentVersionSpec added in v0.9.0

type ComponentVersionSpec struct {
	// CompatibilityRules defines compatibility rules between sets of component definitions and releases.
	//
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MinItems=1
	// +kubebuilder:validation:MaxItems=128
	CompatibilityRules []ComponentVersionCompatibilityRule `json:"compatibilityRules"`

	// Releases represents different releases of component instances within this ComponentVersion.
	//
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MinItems=1
	// +kubebuilder:validation:MaxItems=128
	Releases []ComponentVersionRelease `json:"releases"`
}

ComponentVersionSpec defines the desired state of ComponentVersion

func (*ComponentVersionSpec) DeepCopy added in v0.9.0

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

func (*ComponentVersionSpec) DeepCopyInto added in v0.9.0

func (in *ComponentVersionSpec) DeepCopyInto(out *ComponentVersionSpec)

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

type ComponentVersionStatus added in v0.9.0

type ComponentVersionStatus struct {
	// ObservedGeneration is the most recent generation observed for this ComponentVersion.
	// +optional
	ObservedGeneration int64 `json:"observedGeneration,omitempty"`

	// Phase valid values are “, `Available`, 'Unavailable`.
	// Available is ComponentVersion become available, and can be used for co-related objects.
	// +optional
	Phase Phase `json:"phase,omitempty"`

	// Extra message for current phase.
	// +optional
	Message string `json:"message,omitempty"`

	// ServiceVersions represent the supported service versions of this ComponentVersion.
	// +optional
	ServiceVersions string `json:"serviceVersions,omitempty"`
}

ComponentVersionStatus defines the observed state of ComponentVersion

func (*ComponentVersionStatus) DeepCopy added in v0.9.0

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

func (*ComponentVersionStatus) DeepCopyInto added in v0.9.0

func (in *ComponentVersionStatus) DeepCopyInto(out *ComponentVersionStatus)

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

type ComponentVolume added in v0.8.0

type ComponentVolume struct {
	// Specifies the name of the volume.
	// It must be a DNS_LABEL and unique within the pod.
	// More info can be found at: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
	// Note: This field cannot be updated.
	//
	// +kubebuilder:validation:Required
	Name string `json:"name"`

	// Specifies whether the creation of a snapshot of this volume is necessary when performing a backup of the Component.
	//
	// Note: This field cannot be updated.
	//
	// +kubebuilder:default=false
	// +optional
	NeedSnapshot bool `json:"needSnapshot,omitempty"`

	// Sets the critical threshold for volume space utilization as a percentage (0-100).
	//
	// Exceeding this percentage triggers the system to switch the volume to read-only mode as specified in
	// `componentDefinition.spec.lifecycleActions.readOnly`.
	// This precaution helps prevent space depletion while maintaining read-only access.
	// If the space utilization later falls below this threshold, the system reverts the volume to read-write mode
	// as defined in `componentDefinition.spec.lifecycleActions.readWrite`, restoring full functionality.
	//
	// Note: This field cannot be updated.
	//
	// +kubebuilder:validation:Maximum=100
	// +kubebuilder:validation:Minimum=0
	// +kubebuilder:default=0
	// +optional
	HighWatermark int `json:"highWatermark,omitempty"`
}

func (*ComponentVolume) DeepCopy added in v0.8.0

func (in *ComponentVolume) DeepCopy() *ComponentVolume

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

func (*ComponentVolume) DeepCopyInto added in v0.8.0

func (in *ComponentVolume) DeepCopyInto(out *ComponentVolume)

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

type ConfigConstraint

type ConfigConstraint struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   ConfigConstraintSpec   `json:"spec,omitempty"`
	Status ConfigConstraintStatus `json:"status,omitempty"`
}

ConfigConstraint manages the parameters across multiple configuration files contained in a single configure template. These configuration files should have the same format (e.g. ini, xml, properties, json).

It provides the following functionalities:

1. **Parameter Value Validation**: Validates and ensures compliance of parameter values with defined constraints. 2. **Dynamic Reload on Modification**: Monitors parameter changes and triggers dynamic reloads to apply updates. 3. **Parameter Rendering in Templates**: Injects parameters into templates to generate up-to-date configuration files.

func (*ConfigConstraint) ConvertFrom added in v0.9.0

func (cc *ConfigConstraint) ConvertFrom(srcRaw conversion.Hub) error

func (*ConfigConstraint) ConvertTo added in v0.9.0

func (cc *ConfigConstraint) ConvertTo(dstRaw conversion.Hub) error

func (*ConfigConstraint) DeepCopy added in v0.6.0

func (in *ConfigConstraint) DeepCopy() *ConfigConstraint

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

func (*ConfigConstraint) DeepCopyInto added in v0.6.0

func (in *ConfigConstraint) DeepCopyInto(out *ConfigConstraint)

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

func (*ConfigConstraint) DeepCopyObject added in v0.6.0

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

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

type ConfigConstraintList

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

ConfigConstraintList contains a list of ConfigConstraints.

+kubebuilder:object:root=true

func (*ConfigConstraintList) DeepCopy added in v0.6.0

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

func (*ConfigConstraintList) DeepCopyInto added in v0.6.0

func (in *ConfigConstraintList) DeepCopyInto(out *ConfigConstraintList)

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

func (*ConfigConstraintList) DeepCopyObject added in v0.6.0

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

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

type ConfigConstraintSpec

type ConfigConstraintSpec struct {
	// Specifies the dynamic reload action supported by the engine.
	// When set, the controller executes the method defined here to execute hot parameter updates.
	//
	// Dynamic reloading is triggered only if both of the following conditions are met:
	//
	// 1. The modified parameters are listed in the `dynamicParameters` field.
	//    If `reloadStaticParamsBeforeRestart` is set to true, modifications to `staticParameters`
	//    can also trigger a reload.
	// 2. `reloadOptions` is set.
	//
	// If `reloadOptions` is not set or the modified parameters are not listed in `dynamicParameters`,
	// dynamic reloading will not be triggered.
	//
	// Example:
	// “`yaml
	// reloadOptions:
	//  tplScriptTrigger:
	//    namespace: kb-system
	//    scriptConfigMapRef: mysql-reload-script
	//    sync: true
	// “`
	// +optional
	ReloadOptions *ReloadOptions `json:"reloadOptions,omitempty"`

	// Indicates whether to consolidate dynamic reload and restart actions into a single restart.
	//
	// - If true, updates requiring both actions will result in only a restart, merging the actions.
	// - If false, updates will trigger both actions executed sequentially: first dynamic reload, then restart.
	//
	// This flag allows for more efficient handling of configuration changes by potentially eliminating
	// an unnecessary reload step.
	//
	// +optional
	DynamicActionCanBeMerged *bool `json:"dynamicActionCanBeMerged,omitempty"`

	// Configures whether the dynamic reload specified in `reloadOptions` applies only to dynamic parameters or
	// to all parameters (including static parameters).
	//
	// - false (default): Only modifications to the dynamic parameters listed in `dynamicParameters`
	//   will trigger a dynamic reload.
	// - true: Modifications to both dynamic parameters listed in `dynamicParameters` and static parameters
	//   listed in `staticParameters` will trigger a dynamic reload.
	//   The "true" option is for certain engines that require static parameters to be set
	//   via SQL statements before they can take effect on restart.
	//
	// +optional
	ReloadStaticParamsBeforeRestart *bool `json:"reloadStaticParamsBeforeRestart,omitempty"`

	// Specifies the tools container image used by ShellTrigger for dynamic reload.
	// If the dynamic reload action is triggered by a ShellTrigger, this field is required.
	// This image must contain all necessary tools for executing the ShellTrigger scripts.
	//
	// Usually the specified image is referenced by the init container,
	// which is then responsible for copy the tools from the image to a bin volume.
	// This ensures that the tools are available to the 'config-manager' sidecar.
	//
	// +optional
	ToolsImageSpec *appsv1beta1.ToolsSetup `json:"toolsImageSpec,omitempty"`

	// Specifies a list of actions to execute specified commands based on Pod labels.
	//
	// It utilizes the K8s Downward API to mount label information as a volume into the pod.
	// The 'config-manager' sidecar container watches for changes in the role label and dynamically invoke
	// registered commands (usually execute some SQL statements) when a change is detected.
	//
	// It is designed for scenarios where:
	//
	// - Replicas with different roles have different configurations, such as Redis primary & secondary replicas.
	// - After a role switch (e.g., from secondary to primary), some changes in configuration are needed
	//   to reflect the new role.
	//
	// +optional
	DownwardAPIOptions []appsv1beta1.DownwardAPIChangeTriggeredAction `json:"downwardAPIOptions,omitempty"`

	// A list of ScriptConfig Object.
	//
	// Each ScriptConfig object specifies a ConfigMap that contains script files that should be mounted inside the pod.
	// The scripts are mounted as volumes and can be referenced and executed by the dynamic reload
	// and DownwardAction to perform specific tasks or configurations.
	//
	// +optional
	// +patchMergeKey=scriptConfigMapRef
	// +patchStrategy=merge,retainKeys
	// +listType=map
	// +listMapKey=scriptConfigMapRef
	ScriptConfigs []appsv1beta1.ScriptConfig `json:"scriptConfigs,omitempty"`

	// Specifies the top-level key in the 'configurationSchema.cue' that organizes the validation rules for parameters.
	// This key must exist within the CUE script defined in 'configurationSchema.cue'.
	//
	// +optional
	CfgSchemaTopLevelName string `json:"cfgSchemaTopLevelName,omitempty"`

	// Defines a list of parameters including their names, default values, descriptions,
	// types, and constraints (permissible values or the range of valid values).
	//
	// +optional
	ConfigurationSchema *CustomParametersValidation `json:"configurationSchema,omitempty"`

	// List static parameters.
	// Modifications to any of these parameters require a restart of the process to take effect.
	//
	// +listType=set
	// +optional
	StaticParameters []string `json:"staticParameters,omitempty"`

	// List dynamic parameters.
	// Modifications to these parameters trigger a configuration reload without requiring a process restart.
	//
	// +listType=set
	// +optional
	DynamicParameters []string `json:"dynamicParameters,omitempty"`

	// Lists the parameters that cannot be modified once set.
	// Attempting to change any of these parameters will be ignored.
	//
	// +listType=set
	// +optional
	ImmutableParameters []string `json:"immutableParameters,omitempty"`

	// Used to match labels on the pod to determine whether a dynamic reload should be performed.
	//
	// In some scenarios, only specific pods (e.g., primary replicas) need to undergo a dynamic reload.
	// The `selector` allows you to specify label selectors to target the desired pods for the reload process.
	//
	// If the `selector` is not specified or is nil, all pods managed by the workload will be considered for the dynamic
	// reload.
	//
	// +optional
	Selector *metav1.LabelSelector `json:"selector,omitempty"`

	// Specifies the format of the configuration file and any associated parameters that are specific to the chosen format.
	// Supported formats include `ini`, `xml`, `yaml`, `json`, `hcl`, `dotenv`, `properties`, and `toml`.
	//
	// Each format may have its own set of parameters that can be configured.
	// For instance, when using the `ini` format, you can specify the section name.
	//
	// Example:
	// “`
	// formatterConfig:
	//  format: ini
	//  iniConfig:
	//    sectionName: mysqld
	// “`
	// +kubebuilder:validation:Required
	FormatterConfig *appsv1beta1.FileFormatConfig `json:"formatterConfig"`
}

ConfigConstraintSpec defines the desired state of ConfigConstraint

func (*ConfigConstraintSpec) DeepCopy added in v0.6.0

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

func (*ConfigConstraintSpec) DeepCopyInto added in v0.6.0

func (in *ConfigConstraintSpec) DeepCopyInto(out *ConfigConstraintSpec)

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

type ConfigConstraintStatus

type ConfigConstraintStatus struct {

	// Specifies the status of the configuration template.
	// When set to CCAvailablePhase, the ConfigConstraint can be referenced by ClusterDefinition or ClusterVersion.
	//
	// +optional
	Phase appsv1beta1.ConfigConstraintPhase `json:"phase,omitempty"`

	// Provides descriptions for abnormal states.
	//
	// +optional
	Message string `json:"message,omitempty"`

	// Refers to the most recent generation observed for this ConfigConstraint. This value is updated by the API Server.
	//
	// +optional
	ObservedGeneration int64 `json:"observedGeneration,omitempty"`
}

ConfigConstraintStatus represents the observed state of a ConfigConstraint.

func (*ConfigConstraintStatus) DeepCopy added in v0.6.0

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

func (*ConfigConstraintStatus) DeepCopyInto added in v0.6.0

func (in *ConfigConstraintStatus) DeepCopyInto(out *ConfigConstraintStatus)

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

type ConfigMapRef added in v0.8.0

type ConfigMapRef struct {
	ResourceMeta `json:",inline"`

	// ConfigMap specifies the ConfigMap to be mounted as a volume.
	//
	// +kubebuilder:validation:Required
	ConfigMap corev1.ConfigMapVolumeSource `json:"configMap"`
}

ConfigMapRef defines a reference to a ConfigMap.

func (*ConfigMapRef) DeepCopy added in v0.8.0

func (in *ConfigMapRef) DeepCopy() *ConfigMapRef

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

func (*ConfigMapRef) DeepCopyInto added in v0.8.0

func (in *ConfigMapRef) DeepCopyInto(out *ConfigMapRef)

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

type ConfigParams added in v0.7.0

type ConfigParams struct {
	// Holds the configuration keys and values. This field is a workaround for issues found in kubebuilder and code-generator.
	// Refer to https://github.com/kubernetes-sigs/kubebuilder/issues/528 and https://github.com/kubernetes/code-generator/issues/50 for more details.
	//
	// Represents the content of the configuration file.
	//
	// +optional
	Content *string `json:"content"`

	// Represents the updated parameters for a single configuration file.
	//
	// +optional
	Parameters map[string]*string `json:"parameters,omitempty"`
}

func (*ConfigParams) DeepCopy added in v0.7.0

func (in *ConfigParams) DeepCopy() *ConfigParams

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

func (*ConfigParams) DeepCopyInto added in v0.7.0

func (in *ConfigParams) DeepCopyInto(out *ConfigParams)

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

type ConfigTemplateExtension added in v0.7.0

type ConfigTemplateExtension struct {
	// Specifies the name of the referenced configuration template ConfigMap object.
	//
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MaxLength=63
	// +kubebuilder:validation:Pattern:=`^[a-z0-9]([a-z0-9\.\-]*[a-z0-9])?$`
	TemplateRef string `json:"templateRef"`

	// Specifies the namespace of the referenced configuration template ConfigMap object.
	// An empty namespace is equivalent to the "default" namespace.
	//
	// +kubebuilder:default="default"
	// +kubebuilder:validation:MaxLength=63
	// +kubebuilder:validation:Pattern:=`^[a-z0-9]([a-z0-9\-]*[a-z0-9])?$`
	// +optional
	Namespace string `json:"namespace,omitempty"`

	// Defines the strategy for merging externally imported templates into component templates.
	//
	// +kubebuilder:default="none"
	// +optional
	Policy MergedPolicy `json:"policy,omitempty"`
}

func (*ConfigTemplateExtension) DeepCopy added in v0.7.0

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

func (*ConfigTemplateExtension) DeepCopyInto added in v0.7.0

func (in *ConfigTemplateExtension) DeepCopyInto(out *ConfigTemplateExtension)

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

type Configuration

type Configuration struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   ConfigurationSpec   `json:"spec,omitempty"`
	Status ConfigurationStatus `json:"status,omitempty"`
}

Configuration represents the complete set of configurations for a specific Component of a Cluster. This includes templates for each configuration file, their corresponding ConfigConstraints, volume mounts, and other relevant details.

func (*Configuration) DeepCopy added in v0.6.0

func (in *Configuration) DeepCopy() *Configuration

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

func (*Configuration) DeepCopyInto added in v0.6.0

func (in *Configuration) DeepCopyInto(out *Configuration)

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

func (*Configuration) DeepCopyObject added in v0.7.0

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

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

type ConfigurationItem added in v0.7.0

type ConfigurationItem struct {
	// Specifies the name of the configuration template.
	//
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MaxLength=63
	// +kubebuilder:validation:Pattern:=`^[a-z0-9]([a-z0-9\.\-]*[a-z0-9])?$`
	Name string `json:"name"`

	// Defines the upgrade policy for the configuration.
	//
	// +optional
	Policy *UpgradePolicy `json:"policy,omitempty"`

	// Sets the configuration files and their associated parameters that need to be updated.
	// It should contain at least one item.
	//
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MinItems=1
	// +patchMergeKey=key
	// +patchStrategy=merge,retainKeys
	// +listType=map
	// +listMapKey=key
	Keys []ParameterConfig `json:"keys" patchStrategy:"merge,retainKeys" patchMergeKey:"key"`
}

func (*ConfigurationItem) DeepCopy added in v0.7.0

func (in *ConfigurationItem) DeepCopy() *ConfigurationItem

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

func (*ConfigurationItem) DeepCopyInto added in v0.7.0

func (in *ConfigurationItem) DeepCopyInto(out *ConfigurationItem)

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

type ConfigurationItemDetail added in v0.7.0

type ConfigurationItemDetail struct {
	// Defines the unique identifier of the configuration template.
	//
	// It must be a string of maximum 63 characters, and can only include lowercase alphanumeric characters,
	// hyphens, and periods.
	// The name must start and end with an alphanumeric character.
	//
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MaxLength=63
	// +kubebuilder:validation:Pattern:=`^[a-z0-9]([a-z0-9\.\-]*[a-z0-9])?$`
	Name string `json:"name"`

	// Deprecated: No longer used. Please use 'Payload' instead. Previously represented the version of the configuration template.
	//
	// +optional
	Version string `json:"version,omitempty"`

	// External controllers can trigger a configuration rerender by modifying this field.
	//
	// Note: Currently, the `payload` field is opaque and its content is not interpreted by the system.
	// Modifying this field will cause a rerender, regardless of the specific content of this field.
	//
	// +kubebuilder:pruning:PreserveUnknownFields
	// +optional
	Payload Payload `json:"payload,omitempty"`

	// Specifies the name of the configuration template (a ConfigMap), ConfigConstraint, and other miscellaneous options.
	//
	// The configuration template is a ConfigMap that contains multiple configuration files.
	// Each configuration file is stored as a key-value pair within the ConfigMap.
	//
	// ConfigConstraint allows defining constraints and validation rules for configuration parameters.
	// It ensures that the configuration adheres to certain requirements and limitations.
	//
	// +optional
	ConfigSpec *ComponentConfigSpec `json:"configSpec"`

	// Specifies the user-defined configuration template.
	//
	// When provided, the `importTemplateRef` overrides the default configuration template
	// specified in `configSpec.templateRef`.
	// This allows users to customize the configuration template according to their specific requirements.
	//
	// +optional
	ImportTemplateRef *ConfigTemplateExtension `json:"importTemplateRef"`

	// Specifies the user-defined configuration parameters.
	//
	// When provided, the parameter values in `configFileParams` override the default configuration parameters.
	// This allows users to override the default configuration according to their specific needs.
	//
	// +optional
	ConfigFileParams map[string]ConfigParams `json:"configFileParams,omitempty"`
}

ConfigurationItemDetail corresponds to settings of a configuration template (a ConfigMap).

func (*ConfigurationItemDetail) DeepCopy added in v0.7.0

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

func (*ConfigurationItemDetail) DeepCopyInto added in v0.7.0

func (in *ConfigurationItemDetail) DeepCopyInto(out *ConfigurationItemDetail)

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

type ConfigurationItemDetailStatus added in v0.7.0

type ConfigurationItemDetailStatus struct {
	// Specifies the name of the configuration template. It is a required field and must be a string of maximum 63 characters.
	// The name should only contain lowercase alphanumeric characters, hyphens, or periods. It should start and end with an alphanumeric character.
	//
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MaxLength=63
	// +kubebuilder:validation:Pattern:=`^[a-z0-9]([a-z0-9\.\-]*[a-z0-9])?$`
	Name string `json:"name"`

	// Indicates the current status of the configuration item.
	//
	// Possible values include "Creating", "Init", "Running", "Pending", "Merged", "MergeFailed", "FailedAndPause",
	// "Upgrading", "Deleting", "FailedAndRetry", "Finished".
	//
	// +optional
	Phase ConfigurationPhase `json:"phase,omitempty"`

	// Represents the last completed revision of the configuration item. This field is optional.
	//
	// +optional
	LastDoneRevision string `json:"lastDoneRevision,omitempty"`

	// Represents the updated revision of the configuration item. This field is optional.
	//
	// +optional
	UpdateRevision string `json:"updateRevision,omitempty"`

	// Provides a description of any abnormal status. This field is optional.
	//
	// +optional
	Message *string `json:"message,omitempty"`

	// Provides detailed information about the execution of the configuration change. This field is optional.
	//
	// +optional
	ReconcileDetail *ReconcileDetail `json:"reconcileDetail,omitempty"`
}

func (*ConfigurationItemDetailStatus) DeepCopy added in v0.7.0

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

func (*ConfigurationItemDetailStatus) DeepCopyInto added in v0.7.0

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

type ConfigurationItemStatus added in v0.7.0

type ConfigurationItemStatus struct {
	// Indicates the name of the configuration template (as ConfigMap).
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MaxLength=63
	// +kubebuilder:validation:Pattern:=`^[a-z0-9]([a-z0-9\.\-]*[a-z0-9])?$`
	Name string `json:"name"`

	// Records the UpgradePolicy of the configuration change operation.
	// +optional
	UpdatePolicy UpgradePolicy `json:"updatePolicy,omitempty"`

	// Represents the current state of the reconfiguration state machine.
	// Possible values include "Creating", "Init", "Running", "Pending", "Merged", "MergeFailed", "FailedAndPause",
	// "Upgrading", "Deleting", "FailedAndRetry", "Finished", "ReconfigurePersisting", "ReconfigurePersisted".
	// +optional
	Status string `json:"status,omitempty"`

	// Provides details about the operation.
	// +optional
	Message string `json:"message,omitempty"`

	// Records the number of pods successfully updated following a configuration change.
	// +kubebuilder:default=0
	// +optional
	SucceedCount int32 `json:"succeedCount"`

	// Represents the total count of pods intended to be updated by a configuration change.
	// +kubebuilder:default=-1
	// +optional
	ExpectedCount int32 `json:"expectedCount"`

	// Records the last state of the reconfiguration finite state machine.
	// Possible values include "None", "Retry", "Failed", "NotSupport", "FailedAndRetry".
	//
	// - "None" describes fsm has finished and quit.
	// - "Retry" describes fsm is running.
	// - "Failed" describes fsm is failed and exited.
	// - "NotSupport" describes fsm does not support the feature.
	// - "FailedAndRetry" describes fsm is failed in current state, but can be retried.
	// +optional
	LastAppliedStatus string `json:"lastStatus,omitempty"`

	// Stores the last applied configuration.
	// +optional
	LastAppliedConfiguration map[string]string `json:"lastAppliedConfiguration,omitempty"`

	// Contains the updated parameters.
	// +optional
	UpdatedParameters UpdatedParameters `json:"updatedParameters"`
}

func (*ConfigurationItemStatus) DeepCopy added in v0.7.0

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

func (*ConfigurationItemStatus) DeepCopyInto added in v0.7.0

func (in *ConfigurationItemStatus) DeepCopyInto(out *ConfigurationItemStatus)

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

type ConfigurationList added in v0.7.0

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

ConfigurationList contains a list of Configuration

func (*ConfigurationList) DeepCopy added in v0.7.0

func (in *ConfigurationList) DeepCopy() *ConfigurationList

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

func (*ConfigurationList) DeepCopyInto added in v0.7.0

func (in *ConfigurationList) DeepCopyInto(out *ConfigurationList)

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

func (*ConfigurationList) DeepCopyObject added in v0.7.0

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

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

type ConfigurationPhase added in v0.7.0

type ConfigurationPhase string

ConfigurationPhase defines the Configuration FSM phase +enum +kubebuilder:validation:Enum={Creating,Init,Running,Pending,Merged,MergeFailed,FailedAndPause,Upgrading,Deleting,FailedAndRetry,Finished}

const (
	CCreatingPhase       ConfigurationPhase = "Creating"
	CInitPhase           ConfigurationPhase = "Init"
	CRunningPhase        ConfigurationPhase = "Running"
	CPendingPhase        ConfigurationPhase = "Pending"
	CFailedPhase         ConfigurationPhase = "FailedAndRetry"
	CFailedAndPausePhase ConfigurationPhase = "FailedAndPause"
	CMergedPhase         ConfigurationPhase = "Merged"
	CMergeFailedPhase    ConfigurationPhase = "MergeFailed"
	CDeletingPhase       ConfigurationPhase = "Deleting"
	CUpgradingPhase      ConfigurationPhase = "Upgrading"
	CFinishedPhase       ConfigurationPhase = "Finished"
)

type ConfigurationSpec added in v0.7.0

type ConfigurationSpec struct {
	// Specifies the name of the Cluster that this configuration is associated with.
	//
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="forbidden to update spec.clusterRef"
	ClusterRef string `json:"clusterRef"`

	// Represents the name of the Component that this configuration pertains to.
	//
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="forbidden to update spec.clusterRef"
	ComponentName string `json:"componentName"`

	// ConfigItemDetails is an array of ConfigurationItemDetail objects.
	//
	// Each ConfigurationItemDetail corresponds to a configuration template,
	// which is a ConfigMap that contains multiple configuration files.
	// Each configuration file is stored as a key-value pair within the ConfigMap.
	//
	// The ConfigurationItemDetail includes information such as:
	//
	// - The configuration template (a ConfigMap)
	// - The corresponding ConfigConstraint (constraints and validation rules for the configuration)
	// - Volume mounts (for mounting the configuration files)
	//
	// +optional
	// +patchMergeKey=name
	// +patchStrategy=merge,retainKeys
	// +listType=map
	// +listMapKey=name
	ConfigItemDetails []ConfigurationItemDetail `json:"configItemDetails,omitempty"`
}

ConfigurationSpec defines the desired state of a Configuration resource.

func (*ConfigurationSpec) DeepCopy added in v0.7.0

func (in *ConfigurationSpec) DeepCopy() *ConfigurationSpec

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

func (*ConfigurationSpec) DeepCopyInto added in v0.7.0

func (in *ConfigurationSpec) DeepCopyInto(out *ConfigurationSpec)

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

func (*ConfigurationSpec) GetConfigSpec added in v0.8.2

func (configuration *ConfigurationSpec) GetConfigSpec(configSpecName string) *ComponentConfigSpec

func (*ConfigurationSpec) GetConfigurationItem added in v0.7.0

func (configuration *ConfigurationSpec) GetConfigurationItem(name string) *ConfigurationItemDetail

type ConfigurationStatus

type ConfigurationStatus struct {

	// Provides a description of any abnormal status.
	// +optional
	Message string `json:"message,omitempty"`

	// Represents the latest generation observed for this
	// ClusterDefinition. It corresponds to the ConfigConstraint's generation, which is
	// updated by the API Server.
	// +optional
	ObservedGeneration int64 `json:"observedGeneration,omitempty"`

	// Provides detailed status information for opsRequest.
	// +optional
	// +patchMergeKey=type
	// +patchStrategy=merge
	// +listType=map
	// +listMapKey=type
	Conditions []metav1.Condition `json:"conditions,omitempty"`

	// Provides the status of each component undergoing reconfiguration.
	// +patchMergeKey=name
	// +patchStrategy=merge,retainKeys
	// +listType=map
	// +listMapKey=name
	ConfigurationItemStatus []ConfigurationItemDetailStatus `json:"configurationStatus"`
}

ConfigurationStatus represents the observed state of a Configuration resource.

func (*ConfigurationStatus) DeepCopy added in v0.6.0

func (in *ConfigurationStatus) DeepCopy() *ConfigurationStatus

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

func (*ConfigurationStatus) DeepCopyInto added in v0.6.0

func (in *ConfigurationStatus) DeepCopyInto(out *ConfigurationStatus)

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

func (*ConfigurationStatus) GetItemStatus added in v0.7.0

func (status *ConfigurationStatus) GetItemStatus(name string) *ConfigurationItemDetailStatus

type ConnectionCredentialAuth added in v0.7.0

type ConnectionCredentialAuth struct {
	// Specifies the username for the external service.
	//
	// +optional
	Username *CredentialVar `json:"username,omitempty"`

	// Specifies the password for the external service.
	//
	// +optional
	Password *CredentialVar `json:"password,omitempty"`
}

ConnectionCredentialAuth specifies the authentication credentials required for accessing an external service.

func (*ConnectionCredentialAuth) DeepCopy added in v0.7.0

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

func (*ConnectionCredentialAuth) DeepCopyInto added in v0.7.0

func (in *ConnectionCredentialAuth) DeepCopyInto(out *ConnectionCredentialAuth)

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

type ConnectionCredentialKey

type ConnectionCredentialKey struct {
	// Represents the key of the password in the connection credential secret.
	// If not specified, the default key "password" is used.
	//
	// +optional
	PasswordKey *string `json:"passwordKey,omitempty"`

	// Represents the key of the username in the connection credential secret.
	// If not specified, the default key "username" is used.
	//
	// +optional
	UsernameKey *string `json:"usernameKey,omitempty"`

	// Defines the key of the host in the connection credential secret.
	HostKey *string `json:"hostKey,omitempty"`

	// Indicates map key of the port in the connection credential secret.
	PortKey *string `json:"portKey,omitempty"`
}

func (*ConnectionCredentialKey) DeepCopy added in v0.6.0

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

func (*ConnectionCredentialKey) DeepCopyInto added in v0.6.0

func (in *ConnectionCredentialKey) DeepCopyInto(out *ConnectionCredentialKey)

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

type ConsensusMember

type ConsensusMember struct {
	// Specifies the name of the consensus member.
	//
	// +kubebuilder:validation:Required
	// +kubebuilder:default=leader
	Name string `json:"name"`

	// Specifies the services that this member is capable of providing.
	//
	// +kubebuilder:validation:Required
	// +kubebuilder:default=ReadWrite
	AccessMode AccessMode `json:"accessMode"`

	// Indicates the number of Pods that perform this role.
	// The default is 1 for `Leader`, 0 for `Learner`, others for `Followers`.
	//
	// +kubebuilder:default=0
	// +kubebuilder:validation:Minimum=0
	// +optional
	Replicas *int32 `json:"replicas,omitempty"`
}

ConsensusMember is deprecated since v0.7.

func (*ConsensusMember) DeepCopy added in v0.6.0

func (in *ConsensusMember) DeepCopy() *ConsensusMember

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

func (*ConsensusMember) DeepCopyInto added in v0.6.0

func (in *ConsensusMember) DeepCopyInto(out *ConsensusMember)

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

type ConsensusSetSpec

type ConsensusSetSpec struct {
	StatefulSetSpec `json:",inline"`

	// Represents a single leader in the consensus set.
	//
	// +kubebuilder:validation:Required
	Leader ConsensusMember `json:"leader"`

	// Members of the consensus set that have voting rights but are not the leader.
	//
	// +optional
	Followers []ConsensusMember `json:"followers,omitempty"`

	// Represents a member of the consensus set that does not have voting rights.
	//
	// +optional
	Learner *ConsensusMember `json:"learner,omitempty"`
}

ConsensusSetSpec is deprecated since v0.7.

func NewConsensusSetSpec added in v0.6.0

func NewConsensusSetSpec() *ConsensusSetSpec

func (*ConsensusSetSpec) DeepCopy added in v0.6.0

func (in *ConsensusSetSpec) DeepCopy() *ConsensusSetSpec

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

func (*ConsensusSetSpec) DeepCopyInto added in v0.6.0

func (in *ConsensusSetSpec) DeepCopyInto(out *ConsensusSetSpec)

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

func (*ConsensusSetSpec) FinalStsUpdateStrategy added in v0.6.0

func (*ConsensusSetSpec) GetUpdateStrategy added in v0.6.0

func (r *ConsensusSetSpec) GetUpdateStrategy() UpdateStrategy

type ContainerVars added in v0.9.0

type ContainerVars struct {
	// The name of the container.
	//
	// +kubebuilder:validation:Required
	Name string `json:"name"`

	// Container port to reference.
	//
	// +optional
	Port *NamedVar `json:"port,omitempty"`
}

ContainerVars defines the vars that can be referenced from a Container.

func (*ContainerVars) DeepCopy added in v0.9.0

func (in *ContainerVars) DeepCopy() *ContainerVars

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

func (*ContainerVars) DeepCopyInto added in v0.9.0

func (in *ContainerVars) DeepCopyInto(out *ContainerVars)

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

type CredentialVar added in v0.7.0

type CredentialVar struct {
	// Holds a direct string or an expression that can be evaluated to a string.
	//
	// It can include variables denoted by $(VAR_NAME).
	// These variables are expanded to the value of the environment variables defined in the container.
	// If a variable cannot be resolved, it remains unchanged in the output.
	//
	// To escape variable expansion and retain the literal value, use double $ characters.
	//
	// For example:
	//
	// - "$(VAR_NAME)" will be expanded to the value of the environment variable VAR_NAME.
	// - "$$(VAR_NAME)" will result in "$(VAR_NAME)" in the output, without any variable expansion.
	//
	// Default value is an empty string.
	//
	// +optional
	Value string `json:"value,omitempty" protobuf:"bytes,2,opt,name=value"`

	// Specifies the source for the variable's value.
	//
	// +optional
	ValueFrom *corev1.EnvVarSource `json:"valueFrom,omitempty" protobuf:"bytes,3,opt,name=valueFrom"`
}

CredentialVar represents a variable that retrieves its value either directly from a specified expression or from a source defined in `valueFrom`. Only one of these options may be used at a time.

func (*CredentialVar) DeepCopy added in v0.7.0

func (in *CredentialVar) DeepCopy() *CredentialVar

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

func (*CredentialVar) DeepCopyInto added in v0.7.0

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

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

type CredentialVarSelector added in v0.8.0

type CredentialVarSelector struct {
	// The Credential (SystemAccount) to select from.
	ClusterObjectReference `json:",inline"`

	CredentialVars `json:",inline"`
}

CredentialVarSelector selects a var from a Credential (SystemAccount).

func (*CredentialVarSelector) DeepCopy added in v0.8.0

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

func (*CredentialVarSelector) DeepCopyInto added in v0.8.0

func (in *CredentialVarSelector) DeepCopyInto(out *CredentialVarSelector)

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

type CredentialVars added in v0.8.0

type CredentialVars struct {
	// +optional
	Username *VarOption `json:"username,omitempty"`

	// +optional
	Password *VarOption `json:"password,omitempty"`
}

CredentialVars defines the vars that can be referenced from a Credential (SystemAccount). !!!!! CredentialVars will only be used as environment variables for Pods & Actions, and will not be used to render the templates.

func (*CredentialVars) DeepCopy added in v0.8.0

func (in *CredentialVars) DeepCopy() *CredentialVars

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

func (*CredentialVars) DeepCopyInto added in v0.8.0

func (in *CredentialVars) DeepCopyInto(out *CredentialVars)

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

type CustomLabelSpec

type CustomLabelSpec struct {
	// The key of the label.
	//
	// +kubebuilder:validation:Required
	Key string `json:"key"`

	// The value of the label.
	//
	// +kubebuilder:validation:Required
	Value string `json:"value"`

	// The resources that will be patched with the label.
	//
	// +kubebuilder:validation:Required
	Resources []GVKResource `json:"resources,omitempty"`
}

CustomLabelSpec is deprecated since v0.8.

func (*CustomLabelSpec) DeepCopy added in v0.6.0

func (in *CustomLabelSpec) DeepCopy() *CustomLabelSpec

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

func (*CustomLabelSpec) DeepCopyInto added in v0.6.0

func (in *CustomLabelSpec) DeepCopyInto(out *CustomLabelSpec)

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

type CustomOps added in v0.9.0

type CustomOps struct {
	// Specifies the name of the OpsDefinition.
	//
	// +kubebuilder:validation:Required
	OpsDefinitionName string `json:"opsDefinitionName"`

	// Specifies the name of the ServiceAccount to be used for executing the custom operation.
	ServiceAccountName *string `json:"serviceAccountName,omitempty"`

	// Specifies the maximum number of components to be operated on concurrently to mitigate performance impact
	// on clusters with multiple components.
	//
	// It accepts an absolute number (e.g., 5) or a percentage of components to execute in parallel (e.g., "10%").
	// Percentages are rounded up to the nearest whole number of components.
	// For example, if "10%" results in less than one, it rounds up to 1.
	//
	// When unspecified, all components are processed simultaneously by default.
	//
	// Note: This feature is not implemented yet.
	//
	// +optional
	MaxConcurrentComponents intstr.IntOrString `json:"maxConcurrentComponents,omitempty"`

	// Specifies the components and their parameters for executing custom actions as defined in OpsDefinition.
	// Requires at least one component.
	//
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MinItems=1
	// +kubebuilder:validation:MaxItems=1024
	// +patchMergeKey=componentName
	// +patchStrategy=merge,retainKeys
	// +listType=map
	// +listMapKey=componentName
	CustomOpsComponents []CustomOpsComponent `json:"components"  patchStrategy:"merge,retainKeys" patchMergeKey:"componentName"`
}

func (*CustomOps) DeepCopy added in v0.9.0

func (in *CustomOps) DeepCopy() *CustomOps

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

func (*CustomOps) DeepCopyInto added in v0.9.0

func (in *CustomOps) DeepCopyInto(out *CustomOps)

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

type CustomOpsComponent added in v0.9.0

type CustomOpsComponent struct {
	// Specifies the name of the Component.
	ComponentOps `json:",inline"`

	// Specifies the parameters that match the schema specified in the `opsDefinition.spec.parametersSchema`.
	//
	// +patchMergeKey=name
	// +patchStrategy=merge,retainKeys
	// +listType=map
	// +listMapKey=name
	// +optional
	Parameters []Parameter `json:"parameters,omitempty" patchStrategy:"merge,retainKeys" patchMergeKey:"name"`
}

func (*CustomOpsComponent) DeepCopy added in v0.9.0

func (in *CustomOpsComponent) DeepCopy() *CustomOpsComponent

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

func (*CustomOpsComponent) DeepCopyInto added in v0.9.0

func (in *CustomOpsComponent) DeepCopyInto(out *CustomOpsComponent)

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

type CustomParametersValidation

type CustomParametersValidation struct {
	// Hold a string that contains a script written in CUE language that defines a list of configuration items.
	// Each item is detailed with its name, default value, description, type (e.g. string, integer, float),
	// and constraints (permissible values or the valid range of values).
	//
	// CUE (Configure, Unify, Execute) is a declarative language designed for defining and validating
	// complex data configurations.
	// It is particularly useful in environments like K8s where complex configurations and validation rules are common.
	//
	// This script functions as a validator for user-provided configurations, ensuring compliance with
	// the established specifications and constraints.
	//
	// +optional
	CUE string `json:"cue,omitempty"`

	// Generated from the 'cue' field and transformed into a JSON format.
	//
	// +kubebuilder:validation:Schemaless
	// +kubebuilder:validation:ComponentDefRef=object
	// +kubebuilder:pruning:PreserveUnknownFields
	Schema *apiext.JSONSchemaProps `json:"schema,omitempty"`
}

CustomParametersValidation Defines a list of configuration items with their names, default values, descriptions, types, and constraints.

func (*CustomParametersValidation) DeepCopy added in v0.6.0

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

func (*CustomParametersValidation) DeepCopyInto added in v0.6.0

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

type EnvMappingVar added in v0.7.0

type EnvMappingVar struct {
	// Specifies the environment variable key in the mapping.
	//
	// +kubebuilder:validation:Required
	Key string `json:"key"`

	// Specifies the source used to derive the value of the environment variable,
	// which typically represents the tool image required for backup operation.
	//
	// +kubebuilder:validation:Required
	ValueFrom ValueFrom `json:"valueFrom"`
}

func (*EnvMappingVar) DeepCopy added in v0.7.0

func (in *EnvMappingVar) DeepCopy() *EnvMappingVar

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

func (*EnvMappingVar) DeepCopyInto added in v0.7.0

func (in *EnvMappingVar) DeepCopyInto(out *EnvMappingVar)

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

type EnvVar added in v0.8.0

type EnvVar struct {
	// Name of the variable. Must be a C_IDENTIFIER.
	//
	// +kubebuilder:validation:Required
	Name string `json:"name"`

	// Variable references `$(VAR_NAME)` are expanded using the previously defined variables in the current context.
	//
	// 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 variable's value. Cannot be used if value is not empty.
	//
	// +optional
	ValueFrom *VarSource `json:"valueFrom,omitempty"`

	// A Go template expression that will be applied to the resolved value of the var.
	//
	// The expression will only be evaluated if the var is successfully resolved to a non-credential value.
	//
	// The resolved value can be accessed by its name within the expression, system vars and other user-defined
	// non-credential vars can be used within the expression in the same way.
	// Notice that, when accessing vars by its name, you should replace all the "-" in the name with "_", because of
	// that "-" is not a valid identifier in Go.
	//
	// All expressions are evaluated in the order the vars are defined. If a var depends on any vars that also
	// have expressions defined, be careful about the evaluation order as it may use intermediate values.
	//
	// The result of evaluation will be used as the final value of the var. If the expression fails to evaluate,
	// the resolving of var will also be considered failed.
	//
	// +optional
	Expression *string `json:"expression,omitempty"`
}

EnvVar represents a variable present in the env of Pod/Action or the template of config/script.

func (*EnvVar) DeepCopy added in v0.8.0

func (in *EnvVar) DeepCopy() *EnvVar

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

func (*EnvVar) DeepCopyInto added in v0.8.0

func (in *EnvVar) DeepCopyInto(out *EnvVar)

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

type EnvVarRef added in v0.8.0

type EnvVarRef struct {
	// Specifies the container name in the target Pod.
	// If not specified, the first container will be used by default.
	//
	// +optional
	TargetContainerName string `json:"targetContainerName,omitempty"`

	// Defines the name of the environment variable.
	// This name can originate from an 'env' entry or be a data key from an 'envFrom' source.
	//
	// +kubebuilder:validation:Required
	EnvName string `json:"envName"`
}

func (*EnvVarRef) DeepCopy added in v0.8.0

func (in *EnvVarRef) DeepCopy() *EnvVarRef

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

func (*EnvVarRef) DeepCopyInto added in v0.8.0

func (in *EnvVarRef) DeepCopyInto(out *EnvVarRef)

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

type ExecAction added in v0.8.0

type ExecAction struct {
	// Specifies the command to be executed inside the container.
	// The working directory for this command is the container's root directory('/').
	// Commands are executed directly without a shell environment, meaning shell-specific syntax ('|', etc.) is not supported.
	// If the shell is required, it must be explicitly invoked in the command.
	//
	// A successful execution is indicated by an exit status of 0; any non-zero status signifies a failure.
	//
	// +optional
	Command []string `json:"command,omitempty" protobuf:"bytes,1,rep,name=command"`

	// Args represents the arguments that are passed to the `command` for execution.
	//
	// +optional
	Args []string `json:"args,omitempty"`
}

ExecAction describes an Action that executes a command inside a container. Which may run as a K8s job or be executed inside the Lorry sidecar container, depending on the implementation. Future implementations will standardize execution within Lorry.

func (*ExecAction) DeepCopy added in v0.8.0

func (in *ExecAction) DeepCopy() *ExecAction

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

func (*ExecAction) DeepCopyInto added in v0.8.0

func (in *ExecAction) DeepCopyInto(out *ExecAction)

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

type Exporter added in v0.9.0

type Exporter struct {
	// Specifies the name of the built-in metrics exporter container.
	//
	// +optional
	ContainerName string `json:"containerName,omitempty"`

	// Specifies the http/https url path to scrape for metrics.
	// If empty, Prometheus uses the default value (e.g. `/metrics`).
	//
	// +kubebuilder:validation:default="/metrics"
	// +optional
	ScrapePath string `json:"scrapePath,omitempty"`

	// Specifies the port name to scrape for metrics.
	//
	// +optional
	ScrapePort string `json:"scrapePort,omitempty"`

	// Specifies the schema to use for scraping.
	// `http` and `https` are the expected values unless you rewrite the `__scheme__` label via relabeling.
	// If empty, Prometheus uses the default value `http`.
	//
	// +kubebuilder:validation:default="http"
	// +optional
	ScrapeScheme PrometheusScheme `json:"scrapeScheme,omitempty"`
}

func (*Exporter) DeepCopy added in v0.9.0

func (in *Exporter) DeepCopy() *Exporter

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

func (*Exporter) DeepCopyInto added in v0.9.0

func (in *Exporter) DeepCopyInto(out *Exporter)

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

type ExporterConfig

type ExporterConfig struct {
	// scrapePort is exporter port for Time Series Database to scrape metrics.
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:XIntOrString
	ScrapePort intstr.IntOrString `json:"scrapePort"`

	// scrapePath is exporter url path for Time Series Database to scrape metrics.
	// +kubebuilder:validation:MaxLength=128
	// +kubebuilder:default="/metrics"
	// +optional
	ScrapePath string `json:"scrapePath,omitempty"`
}

func (*ExporterConfig) DeepCopy added in v0.6.0

func (in *ExporterConfig) DeepCopy() *ExporterConfig

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

func (*ExporterConfig) DeepCopyInto added in v0.6.0

func (in *ExporterConfig) DeepCopyInto(out *ExporterConfig)

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

type Expose

type Expose struct {
	// Specifies the name of the Component.
	ComponentName string `json:"componentName,omitempty"`

	// Indicates whether the services will be exposed.
	// 'Enable' exposes the services. while 'Disable' removes the exposed Service.
	//
	// +kubebuilder:validation:Required
	Switch ExposeSwitch `json:"switch"`

	// Specifies a list of OpsService.
	// When an OpsService is exposed, a corresponding ClusterService will be added to `cluster.spec.services`.
	// On the other hand, when an OpsService is unexposed, the corresponding ClusterService will be removed
	// from `cluster.spec.services`.
	//
	// Note: If `componentName` is not specified, the `ports` and `selector` fields must be provided
	// in each OpsService definition.
	//
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:Minitems=0
	Services []OpsService `json:"services"`
}

func (*Expose) DeepCopy added in v0.6.0

func (in *Expose) DeepCopy() *Expose

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

func (*Expose) DeepCopyInto added in v0.6.0

func (in *Expose) DeepCopyInto(out *Expose)

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

type ExposeSwitch added in v0.8.0

type ExposeSwitch string

ExposeSwitch Specifies the switch for the expose operation. This switch can be used to enable or disable the expose operation. +enum +kubebuilder:validation:Enum={Enable, Disable}

const (
	EnableExposeSwitch  ExposeSwitch = "Enable"
	DisableExposeSwitch ExposeSwitch = "Disable"
)

type FailurePolicyType added in v0.6.0

type FailurePolicyType string

FailurePolicyType specifies the type of failure policy.

+enum +kubebuilder:validation:Enum={Ignore,Fail}

const (
	// FailurePolicyIgnore means that an error will be ignored but logged.
	FailurePolicyIgnore FailurePolicyType = "Ignore"
	// FailurePolicyFail means that an error will be reported.
	FailurePolicyFail FailurePolicyType = "Fail"
)

type GVKResource

type GVKResource struct {
	// Represents the GVK of a resource, such as "v1/Pod", "apps/v1/StatefulSet", etc.
	// When a resource matching this is found by the selector, a custom label will be added if it doesn't already exist,
	// or updated if it does.
	//
	// +kubebuilder:validation:Required
	GVK string `json:"gvk"`

	// A label query used to filter a set of resources.
	//
	// +optional
	Selector map[string]string `json:"selector,omitempty"`
}

GVKResource is deprecated since v0.8.

func (*GVKResource) DeepCopy added in v0.6.0

func (in *GVKResource) DeepCopy() *GVKResource

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

func (*GVKResource) DeepCopyInto added in v0.6.0

func (in *GVKResource) DeepCopyInto(out *GVKResource)

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

type HScaleDataClonePolicyType

type HScaleDataClonePolicyType string

HScaleDataClonePolicyType defines the data clone policy to be used during horizontal scaling. This policy determines how data is handled when new nodes are added to the cluster. The policy can be set to `None`, `CloneVolume`, or `Snapshot`.

+enum +kubebuilder:validation:Enum={None,CloneVolume,Snapshot}

const (
	// HScaleDataClonePolicyNone indicates that no data cloning will occur during horizontal scaling.
	HScaleDataClonePolicyNone HScaleDataClonePolicyType = "None"

	// HScaleDataClonePolicyCloneVolume indicates that data will be cloned from existing volumes during horizontal scaling.
	HScaleDataClonePolicyCloneVolume HScaleDataClonePolicyType = "CloneVolume"

	// HScaleDataClonePolicyFromSnapshot indicates that data will be cloned from a snapshot during horizontal scaling.
	HScaleDataClonePolicyFromSnapshot HScaleDataClonePolicyType = "Snapshot"
)

type HTTPAction added in v0.8.0

type HTTPAction struct {
	// Specifies the endpoint to be requested on the HTTP server.
	//
	// +optional
	Path string `json:"path,omitempty"`

	// Specifies the target port for the HTTP request.
	// It can be specified either as a numeric value in the range of 1 to 65535,
	// or as a named port that meets the IANA_SVC_NAME specification.
	Port intstr.IntOrString `json:"port"`

	// Indicates the server's domain name or IP address. Defaults to the Pod's IP.
	// Prefer setting the "Host" header in httpHeaders when needed.
	//
	// +optional
	Host string `json:"host,omitempty"`

	// Designates the protocol used to make the request, such as HTTP or HTTPS.
	// If not specified, HTTP is used by default.
	//
	// +optional
	Scheme corev1.URIScheme `json:"scheme,omitempty"`

	// Represents the type of HTTP request to be made, such as "GET," "POST," "PUT," etc.
	// If not specified, "GET" is the default method.
	//
	// +optional
	Method string `json:"method,omitempty"`

	// Allows for the inclusion of custom headers in the request.
	// HTTP permits the use of repeated headers.
	//
	// +optional
	HTTPHeaders []corev1.HTTPHeader `json:"httpHeaders,omitempty"`
}

HTTPAction describes an Action that triggers HTTP requests. HTTPAction is to be implemented in future version.

func (*HTTPAction) DeepCopy added in v0.8.0

func (in *HTTPAction) DeepCopy() *HTTPAction

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

func (*HTTPAction) DeepCopyInto added in v0.8.0

func (in *HTTPAction) DeepCopyInto(out *HTTPAction)

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

type HorizontalScalePolicy

type HorizontalScalePolicy struct {
	// Determines the data synchronization method when a component scales out.
	// The policy can be one of the following: {None, CloneVolume}. The default policy is `None`.
	//
	// - `None`: This is the default policy. It creates an empty volume without data cloning.
	// - `CloneVolume`: This policy clones data to newly scaled pods. It first tries to use a volume snapshot.
	//   If volume snapshot is not enabled, it will attempt to use a backup tool. If neither method works, it will report an error.
	// - `Snapshot`: This policy is deprecated and is an alias for CloneVolume.
	//
	// +kubebuilder:default=None
	// +optional
	Type HScaleDataClonePolicyType `json:"type,omitempty"`

	// Refers to the backup policy template.
	//
	// +optional
	BackupPolicyTemplateName string `json:"backupPolicyTemplateName,omitempty"`

	// Specifies the volumeMount of the container to backup.
	// This only works if Type is not None. If not specified, the first volumeMount will be selected.
	//
	// +optional
	VolumeMountsName string `json:"volumeMountsName,omitempty"`
}

HorizontalScalePolicy is deprecated since v0.8.

func (*HorizontalScalePolicy) DeepCopy added in v0.6.0

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

func (*HorizontalScalePolicy) DeepCopyInto added in v0.6.0

func (in *HorizontalScalePolicy) DeepCopyInto(out *HorizontalScalePolicy)

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

type HorizontalScaling

type HorizontalScaling struct {
	// Specifies the name of the Component.
	ComponentOps `json:",inline"`

	// Deprecated: since v0.9, use scaleOut and scaleIn instead.
	// Specifies the number of replicas for the component. Cannot be used with "scaleIn" and "scaleOut".
	// +kubebuilder:deprecatedversion:warning="This field has been deprecated since 0.9.0"
	// +kubebuilder:validation:Minimum=0
	// +optional
	Replicas *int32 `json:"replicas,omitempty"`

	// Specifies the replica changes for scaling out components and instance templates,
	// and brings offline instances back online. Can be used in conjunction with the "scaleIn" operation.
	// Note: Any configuration that deletes instances is considered invalid.
	//
	// +optional
	ScaleOut *ScaleOut `json:"scaleOut,omitempty"`

	// Specifies the replica changes for scaling in components and instance templates,
	// and takes specified instances offline. Can be used in conjunction with the "scaleOut" operation.
	// Note: Any configuration that creates instances is considered invalid.
	// +optional
	ScaleIn *ScaleIn `json:"scaleIn,omitempty"`
}

HorizontalScaling defines the parameters of a horizontal scaling operation.

func (*HorizontalScaling) DeepCopy added in v0.6.0

func (in *HorizontalScaling) DeepCopy() *HorizontalScaling

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

func (*HorizontalScaling) DeepCopyInto added in v0.6.0

func (in *HorizontalScaling) DeepCopyInto(out *HorizontalScaling)

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

type HostNetwork added in v0.9.0

type HostNetwork struct {
	// The list of container ports that are required by the component.
	//
	// +optional
	ContainerPorts []HostNetworkContainerPort `json:"containerPorts,omitempty"`
}

func (*HostNetwork) DeepCopy added in v0.9.0

func (in *HostNetwork) DeepCopy() *HostNetwork

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

func (*HostNetwork) DeepCopyInto added in v0.9.0

func (in *HostNetwork) DeepCopyInto(out *HostNetwork)

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

type HostNetworkContainerPort added in v0.9.0

type HostNetworkContainerPort struct {
	// Container specifies the target container within the Pod.
	//
	// +required
	Container string `json:"container"`

	// Ports are named container ports within the specified container.
	// These container ports must be defined in the container for proper port allocation.
	//
	// +kubebuilder:validation:MinItems=1
	// +required
	Ports []string `json:"ports"`
}

func (*HostNetworkContainerPort) DeepCopy added in v0.9.0

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

func (*HostNetworkContainerPort) DeepCopyInto added in v0.9.0

func (in *HostNetworkContainerPort) DeepCopyInto(out *HostNetworkContainerPort)

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

type HostNetworkVarSelector added in v0.9.0

type HostNetworkVarSelector struct {
	// The component to select from.
	ClusterObjectReference `json:",inline"`

	HostNetworkVars `json:",inline"`
}

HostNetworkVarSelector selects a var from host-network resources.

func (*HostNetworkVarSelector) DeepCopy added in v0.9.0

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

func (*HostNetworkVarSelector) DeepCopyInto added in v0.9.0

func (in *HostNetworkVarSelector) DeepCopyInto(out *HostNetworkVarSelector)

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

type HostNetworkVars added in v0.9.0

type HostNetworkVars struct {
	// +optional
	Container *ContainerVars `json:"container,omitempty"`
}

HostNetworkVars defines the vars that can be referenced from host-network resources.

func (*HostNetworkVars) DeepCopy added in v0.9.0

func (in *HostNetworkVars) DeepCopy() *HostNetworkVars

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

func (*HostNetworkVars) DeepCopyInto added in v0.9.0

func (in *HostNetworkVars) DeepCopyInto(out *HostNetworkVars)

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

type Instance added in v0.8.3

type Instance struct {
	// Pod name of the instance.
	// +kubebuilder:validation:Required
	Name string `json:"name"`

	// The instance will rebuild on the specified node when the instance uses local PersistentVolume as the storage disk.
	// If not set, it will rebuild on a random node.
	// +optional
	TargetNodeName string `json:"targetNodeName,omitempty"`
}

func (*Instance) DeepCopy added in v0.8.3

func (in *Instance) DeepCopy() *Instance

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

func (*Instance) DeepCopyInto added in v0.8.3

func (in *Instance) DeepCopyInto(out *Instance)

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

type InstanceReplicasTemplate added in v0.9.0

type InstanceReplicasTemplate struct {
	// Specifies the name of the instance template.
	// +kubebuilder:validation:Required
	Name string `json:"name"`

	// Specifies the replica changes for the instance template.
	// +kubebuilder:validation:Minimum=0
	// +kubebuilder:validation:Required
	ReplicaChanges int32 `json:"replicaChanges"`
}

InstanceReplicasTemplate defines the template for instance replicas.

func (*InstanceReplicasTemplate) DeepCopy added in v0.9.0

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

func (*InstanceReplicasTemplate) DeepCopyInto added in v0.9.0

func (in *InstanceReplicasTemplate) DeepCopyInto(out *InstanceReplicasTemplate)

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

type InstanceResourceTemplate added in v0.9.0

type InstanceResourceTemplate struct {
	// Refer to the instance template name of the component or sharding.
	// +kubebuilder:validation:Required
	Name string `json:"name"`

	// Defines the computational resource size for vertical scaling.
	// +kubebuilder:pruning:PreserveUnknownFields
	corev1.ResourceRequirements `json:",inline"`
}

func (*InstanceResourceTemplate) DeepCopy added in v0.9.0

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

func (*InstanceResourceTemplate) DeepCopyInto added in v0.9.0

func (in *InstanceResourceTemplate) DeepCopyInto(out *InstanceResourceTemplate)

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

type InstanceTemplate added in v0.9.0

type InstanceTemplate struct {
	// Name specifies the unique name of the instance Pod created using this InstanceTemplate.
	// This name is constructed by concatenating the Component's name, the template's name, and the instance's ordinal
	// using the pattern: $(cluster.name)-$(component.name)-$(template.name)-$(ordinal). Ordinals start from 0.
	// The specified name overrides any default naming conventions or patterns.
	//
	// +kubebuilder:validation:MaxLength=54
	// +kubebuilder:validation:Pattern:=`^[a-z0-9]([a-z0-9\.\-]*[a-z0-9])?$`
	// +kubebuilder:validation:Required
	Name string `json:"name"`

	// Specifies the number of instances (Pods) to create from this InstanceTemplate.
	// This field allows setting how many replicated instances of the Component,
	// with the specific overrides in the InstanceTemplate, are created.
	// The default value is 1. A value of 0 disables instance creation.
	//
	// +kubebuilder:default=1
	// +kubebuilder:validation:Minimum=0
	// +optional
	Replicas *int32 `json:"replicas,omitempty"`

	// Specifies a map of key-value pairs to be merged into the Pod's existing annotations.
	// Existing keys will have their values overwritten, while new keys will be added to the annotations.
	//
	// +optional
	Annotations map[string]string `json:"annotations,omitempty"`

	// Specifies a map of key-value pairs that will be merged into the Pod's existing labels.
	// Values for existing keys will be overwritten, and new keys will be added.
	//
	// +optional
	Labels map[string]string `json:"labels,omitempty"`

	// Specifies an override for the first container's image in the Pod.
	//
	// +optional
	Image *string `json:"image,omitempty"`

	// Specifies the name of the node where the Pod should be scheduled.
	// If set, the Pod will be directly assigned to the specified node, bypassing the Kubernetes scheduler.
	// This is useful for controlling Pod placement on specific nodes.
	//
	// Important considerations:
	// - `nodeName` bypasses default scheduling constraints (e.g., resource requirements, node selectors, affinity rules).
	// - It is the user's responsibility to ensure the node is suitable for the Pod.
	// - If the node is unavailable, the Pod will remain in "Pending" state until the node is available or the Pod is deleted.
	//
	// +optional
	NodeName *string `json:"nodeName,omitempty"`

	// Defines NodeSelector to override.
	// +optional
	NodeSelector map[string]string `json:"nodeSelector,omitempty"`

	// Tolerations specifies a list of tolerations to be applied to the Pod, allowing it to tolerate node taints.
	// This field can be used to add new tolerations or override existing ones.
	//
	// +optional
	Tolerations []corev1.Toleration `json:"tolerations,omitempty"`

	// Specifies an override for the resource requirements of the first container in the Pod.
	// This field allows for customizing resource allocation (CPU, memory, etc.) for the container.
	//
	// +optional
	Resources *corev1.ResourceRequirements `json:"resources,omitempty"`

	// Defines Env to override.
	// Add new or override existing envs.
	// +optional
	Env []corev1.EnvVar `json:"env,omitempty"`

	// Defines Volumes to override.
	// Add new or override existing volumes.
	// +optional
	Volumes []corev1.Volume `json:"volumes,omitempty"`

	// Defines VolumeMounts to override.
	// Add new or override existing volume mounts of the first container in the Pod.
	// +optional
	VolumeMounts []corev1.VolumeMount `json:"volumeMounts,omitempty"`

	// Defines VolumeClaimTemplates to override.
	// Add new or override existing volume claim templates.
	// +optional
	VolumeClaimTemplates []ClusterComponentVolumeClaimTemplate `json:"volumeClaimTemplates,omitempty"`
}

InstanceTemplate allows customization of individual replica configurations in a Component.

func (*InstanceTemplate) DeepCopy added in v0.9.0

func (in *InstanceTemplate) DeepCopy() *InstanceTemplate

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

func (*InstanceTemplate) DeepCopyInto added in v0.9.0

func (in *InstanceTemplate) DeepCopyInto(out *InstanceTemplate)

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

func (*InstanceTemplate) GetName added in v0.9.0

func (t *InstanceTemplate) GetName() string

func (*InstanceTemplate) GetReplicas added in v0.9.0

func (t *InstanceTemplate) GetReplicas() int32

type InstanceVolumeClaimTemplate added in v0.9.0

type InstanceVolumeClaimTemplate struct {
	// Refer to the instance template name of the component or sharding.
	// +kubebuilder:validation:Required
	Name string `json:"name"`

	// volumeClaimTemplates specifies the storage size and volumeClaimTemplate name.
	// +kubebuilder:validation:Required
	// +patchMergeKey=name
	// +patchStrategy=merge,retainKeys
	// +listType=map
	// +listMapKey=name
	VolumeClaimTemplates []OpsRequestVolumeClaimTemplate `json:"volumeClaimTemplates" patchStrategy:"merge,retainKeys" patchMergeKey:"name"`
}

func (*InstanceVolumeClaimTemplate) DeepCopy added in v0.9.0

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

func (*InstanceVolumeClaimTemplate) DeepCopyInto added in v0.9.0

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

type Issuer

type Issuer struct {
	// The issuer for TLS certificates.
	// It only allows two enum values: `KubeBlocks` and `UserProvided`.
	//
	// - `KubeBlocks` indicates that the self-signed TLS certificates generated by the KubeBlocks Operator will be used.
	// - `UserProvided` means that the user is responsible for providing their own CA, Cert, and Key.
	//   In this case, the user-provided CA certificate, server certificate, and private key will be used
	//   for TLS communication.
	//
	// +kubebuilder:validation:Enum={KubeBlocks, UserProvided}
	// +kubebuilder:default=KubeBlocks
	// +kubebuilder:validation:Required
	Name IssuerName `json:"name"`

	// SecretRef is the reference to the secret that contains user-provided certificates.
	// It is required when the issuer is set to `UserProvided`.
	//
	// +optional
	SecretRef *TLSSecretRef `json:"secretRef,omitempty"`
}

Issuer defines the TLS certificates issuer for the Cluster.

func (*Issuer) DeepCopy added in v0.6.0

func (in *Issuer) DeepCopy() *Issuer

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

func (*Issuer) DeepCopyInto added in v0.6.0

func (in *Issuer) DeepCopyInto(out *Issuer)

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

type IssuerName

type IssuerName string

IssuerName defines the name of the TLS certificates issuer. +enum +kubebuilder:validation:Enum={KubeBlocks,UserProvided}

const (
	// IssuerKubeBlocks represents certificates that are signed by the KubeBlocks Operator.
	IssuerKubeBlocks IssuerName = "KubeBlocks"

	// IssuerUserProvided indicates that the user has provided their own CA-signed certificates.
	IssuerUserProvided IssuerName = "UserProvided"
)

type JSONPatchOperation added in v0.9.0

type JSONPatchOperation struct {
	// Specifies the type of JSON patch operation. It supports the following values: 'add', 'remove', 'replace'.
	// +enum
	// +kubebuilder:validation:Enum={add,remove,replace}
	// +kubebuilder:validation:Required
	Operation string `json:"op"`

	// Specifies the json patch path.
	// +kubebuilder:validation:Required
	Path string `json:"path"`

	// Specifies the value to be used in the JSON patch operation.
	// +kubebuilder:validation:Required
	Value string `json:"value"`
}

func (*JSONPatchOperation) DeepCopy added in v0.9.0

func (in *JSONPatchOperation) DeepCopy() *JSONPatchOperation

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

func (*JSONPatchOperation) DeepCopyInto added in v0.9.0

func (in *JSONPatchOperation) DeepCopyInto(out *JSONPatchOperation)

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

type KBAccountType

type KBAccountType uint8

KBAccountType is used for bitwise operation.

type LastComponentConfiguration

type LastComponentConfiguration struct {
	// Records the `replicas` of the Component prior to any changes.
	// +optional
	Replicas *int32 `json:"replicas,omitempty"`

	// Records the resources of the Component prior to any changes.
	// +kubebuilder:pruning:PreserveUnknownFields
	// +optional
	corev1.ResourceRequirements `json:",inline,omitempty"`

	// Records the class of the Component prior to any changes.
	// Deprecated since v0.9.
	// +kubebuilder:deprecatedversion:warning="Due to the lack of practical use cases, this field is deprecated from KB 0.9.0."
	// +optional
	ClassDefRef *ClassDefRef `json:"classDefRef,omitempty"`

	// Records volumes' storage size of the Component prior to any changes.
	// +optional
	VolumeClaimTemplates []OpsRequestVolumeClaimTemplate `json:"volumeClaimTemplates,omitempty"`

	// Records the ClusterComponentService list of the Component prior to any changes.
	// +optional
	Services []ClusterComponentService `json:"services,omitempty"`

	// Records the information about various types of resources associated with the Component prior to any changes.
	// Currently, only one type of resource is supported: "pods".
	// The "pods" key maps to a list of names of all Pods of the Component.
	// +optional
	TargetResources map[ComponentResourceKey][]string `json:"targetResources,omitempty"`

	// Records the InstanceTemplate list of the Component prior to any changes.
	// +optional
	Instances []InstanceTemplate `json:"instances,omitempty"`

	// Records the offline instances of the Component prior to any changes.
	// +optional
	OfflineInstances []string `json:"offlineInstances,omitempty"`

	// Records the version of the Service expected to be provisioned by this Component prior to any changes.
	// +optional
	ServiceVersion string `json:"serviceVersion,omitempty"`

	// Records the name of the ComponentDefinition prior to any changes.
	// +optional
	ComponentDefinitionName string `json:"componentDefinitionName,omitempty"`
}

LastComponentConfiguration can be used to track and compare the desired state of the Component over time.

func (*LastComponentConfiguration) DeepCopy added in v0.6.0

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

func (*LastComponentConfiguration) DeepCopyInto added in v0.6.0

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

type LastConfiguration

type LastConfiguration struct {
	// Specifies the name of the ClusterVersion.
	// Deprecated and should be removed in the future version.
	// +optional
	ClusterVersionRef string `json:"clusterVersionRef,omitempty"`

	// Records the configuration of each Component prior to any changes.
	// +optional
	Components map[string]LastComponentConfiguration `json:"components,omitempty"`
}

func (*LastConfiguration) DeepCopy added in v0.6.0

func (in *LastConfiguration) DeepCopy() *LastConfiguration

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

func (*LastConfiguration) DeepCopyInto added in v0.6.0

func (in *LastConfiguration) DeepCopyInto(out *LastConfiguration)

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

type LegacyRenderedTemplateSpec added in v0.7.0

type LegacyRenderedTemplateSpec struct {
	// Extends the configuration template.
	ConfigTemplateExtension `json:",inline"`
}

LegacyRenderedTemplateSpec describes the configuration extension for the lazy rendered template. Deprecated: LegacyRenderedTemplateSpec has been deprecated since 0.9.0 and will be removed in 0.10.0

func (*LegacyRenderedTemplateSpec) DeepCopy added in v0.7.0

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

func (*LegacyRenderedTemplateSpec) DeepCopyInto added in v0.7.0

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

type LetterCase

type LetterCase string

LetterCase defines the available cases to be used in password generation.

+enum +kubebuilder:validation:Enum={LowerCases,UpperCases,MixedCases}

const (
	// LowerCases represents the use of lower case letters only.
	LowerCases LetterCase = "LowerCases"

	// UpperCases represents the use of upper case letters only.
	UpperCases LetterCase = "UpperCases"

	// MixedCases represents the use of a mix of both lower and upper case letters.
	MixedCases LetterCase = "MixedCases"
)

type LifecycleActionHandler added in v0.8.0

type LifecycleActionHandler struct {
	// Specifies the name of the predefined action handler to be invoked for lifecycle actions.
	//
	// Lorry, as a sidecar agent co-located with the database container in the same Pod,
	// includes a suite of built-in action implementations that are tailored to different database engines.
	// These are known as "builtin" handlers, includes: `mysql`, `redis`, `mongodb`, `etcd`,
	// `postgresql`, `official-postgresql`, `apecloud-postgresql`, `wesql`, `oceanbase`, `polardbx`.
	//
	// If the `builtinHandler` field is specified, it instructs Lorry to utilize its internal built-in action handler
	// to execute the specified lifecycle actions.
	//
	// The `builtinHandler` field is of type `BuiltinActionHandlerType`,
	// which represents the name of the built-in handler.
	// The `builtinHandler` specified within the same `ComponentLifecycleActions` should be consistent across all
	// actions.
	// This means that if you specify a built-in handler for one action, you should use the same handler
	// for all other actions throughout the entire `ComponentLifecycleActions` collection.
	//
	// If you need to define lifecycle actions for database engines not covered by the existing built-in support,
	// or when the pre-existing built-in handlers do not meet your specific needs,
	// you can use the `customHandler` field to define your own action implementation.
	//
	// Deprecation Notice:
	//
	// - In the future, the `builtinHandler` field will be deprecated in favor of using the `customHandler` field
	//   for configuring all lifecycle actions.
	// - Instead of using a name to indicate the built-in action implementations in Lorry,
	//   the recommended approach will be to explicitly invoke the desired action implementation through
	//   a gRPC interface exposed by the sidecar agent.
	// - Developers will have the flexibility to either use the built-in action implementations provided by Lorry
	//   or develop their own sidecar agent to implement custom actions and expose them via gRPC interfaces.
	// - This change will allow for greater customization and extensibility of lifecycle actions,
	//   as developers can create their own "builtin" implementations tailored to their specific requirements.
	//
	// +optional
	BuiltinHandler *BuiltinActionHandlerType `json:"builtinHandler,omitempty"`

	// Specifies a user-defined hook or procedure that is called to perform the specific lifecycle action.
	// It offers a flexible and expandable approach for customizing the behavior of a Component by leveraging
	// tailored actions.
	//
	// An Action can be implemented as either an ExecAction or an HTTPAction, with future versions planning
	// to support GRPCAction,
	// thereby accommodating unique logic for different database systems within the Action's framework.
	//
	// In future iterations, all built-in handlers are expected to transition to GRPCAction.
	// This change means that Lorry or other sidecar agents will expose the implementation of actions
	// through a GRPC interface for external invocation.
	// Then the controller will interact with these actions via GRPCAction calls.
	//
	// +optional
	CustomHandler *Action `json:"customHandler,omitempty"`
}

LifecycleActionHandler describes the implementation of a specific lifecycle action.

Each action is deemed successful if it returns an exit code of 0 for command executions, or an HTTP 200 status for HTTP(s) actions. Any other exit code or HTTP status is considered an indication of failure.

func (*LifecycleActionHandler) DeepCopy added in v0.8.0

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

func (*LifecycleActionHandler) DeepCopyInto added in v0.8.0

func (in *LifecycleActionHandler) DeepCopyInto(out *LifecycleActionHandler)

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

type LogConfig

type LogConfig struct {
	// Specifies a descriptive label for the log type, such as 'slow' for a MySQL slow log file.
	// It provides a clear identification of the log's purpose and content.
	//
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MaxLength=128
	Name string `json:"name"`

	// Specifies the paths or patterns identifying where the log files are stored.
	// This field allows the system to locate and manage log files effectively.
	//
	// Examples:
	//
	// - /home/postgres/pgdata/pgroot/data/log/postgresql-*
	// - /data/mysql/log/mysqld-error.log
	//
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MaxLength=4096
	FilePathPattern string `json:"filePathPattern"`
}

func (*LogConfig) DeepCopy added in v0.6.0

func (in *LogConfig) DeepCopy() *LogConfig

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

func (*LogConfig) DeepCopyInto added in v0.6.0

func (in *LogConfig) DeepCopyInto(out *LogConfig)

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

type MatchExpressions added in v0.9.0

type MatchExpressions struct {
	// Specifies a failure condition for an action using a Go template expression.
	// Should evaluate to either `true` or `false`.
	// The current resource object is parsed into the Go template.
	// for example, you can use '{{ eq .spec.replicas 1 }}'.
	// +optional
	Failure string `json:"failure,omitempty"`

	// Specifies a success condition for an action using a Go template expression.
	// Should evaluate to either `true` or `false`.
	// The current resource object is parsed into the Go template.
	// for example, using '{{ eq .spec.replicas 1 }}'
	// +kubebuilder:validation:Required
	Success string `json:"success"`
}

func (*MatchExpressions) DeepCopy added in v0.9.0

func (in *MatchExpressions) DeepCopy() *MatchExpressions

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

func (*MatchExpressions) DeepCopyInto added in v0.9.0

func (in *MatchExpressions) DeepCopyInto(out *MatchExpressions)

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

type MemoryConstraint

type MemoryConstraint struct {
	// The size of memory per vcpu core.
	// For example: 1Gi, 200Mi.
	// If SizePerCPU is specified, MinPerCPU and MaxPerCPU are ignore.
	// +optional
	SizePerCPU *resource.Quantity `json:"sizePerCPU,omitempty"`

	// The maximum size of memory per vcpu core, [MinPerCPU, MaxPerCPU] defines a range for valid memory size per vcpu core.
	// It is useful on GCP as the ratio between the CPU and memory may be a range.
	// If SizePerCPU is specified, MinPerCPU and MaxPerCPU are ignored.
	// Reference: https://cloud.google.com/compute/docs/general-purpose-machines#custom_machine_types
	// +optional
	MaxPerCPU *resource.Quantity `json:"maxPerCPU,omitempty"`

	// The minimum size of memory per vcpu core, [MinPerCPU, MaxPerCPU] defines a range for valid memory size per vcpu core.
	// It is useful on GCP as the ratio between the CPU and memory may be a range.
	// If SizePerCPU is specified, MinPerCPU and MaxPerCPU are ignored.
	// Reference: https://cloud.google.com/compute/docs/general-purpose-machines#custom_machine_types
	// +optional
	MinPerCPU *resource.Quantity `json:"minPerCPU,omitempty"`
}

func (*MemoryConstraint) DeepCopy added in v0.6.0

func (in *MemoryConstraint) DeepCopy() *MemoryConstraint

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

func (*MemoryConstraint) DeepCopyInto added in v0.6.0

func (in *MemoryConstraint) DeepCopyInto(out *MemoryConstraint)

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

type MergedPolicy added in v0.6.0

type MergedPolicy string

MergedPolicy defines how to merge external imported templates into component templates. +enum +kubebuilder:validation:Enum={patch,replace,none}

const (
	PatchPolicy     MergedPolicy = "patch"
	ReplacePolicy   MergedPolicy = "replace"
	OnlyAddPolicy   MergedPolicy = "add"
	NoneMergePolicy MergedPolicy = "none"
)

type MonitorConfig

type MonitorConfig struct {
	// builtIn is a switch to enable KubeBlocks builtIn monitoring.
	// If BuiltIn is set to true, monitor metrics will be scraped automatically.
	// If BuiltIn is set to false, the provider should set ExporterConfig and Sidecar container own.
	// +kubebuilder:default=false
	// +optional
	BuiltIn bool `json:"builtIn,omitempty"`

	// exporterConfig provided by provider, which specify necessary information to Time Series Database.
	// exporterConfig is valid when builtIn is false.
	// +optional
	Exporter *ExporterConfig `json:"exporterConfig,omitempty"`
}

func (*MonitorConfig) DeepCopy added in v0.6.0

func (in *MonitorConfig) DeepCopy() *MonitorConfig

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

func (*MonitorConfig) DeepCopyInto added in v0.6.0

func (in *MonitorConfig) DeepCopyInto(out *MonitorConfig)

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

type MultipleClusterObjectCombinedOption added in v0.8.3

type MultipleClusterObjectCombinedOption struct {
	// If set, the existing variable will be kept, and a new variable will be defined with the specified suffix
	// in pattern: $(var.name)_$(suffix).
	// The new variable will be auto-created and placed behind the existing one.
	// If not set, the existing variable will be reused with the value format defined below.
	//
	// +optional
	NewVarSuffix *string `json:"newVarSuffix,omitempty"`

	// The format of the value that the operator will use to compose values from multiple components.
	//
	// +kubebuilder:default="Flatten"
	// +optional
	ValueFormat MultipleClusterObjectValueFormat `json:"valueFormat,omitempty"`

	// The flatten format, default is: $(comp-name-1):value,$(comp-name-2):value.
	//
	// +optional
	FlattenFormat *MultipleClusterObjectValueFormatFlatten `json:"flattenFormat,omitempty"`
}

MultipleClusterObjectCombinedOption defines options for handling combined variables.

func (*MultipleClusterObjectCombinedOption) DeepCopy added in v0.8.3

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

func (*MultipleClusterObjectCombinedOption) DeepCopyInto added in v0.8.3

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

type MultipleClusterObjectOption added in v0.8.3

type MultipleClusterObjectOption struct {
	// Define the strategy for handling multiple cluster objects.
	//
	// +kubebuilder:validation:Required
	Strategy MultipleClusterObjectStrategy `json:"strategy"`

	// Define the options for handling combined variables.
	// Valid only when the strategy is set to "combined".
	//
	// +optional
	CombinedOption *MultipleClusterObjectCombinedOption `json:"combinedOption,omitempty"`
}

MultipleClusterObjectOption defines the options for handling multiple cluster objects matched.

func (*MultipleClusterObjectOption) DeepCopy added in v0.8.3

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

func (*MultipleClusterObjectOption) DeepCopyInto added in v0.8.3

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

type MultipleClusterObjectStrategy added in v0.8.3

type MultipleClusterObjectStrategy string

MultipleClusterObjectStrategy defines the strategy for handling multiple cluster objects. +enum +kubebuilder:validation:Enum={individual,combined}

const (
	// MultipleClusterObjectStrategyIndividual - each matched component will have its individual variable with its name
	// as the suffix.
	// This is required when referencing credential variables that cannot be passed by values.
	MultipleClusterObjectStrategyIndividual MultipleClusterObjectStrategy = "individual"

	// MultipleClusterObjectStrategyCombined - the values from all matched components will be combined into a single
	// variable using the specified option.
	MultipleClusterObjectStrategyCombined MultipleClusterObjectStrategy = "combined"
)

type MultipleClusterObjectValueFormat added in v0.8.3

type MultipleClusterObjectValueFormat string

MultipleClusterObjectValueFormat defines the format details for the value.

const (
	FlattenFormat MultipleClusterObjectValueFormat = "Flatten"
)

type MultipleClusterObjectValueFormatFlatten added in v0.8.3

type MultipleClusterObjectValueFormatFlatten struct {
	// Pair delimiter.
	//
	// +kubebuilder:default=","
	// +kubebuilder:validation:Required
	Delimiter string `json:"delimiter"`

	// Key-value delimiter.
	//
	// +kubebuilder:default=":"
	// +kubebuilder:validation:Required
	KeyValueDelimiter string `json:"keyValueDelimiter"`
}

MultipleClusterObjectValueFormatFlatten defines the flatten format for the value.

func (*MultipleClusterObjectValueFormatFlatten) DeepCopy added in v0.8.3

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

func (*MultipleClusterObjectValueFormatFlatten) DeepCopyInto added in v0.8.3

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

type NamedVar added in v0.8.0

type NamedVar struct {
	// +optional
	Name string `json:"name,omitempty"`

	// +optional
	Option *VarOption `json:"option,omitempty"`
}

func (*NamedVar) DeepCopy added in v0.8.0

func (in *NamedVar) DeepCopy() *NamedVar

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

func (*NamedVar) DeepCopyInto added in v0.8.0

func (in *NamedVar) DeepCopyInto(out *NamedVar)

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

type OpsAction added in v0.9.0

type OpsAction struct {
	// Specifies the name of the OpsAction.
	// +kubebuilder:validation:MaxLength=20
	// +kubebuilder:validation:Required
	Name string `json:"name"`

	// Specifies the failure policy of the OpsAction.
	// Valid values are:
	//
	// - "Fail": Marks the entire OpsRequest as failed if the action fails.
	// - "Ignore": The OpsRequest continues processing despite the failure of the action.
	// +kubebuilder:validation:Enum={Ignore,Fail}
	// +kubebuilder:default=Fail
	// +optional
	FailurePolicy FailurePolicyType `json:"failurePolicy"`

	// Specifies the parameters for the OpsAction. Their usage varies based on the action type:
	//
	// - For 'workload' or 'exec' actions, parameters are injected as environment variables.
	// - For 'resourceModifier' actions, parameter can be referenced using $() in fields
	// `resourceModifier.completionProbe.matchExpressions` and `resourceModifier.jsonPatches[*].value`.
	//
	// +optional
	Parameters []string `json:"parameters,omitempty"`

	// Specifies the configuration for a 'workload' action.
	// This action leads to the creation of a K8s workload, such as a Pod or Job, to execute specified tasks.
	//
	// +optional
	Workload *OpsWorkloadAction `json:"workload,omitempty"`

	// Specifies the configuration for a 'exec' action.
	// It creates a Pod and invokes a 'kubectl exec' to run command inside a specified container with the target Pod.
	// +optional
	Exec *OpsExecAction `json:"exec,omitempty"`

	// Specifies the configuration for a 'resourceModifier' action.
	// This action allows for modifications to existing K8s objects.
	//
	// Note: This feature has not been implemented yet.
	//
	// +optional
	ResourceModifier *OpsResourceModifierAction `json:"resourceModifier,omitempty"`
}

OpsAction specifies a custom action defined in OpsDefinition for execution in a "Custom" OpsRequest.

OpsAction can be of three types:

  • workload: Creates a Job or Pod to run custom scripts, ideal for isolated or long-running tasks.
  • exec: Executes commands directly within an existing container using the kubectl exec interface, suitable for immediate, short-lived operations.
  • resourceModifier: Modifies a K8s object using JSON patches, useful for updating the spec of some resource.

+kubebuilder:validation:XValidation:rule="has(self.workload) || has(self.exec) || has(self.resourceModifier)", message="at least one action exists for workload, exec and resourceModifier."

func (*OpsAction) DeepCopy added in v0.9.0

func (in *OpsAction) DeepCopy() *OpsAction

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

func (*OpsAction) DeepCopyInto added in v0.9.0

func (in *OpsAction) DeepCopyInto(out *OpsAction)

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

type OpsDefinition added in v0.8.0

type OpsDefinition struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   OpsDefinitionSpec   `json:"spec,omitempty"`
	Status OpsDefinitionStatus `json:"status,omitempty"`
}

OpsDefinition is the Schema for the OpsDefinitions API.

func (*OpsDefinition) DeepCopy added in v0.8.0

func (in *OpsDefinition) DeepCopy() *OpsDefinition

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

func (*OpsDefinition) DeepCopyInto added in v0.8.0

func (in *OpsDefinition) DeepCopyInto(out *OpsDefinition)

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

func (*OpsDefinition) DeepCopyObject added in v0.8.0

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

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

func (*OpsDefinition) GetComponentInfo added in v0.9.0

func (o *OpsDefinition) GetComponentInfo(compDefName string) *ComponentInfo

type OpsDefinitionList added in v0.8.0

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

OpsDefinitionList contains a list of OpsDefinition.

func (*OpsDefinitionList) DeepCopy added in v0.8.0

func (in *OpsDefinitionList) DeepCopy() *OpsDefinitionList

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

func (*OpsDefinitionList) DeepCopyInto added in v0.8.0

func (in *OpsDefinitionList) DeepCopyInto(out *OpsDefinitionList)

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

func (*OpsDefinitionList) DeepCopyObject added in v0.8.0

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

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

type OpsDefinitionSpec added in v0.8.0

type OpsDefinitionSpec struct {
	// Specifies the preconditions that must be met to run the actions for the operation.
	// if set, it will check the condition before the Component runs this operation.
	// Example:
	// “`yaml
	//  preConditions:
	//  - rule:
	//      expression: '{{ eq .component.status.phase "Running" }}'
	//      message: Component is not in Running status.
	// “`
	// +optional
	PreConditions []PreCondition `json:"preConditions,omitempty"`

	// Specifies a list of PodInfoExtractor, each designed to select a specific Pod and extract selected runtime info
	// from its PodSpec.
	// The extracted information, such as environment variables, volumes and tolerations, are then injected into
	// Jobs or Pods that execute the OpsActions defined in `actions`.
	//
	// +patchMergeKey=name
	// +patchStrategy=merge,retainKeys
	// +listType=map
	// +listMapKey=name
	// +optional
	PodInfoExtractors []PodInfoExtractor `json:"podInfoExtractors,omitempty" patchStrategy:"merge,retainKeys" patchMergeKey:"name"`

	// Specifies a list of ComponentDefinition for Components associated with this OpsDefinition.
	// It also includes connection credentials (address and account) for each Component.
	//
	// +patchMergeKey=componentDefinitionName
	// +patchStrategy=merge,retainKeys
	// +listType=map
	// +listMapKey=componentDefinitionName
	// +optional
	ComponentInfos []ComponentInfo `json:"componentInfos,omitempty" patchStrategy:"merge,retainKeys" patchMergeKey:"componentDefinitionName"`

	// Specifies the schema for validating the data types and value ranges of parameters in OpsActions before their usage.
	//
	// +optional
	ParametersSchema *ParametersSchema `json:"parametersSchema,omitempty"`

	// Specifies a list of OpsAction where each customized action is executed sequentially.
	//
	// +kubebuilder:validation:MinItems=1
	// +patchMergeKey=name
	// +patchStrategy=merge,retainKeys
	// +listType=map
	// +listMapKey=name
	// +kubebuilder:validation:Required
	Actions []OpsAction `json:"actions" patchStrategy:"merge,retainKeys" patchMergeKey:"name"`
}

OpsDefinitionSpec defines the desired state of OpsDefinition.

func (*OpsDefinitionSpec) DeepCopy added in v0.8.0

func (in *OpsDefinitionSpec) DeepCopy() *OpsDefinitionSpec

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

func (*OpsDefinitionSpec) DeepCopyInto added in v0.8.0

func (in *OpsDefinitionSpec) DeepCopyInto(out *OpsDefinitionSpec)

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

type OpsDefinitionStatus added in v0.8.0

type OpsDefinitionStatus struct {
	// Represents the most recent generation observed of this OpsDefinition.
	// +optional
	ObservedGeneration int64 `json:"observedGeneration,omitempty"`

	// Represents the current state of the OpsDefinition.
	// Valid values are "", "Available", "Unavailable".
	// When it equals to "Available", the OpsDefinition is ready and can be used in a "Custom" OpsRequest.
	// +optional
	Phase Phase `json:"phase,omitempty"`

	// Provides additional information about the current phase.
	// +optional
	Message string `json:"message,omitempty"`
}

OpsDefinitionStatus defines the observed state of OpsDefinition

func (*OpsDefinitionStatus) DeepCopy added in v0.8.0

func (in *OpsDefinitionStatus) DeepCopy() *OpsDefinitionStatus

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

func (*OpsDefinitionStatus) DeepCopyInto added in v0.8.0

func (in *OpsDefinitionStatus) DeepCopyInto(out *OpsDefinitionStatus)

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

type OpsEnvVar added in v0.8.0

type OpsEnvVar struct {
	// Specifies the name of the environment variable to be injected into Pods executing OpsActions.
	// It must conform to the C_IDENTIFIER format, which includes only alphanumeric characters and underscores, and cannot begin with a digit.
	//
	// +kubebuilder:validation:Required
	Name string `json:"name"`

	// Specifies the source of the environment variable's value.
	//
	// +kubebuilder:validation:Required
	ValueFrom *OpsVarSource `json:"valueFrom"`
}

func (*OpsEnvVar) DeepCopy added in v0.8.0

func (in *OpsEnvVar) DeepCopy() *OpsEnvVar

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

func (*OpsEnvVar) DeepCopyInto added in v0.8.0

func (in *OpsEnvVar) DeepCopyInto(out *OpsEnvVar)

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

type OpsExecAction added in v0.9.0

type OpsExecAction struct {
	// Specifies a PodInfoExtractor defined in the `opsDefinition.spec.podInfoExtractors`.
	// +kubebuilder:validation:Required
	PodInfoExtractorName string `json:"podInfoExtractorName"`

	// Specifies the number of retries allowed before marking the action as failed.
	// +kubebuilder:validation:Minimum=0
	// +kubebuilder:default=0
	// +optional
	BackoffLimit int32 `json:"backoffLimit,omitempty"`

	// The command to be executed via 'kubectl exec --'.
	// +kubebuilder:validation:MinItems=1
	// +kubebuilder:validation:Required
	Command []string `json:"command"`

	// The name of the container in the target pod where the command should be executed.
	// This corresponds to the `-c {containerName}` option in `kubectl exec`.
	//
	// If not set, the first container is used.
	//
	// +optional
	ContainerName string `json:"containerName"`
}

func (*OpsExecAction) DeepCopy added in v0.9.0

func (in *OpsExecAction) DeepCopy() *OpsExecAction

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

func (*OpsExecAction) DeepCopyInto added in v0.9.0

func (in *OpsExecAction) DeepCopyInto(out *OpsExecAction)

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

type OpsPhase

type OpsPhase string

OpsPhase defines opsRequest phase. +enum +kubebuilder:validation:Enum={Pending,Creating,Running,Cancelling,Cancelled,Aborted,Failed,Succeed}

const (
	OpsPendingPhase    OpsPhase = "Pending"
	OpsCreatingPhase   OpsPhase = "Creating"
	OpsRunningPhase    OpsPhase = "Running"
	OpsCancellingPhase OpsPhase = "Cancelling"
	OpsSucceedPhase    OpsPhase = "Succeed"
	OpsCancelledPhase  OpsPhase = "Cancelled"
	OpsFailedPhase     OpsPhase = "Failed"
	OpsAbortedPhase    OpsPhase = "Aborted"
)

type OpsRecorder

type OpsRecorder struct {
	// name OpsRequest name
	Name string `json:"name"`
	// opsRequest type
	Type OpsType `json:"type"`
	// indicates whether the current opsRequest is in the queue
	InQueue bool `json:"inQueue,omitempty"`
	// indicates that the operation is queued for execution within its own-type scope.
	QueueBySelf bool `json:"queueBySelf,omitempty"`
}

func (*OpsRecorder) DeepCopy added in v0.6.0

func (in *OpsRecorder) DeepCopy() *OpsRecorder

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

func (*OpsRecorder) DeepCopyInto added in v0.6.0

func (in *OpsRecorder) DeepCopyInto(out *OpsRecorder)

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

type OpsRequest

type OpsRequest struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   OpsRequestSpec   `json:"spec,omitempty"`
	Status OpsRequestStatus `json:"status,omitempty"`
}

OpsRequest is the Schema for the opsrequests API

func GetRunningOpsByOpsType added in v0.6.0

func GetRunningOpsByOpsType(ctx context.Context, cli client.Client,
	clusterName, namespace, opsType string) ([]OpsRequest, error)

GetRunningOpsByOpsType gets the running opsRequests by type.

func (*OpsRequest) CountOfflineOrOnlineInstances added in v0.9.0

func (r *OpsRequest) CountOfflineOrOnlineInstances(clusterName, componentName string, hScaleInstanceNames []string) map[string]int32

CountOfflineOrOnlineInstances calculate the number of instances that need to be brought online and offline corresponding to the instance template name.

func (*OpsRequest) DeepCopy added in v0.6.0

func (in *OpsRequest) DeepCopy() *OpsRequest

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

func (*OpsRequest) DeepCopyInto added in v0.6.0

func (in *OpsRequest) DeepCopyInto(out *OpsRequest)

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

func (*OpsRequest) DeepCopyObject added in v0.6.0

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

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

func (*OpsRequest) Force added in v0.9.0

func (r *OpsRequest) Force() bool

Force checks if the current opsRequest can be forcibly executed

func (*OpsRequest) IsComplete added in v0.6.0

func (r *OpsRequest) IsComplete(phases ...OpsPhase) bool

IsComplete checks if opsRequest has been completed.

func (*OpsRequest) SetStatusCondition

func (r *OpsRequest) SetStatusCondition(condition metav1.Condition)

func (*OpsRequest) SetupWebhookWithManager

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

func (*OpsRequest) Validate

func (r *OpsRequest) Validate(ctx context.Context,
	k8sClient client.Client,
	cluster *Cluster,
	needCheckClusterPhase bool) error

Validate validates OpsRequest

func (*OpsRequest) ValidateCreate

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

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

func (*OpsRequest) ValidateDelete

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

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

func (*OpsRequest) ValidateUpdate

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

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

type OpsRequestBehaviour

type OpsRequestBehaviour struct {
	FromClusterPhases []ClusterPhase
	ToClusterPhase    ClusterPhase
}

func (*OpsRequestBehaviour) DeepCopy added in v0.6.0

func (in *OpsRequestBehaviour) DeepCopy() *OpsRequestBehaviour

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

func (*OpsRequestBehaviour) DeepCopyInto added in v0.6.0

func (in *OpsRequestBehaviour) DeepCopyInto(out *OpsRequestBehaviour)

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

type OpsRequestComponentStatus

type OpsRequestComponentStatus struct {
	// Records the current phase of the Component, mirroring `cluster.status.components[componentName].phase`.
	// Possible values include "Creating", "Running", "Updating", "Stopping", "Stopped", "Deleting", "Failed", "Abnormal".
	// +optional
	Phase ClusterComponentPhase `json:"phase,omitempty"`

	// Records the timestamp when the Component last transitioned to a "Failed" or "Abnormal" phase.
	// +optional
	LastFailedTime metav1.Time `json:"lastFailedTime,omitempty"`

	// Records the result of the preConditions check of the opsRequest, which determines subsequent steps.
	// +optional
	PreCheckResult *PreCheckResult `json:"preCheck,omitempty"`

	// Describes the progress details of objects or actions associated with the Component.
	// +optional
	ProgressDetails []ProgressStatusDetail `json:"progressDetails,omitempty"`

	// Records the workload type of Component in ClusterDefinition.
	// Deprecated and should be removed in the future version.
	// +optional
	WorkloadType WorkloadType `json:"workloadType,omitempty"`

	// Provides an explanation for the Component being in its current state.
	// +kubebuilder:validation:MaxLength=1024
	// +optional
	Reason string `json:"reason,omitempty" protobuf:"bytes,5,opt,name=reason"`

	// Provides a human-readable message indicating details about this operation.
	// +kubebuilder:validation:MaxLength=32768
	// +optional
	Message string `json:"message,omitempty" protobuf:"bytes,6,opt,name=message"`
}

func (*OpsRequestComponentStatus) DeepCopy added in v0.6.0

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

func (*OpsRequestComponentStatus) DeepCopyInto added in v0.6.0

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

type OpsRequestList

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

OpsRequestList contains a list of OpsRequest

func (*OpsRequestList) DeepCopy added in v0.6.0

func (in *OpsRequestList) DeepCopy() *OpsRequestList

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

func (*OpsRequestList) DeepCopyInto added in v0.6.0

func (in *OpsRequestList) DeepCopyInto(out *OpsRequestList)

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

func (*OpsRequestList) DeepCopyObject added in v0.6.0

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

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

type OpsRequestSpec

type OpsRequestSpec struct {
	// Specifies the name of the Cluster resource that this operation is targeting.
	//
	// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="forbidden to update spec.clusterName"
	ClusterName string `json:"clusterName,omitempty"`

	// Deprecated: since v0.9, use clusterName instead.
	// Specifies the name of the Cluster resource that this operation is targeting.
	// +kubebuilder:deprecatedversion:warning="This field has been deprecated since 0.9.0"
	// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="forbidden to update spec.clusterRef"
	ClusterRef string `json:"clusterRef,omitempty"`

	// Indicates whether the current operation should be canceled and terminated gracefully if it's in the
	// "Pending", "Creating", or "Running" state.
	//
	// This field applies only to "VerticalScaling" and "HorizontalScaling" opsRequests.
	//
	// Note: Setting `cancel` to true is irreversible; further modifications to this field are ineffective.
	//
	// +optional
	Cancel bool `json:"cancel,omitempty"`

	// Instructs the system to bypass pre-checks (including cluster state checks and customized pre-conditions hooks)
	// and immediately execute the opsRequest, except for the opsRequest of 'Start' type, which will still undergo
	// pre-checks even if `force` is true.
	//
	// This is useful for concurrent execution of 'VerticalScaling' and 'HorizontalScaling' opsRequests.
	// By setting `force` to true, you can bypass the default checks and demand these opsRequests to run
	// simultaneously.
	//
	// Note: Once set, the `force` field is immutable and cannot be updated.
	//
	// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="forbidden to update spec.force"
	// +optional
	Force bool `json:"force,omitempty"`

	// Specifies the type of this operation. Supported types include "Start", "Stop", "Restart", "Switchover",
	// "VerticalScaling", "HorizontalScaling", "VolumeExpansion", "Reconfiguring", "Upgrade", "Backup", "Restore",
	// "Expose", "DataScript", "RebuildInstance", "Custom".
	//
	// Note: This field is immutable once set.
	//
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="forbidden to update spec.type"
	Type OpsType `json:"type"`

	// Specifies the duration in seconds that an OpsRequest will remain in the system after successfully completing
	// (when `opsRequest.status.phase` is "Succeed") before automatic deletion.
	//
	// +optional
	TTLSecondsAfterSucceed int32 `json:"ttlSecondsAfterSucceed,omitempty"`

	// Specifies the maximum time in seconds that the OpsRequest will wait for its pre-conditions to be met
	// before it aborts the operation.
	// If set to 0 (default), pre-conditions must be satisfied immediately for the OpsRequest to proceed.
	//
	// +kubebuilder:default=0
	// +optional
	PreConditionDeadlineSeconds *int32 `json:"preConditionDeadlineSeconds,omitempty"`

	// Specifies the maximum duration (in seconds) that an opsRequest is allowed to run.
	// If the opsRequest runs longer than this duration, its phase will be marked as Aborted.
	// If this value is not set or set to 0, the timeout will be ignored and the opsRequest will run indefinitely.
	// +optional
	// +kubebuilder:Minimum=0
	TimeoutSeconds *int32 `json:"timeoutSeconds,omitempty"`

	// Exactly one of its members must be set.
	SpecificOpsRequest `json:",inline"`
}

OpsRequestSpec defines the desired state of OpsRequest

+kubebuilder:validation:XValidation:rule="has(self.cancel) && self.cancel ? (self.type in ['VerticalScaling', 'HorizontalScaling']) : true",message="forbidden to cancel the opsRequest which type not in ['VerticalScaling','HorizontalScaling']"

func (*OpsRequestSpec) DeepCopy added in v0.6.0

func (in *OpsRequestSpec) DeepCopy() *OpsRequestSpec

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

func (*OpsRequestSpec) DeepCopyInto added in v0.6.0

func (in *OpsRequestSpec) DeepCopyInto(out *OpsRequestSpec)

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

func (OpsRequestSpec) GetBackup added in v0.9.0

func (r OpsRequestSpec) GetBackup() *Backup

func (OpsRequestSpec) GetClusterName added in v0.9.0

func (r OpsRequestSpec) GetClusterName() string

func (OpsRequestSpec) GetRestore added in v0.9.0

func (r OpsRequestSpec) GetRestore() *Restore

func (OpsRequestSpec) ToExposeListToMap

func (r OpsRequestSpec) ToExposeListToMap() map[string]Expose

ToExposeListToMap build expose map

type OpsRequestStatus

type OpsRequestStatus struct {
	// Records the cluster generation after the OpsRequest action has been handled.
	// +optional
	ClusterGeneration int64 `json:"clusterGeneration,omitempty"`

	// Represents the phase of the OpsRequest.
	// Possible values include "Pending", "Creating", "Running", "Cancelling", "Cancelled", "Failed", "Succeed".
	Phase OpsPhase `json:"phase,omitempty"`

	// Represents the progress of the OpsRequest.
	// +kubebuilder:validation:Pattern:=`^(\d+|\-)/(\d+|\-)$`
	// +kubebuilder:default=-/-
	Progress string `json:"progress"`

	// Records the configuration prior to any changes.
	// +optional
	LastConfiguration LastConfiguration `json:"lastConfiguration,omitempty"`

	// Records the status information of Components changed due to the OpsRequest.
	// +optional
	Components map[string]OpsRequestComponentStatus `json:"components,omitempty"`

	// A collection of additional key-value pairs that provide supplementary information for the OpsRequest.
	Extras []map[string]string `json:"extras,omitempty"`

	// Records the time when the OpsRequest started processing.
	// +optional
	StartTimestamp metav1.Time `json:"startTimestamp,omitempty"`

	// Records the time when the OpsRequest was completed.
	// +optional
	CompletionTimestamp metav1.Time `json:"completionTimestamp,omitempty"`

	// Records the time when the OpsRequest was cancelled.
	// +optional
	CancelTimestamp metav1.Time `json:"cancelTimestamp,omitempty"`

	// Deprecated: Replaced by ReconfiguringStatusAsComponent.
	// Defines the status information of reconfiguring.
	// +optional
	ReconfiguringStatus *ReconfiguringStatus `json:"reconfiguringStatus,omitempty"`

	// Records the status of a reconfiguring operation if `opsRequest.spec.type` equals to "Reconfiguring".
	// +optional
	ReconfiguringStatusAsComponent map[string]*ReconfiguringStatus `json:"reconfiguringStatusAsComponent,omitempty"`

	// Describes the detailed status of the OpsRequest.
	// Possible condition types include "Cancelled", "WaitForProgressing", "Validated", "Succeed", "Failed", "Restarting",
	// "VerticalScaling", "HorizontalScaling", "VolumeExpanding", "Reconfigure", "Switchover", "Stopping", "Starting",
	// "VersionUpgrading", "Exposing", "ExecuteDataScript", "Backup", "InstancesRebuilding", "CustomOperation".
	// +optional
	// +patchMergeKey=type
	// +patchStrategy=merge
	// +listType=map
	// +listMapKey=type
	Conditions []metav1.Condition `json:"conditions,omitempty"`
}

OpsRequestStatus represents the observed state of an OpsRequest.

func (*OpsRequestStatus) DeepCopy added in v0.6.0

func (in *OpsRequestStatus) DeepCopy() *OpsRequestStatus

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

func (*OpsRequestStatus) DeepCopyInto added in v0.6.0

func (in *OpsRequestStatus) DeepCopyInto(out *OpsRequestStatus)

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

type OpsRequestVolumeClaimTemplate

type OpsRequestVolumeClaimTemplate struct {
	// Specifies the desired storage size for the volume.
	//
	// +kubebuilder:validation:Required
	Storage resource.Quantity `json:"storage"`

	// Specify the name of the volumeClaimTemplate in the Component.
	// The specified name must match one of the volumeClaimTemplates defined
	// in the `clusterComponentSpec.volumeClaimTemplates` field.
	//
	// +kubebuilder:validation:Required
	Name string `json:"name"`
}

func (*OpsRequestVolumeClaimTemplate) DeepCopy added in v0.6.0

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

func (*OpsRequestVolumeClaimTemplate) DeepCopyInto added in v0.6.0

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

type OpsResourceModifierAction added in v0.9.0

type OpsResourceModifierAction struct {
	// Specifies the K8s object that is to be updated.
	//
	// +kubebuilder:validation:Required
	Resource TypedObjectRef `json:"resource"`

	// Specifies a list of patches for modifying the object.
	//
	// +kubebuilder:validation:MinItems=1
	// +kubebuilder:validation:Required
	JSONPatches []JSONPatchOperation `json:"jsonPatches"`

	// Specifies a method to determine if the action has been completed.
	//
	// Note: This feature has not been implemented yet.
	//
	// +kubebuilder:validation:Required
	CompletionProbe CompletionProbe `json:"completionProbe"`
}

func (*OpsResourceModifierAction) DeepCopy added in v0.9.0

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

func (*OpsResourceModifierAction) DeepCopyInto added in v0.9.0

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

type OpsService added in v0.8.0

type OpsService struct {
	// Specifies the name of the Service. This name is used to set `clusterService.name`.
	//
	// Note: This field cannot be updated.
	//
	// +required
	Name string `json:"name"`

	// Contains cloud provider related parameters if ServiceType is LoadBalancer.
	//
	// More info: https://kubernetes.io/docs/concepts/services-networking/service/#loadbalancer.
	//
	// +optional
	Annotations map[string]string `json:"annotations,omitempty"`

	// Specifies Port definitions that are to be exposed by a ClusterService.
	//
	// If not specified, the Port definitions from non-NodePort and non-LoadBalancer type ComponentService
	// defined in the ComponentDefinition (`componentDefinition.spec.services`) will be used.
	// If no matching ComponentService is found, the expose operation will fail.
	//
	// More info: https://kubernetes.io/docs/concepts/services-networking/service/#field-spec-ports
	//
	// +patchMergeKey=port
	// +patchStrategy=merge
	// +listType=map
	// +listMapKey=port
	// +listMapKey=protocol
	// +optional
	Ports []corev1.ServicePort `json:"ports,omitempty" patchStrategy:"merge" patchMergeKey:"port" protobuf:"bytes,1,rep,name=ports"`

	// Specifies a role to target with the service.
	// If specified, the service will only be exposed to pods with the matching role.
	//
	// Note: If the component has roles, at least one of 'roleSelector' or 'podSelector' must be specified.
	// If both are specified, a pod must match both conditions to be selected.
	//
	// +optional
	RoleSelector string `json:"roleSelector,omitempty"`

	// Routes service traffic to pods with matching label keys and values.
	// If specified, the service will only be exposed to pods matching the selector.
	//
	// Note: If the component has roles, at least one of 'roleSelector' or 'podSelector' must be specified.
	// If both are specified, a pod must match both conditions to be selected.
	//
	// +optional
	// +mapType=atomic
	PodSelector map[string]string `json:"podSelector,omitempty"`

	// Determines how the Service is exposed. Defaults to 'ClusterIP'.
	// Valid options are `ClusterIP`, `NodePort`, and `LoadBalancer`.
	//
	// - `ClusterIP`: allocates a cluster-internal IP address for load-balancing to endpoints.
	//    Endpoints are determined by the selector or if that is not specified,
	//    they are determined by manual construction of an Endpoints object or EndpointSlice objects.
	// - `NodePort`: builds on ClusterIP and allocates a port on every node which routes to the same endpoints as the clusterIP.
	// - `LoadBalancer`: builds on NodePort and creates an external load-balancer (if supported in the current cloud)
	//    which routes to the same endpoints as the clusterIP.
	//
	// Note: although K8s Service type allows the 'ExternalName' type, it is not a valid option for the expose operation.
	//
	// For more info, see:
	// https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types.
	//
	// +optional
	ServiceType corev1.ServiceType `json:"serviceType,omitempty"`

	// A list of IP families (e.g., IPv4, IPv6) assigned to this Service.
	//
	// Usually assigned automatically based on the cluster configuration and the `ipFamilyPolicy` field.
	// If specified manually, the requested IP family must be available in the cluster and allowed by the `ipFamilyPolicy`.
	// If the requested IP family is not available or not allowed, the Service creation will fail.
	//
	// Valid values:
	//
	// - "IPv4"
	// - "IPv6"
	//
	// This field may hold a maximum of two entries (dual-stack families, in either order).
	//
	// Common combinations of `ipFamilies` and `ipFamilyPolicy` are:
	//
	// - ipFamilies=[] + ipFamilyPolicy="PreferDualStack" :
	//   The Service prefers dual-stack but can fall back to single-stack if the cluster does not support dual-stack.
	//   The IP family is automatically assigned based on the cluster configuration.
	// - ipFamilies=["IPV4","IPV6"] + ipFamilyPolicy="RequiredDualStack" :
	//   The Service requires dual-stack and will only be created if the cluster supports both IPv4 and IPv6.
	//   The primary IP family is IPV4.
	// - ipFamilies=["IPV6","IPV4"] + ipFamilyPolicy="RequiredDualStack" :
	//   The Service requires dual-stack and will only be created if the cluster supports both IPv4 and IPv6.
	//   The primary IP family is IPV6.
	// - ipFamilies=["IPV4"] + ipFamilyPolicy="SingleStack" :
	//   The Service uses a single-stack with IPv4 only.
	// - ipFamilies=["IPV6"] + ipFamilyPolicy="SingleStack" :
	//   The Service uses a single-stack with IPv6 only.
	//
	// +listType=atomic
	// +optional
	IPFamilies []corev1.IPFamily `json:"ipFamilies,omitempty" protobuf:"bytes,19,opt,name=ipFamilies,casttype=IPFamily"`

	// Specifies whether the Service should use a single IP family (SingleStack) or two IP families (DualStack).
	//
	// Possible values:
	//
	// - 'SingleStack' (default) : The Service uses a single IP family.
	//   If no value is provided, IPFamilyPolicy defaults to SingleStack.
	// - 'PreferDualStack' : The Service prefers to use two IP families on dual-stack configured clusters
	//   or a single IP family on single-stack clusters.
	// - 'RequiredDualStack' : The Service requires two IP families on dual-stack configured clusters.
	//   If the cluster is not configured for dual-stack, the Service creation fails.
	//
	// +optional
	IPFamilyPolicy *corev1.IPFamilyPolicy `json:"ipFamilyPolicy,omitempty" protobuf:"bytes,17,opt,name=ipFamilyPolicy,casttype=IPFamilyPolicy"`
}

OpsService represents the parameters to dynamically create or remove a ClusterService in the `cluster.spec.services` array.

func (*OpsService) DeepCopy added in v0.8.0

func (in *OpsService) DeepCopy() *OpsService

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

func (*OpsService) DeepCopyInto added in v0.8.0

func (in *OpsService) DeepCopyInto(out *OpsService)

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

type OpsType

type OpsType string

OpsType defines operation types. +enum +kubebuilder:validation:Enum={Upgrade,VerticalScaling,VolumeExpansion,HorizontalScaling,Restart,Reconfiguring,Start,Stop,Expose,Switchover,DataScript,Backup,Restore,RebuildInstance,Custom}

const (
	VerticalScalingType   OpsType = "VerticalScaling"
	HorizontalScalingType OpsType = "HorizontalScaling"
	VolumeExpansionType   OpsType = "VolumeExpansion"
	UpgradeType           OpsType = "Upgrade"
	ReconfiguringType     OpsType = "Reconfiguring"
	SwitchoverType        OpsType = "Switchover"
	RestartType           OpsType = "Restart" // RestartType the restart operation is a special case of the rolling update operation.
	StopType              OpsType = "Stop"    // StopType the stop operation will delete all pods in a cluster concurrently.
	StartType             OpsType = "Start"   // StartType the start operation will start the pods which is deleted in stop operation.
	ExposeType            OpsType = "Expose"
	DataScriptType        OpsType = "DataScript" // DataScriptType the data script operation will execute the data script against the cluster.
	BackupType            OpsType = "Backup"
	RestoreType           OpsType = "Restore"
	RebuildInstanceType   OpsType = "RebuildInstance" // RebuildInstance rebuilding an instance is very useful when a node is offline or an instance is unrecoverable.
	CustomType            OpsType = "Custom"          // use opsDefinition
)

type OpsVarSource added in v0.8.0

type OpsVarSource struct {
	// Specifies a reference to a specific environment variable within a container.
	// Used to specify the source of the variable, which can be either "env" or "envFrom".
	//
	// +optional
	EnvVarRef *EnvVarRef `json:"envRef,omitempty"`

	// Represents the JSONPath expression pointing to the specific data within the JSON structure of the target Pod.
	// It is used to extract precise data locations for operations on the Pod.
	//
	// +optional
	FieldRef *corev1.ObjectFieldSelector `json:"fieldPath,omitempty"`
}

func (*OpsVarSource) DeepCopy added in v0.8.0

func (in *OpsVarSource) DeepCopy() *OpsVarSource

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

func (*OpsVarSource) DeepCopyInto added in v0.8.0

func (in *OpsVarSource) DeepCopyInto(out *OpsVarSource)

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

type OpsWorkloadAction added in v0.9.0

type OpsWorkloadAction struct {
	// Defines the workload type of the action. Valid values include "Job" and "Pod".
	//
	// - "Job": Creates a Job to execute the action.
	// - "Pod": Creates a Pod to execute the action.
	//    Note: unlike Jobs, manually deleting a Pod does not affect the `backoffLimit`.
	//
	// +kubebuilder:validation:Required
	Type OpsWorkloadType `json:"type"`

	// Specifies a PodInfoExtractor defined in the `opsDefinition.spec.podInfoExtractors`.
	PodInfoExtractorName string `json:"podInfoExtractorName,omitempty"`

	// Specifies the number of retries allowed before marking the action as failed.
	// +kubebuilder:validation:Minimum=0
	// +kubebuilder:default=0
	// +optional
	BackoffLimit int32 `json:"backoffLimit,omitempty"`

	// Specifies the PodSpec of the 'workload' action.
	// +kubebuilder:validation:Required
	PodSpec corev1.PodSpec `json:"podSpec"`
}

func (*OpsWorkloadAction) DeepCopy added in v0.9.0

func (in *OpsWorkloadAction) DeepCopy() *OpsWorkloadAction

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

func (*OpsWorkloadAction) DeepCopyInto added in v0.9.0

func (in *OpsWorkloadAction) DeepCopyInto(out *OpsWorkloadAction)

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

type OpsWorkloadType added in v0.9.0

type OpsWorkloadType string

OpsWorkloadType policy after action failure. +enum +kubebuilder:validation:Enum={Job,Pod}

const (
	PodWorkload OpsWorkloadType = "Pod"
	JobWorkload OpsWorkloadType = "Job"
)

type OverrideBy added in v0.9.0

type OverrideBy struct {
	// Indicates the name of the OpsRequest.
	// +optional
	OpsName string `json:"opsName"`

	LastComponentConfiguration `json:",inline"`
}

func (*OverrideBy) DeepCopy added in v0.9.0

func (in *OverrideBy) DeepCopy() *OverrideBy

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

func (*OverrideBy) DeepCopyInto added in v0.9.0

func (in *OverrideBy) DeepCopyInto(out *OverrideBy)

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

type Parameter added in v0.9.0

type Parameter struct {
	// Specifies the identifier of the parameter as defined in the OpsDefinition.
	// +kubebuilder:validation:Required
	Name string `json:"name"`

	// Holds the data associated with the parameter.
	// If the parameter type is an array, the format should be "v1,v2,v3".
	// +kubebuilder:validation:Required
	Value string `json:"value"`
}

func (*Parameter) DeepCopy added in v0.9.0

func (in *Parameter) DeepCopy() *Parameter

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

func (*Parameter) DeepCopyInto added in v0.9.0

func (in *Parameter) DeepCopyInto(out *Parameter)

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

type ParameterConfig

type ParameterConfig struct {
	// Represents a key in the configuration template(as ConfigMap).
	// Each key in the ConfigMap corresponds to a specific configuration file.
	//
	// +kubebuilder:validation:Required
	Key string `json:"key"`

	// Specifies a list of key-value pairs representing parameters and their corresponding values
	// within a single configuration file.
	// This field is used to override or set the values of parameters without modifying the entire configuration file.
	//
	// Either the `parameters` field or the `fileContent` field must be set, but not both.
	//
	// +optional
	Parameters []ParameterPair `json:"parameters,omitempty"`

	// Specifies the content of the entire configuration file.
	// This field is used to update the complete configuration file.
	//
	// Either the `parameters` field or the `fileContent` field must be set, but not both.
	//
	// +optional
	FileContent string `json:"fileContent,omitempty"`
}

func (*ParameterConfig) DeepCopy added in v0.6.0

func (in *ParameterConfig) DeepCopy() *ParameterConfig

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

func (*ParameterConfig) DeepCopyInto added in v0.6.0

func (in *ParameterConfig) DeepCopyInto(out *ParameterConfig)

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

type ParameterPair

type ParameterPair struct {
	// Represents the name of the parameter that is to be updated.
	// +kubebuilder:validation:Required
	Key string `json:"key"`

	// Represents the parameter values that are to be updated.
	// If set to nil, the parameter defined by the Key field will be removed from the configuration file.
	// +optional
	Value *string `json:"value"`
}

func (*ParameterPair) DeepCopy added in v0.6.0

func (in *ParameterPair) DeepCopy() *ParameterPair

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

func (*ParameterPair) DeepCopyInto added in v0.6.0

func (in *ParameterPair) DeepCopyInto(out *ParameterPair)

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

type ParametersSchema added in v0.8.0

type ParametersSchema struct {
	// Defines the schema for parameters using the OpenAPI v3.
	// The supported property types include:
	// - string
	// - number
	// - integer
	// - array: Note that only items of string type are supported.
	// +kubebuilder:validation:Schemaless
	// +kubebuilder:validation:Type=object
	// +kubebuilder:pruning:PreserveUnknownFields
	// +k8s:conversion-gen=false
	// +optional
	OpenAPIV3Schema *apiextensionsv1.JSONSchemaProps `json:"openAPIV3Schema,omitempty"`
}

func (*ParametersSchema) DeepCopy added in v0.8.0

func (in *ParametersSchema) DeepCopy() *ParametersSchema

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

func (*ParametersSchema) DeepCopyInto added in v0.8.0

func (in *ParametersSchema) DeepCopyInto(out *ParametersSchema)

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

type PasswordConfig

type PasswordConfig struct {
	// The length of the password.
	//
	// +kubebuilder:validation:Maximum=32
	// +kubebuilder:validation:Minimum=8
	// +kubebuilder:default=16
	// +optional
	Length int32 `json:"length,omitempty"`

	// The number of digits in the password.
	//
	// +kubebuilder:validation:Maximum=8
	// +kubebuilder:validation:Minimum=0
	// +kubebuilder:default=4
	// +optional
	NumDigits int32 `json:"numDigits,omitempty"`

	// The number of symbols in the password.
	//
	// +kubebuilder:validation:Maximum=8
	// +kubebuilder:validation:Minimum=0
	// +kubebuilder:default=0
	// +optional
	NumSymbols int32 `json:"numSymbols,omitempty"`

	// The case of the letters in the password.
	//
	// +kubebuilder:default=MixedCases
	// +optional
	LetterCase LetterCase `json:"letterCase,omitempty"`

	// Seed to generate the account's password.
	// Cannot be updated.
	//
	// +optional
	Seed string `json:"seed,omitempty"`
}

PasswordConfig helps provide to customize complexity of password generation pattern.

func (*PasswordConfig) DeepCopy added in v0.6.0

func (in *PasswordConfig) DeepCopy() *PasswordConfig

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

func (*PasswordConfig) DeepCopyInto added in v0.6.0

func (in *PasswordConfig) DeepCopyInto(out *PasswordConfig)

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

type Payload added in v0.8.0

type Payload struct {
	// Holds the payload data. This field is optional and can contain any type of data.
	// Not included in the JSON representation of the object.
	//
	// +kubebuilder:pruning:PreserveUnknownFields
	// +optional
	Data map[string]any `json:"-"`
}

func (*Payload) DeepCopy added in v0.8.0

func (in *Payload) DeepCopy() *Payload

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

func (*Payload) DeepCopyInto added in v0.8.0

func (c *Payload) DeepCopyInto(out *Payload)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. This exists here to work around https://github.com/kubernetes/code-generator/issues/50

func (*Payload) MarshalJSON added in v0.8.0

func (c *Payload) MarshalJSON() ([]byte, error)

MarshalJSON implements the Marshaler interface.

func (*Payload) UnmarshalJSON added in v0.8.0

func (c *Payload) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the Unmarshaler interface.

type PersistentVolumeClaimSpec

type PersistentVolumeClaimSpec struct {
	// Contains the desired access modes the volume should have.
	// More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1.
	//
	// +kubebuilder:pruning:PreserveUnknownFields
	// +optional
	AccessModes []corev1.PersistentVolumeAccessMode `json:"accessModes,omitempty" protobuf:"bytes,1,rep,name=accessModes,casttype=PersistentVolumeAccessMode"`

	// Represents the minimum resources the volume should have.
	// If the RecoverVolumeExpansionFailure feature is enabled, users are allowed to specify resource requirements that
	// are lower than the previous value but must still be higher than the capacity recorded in the status field of the claim.
	// More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources.
	//
	// +kubebuilder:pruning:PreserveUnknownFields
	// +optional
	Resources corev1.ResourceRequirements `json:"resources,omitempty" protobuf:"bytes,2,opt,name=resources"`

	// The name of the StorageClass required by the claim.
	// More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1.
	//
	// +optional
	StorageClassName *string `json:"storageClassName,omitempty" protobuf:"bytes,5,opt,name=storageClassName"`

	// Defines what type of volume is required by the claim, either Block or Filesystem.
	//
	// +optional
	VolumeMode *corev1.PersistentVolumeMode `json:"volumeMode,omitempty" protobuf:"bytes,6,opt,name=volumeMode,casttype=PersistentVolumeMode"`
}

func (*PersistentVolumeClaimSpec) DeepCopy added in v0.6.0

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

func (*PersistentVolumeClaimSpec) DeepCopyInto added in v0.6.0

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

func (*PersistentVolumeClaimSpec) ToV1PersistentVolumeClaimSpec

func (r *PersistentVolumeClaimSpec) ToV1PersistentVolumeClaimSpec() corev1.PersistentVolumeClaimSpec

ToV1PersistentVolumeClaimSpec converts to corev1.PersistentVolumeClaimSpec.

type Phase

type Phase string

Phase represents the current status of the ClusterDefinition and ClusterVersion CR.

+enum +kubebuilder:validation:Enum={Available,Unavailable}

const (
	// AvailablePhase indicates that the object is in an available state.
	AvailablePhase Phase = "Available"

	// UnavailablePhase indicates that the object is in an unavailable state.
	UnavailablePhase Phase = "Unavailable"
)

type PodAntiAffinity

type PodAntiAffinity string

PodAntiAffinity defines the pod anti-affinity strategy.

This strategy determines how pods are scheduled in relation to other pods, with the aim of either spreading pods across nodes (Preferred) or ensuring that certain pods do not share a node (Required).

+enum +kubebuilder:validation:Enum={Preferred,Required}

const (
	// Preferred indicates that the scheduler will try to enforce the anti-affinity rules, but it will not guarantee it.
	Preferred PodAntiAffinity = "Preferred"

	// Required indicates that the scheduler must enforce the anti-affinity rules and will not schedule the pods unless
	// the rules are met.
	Required PodAntiAffinity = "Required"
)

type PodAvailabilityPolicy added in v0.9.0

type PodAvailabilityPolicy string

PodAvailabilityPolicy pod availability strategy. +enum +kubebuilder:validation:Enum={Available,PreferredAvailable,None}

const (
	AvailablePolicy        PodAvailabilityPolicy = "Available"
	UnAvailablePolicy      PodAvailabilityPolicy = "UnAvailable"
	NoneAvailabilityPolicy PodAvailabilityPolicy = "None"
)

type PodInfoExtractor added in v0.9.0

type PodInfoExtractor struct {
	// Specifies the name of the PodInfoExtractor.
	//
	// +kubebuilder:validation:MaxLength=32
	// +kubebuilder:validation:Required
	Name string `json:"name"`

	// Specifies a list of environment variables to be extracted from a selected Pod,
	// and injected into the containers executing each OpsAction.
	//
	// +optional
	Env []OpsEnvVar `json:"env,omitempty"`

	// Used to select the target Pod from which environment variables and volumes are extracted from its PodSpec.
	//
	// +kubebuilder:validation:Required
	PodSelector PodSelector `json:"podSelector"`

	// Specifies a list of volumes, along with their respective mount points, that are to be extracted from a selected Pod,
	// and mounted onto the containers executing each OpsAction.
	// This allows the containers to access shared or persistent data necessary for the operation.
	//
	// +optional
	VolumeMounts []corev1.VolumeMount `json:"volumeMounts,omitempty"`
}

func (*PodInfoExtractor) DeepCopy added in v0.9.0

func (in *PodInfoExtractor) DeepCopy() *PodInfoExtractor

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

func (*PodInfoExtractor) DeepCopyInto added in v0.9.0

func (in *PodInfoExtractor) DeepCopyInto(out *PodInfoExtractor)

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

type PodSelectionPolicy added in v0.9.0

type PodSelectionPolicy string

PodSelectionPolicy pod selection strategy. +enum +kubebuilder:validation:Enum={All,Any}

const (
	All PodSelectionPolicy = "All"
	Any PodSelectionPolicy = "Any"
)

type PodSelector added in v0.9.0

type PodSelector struct {
	// Specifies the role of the target Pod.
	//
	// +optional
	Role string `json:"role,omitempty"`

	// Defines the policy for selecting the target pod when multiple pods match the podSelector.
	// It can be either 'Any' (select any one pod that matches the podSelector)
	// or 'All' (select all pods that match the podSelector).
	//
	// +kubebuilder:default=Any
	// +kubebuilder:validation:Required
	MultiPodSelectionPolicy PodSelectionPolicy `json:"multiPodSelectionPolicy,omitempty"`
}

PodSelector selects the target Pod from which environment variables and volumes are extracted from its PodSpec.

func (*PodSelector) DeepCopy added in v0.9.0

func (in *PodSelector) DeepCopy() *PodSelector

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

func (*PodSelector) DeepCopyInto added in v0.9.0

func (in *PodSelector) DeepCopyInto(out *PodSelector)

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

type PointInTimeRefSpec

type PointInTimeRefSpec struct {
	// Refers to the specific time point for restoration, with UTC as the time zone.
	// +optional
	Time *metav1.Time `json:"time,omitempty"`

	// Refers to a reference source cluster that needs to be restored.
	// +optional
	Ref RefNamespaceName `json:"ref,omitempty"`
}

func (*PointInTimeRefSpec) DeepCopy added in v0.6.0

func (in *PointInTimeRefSpec) DeepCopy() *PointInTimeRefSpec

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

func (*PointInTimeRefSpec) DeepCopyInto added in v0.6.0

func (in *PointInTimeRefSpec) DeepCopyInto(out *PointInTimeRefSpec)

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

type PostStartAction added in v0.7.1

type PostStartAction struct {
	// Specifies the  post-start command to be executed.
	//
	// +kubebuilder:validation:Required
	CmdExecutorConfig CmdExecutorConfig `json:"cmdExecutorConfig"`

	// Used to select the script that need to be referenced.
	// When defined, the scripts defined in scriptSpecs can be referenced within the CmdExecutorConfig.
	//
	// +optional
	ScriptSpecSelectors []ScriptSpecSelector `json:"scriptSpecSelectors,omitempty"`
}

PostStartAction is deprecated since v0.8.

func (*PostStartAction) DeepCopy added in v0.7.1

func (in *PostStartAction) DeepCopy() *PostStartAction

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

func (*PostStartAction) DeepCopyInto added in v0.7.1

func (in *PostStartAction) DeepCopyInto(out *PostStartAction)

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

type PreCheckResult added in v0.9.0

type PreCheckResult struct {
	// Indicates whether the preCheck operation passed or failed.
	// +kubebuilder:validation:Required
	Pass bool `json:"pass"`

	// Provides explanations related to the preCheck result in a human-readable format.
	// +optional
	Message string `json:"message,omitempty"`
}

func (*PreCheckResult) DeepCopy added in v0.9.0

func (in *PreCheckResult) DeepCopy() *PreCheckResult

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

func (*PreCheckResult) DeepCopyInto added in v0.9.0

func (in *PreCheckResult) DeepCopyInto(out *PreCheckResult)

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

type PreCondition added in v0.8.0

type PreCondition struct {
	// Specifies the conditions that must be met for the operation to execute.
	Rule *Rule `json:"rule,omitempty"`
}

func (*PreCondition) DeepCopy added in v0.8.0

func (in *PreCondition) DeepCopy() *PreCondition

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

func (*PreCondition) DeepCopyInto added in v0.8.0

func (in *PreCondition) DeepCopyInto(out *PreCondition)

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

type PreConditionExec added in v0.8.0

type PreConditionExec struct {
	// Specifies the name of the image used for execution.
	// +kubebuilder:validation:Required
	Image string `json:"image"`

	// Specifies a list of environment variables to be set in the container.
	// +optional
	Env []corev1.EnvVar `json:"env,omitempty"`

	// Specifies the command to be executed in the container.
	// +optional
	Command []string `json:"command,omitempty"`

	// Specifies the arguments to be passed to the command in the container.
	// +optional
	Args []string `json:"args,omitempty"`
}

PreConditionExec is deprecated.

func (*PreConditionExec) DeepCopy added in v0.8.0

func (in *PreConditionExec) DeepCopy() *PreConditionExec

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

func (*PreConditionExec) DeepCopyInto added in v0.8.0

func (in *PreConditionExec) DeepCopyInto(out *PreConditionExec)

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

type PreConditionType added in v0.8.0

type PreConditionType string

PreConditionType defines the preCondition type of the action execution.

const (
	ImmediatelyPreConditionType    PreConditionType = "Immediately"
	RuntimeReadyPreConditionType   PreConditionType = "RuntimeReady"
	ComponentReadyPreConditionType PreConditionType = "ComponentReady"
	ClusterReadyPreConditionType   PreConditionType = "ClusterReady"
)

type ProgressStatus

type ProgressStatus string

ProgressStatus defines the status of the opsRequest progress. +enum +kubebuilder:validation:Enum={Processing,Pending,Failed,Succeed}

const (
	PendingProgressStatus    ProgressStatus = "Pending"
	ProcessingProgressStatus ProgressStatus = "Processing"
	FailedProgressStatus     ProgressStatus = "Failed"
	SucceedProgressStatus    ProgressStatus = "Succeed"
)

type ProgressStatusDetail

type ProgressStatusDetail struct {
	// Specifies the group to which the current object belongs to.
	// +optional
	Group string `json:"group,omitempty"`

	// `objectKey` uniquely identifies the object, which can be any K8s object, like a Pod, Job, Component, or PVC.
	// Either `objectKey` or `actionName` must be provided.
	// +optional
	ObjectKey string `json:"objectKey,omitempty"`

	// Indicates the name of an OpsAction, as defined in `opsDefinition.spec.actions[*].name`.
	// Either `objectKey` or `actionName` must be provided.
	// +optional
	ActionName string `json:"actionName,omitempty"`

	// Lists the tasks, such as Jobs or Pods, that carry out the action.
	// +optional
	ActionTasks []ActionTask `json:"actionTasks,omitempty"`

	// Represents the current processing state of the object, including "Processing", "Pending", "Failed", "Succeed"
	// +kubebuilder:validation:Required
	Status ProgressStatus `json:"status"`

	// Provides a human-readable explanation of the object's condition.
	// +optional
	Message string `json:"message,omitempty"`

	// Records the start time of object processing.
	// +optional
	StartTime metav1.Time `json:"startTime,omitempty"`

	// Records the completion time of object processing.
	// +optional
	EndTime metav1.Time `json:"endTime,omitempty"`
}

func (*ProgressStatusDetail) DeepCopy added in v0.6.0

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

func (*ProgressStatusDetail) DeepCopyInto added in v0.6.0

func (in *ProgressStatusDetail) DeepCopyInto(out *ProgressStatusDetail)

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

func (*ProgressStatusDetail) SetStatusAndMessage

func (p *ProgressStatusDetail) SetStatusAndMessage(status ProgressStatus, message string)

type PrometheusScheme added in v0.9.0

type PrometheusScheme string

PrometheusScheme defines the protocol of prometheus scrape metrics.

+enum +kubebuilder:validation:Enum={http,https}

const (
	HTTPProtocol  PrometheusScheme = "http"
	HTTPSProtocol PrometheusScheme = "https"
)

type ProtectedVolume added in v0.6.0

type ProtectedVolume struct {
	// The Name of the volume to protect.
	//
	// +optional
	Name string `json:"name,omitempty"`

	// Defines the high watermark threshold for the volume, it will override the component level threshold.
	// If the value is invalid, it will be ignored and the component level threshold will be used.
	//
	// +kubebuilder:validation:Maximum=100
	// +kubebuilder:validation:Minimum=0
	// +optional
	HighWatermark *int `json:"highWatermark,omitempty"`
}

ProtectedVolume is deprecated since v0.9, replaced with ComponentVolume.HighWatermark.

func (*ProtectedVolume) DeepCopy added in v0.6.0

func (in *ProtectedVolume) DeepCopy() *ProtectedVolume

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

func (*ProtectedVolume) DeepCopyInto added in v0.6.0

func (in *ProtectedVolume) DeepCopyInto(out *ProtectedVolume)

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

type ProvisionPolicy

type ProvisionPolicy struct {
	// Specifies the method to provision an account.
	//
	// +kubebuilder:validation:Required
	Type ProvisionPolicyType `json:"type"`

	// Defines the scope within which the account is provisioned.
	//
	// +kubebuilder:default=AnyPods
	Scope ProvisionScope `json:"scope"`

	// The statement to provision an account.
	//
	// +optional
	Statements *ProvisionStatements `json:"statements,omitempty"`

	// The external secret to refer.
	//
	// +optional
	SecretRef *ProvisionSecretRef `json:"secretRef,omitempty"`
}

ProvisionPolicy defines the policy details for creating accounts.

Deprecated since v0.9.

func (*ProvisionPolicy) DeepCopy added in v0.6.0

func (in *ProvisionPolicy) DeepCopy() *ProvisionPolicy

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

func (*ProvisionPolicy) DeepCopyInto added in v0.6.0

func (in *ProvisionPolicy) DeepCopyInto(out *ProvisionPolicy)

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

type ProvisionPolicyType

type ProvisionPolicyType string

ProvisionPolicyType defines the policy for creating accounts.

+enum +kubebuilder:validation:Enum={CreateByStmt,ReferToExisting}

const (
	// CreateByStmt will create account w.r.t. deletion and creation statement given by provider.
	CreateByStmt ProvisionPolicyType = "CreateByStmt"

	// ReferToExisting will not create account, but create a secret by copying data from referred secret file.
	ReferToExisting ProvisionPolicyType = "ReferToExisting"
)

type ProvisionScope

type ProvisionScope string

ProvisionScope defines the scope of provision within a component.

+enum

const (
	// AllPods indicates that accounts will be created for all pods within the component.
	AllPods ProvisionScope = "AllPods"

	// AnyPods indicates that accounts will be created only on a single pod within the component.
	AnyPods ProvisionScope = "AnyPods"
)

type ProvisionSecretRef

type ProvisionSecretRef struct {
	// The unique identifier of the secret.
	//
	// +kubebuilder:validation:Required
	Name string `json:"name"`

	// The namespace where the secret is located.
	//
	// +kubebuilder:validation:Required
	Namespace string `json:"namespace"`
}

ProvisionSecretRef represents the reference to a secret.

func (*ProvisionSecretRef) DeepCopy added in v0.6.0

func (in *ProvisionSecretRef) DeepCopy() *ProvisionSecretRef

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

func (*ProvisionSecretRef) DeepCopyInto added in v0.6.0

func (in *ProvisionSecretRef) DeepCopyInto(out *ProvisionSecretRef)

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

type ProvisionStatements

type ProvisionStatements struct {
	// Specifies the statement required to create a new account with the necessary privileges.
	//
	// +kubebuilder:validation:Required
	CreationStatement string `json:"creation"`

	// Defines the statement required to update the password of an existing account.
	//
	// +optional
	UpdateStatement string `json:"update,omitempty"`

	// Defines the statement required to delete an existing account.
	// Typically used in conjunction with the creation statement to delete an account before recreating it.
	// For example, one might use a `drop user if exists` statement followed by a `create user` statement to ensure a fresh account.
	//
	// Deprecated: This field is deprecated and the update statement should be used instead.
	//
	// +optional
	DeletionStatement string `json:"deletion,omitempty"`
}

ProvisionStatements defines the statements used to create accounts.

Deprecated since v0.9.

func (*ProvisionStatements) DeepCopy added in v0.6.0

func (in *ProvisionStatements) DeepCopy() *ProvisionStatements

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

func (*ProvisionStatements) DeepCopyInto added in v0.6.0

func (in *ProvisionStatements) DeepCopyInto(out *ProvisionStatements)

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

type RSMSpec added in v0.7.0

type RSMSpec struct {
	// Specifies a list of roles defined within the system.
	//
	// +optional
	Roles []workloads.ReplicaRole `json:"roles,omitempty"`

	// Defines the method used to probe a role.
	//
	// +optional
	RoleProbe *workloads.RoleProbe `json:"roleProbe,omitempty"`

	// Indicates the actions required for dynamic membership reconfiguration.
	//
	// +optional
	MembershipReconfiguration *workloads.MembershipReconfiguration `json:"membershipReconfiguration,omitempty"`

	// Describes the strategy for updating Members (Pods).
	//
	// - `Serial`: Updates Members sequentially to ensure minimum component downtime.
	// - `BestEffortParallel`: Updates Members in parallel to ensure minimum component write downtime.
	// - `Parallel`: Forces parallel updates.
	//
	// +kubebuilder:validation:Enum={Serial,BestEffortParallel,Parallel}
	// +optional
	MemberUpdateStrategy *workloads.MemberUpdateStrategy `json:"memberUpdateStrategy,omitempty"`
}

RSMSpec is deprecated since v0.8.

func (*RSMSpec) DeepCopy added in v0.7.0

func (in *RSMSpec) DeepCopy() *RSMSpec

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

func (*RSMSpec) DeepCopyInto added in v0.7.0

func (in *RSMSpec) DeepCopyInto(out *RSMSpec)

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

type RebuildInstance added in v0.8.3

type RebuildInstance struct {
	// Specifies the name of the Component.
	ComponentOps `json:",inline"`

	// Specifies the instances (Pods) that need to be rebuilt, typically operating as standbys.
	//
	// +kubebuilder:validation:Required
	Instances []Instance `json:"instances"`

	// Indicates the name of the Backup custom resource from which to recover the instance.
	// Defaults to an empty PersistentVolume if unspecified.
	//
	// Note:
	// - Only full physical backups are supported for multi-replica Components (e.g., 'xtrabackup' for MySQL).
	// - Logical backups (e.g., 'mysqldump' for MySQL) are unsupported in the current version.
	//
	// +optional
	BackupName string `json:"backupName,omitempty"`

	// Defines container environment variables for the restore process.
	// merged with the ones specified in the Backup and ActionSet resources.
	//
	// Merge priority: Restore env > Backup env > ActionSet env.
	//
	// Purpose: Some databases require different configurations when being restored as a standby
	// compared to being restored as a primary.
	// For example, when restoring MySQL as a replica, you need to set `skip_slave_start="ON"` for 5.7
	// or `skip_replica_start="ON"` for 8.0.
	// Allowing environment variables to be passed in makes it more convenient to control these behavioral differences
	// during the restore process.
	//
	// +kubebuilder:pruning:PreserveUnknownFields
	// +optional
	RestoreEnv []corev1.EnvVar `json:"restoreEnv,omitempty" patchStrategy:"merge" patchMergeKey:"name"`
}

func (*RebuildInstance) DeepCopy added in v0.8.3

func (in *RebuildInstance) DeepCopy() *RebuildInstance

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

func (*RebuildInstance) DeepCopyInto added in v0.8.3

func (in *RebuildInstance) DeepCopyInto(out *RebuildInstance)

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

type ReconcileDetail added in v0.7.0

type ReconcileDetail struct {
	// Represents the policy applied during the most recent execution.
	//
	// +optional
	Policy string `json:"policy"`

	// Represents the outcome of the most recent execution.
	//
	// +optional
	ExecResult string `json:"execResult"`

	// Represents the current revision of the configuration item.
	//
	// +optional
	CurrentRevision string `json:"currentRevision,omitempty"`

	// Represents the number of pods where configuration changes were successfully applied.
	//
	// +kubebuilder:default=-1
	// +optional
	SucceedCount int32 `json:"succeedCount,omitempty"`

	// Represents the total number of pods that require execution of configuration changes.
	//
	// +kubebuilder:default=-1
	// +optional
	ExpectedCount int32 `json:"expectedCount,omitempty"`

	// Represents the error message generated when the execution of configuration changes fails.
	//
	// +optional
	ErrMessage string `json:"errMessage,omitempty"`
}

func (*ReconcileDetail) DeepCopy added in v0.7.0

func (in *ReconcileDetail) DeepCopy() *ReconcileDetail

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

func (*ReconcileDetail) DeepCopyInto added in v0.7.0

func (in *ReconcileDetail) DeepCopyInto(out *ReconcileDetail)

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

type Reconfigure

type Reconfigure struct {
	// Specifies the name of the Component.
	ComponentOps `json:",inline"`

	// Contains a list of ConfigurationItem objects, specifying the Component's configuration template name,
	// upgrade policy, and parameter key-value pairs to be updated.
	//
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MinItems=1
	// +patchMergeKey=name
	// +patchStrategy=merge,retainKeys
	// +listType=map
	// +listMapKey=name
	Configurations []ConfigurationItem `json:"configurations" patchStrategy:"merge,retainKeys" patchMergeKey:"name"`
}

Reconfigure defines the parameters for updating a Component's configuration.

func (*Reconfigure) DeepCopy added in v0.6.0

func (in *Reconfigure) DeepCopy() *Reconfigure

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

func (*Reconfigure) DeepCopyInto added in v0.6.0

func (in *Reconfigure) DeepCopyInto(out *Reconfigure)

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

type ReconfiguringStatus

type ReconfiguringStatus struct {
	// Describes the reconfiguring detail status.
	// Possible condition types include "Creating", "Init", "Running", "Pending", "Merged", "MergeFailed", "FailedAndPause",
	// "Upgrading", "Deleting", "FailedAndRetry", "Finished", "ReconfigurePersisting", "ReconfigurePersisted".
	// +optional
	// +patchMergeKey=type
	// +patchStrategy=merge
	// +listType=map
	// +listMapKey=type
	Conditions []metav1.Condition `json:"conditions,omitempty"`

	// Describes the status of the component reconfiguring.
	// +kubebuilder:validation:Required
	// +patchMergeKey=name
	// +patchStrategy=merge,retainKeys
	// +listType=map
	// +listMapKey=name
	ConfigurationStatus []ConfigurationItemStatus `json:"configurationStatus"`
}

func (*ReconfiguringStatus) DeepCopy added in v0.6.0

func (in *ReconfiguringStatus) DeepCopy() *ReconfiguringStatus

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

func (*ReconfiguringStatus) DeepCopyInto added in v0.6.0

func (in *ReconfiguringStatus) DeepCopyInto(out *ReconfiguringStatus)

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

type RefNamespaceName

type RefNamespaceName struct {
	// Refers to the specific name of the resource.
	// +optional
	Name string `json:"name,omitempty"`

	// Refers to the specific namespace of the resource.
	// +optional
	Namespace string `json:"namespace,omitempty"`
}

func (*RefNamespaceName) DeepCopy added in v0.6.0

func (in *RefNamespaceName) DeepCopy() *RefNamespaceName

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

func (*RefNamespaceName) DeepCopyInto added in v0.6.0

func (in *RefNamespaceName) DeepCopyInto(out *RefNamespaceName)

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

type ReloadOptions

type ReloadOptions struct {
	// Used to trigger a reload by sending a specific Unix signal to the process.
	//
	// +optional
	UnixSignalTrigger *appsv1beta1.UnixSignalTrigger `json:"unixSignalTrigger,omitempty"`

	// Allows to execute a custom shell script to reload the process.
	//
	// +optional
	ShellTrigger *appsv1beta1.ShellTrigger `json:"shellTrigger,omitempty"`

	// Enables reloading process using a Go template script.
	//
	// +optional
	TPLScriptTrigger *appsv1beta1.TPLScriptTrigger `json:"tplScriptTrigger"`

	// Automatically perform the reload when specified conditions are met.
	//
	// +optional
	AutoTrigger *appsv1beta1.AutoTrigger `json:"autoTrigger,omitempty"`
}

ReloadOptions defines the mechanisms available for dynamically reloading a process within K8s without requiring a restart.

Only one of the mechanisms can be specified at a time.

func (*ReloadOptions) DeepCopy added in v0.6.0

func (in *ReloadOptions) DeepCopy() *ReloadOptions

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

func (*ReloadOptions) DeepCopyInto added in v0.6.0

func (in *ReloadOptions) DeepCopyInto(out *ReloadOptions)

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

type ReplicaChanger added in v0.9.0

type ReplicaChanger struct {
	// Specifies the replica changes for the component.
	// +kubebuilder:validation:Minimum=0
	ReplicaChanges *int32 `json:"replicaChanges,omitempty"`

	// Modifies the desired replicas count for existing InstanceTemplate.
	// if the inst
	// +patchMergeKey=name
	// +patchStrategy=merge,retainKeys
	// +listType=map
	// +listMapKey=name
	// +optional
	Instances []InstanceReplicasTemplate `json:"instances,omitempty" patchStrategy:"merge,retainKeys" patchMergeKey:"name"`
}

ReplicaChanger defines the parameters for changing the number of replicas.

func (*ReplicaChanger) DeepCopy added in v0.9.0

func (in *ReplicaChanger) DeepCopy() *ReplicaChanger

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

func (*ReplicaChanger) DeepCopyInto added in v0.9.0

func (in *ReplicaChanger) DeepCopyInto(out *ReplicaChanger)

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

type ReplicaRole added in v0.8.0

type ReplicaRole struct {
	// Defines the role's identifier. It is used to set the "apps.kubeblocks.io/role" label value
	// on the corresponding object.
	//
	// This field is immutable once set.
	//
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MaxLength=32
	// +kubebuilder:validation:Pattern=`^.*[^\s]+.*$`
	Name string `json:"name"`

	// Indicates whether a replica assigned this role is capable of providing services.
	//
	// This field is immutable once set.
	//
	// +kubebuilder:default=false
	// +optional
	Serviceable bool `json:"serviceable,omitempty"`

	// Determines if a replica in this role has the authority to perform write operations.
	// A writable replica can modify data, handle update operations.
	//
	// This field is immutable once set.
	//
	// +kubebuilder:default=false
	// +optional
	Writable bool `json:"writable,omitempty"`

	// Specifies whether a replica with this role has voting rights.
	// In distributed systems, this typically means the replica can participate in consensus decisions,
	// configuration changes, or other processes that require a quorum.
	//
	// This field is immutable once set.
	//
	// +kubebuilder:default=false
	// +optional
	Votable bool `json:"votable,omitempty"`
}

ReplicaRole represents a role that can be assumed by a component instance.

func (*ReplicaRole) DeepCopy added in v0.8.0

func (in *ReplicaRole) DeepCopy() *ReplicaRole

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

func (*ReplicaRole) DeepCopyInto added in v0.8.0

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

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

type ReplicasLimit added in v0.8.0

type ReplicasLimit struct {
	// The minimum limit of replicas.
	//
	// +kubebuilder:validation:Required
	MinReplicas int32 `json:"minReplicas"`

	// The maximum limit of replicas.
	//
	// +kubebuilder:validation:Required
	MaxReplicas int32 `json:"maxReplicas"`
}

ReplicasLimit defines the valid range of number of replicas supported.

+kubebuilder:validation:XValidation:rule="self.minReplicas >= 0 && self.maxReplicas <= 128",message="the minimum and maximum limit of replicas should be in the range of [0, 128]" +kubebuilder:validation:XValidation:rule="self.minReplicas <= self.maxReplicas",message="the minimum replicas limit should be no greater than the maximum"

func (*ReplicasLimit) DeepCopy added in v0.8.0

func (in *ReplicasLimit) DeepCopy() *ReplicasLimit

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

func (*ReplicasLimit) DeepCopyInto added in v0.8.0

func (in *ReplicasLimit) DeepCopyInto(out *ReplicasLimit)

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

type ReplicationSetSpec added in v0.6.0

type ReplicationSetSpec struct {
	StatefulSetSpec `json:",inline"`
}

ReplicationSetSpec is deprecated since v0.7.

func (*ReplicationSetSpec) DeepCopy added in v0.6.0

func (in *ReplicationSetSpec) DeepCopy() *ReplicationSetSpec

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

func (*ReplicationSetSpec) DeepCopyInto added in v0.6.0

func (in *ReplicationSetSpec) DeepCopyInto(out *ReplicationSetSpec)

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

func (*ReplicationSetSpec) FinalStsUpdateStrategy added in v0.6.0

func (*ReplicationSetSpec) GetUpdateStrategy added in v0.6.0

func (r *ReplicationSetSpec) GetUpdateStrategy() UpdateStrategy

type RerenderResourceType added in v0.9.0

type RerenderResourceType string

RerenderResourceType defines the resource requirements for a component. +enum +kubebuilder:validation:Enum={vscale,hscale,tls}

const (
	ComponentVScaleType RerenderResourceType = "vscale"
	ComponentHScaleType RerenderResourceType = "hscale"
)

type ResourceConstraintRule added in v0.6.0

type ResourceConstraintRule struct {
	// The name of the constraint.
	// +kubebuilder:validation:Required
	Name string `json:"name"`

	// The constraint for vcpu cores.
	// +kubebuilder:validation:Required
	CPU CPUConstraint `json:"cpu"`

	// The constraint for memory size.
	// +kubebuilder:validation:Required
	Memory MemoryConstraint `json:"memory"`

	// The constraint for storage size.
	// +optional
	Storage StorageConstraint `json:"storage"`
}

func (*ResourceConstraintRule) CompleteResources added in v0.6.0

func (*ResourceConstraintRule) DeepCopy added in v0.6.0

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

func (*ResourceConstraintRule) DeepCopyInto added in v0.6.0

func (in *ResourceConstraintRule) DeepCopyInto(out *ResourceConstraintRule)

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

func (*ResourceConstraintRule) GetMinimalResources added in v0.6.0

func (m *ResourceConstraintRule) GetMinimalResources() corev1.ResourceList

GetMinimalResources gets the minimal resources meets the constraint

func (*ResourceConstraintRule) ValidateCPU added in v0.6.0

func (m *ResourceConstraintRule) ValidateCPU(cpu *resource.Quantity) bool

ValidateCPU validates if the CPU meets the constraint

func (*ResourceConstraintRule) ValidateMemory added in v0.6.0

func (m *ResourceConstraintRule) ValidateMemory(cpu *resource.Quantity, memory *resource.Quantity) bool

ValidateMemory validates if the memory meets the constraint

func (*ResourceConstraintRule) ValidateResources added in v0.6.0

func (m *ResourceConstraintRule) ValidateResources(r corev1.ResourceList) bool

ValidateResources validates if the resources meets the constraint

func (*ResourceConstraintRule) ValidateStorage added in v0.6.0

func (m *ResourceConstraintRule) ValidateStorage(storage *resource.Quantity) bool

ValidateStorage validates if the storage meets the constraint

type ResourceMeta added in v0.8.0

type ResourceMeta struct {
	// Name is the name of the referenced ConfigMap or Secret object. It must conform to DNS label standards.
	//
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MaxLength=63
	// +kubebuilder:validation:Pattern:=`^[a-z0-9]([a-z0-9\.\-]*[a-z0-9])?$`
	Name string `json:"name"`

	// MountPoint is the filesystem path where the volume will be mounted.
	//
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MaxLength=256
	// +kubebuilder:validation:Pattern:=`^/[a-z]([a-z0-9\-]*[a-z0-9])?$`
	MountPoint string `json:"mountPoint"`

	// SubPath specifies a path within the volume from which to mount.
	//
	// +optional
	SubPath string `json:"subPath,omitempty"`

	// AsVolumeFrom lists the names of containers in which the volume should be mounted.
	//
	// +listType=set
	// +optional
	AsVolumeFrom []string `json:"asVolumeFrom,omitempty"`
}

ResourceMeta encapsulates metadata and configuration for referencing ConfigMaps and Secrets as volumes.

func (*ResourceMeta) DeepCopy added in v0.8.0

func (in *ResourceMeta) DeepCopy() *ResourceMeta

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

func (*ResourceMeta) DeepCopyInto added in v0.8.0

func (in *ResourceMeta) DeepCopyInto(out *ResourceMeta)

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

type Restore added in v0.9.0

type Restore struct {
	// Specifies the name of the Backup custom resource.
	//
	// +kubebuilder:validation:Required
	BackupName string `json:"backupName"`

	// Specifies the point in time to which the restore should be performed.
	// Supported time formats:
	//
	// - RFC3339 format, e.g. "2023-11-25T18:52:53Z"
	// - A human-readable date-time format, e.g. "Jul 25,2023 18:52:53 UTC+0800"
	//
	RestorePointInTime string `json:"restorePointInTime,omitempty"`

	// Specifies the policy for restoring volume claims of a Component's Pods.
	// It determines whether the volume claims should be restored sequentially (one by one) or in parallel (all at once).
	// Support values:
	//
	// - "Serial"
	// - "Parallel"
	//
	// +kubebuilder:validation:Enum=Serial;Parallel
	// +kubebuilder:default=Parallel
	VolumeRestorePolicy string `json:"volumeRestorePolicy,omitempty"`

	// Controls the timing of PostReady actions during the recovery process.
	//
	// If false (default), PostReady actions execute when the Component reaches the "Running" state.
	// If true, PostReady actions are delayed until the entire Cluster is "Running,"
	// ensuring the cluster's overall stability before proceeding.
	//
	// This setting is useful for coordinating PostReady operations across the Cluster for optimal cluster conditions.
	DeferPostReadyUntilClusterRunning bool `json:"deferPostReadyUntilClusterRunning,omitempty"`
}

func (*Restore) DeepCopy added in v0.9.0

func (in *Restore) DeepCopy() *Restore

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

func (*Restore) DeepCopyInto added in v0.9.0

func (in *Restore) DeepCopyInto(out *Restore)

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

type RetryPolicy added in v0.8.0

type RetryPolicy struct {
	// Defines the maximum number of retry attempts that should be made for a given Action.
	// This value is set to 0 by default, indicating that no retries will be made.
	//
	// +kubebuilder:default=0
	// +optional
	MaxRetries int `json:"maxRetries,omitempty"`

	// Indicates the duration of time to wait between each retry attempt.
	// This value is set to 0 by default, indicating that there will be no delay between retry attempts.
	//
	// +kubebuilder:default=0
	// +optional
	RetryInterval time.Duration `json:"retryInterval,omitempty"`
}

func (*RetryPolicy) DeepCopy added in v0.8.0

func (in *RetryPolicy) DeepCopy() *RetryPolicy

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

func (*RetryPolicy) DeepCopyInto added in v0.8.0

func (in *RetryPolicy) DeepCopyInto(out *RetryPolicy)

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

type RoleArbitrator added in v0.8.0

type RoleArbitrator string

RoleArbitrator defines how to arbitrate the role of replicas.

Deprecated since v0.9 +enum +kubebuilder:validation:Enum={External,Lorry}

const (
	ExternalRoleArbitrator RoleArbitrator = "External"
	LorryRoleArbitrator    RoleArbitrator = "Lorry"
)

type RoleProbe added in v0.8.0

type RoleProbe struct {
	LifecycleActionHandler `json:",inline"`

	// Specifies the number of seconds to wait after the container has started before the RoleProbe
	// begins to detect the container's role.
	//
	// +optional
	InitialDelaySeconds int32 `json:"initialDelaySeconds,omitempty" protobuf:"varint,2,opt,name=initialDelaySeconds"`

	// Specifies the number of seconds after which the probe times out.
	// Defaults to 1 second. Minimum value is 1.
	//
	// +optional
	TimeoutSeconds int32 `json:"timeoutSeconds,omitempty" protobuf:"varint,3,opt,name=timeoutSeconds"`

	// Specifies the frequency at which the probe is conducted. This value is expressed in seconds.
	// Default to 10 seconds. Minimum value is 1.
	//
	// +optional
	PeriodSeconds int32 `json:"periodSeconds,omitempty" protobuf:"varint,4,opt,name=periodSeconds"`
}

func (*RoleProbe) DeepCopy added in v0.8.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.8.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 Rule added in v0.8.0

type Rule struct {
	// Specifies a Go template expression that determines how the operation can be executed.
	// The return value must be either `true` or `false`.
	// Available built-in objects that can be referenced in the expression include:
	//
	// - `params`: Input parameters.
	// - `cluster`: The referenced Cluster object.
	// - `component`: The referenced Component object.
	//
	// +kubebuilder:validation:Required
	Expression string `json:"expression"`

	// Specifies the error or status message reported if the `expression` does not evaluate to `true`.
	//
	// +kubebuilder:validation:Required
	Message string `json:"message"`
}

func (*Rule) DeepCopy added in v0.8.0

func (in *Rule) DeepCopy() *Rule

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

func (*Rule) DeepCopyInto added in v0.8.0

func (in *Rule) DeepCopyInto(out *Rule)

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

type ScaleIn added in v0.9.0

type ScaleIn struct {

	// Modifies the replicas of the component and instance templates.
	ReplicaChanger `json:",inline"`

	// Specifies the instance names that need to be taken offline.
	// +optional
	OnlineInstancesToOffline []string `json:"onlineInstancesToOffline,omitempty"`
}

ScaleIn defines the configuration for a scale-in operation.

func (*ScaleIn) DeepCopy added in v0.9.0

func (in *ScaleIn) DeepCopy() *ScaleIn

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

func (*ScaleIn) DeepCopyInto added in v0.9.0

func (in *ScaleIn) DeepCopyInto(out *ScaleIn)

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

type ScaleOut added in v0.9.0

type ScaleOut struct {

	// Modifies the replicas of the component and instance templates.
	ReplicaChanger `json:",inline"`

	// Defines the configuration for new instances added during scaling, including resource requirements, labels, annotations, etc.
	// New instances are created based on the provided instance templates.
	// +optional
	// +patchMergeKey=name
	// +patchStrategy=merge,retainKeys
	// +listType=map
	// +listMapKey=name
	NewInstances []InstanceTemplate `json:"newInstances,omitempty" patchStrategy:"merge,retainKeys" patchMergeKey:"name"`

	// Specifies the instances in the offline list to bring back online.
	// +optional
	OfflineInstancesToOnline []string `json:"offlineInstancesToOnline,omitempty"`
}

ScaleOut defines the configuration for a scale-out operation.

func (*ScaleOut) DeepCopy added in v0.9.0

func (in *ScaleOut) DeepCopy() *ScaleOut

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

func (*ScaleOut) DeepCopyInto added in v0.9.0

func (in *ScaleOut) DeepCopyInto(out *ScaleOut)

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

type SchedulePolicy

type SchedulePolicy struct {
	// Specifies whether the backup schedule is enabled or not.
	//
	// +optional
	Enabled *bool `json:"enabled,omitempty"`

	// Defines the backup method name that is defined in backupPolicy.
	//
	// +kubebuilder:validation:Required
	BackupMethod string `json:"backupMethod"`

	// Represents the cron expression for schedule, with the timezone set in UTC.
	// Refer to https://en.wikipedia.org/wiki/Cron for more details.
	//
	// +kubebuilder:validation:Required
	CronExpression string `json:"cronExpression"`

	// Determines the duration for which the backup should be retained.
	// The controller will remove all backups that are older than the RetentionPeriod.
	// For instance, a RetentionPeriod of `30d` will retain only the backups from the last 30 days.
	// Sample duration format:
	//
	// - years: 	2y
	// - months: 	6mo
	// - days: 		30d
	// - hours: 	12h
	// - minutes: 	30m
	//
	// These durations can also be combined, for example: 30d12h30m.
	//
	// +optional
	// +kubebuilder:default="7d"
	RetentionPeriod dpv1alpha1.RetentionPeriod `json:"retentionPeriod,omitempty"`
}

func (*SchedulePolicy) DeepCopy added in v0.6.0

func (in *SchedulePolicy) DeepCopy() *SchedulePolicy

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

func (*SchedulePolicy) DeepCopyInto added in v0.6.0

func (in *SchedulePolicy) DeepCopyInto(out *SchedulePolicy)

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

type ScriptFrom added in v0.6.0

type ScriptFrom struct {
	// A list of ConfigMapKeySelector objects, each specifies a ConfigMap and a key containing the script.
	//
	// Note: This field cannot be modified once set.
	//
	// +optional
	// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="forbidden to update spec.scriptSpec.scriptFrom.configMapRef"
	ConfigMapRef []corev1.ConfigMapKeySelector `json:"configMapRef,omitempty"`

	// A list of SecretKeySelector objects, each specifies a Secret and a key containing the script.
	//
	// Note: This field cannot be modified once set.
	//
	// +optional
	// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="forbidden to update spec.scriptSpec.scriptFrom.secretRef"
	SecretRef []corev1.SecretKeySelector `json:"secretRef,omitempty"`
}

ScriptFrom specifies the source of the script to be executed, which can be either a ConfigMap or a Secret.

func (*ScriptFrom) DeepCopy added in v0.6.0

func (in *ScriptFrom) DeepCopy() *ScriptFrom

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

func (*ScriptFrom) DeepCopyInto added in v0.6.0

func (in *ScriptFrom) DeepCopyInto(out *ScriptFrom)

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

type ScriptSecret added in v0.6.0

type ScriptSecret struct {
	// Specifies the name of the secret.
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MaxLength=63
	// +kubebuilder:validation:Pattern:=`^[a-z0-9]([a-z0-9\.\-]*[a-z0-9])?$`
	Name string `json:"name"`
	// Used to specify the username part of the secret.
	// +kubebuilder:default:="username"
	// +optional
	UsernameKey string `json:"usernameKey,omitempty"`
	// Used to specify the password part of the secret.
	// +kubebuilder:default:="password"
	// +optional
	PasswordKey string `json:"passwordKey,omitempty"`
}

ScriptSecret represents the secret that is used to execute the script.

func (*ScriptSecret) DeepCopy added in v0.6.0

func (in *ScriptSecret) DeepCopy() *ScriptSecret

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

func (*ScriptSecret) DeepCopyInto added in v0.6.0

func (in *ScriptSecret) DeepCopyInto(out *ScriptSecret)

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

type ScriptSpec added in v0.6.0

type ScriptSpec struct {
	// Specifies the name of the Component.
	ComponentOps `json:",inline"`

	// Specifies the image to be used to execute scripts.
	//
	// By default, the image "apecloud/kubeblocks-datascript:latest" is used.
	//
	// +optional
	Image string `json:"image,omitempty"`

	// Defines the secret to be used to execute the script. If not specified, the default cluster root credential secret is used.
	// +optional
	Secret *ScriptSecret `json:"secret,omitempty"`

	// Defines the content of scripts to be executed.
	//
	// All scripts specified in this field will be executed in the order they are provided.
	//
	// Note: this field cannot be modified once set.
	//
	// +optional
	// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="forbidden to update spec.scriptSpec.script"
	Script []string `json:"script,omitempty"`

	// Specifies the sources of the scripts to be executed.
	// Each script can be imported either from a ConfigMap or a Secret.
	//
	// All scripts obtained from the sources specified in this field will be executed after
	// any scripts provided in the `script` field.
	//
	// Execution order:
	// 1. Scripts provided in the `script` field, in the order of the scripts listed.
	// 2. Scripts imported from ConfigMaps, in the order of the sources listed.
	// 3. Scripts imported from Secrets, in the order of the sources listed.
	//
	// Note: this field cannot be modified once set.
	//
	// +optional
	// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="forbidden to update spec.scriptSpec.scriptFrom"
	ScriptFrom *ScriptFrom `json:"scriptFrom,omitempty"`

	// Specifies the labels used to select the Pods on which the script should be executed.
	//
	// By default, the script is executed on the Pod associated with the service named "{clusterName}-{componentName}",
	// which typically routes to the Pod with the primary/leader role.
	//
	// However, some Components, such as Redis, do not synchronize account information between primary and secondary Pods.
	// In these cases, the script must be executed on all replica Pods matching the selector.
	//
	// Note: this field cannot be modified once set.
	//
	// +optional
	// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="forbidden to update spec.scriptSpec.script.selector"
	Selector *metav1.LabelSelector `json:"selector,omitempty"`
}

ScriptSpec is a legacy feature for executing engine-specific operations such as creating databases or users. It supports limited engines including MySQL, PostgreSQL, Redis, MongoDB.

ScriptSpec has been replaced by the more versatile OpsDefinition. It is recommended to use OpsDefinition instead. ScriptSpec is deprecated and will be removed in a future version.

func (*ScriptSpec) DeepCopy added in v0.6.0

func (in *ScriptSpec) DeepCopy() *ScriptSpec

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

func (*ScriptSpec) DeepCopyInto added in v0.6.0

func (in *ScriptSpec) DeepCopyInto(out *ScriptSpec)

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

type ScriptSpecSelector added in v0.6.0

type ScriptSpecSelector struct {
	// Represents the name of the ScriptSpec referent.
	//
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MaxLength=63
	// +kubebuilder:validation:Pattern:=`^[a-z0-9]([a-z0-9\.\-]*[a-z0-9])?$`
	Name string `json:"name"`
}

func (*ScriptSpecSelector) DeepCopy added in v0.6.0

func (in *ScriptSpecSelector) DeepCopy() *ScriptSpecSelector

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

func (*ScriptSpecSelector) DeepCopyInto added in v0.6.0

func (in *ScriptSpecSelector) DeepCopyInto(out *ScriptSpecSelector)

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

type SecretRef added in v0.8.0

type SecretRef struct {
	ResourceMeta `json:",inline"`

	// Secret specifies the Secret to be mounted as a volume.
	//
	// +kubebuilder:validation:Required
	Secret corev1.SecretVolumeSource `json:"secret"`
}

SecretRef defines a reference to a Secret.

func (*SecretRef) DeepCopy added in v0.8.0

func (in *SecretRef) DeepCopy() *SecretRef

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

func (*SecretRef) DeepCopyInto added in v0.8.0

func (in *SecretRef) DeepCopyInto(out *SecretRef)

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

type Service added in v0.8.0

type Service struct {
	// Name defines the name of the service.
	// otherwise, it indicates the name of the service.
	// Others can refer to this service by its name. (e.g., connection credential)
	// Cannot be updated.
	//
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MaxLength=25
	Name string `json:"name"`

	// ServiceName defines the name of the underlying service object.
	// If not specified, the default service name with different patterns will be used:
	//
	// - CLUSTER_NAME: for cluster-level services
	// - CLUSTER_NAME-COMPONENT_NAME: for component-level services
	//
	// Only one default service name is allowed.
	// Cannot be updated.
	//
	// +kubebuilder:validation:MaxLength=25
	// +kubebuilder:validation:Pattern:=`^[a-z]([a-z0-9\-]*[a-z0-9])?$`
	//
	// +optional
	ServiceName string `json:"serviceName,omitempty"`

	// If ServiceType is LoadBalancer, cloud provider related parameters can be put here
	// More info: https://kubernetes.io/docs/concepts/services-networking/service/#loadbalancer.
	//
	// +optional
	Annotations map[string]string `json:"annotations,omitempty"`

	// Spec defines the behavior of a service.
	// https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
	//
	// +optional
	Spec corev1.ServiceSpec `json:"spec,omitempty"`

	// Extends the above `serviceSpec.selector` by allowing you to specify defined role as selector for the service.
	// When `roleSelector` is set, it adds a label selector "kubeblocks.io/role: {roleSelector}"
	// to the `serviceSpec.selector`.
	// Example usage:
	//
	//	  roleSelector: "leader"
	//
	// In this example, setting `roleSelector` to "leader" will add a label selector
	// "kubeblocks.io/role: leader" to the `serviceSpec.selector`.
	// This means that the service will select and route traffic to Pods with the label
	// "kubeblocks.io/role" set to "leader".
	//
	// Note that if `podService` sets to true, RoleSelector will be ignored.
	// The `podService` flag takes precedence over `roleSelector` and generates a service for each Pod.
	//
	// +optional
	RoleSelector string `json:"roleSelector,omitempty"`
}

func (*Service) DeepCopy added in v0.8.0

func (in *Service) DeepCopy() *Service

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

func (*Service) DeepCopyInto added in v0.8.0

func (in *Service) DeepCopyInto(out *Service)

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

type ServiceDescriptor added in v0.7.0

type ServiceDescriptor struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   ServiceDescriptorSpec   `json:"spec,omitempty"`
	Status ServiceDescriptorStatus `json:"status,omitempty"`
}

ServiceDescriptor describes a service provided by external sources. It contains the necessary details such as the service's address and connection credentials. To enable a Cluster to access this service, the ServiceDescriptor's name should be specified in the Cluster configuration under `clusterComponent.serviceRefs[*].serviceDescriptor`.

func (*ServiceDescriptor) DeepCopy added in v0.7.0

func (in *ServiceDescriptor) DeepCopy() *ServiceDescriptor

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

func (*ServiceDescriptor) DeepCopyInto added in v0.7.0

func (in *ServiceDescriptor) DeepCopyInto(out *ServiceDescriptor)

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

func (*ServiceDescriptor) DeepCopyObject added in v0.7.0

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

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

func (*ServiceDescriptor) Default added in v0.7.0

func (r *ServiceDescriptor) Default()

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

func (*ServiceDescriptor) SetupWebhookWithManager added in v0.7.0

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

func (*ServiceDescriptor) ValidateCreate added in v0.7.0

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

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

func (*ServiceDescriptor) ValidateDelete added in v0.7.0

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

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

func (*ServiceDescriptor) ValidateUpdate added in v0.7.0

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

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

type ServiceDescriptorList added in v0.7.0

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

ServiceDescriptorList contains a list of ServiceDescriptor.

func (*ServiceDescriptorList) DeepCopy added in v0.7.0

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

func (*ServiceDescriptorList) DeepCopyInto added in v0.7.0

func (in *ServiceDescriptorList) DeepCopyInto(out *ServiceDescriptorList)

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

func (*ServiceDescriptorList) DeepCopyObject added in v0.7.0

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

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

type ServiceDescriptorSpec added in v0.7.0

type ServiceDescriptorSpec struct {
	// Describes the type of database service provided by the external service.
	// For example, "mysql", "redis", "mongodb".
	// This field categorizes databases by their functionality, protocol and compatibility, facilitating appropriate
	// service integration based on their unique capabilities.
	//
	// This field is case-insensitive.
	//
	// It also supports abbreviations for some well-known databases:
	// - "pg", "pgsql", "postgres", "postgresql": PostgreSQL service
	// - "zk", "zookeeper": ZooKeeper service
	// - "es", "elasticsearch": Elasticsearch service
	// - "mongo", "mongodb": MongoDB service
	// - "ch", "clickhouse": ClickHouse service
	//
	// +kubebuilder:validation:Required
	ServiceKind string `json:"serviceKind"`

	// Describes the version of the service provided by the external service.
	// This is crucial for ensuring compatibility between different components of the system,
	// as different versions of a service may have varying features.
	//
	// +kubebuilder:validation:Required
	ServiceVersion string `json:"serviceVersion"`

	// Specifies the endpoint of the external service.
	//
	// If the service is exposed via a cluster, the endpoint will be provided in the format of <host>:<port>.
	//
	// +optional
	Endpoint *CredentialVar `json:"endpoint,omitempty"`

	// Specifies the service or IP address of the external service.
	//
	// +optional
	Host *CredentialVar `json:"host,omitempty"`

	// Specifies the port of the external service.
	//
	// +optional
	Port *CredentialVar `json:"port,omitempty"`

	// Specifies the authentication credentials required for accessing an external service.
	//
	// +optional
	Auth *ConnectionCredentialAuth `json:"auth,omitempty"`
}

ServiceDescriptorSpec defines the desired state of ServiceDescriptor.

func (*ServiceDescriptorSpec) DeepCopy added in v0.7.0

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

func (*ServiceDescriptorSpec) DeepCopyInto added in v0.7.0

func (in *ServiceDescriptorSpec) DeepCopyInto(out *ServiceDescriptorSpec)

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

type ServiceDescriptorStatus added in v0.7.0

type ServiceDescriptorStatus struct {
	// Indicates the current lifecycle phase of the ServiceDescriptor. This can be either 'Available' or 'Unavailable'.
	//
	// +optional
	Phase Phase `json:"phase,omitempty"`

	// Provides a human-readable explanation detailing the reason for the current phase of the ServiceConnectionCredential.
	//
	// +optional
	Message string `json:"message,omitempty"`

	// Represents the generation number that has been processed by the controller.
	//
	// +optional
	ObservedGeneration int64 `json:"observedGeneration,omitempty"`
}

ServiceDescriptorStatus defines the observed state of ServiceDescriptor

func (*ServiceDescriptorStatus) DeepCopy added in v0.7.0

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

func (*ServiceDescriptorStatus) DeepCopyInto added in v0.7.0

func (in *ServiceDescriptorStatus) DeepCopyInto(out *ServiceDescriptorStatus)

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

func (ServiceDescriptorStatus) GetTerminalPhases added in v0.7.0

func (r ServiceDescriptorStatus) GetTerminalPhases() []Phase

type ServicePort

type ServicePort struct {
	// The name of this port within the service. This must be a DNS_LABEL.
	// All ports within a ServiceSpec must have unique names. When considering
	// the endpoints for a Service, this must match the 'name' field in the
	// EndpointPort.
	// +kubebuilder:validation:Required
	Name string `json:"name,omitempty" protobuf:"bytes,1,opt,name=name"`

	// The IP protocol for this port. Supports "TCP", "UDP", and "SCTP".
	// Default is TCP.
	// +kubebuilder:validation:Enum={TCP,UDP,SCTP}
	// +default="TCP"
	// +optional
	Protocol corev1.Protocol `json:"protocol,omitempty" protobuf:"bytes,2,opt,name=protocol,casttype=Protocol"`

	// The application protocol for this port.
	// This field follows standard Kubernetes label syntax.
	// Un-prefixed names are reserved for IANA standard service names (as per
	// RFC-6335 and https://www.iana.org/assignments/service-names).
	// Non-standard protocols should use prefixed names such as
	// mycompany.com/my-custom-protocol.
	// +optional
	AppProtocol *string `json:"appProtocol,omitempty" protobuf:"bytes,6,opt,name=appProtocol"`

	// The port that will be exposed by this service.
	Port int32 `json:"port" protobuf:"varint,3,opt,name=port"`

	// Number or name of the port to access on the pods targeted by the service.
	//
	// Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME.
	//
	// - If this is a string, it will be looked up as a named port in the target Pod's container ports.
	// - If this is not specified, the value of the `port` field is used (an identity map).
	//
	// This field is ignored for services with clusterIP=None, and should be
	// omitted or set equal to the `port` field.
	//
	// More info: https://kubernetes.io/docs/concepts/services-networking/service/#defining-a-service
	//
	// +kubebuilder:validation:XIntOrString
	// +optional
	TargetPort intstr.IntOrString `json:"targetPort,omitempty" protobuf:"bytes,4,opt,name=targetPort"`
}

ServicePort is deprecated since v0.8.

func (*ServicePort) DeepCopy added in v0.6.0

func (in *ServicePort) DeepCopy() *ServicePort

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

func (*ServicePort) DeepCopyInto added in v0.6.0

func (in *ServicePort) DeepCopyInto(out *ServicePort)

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

type ServiceRef added in v0.7.0

type ServiceRef struct {
	// Specifies the identifier of the service reference declaration.
	// It corresponds to the serviceRefDeclaration name defined in either:
	//
	// - `componentDefinition.spec.serviceRefDeclarations[*].name`
	// - `clusterDefinition.spec.componentDefs[*].serviceRefDeclarations[*].name` (deprecated)
	//
	// +kubebuilder:validation:Required
	Name string `json:"name"`

	// Specifies the namespace of the referenced Cluster or the namespace of the referenced ServiceDescriptor object.
	// If not provided, the referenced Cluster and ServiceDescriptor will be searched in the namespace of the current
	// Cluster by default.
	//
	// +optional
	Namespace string `json:"namespace,omitempty"`

	// Specifies the name of the KubeBlocks Cluster being referenced.
	// This is used when services from another KubeBlocks Cluster are consumed.
	//
	// By default, the referenced KubeBlocks Cluster's `clusterDefinition.spec.connectionCredential`
	// will be utilized to bind to the current Component. This credential should include:
	// `endpoint`, `port`, `username`, and `password`.
	//
	// Note:
	//
	// - The `ServiceKind` and `ServiceVersion` specified in the service reference within the
	//   ClusterDefinition are not validated when using this approach.
	// - If both `cluster` and `serviceDescriptor` are present, `cluster` will take precedence.
	//
	// Deprecated since v0.9 since `clusterDefinition.spec.connectionCredential` is deprecated,
	// use `clusterServiceSelector` instead.
	// This field is maintained for backward compatibility and its use is discouraged.
	// Existing usage should be updated to the current preferred approach to avoid compatibility issues in future releases.
	//
	// +kubebuilder:deprecatedversion:warning="This field has been deprecated since 0.9.0"
	// +optional
	Cluster string `json:"cluster,omitempty"`

	// References a service provided by another KubeBlocks Cluster.
	// It specifies the ClusterService and the account credentials needed for access.
	//
	// +optional
	ClusterServiceSelector *ServiceRefClusterSelector `json:"clusterServiceSelector,omitempty"`

	// Specifies the name of the ServiceDescriptor object that describes a service provided by external sources.
	//
	// When referencing a service provided by external sources, a ServiceDescriptor object is required to establish
	// the service binding.
	// The `serviceDescriptor.spec.serviceKind` and `serviceDescriptor.spec.serviceVersion` should match the serviceKind
	// and serviceVersion declared in the definition.
	//
	// If both `cluster` and `serviceDescriptor` are specified, the `cluster` takes precedence.
	//
	// +optional
	ServiceDescriptor string `json:"serviceDescriptor,omitempty"`
}

func (*ServiceRef) DeepCopy added in v0.7.0

func (in *ServiceRef) DeepCopy() *ServiceRef

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

func (*ServiceRef) DeepCopyInto added in v0.7.0

func (in *ServiceRef) DeepCopyInto(out *ServiceRef)

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

type ServiceRefClusterSelector added in v0.9.0

type ServiceRefClusterSelector struct {
	// The name of the Cluster being referenced.
	//
	// +kubebuilder:validation:Required
	Cluster string `json:"cluster"`

	// Identifies a ClusterService from the list of Services defined in `cluster.spec.services` of the referenced Cluster.
	//
	// +optional
	Service *ServiceRefServiceSelector `json:"service,omitempty"`

	// Specifies the SystemAccount to authenticate and establish a connection with the referenced Cluster.
	// The SystemAccount should be defined in `componentDefinition.spec.systemAccounts`
	// of the Component providing the service in the referenced Cluster.
	//
	// +optional
	Credential *ServiceRefCredentialSelector `json:"credential,omitempty"`
}

func (*ServiceRefClusterSelector) DeepCopy added in v0.9.0

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

func (*ServiceRefClusterSelector) DeepCopyInto added in v0.9.0

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

type ServiceRefCredentialSelector added in v0.9.0

type ServiceRefCredentialSelector struct {
	// The name of the Component where the credential resides in.
	//
	// +kubebuilder:validation:Required
	Component string `json:"component"`

	// The name of the credential (SystemAccount) to reference.
	//
	// +kubebuilder:validation:Required
	Name string `json:"name"`
}

func (*ServiceRefCredentialSelector) DeepCopy added in v0.9.0

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

func (*ServiceRefCredentialSelector) DeepCopyInto added in v0.9.0

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

type ServiceRefDeclaration added in v0.7.0

type ServiceRefDeclaration struct {
	// Specifies the name of the ServiceRefDeclaration.
	//
	// +kubebuilder:validation:Required
	Name string `json:"name"`

	// Defines a list of constraints and requirements for services that can be bound to this ServiceRefDeclaration
	// upon Cluster creation.
	// Each ServiceRefDeclarationSpec defines a ServiceKind and ServiceVersion,
	// outlining the acceptable service types and versions that are compatible.
	//
	// This flexibility allows a ServiceRefDeclaration to be fulfilled by any one of the provided specs.
	// For example, if it requires an OLTP database, specs for both MySQL and PostgreSQL are listed,
	// either MySQL or PostgreSQL services can be used when binding.
	//
	// +kubebuilder:validation:Required
	ServiceRefDeclarationSpecs []ServiceRefDeclarationSpec `json:"serviceRefDeclarationSpecs"`

	// Specifies whether the service reference can be optional.
	//
	// For an optional service-ref, the component can still be created even if the service-ref is not provided.
	//
	// +optional
	Optional *bool `json:"optional,omitempty"`
}

ServiceRefDeclaration represents a reference to a service that can be either provided by a KubeBlocks Cluster or an external service. It acts as a placeholder for the actual service reference, which is determined later when a Cluster is created.

The purpose of ServiceRefDeclaration is to declare a service dependency without specifying the concrete details of the service. It allows for flexibility and abstraction in defining service references within a Component. By using ServiceRefDeclaration, you can define service dependencies in a declarative manner, enabling loose coupling and easier management of service references across different components and clusters.

Upon Cluster creation, the ServiceRefDeclaration is bound to an actual service through the ServiceRef field, effectively resolving and connecting to the specified service.

func (*ServiceRefDeclaration) DeepCopy added in v0.7.0

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

func (*ServiceRefDeclaration) DeepCopyInto added in v0.7.0

func (in *ServiceRefDeclaration) DeepCopyInto(out *ServiceRefDeclaration)

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

type ServiceRefDeclarationSpec added in v0.7.0

type ServiceRefDeclarationSpec struct {
	// Specifies the type or nature of the service. This should be a well-known application cluster type, such as
	// {mysql, redis, mongodb}.
	// The field is case-insensitive and supports abbreviations for some well-known databases.
	// For instance, both `zk` and `zookeeper` are considered as a ZooKeeper cluster, while `pg`, `postgres`, `postgresql`
	// are all recognized as a PostgreSQL cluster.
	//
	// +kubebuilder:validation:Required
	ServiceKind string `json:"serviceKind"`

	// Defines the service version of the service reference. This is a regular expression that matches a version number pattern.
	// For instance, `^8.0.8$`, `8.0.\d{1,2}$`, `^[v\-]*?(\d{1,2}\.){0,3}\d{1,2}$` are all valid patterns.
	//
	// +kubebuilder:validation:Required
	ServiceVersion string `json:"serviceVersion"`
}

func (*ServiceRefDeclarationSpec) DeepCopy added in v0.7.0

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

func (*ServiceRefDeclarationSpec) DeepCopyInto added in v0.7.0

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

type ServiceRefServiceSelector added in v0.9.0

type ServiceRefServiceSelector struct {
	// The name of the Component where the Service resides in.
	//
	// It is required when referencing a Component's Service.
	//
	// +optional
	Component string `json:"component,omitempty"`

	// The name of the Service to be referenced.
	//
	// Leave it empty to reference the default Service. Set it to "headless" to reference the default headless Service.
	//
	// If the referenced Service is of pod-service type (a Service per Pod), there will be multiple Service objects matched,
	// and the resolved value will be presented in the following format: service1.name,service2.name...
	//
	// +kubebuilder:validation:Required
	Service string `json:"service"`

	// The port name of the Service to be referenced.
	//
	// If there is a non-zero node-port exist for the matched Service port, the node-port will be selected first.
	//
	// If the referenced Service is of pod-service type (a Service per Pod), there will be multiple Service objects matched,
	// and the resolved value will be presented in the following format: service1.name:port1,service2.name:port2...
	//
	// +optional
	Port string `json:"port,omitempty"`
}

func (*ServiceRefServiceSelector) DeepCopy added in v0.9.0

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

func (*ServiceRefServiceSelector) DeepCopyInto added in v0.9.0

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

type ServiceRefVarSelector added in v0.8.0

type ServiceRefVarSelector struct {
	// The ServiceRefDeclaration to select from.
	ClusterObjectReference `json:",inline"`

	ServiceRefVars `json:",inline"`
}

ServiceRefVarSelector selects a var from a ServiceRefDeclaration.

func (*ServiceRefVarSelector) DeepCopy added in v0.8.0

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

func (*ServiceRefVarSelector) DeepCopyInto added in v0.8.0

func (in *ServiceRefVarSelector) DeepCopyInto(out *ServiceRefVarSelector)

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

type ServiceRefVars added in v0.8.0

type ServiceRefVars struct {
	// +optional
	Endpoint *VarOption `json:"endpoint,omitempty"`

	// +optional
	Host *VarOption `json:"host,omitempty"`

	// +optional
	Port *VarOption `json:"port,omitempty"`

	CredentialVars `json:",inline"`
}

ServiceRefVars defines the vars that can be referenced from a ServiceRef.

func (*ServiceRefVars) DeepCopy added in v0.8.0

func (in *ServiceRefVars) DeepCopy() *ServiceRefVars

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

func (*ServiceRefVars) DeepCopyInto added in v0.8.0

func (in *ServiceRefVars) DeepCopyInto(out *ServiceRefVars)

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

type ServiceSpec

type ServiceSpec struct {
	// The list of ports that are exposed by this service.
	// More info: https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies
	//
	// +patchMergeKey=port
	// +patchStrategy=merge
	// +listType=map
	// +listMapKey=port
	// +listMapKey=protocol
	// +optional
	Ports []ServicePort `json:"ports,omitempty" patchStrategy:"merge" patchMergeKey:"port" protobuf:"bytes,1,rep,name=ports"`
}

ServiceSpec is deprecated since v0.8.

func (*ServiceSpec) DeepCopy added in v0.6.0

func (in *ServiceSpec) DeepCopy() *ServiceSpec

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

func (*ServiceSpec) DeepCopyInto added in v0.6.0

func (in *ServiceSpec) DeepCopyInto(out *ServiceSpec)

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

func (*ServiceSpec) ToSVCPorts added in v0.8.0

func (r *ServiceSpec) ToSVCPorts() []corev1.ServicePort

func (ServiceSpec) ToSVCSpec

func (r ServiceSpec) ToSVCSpec() corev1.ServiceSpec

type ServiceVarSelector added in v0.8.0

type ServiceVarSelector struct {
	// The Service to select from.
	// It can be referenced from the default headless service by setting the name to "headless".
	ClusterObjectReference `json:",inline"`

	ServiceVars `json:",inline"`
}

ServiceVarSelector selects a var from a Service.

func (*ServiceVarSelector) DeepCopy added in v0.8.0

func (in *ServiceVarSelector) DeepCopy() *ServiceVarSelector

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

func (*ServiceVarSelector) DeepCopyInto added in v0.8.0

func (in *ServiceVarSelector) DeepCopyInto(out *ServiceVarSelector)

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

type ServiceVars added in v0.8.0

type ServiceVars struct {
	// +optional
	Host *VarOption `json:"host,omitempty"`

	// LoadBalancer represents the LoadBalancer ingress point of the service.
	//
	// If multiple ingress points are available, the first one will be used automatically, choosing between IP and Hostname.
	//
	// +optional
	LoadBalancer *VarOption `json:"loadBalancer,omitempty"`

	// Port references a port or node-port defined in the service.
	//
	// If the referenced service is a pod-service, there will be multiple service objects matched,
	// and the value will be presented in the following format: service1.name:port1,service2.name:port2...
	//
	// +optional
	Port *NamedVar `json:"port,omitempty"`
}

ServiceVars defines the vars that can be referenced from a Service.

func (*ServiceVars) DeepCopy added in v0.8.0

func (in *ServiceVars) DeepCopy() *ServiceVars

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

func (*ServiceVars) DeepCopyInto added in v0.8.0

func (in *ServiceVars) DeepCopyInto(out *ServiceVars)

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

type ShardingSpec added in v0.8.2

type ShardingSpec struct {
	// Represents the common parent part of all shard names.
	// This identifier is included as part of the Service DNS name and must comply with IANA service naming rules.
	// It is used to generate the names of underlying Components following the pattern `$(shardingSpec.name)-$(ShardID)`.
	// ShardID is a random string that is appended to the Name to generate unique identifiers for each shard.
	// For example, if the sharding specification name is "my-shard" and the ShardID is "abc", the resulting Component name
	// would be "my-shard-abc".
	//
	// Note that the name defined in Component template(`shardingSpec.template.name`) will be disregarded
	// when generating the Component names of the shards. The `shardingSpec.name` field takes precedence.
	//
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MaxLength=15
	// +kubebuilder:validation:Pattern:=`^[a-z0-9]([a-z0-9\.\-]*[a-z0-9])?$`
	// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="name is immutable"
	Name string `json:"name"`

	// The template for generating Components for shards, where each shard consists of one Component.
	// This field is of type ClusterComponentSpec, which encapsulates all the required details and
	// definitions for creating and managing the Components.
	// KubeBlocks uses this template to generate a set of identical Components or shards.
	// All the generated Components will have the same specifications and definitions as specified in the `template` field.
	//
	// This allows for the creation of multiple Components with consistent configurations,
	// enabling sharding and distribution of workloads across Components.
	//
	// +kubebuilder:validation:Required
	Template ClusterComponentSpec `json:"template"`

	// Specifies the desired number of shards.
	// Users can declare the desired number of shards through this field.
	// KubeBlocks dynamically creates and deletes Components based on the difference
	// between the desired and actual number of shards.
	// KubeBlocks provides lifecycle management for sharding, including:
	//
	// - Executing the postProvision Action defined in the ComponentDefinition when the number of shards increases.
	//   This allows for custom actions to be performed after a new shard is provisioned.
	// - Executing the preTerminate Action defined in the ComponentDefinition when the number of shards decreases.
	//   This enables custom cleanup or data migration tasks to be executed before a shard is terminated.
	//   Resources and data associated with the corresponding Component will also be deleted.
	//
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:Minimum=0
	// +kubebuilder:validation:Maximum=2048
	Shards int32 `json:"shards,omitempty"`
}

ShardingSpec defines how KubeBlocks manage dynamic provisioned shards. A typical design pattern for distributed databases is to distribute data across multiple shards, with each shard consisting of multiple replicas. Therefore, KubeBlocks supports representing a shard with a Component and dynamically instantiating Components using a template when shards are added. When shards are removed, the corresponding Components are also deleted.

func (*ShardingSpec) DeepCopy added in v0.8.2

func (in *ShardingSpec) DeepCopy() *ShardingSpec

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

func (*ShardingSpec) DeepCopyInto added in v0.8.2

func (in *ShardingSpec) DeepCopyInto(out *ShardingSpec)

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

type SpecificOpsRequest added in v0.9.0

type SpecificOpsRequest struct {
	// Specifies the desired new version of the Cluster.
	//
	// Note: This field is immutable once set.
	//
	// +optional
	// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="forbidden to update spec.upgrade"
	Upgrade *Upgrade `json:"upgrade,omitempty"`

	// Lists HorizontalScaling objects, each specifying scaling requirements for a Component,
	// including desired replica changes, configurations for new instances, modifications for existing instances,
	// and take offline/online the specified instances.
	//
	// +optional
	// +patchMergeKey=componentName
	// +patchStrategy=merge,retainKeys
	// +listType=map
	// +listMapKey=componentName
	// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="forbidden to update spec.horizontalScaling"
	HorizontalScalingList []HorizontalScaling `json:"horizontalScaling,omitempty"  patchStrategy:"merge,retainKeys" patchMergeKey:"componentName"`

	// Lists VolumeExpansion objects, each specifying a component and its corresponding volumeClaimTemplates
	// that requires storage expansion.
	//
	// +optional
	// +patchMergeKey=componentName
	// +patchStrategy=merge,retainKeys
	// +listType=map
	// +listMapKey=componentName
	VolumeExpansionList []VolumeExpansion `json:"volumeExpansion,omitempty"  patchStrategy:"merge,retainKeys" patchMergeKey:"componentName"`

	// Lists Components to be restarted.
	//
	// +optional
	// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="forbidden to update spec.restart"
	// +kubebuilder:validation:MaxItems=1024
	// +patchMergeKey=componentName
	// +patchStrategy=merge,retainKeys
	// +listType=map
	// +listMapKey=componentName
	RestartList []ComponentOps `json:"restart,omitempty" patchStrategy:"merge,retainKeys" patchMergeKey:"componentName"`

	// Lists Switchover objects, each specifying a Component to perform the switchover operation.
	//
	// +optional
	// +patchMergeKey=componentName
	// +patchStrategy=merge,retainKeys
	// +listType=map
	// +listMapKey=componentName
	// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="forbidden to update spec.switchover"
	SwitchoverList []Switchover `json:"switchover,omitempty"  patchStrategy:"merge,retainKeys" patchMergeKey:"componentName"`

	// Lists VerticalScaling objects, each specifying a component and its desired compute resources for vertical scaling.
	//
	// +kubebuilder:validation:MaxItems=1024
	// +optional
	// +patchMergeKey=componentName
	// +patchStrategy=merge,retainKeys
	// +listType=map
	// +listMapKey=componentName
	VerticalScalingList []VerticalScaling `json:"verticalScaling,omitempty"  patchStrategy:"merge,retainKeys" patchMergeKey:"componentName"`

	// Specifies a component and its configuration updates.
	//
	// This field is deprecated and replaced by `reconfigures`.
	//
	// +optional
	Reconfigure *Reconfigure `json:"reconfigure,omitempty"`

	// Lists Reconfigure objects, each specifying a Component and its configuration updates.
	//
	// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="forbidden to update spec.reconfigure"
	// +optional
	// +patchMergeKey=componentName
	// +patchStrategy=merge,retainKeys
	// +listType=map
	// +listMapKey=componentName
	Reconfigures []Reconfigure `json:"reconfigures,omitempty"  patchStrategy:"merge,retainKeys" patchMergeKey:"componentName"`

	// Lists Expose objects, each specifying a Component and its services to be exposed.
	//
	// +optional
	ExposeList []Expose `json:"expose,omitempty"`

	// Specifies the image and scripts for executing engine-specific operations such as creating databases or users.
	// It supports limited engines including MySQL, PostgreSQL, Redis, MongoDB.
	//
	// ScriptSpec has been replaced by the more versatile OpsDefinition.
	// It is recommended to use OpsDefinition instead.
	// ScriptSpec is deprecated and will be removed in a future version.
	//
	// +optional
	ScriptSpec *ScriptSpec `json:"scriptSpec,omitempty"`

	// Specifies the parameters to backup a Cluster.
	// +optional
	Backup *Backup `json:"backup,omitempty"`

	// Deprecated: since v0.9, use backup instead.
	// Specifies the parameters to backup a Cluster.
	// +optional
	// +kubebuilder:deprecatedversion:warning="This field has been deprecated since 0.9.0"
	BackupSpec *Backup `json:"backupSpec,omitempty"`

	// Specifies the parameters to restore a Cluster.
	// Note that this restore operation will roll back cluster services.
	//
	// +optional
	Restore *Restore `json:"restore,omitempty"`

	// Deprecated: since v0.9, use restore instead.
	// Specifies the parameters to restore a Cluster.
	// Note that this restore operation will roll back cluster services.
	// +kubebuilder:deprecatedversion:warning="This field has been deprecated since 0.9.0"
	// +optional
	RestoreSpec *Restore `json:"restoreSpec,omitempty"`

	// Specifies the parameters to rebuild some instances.
	// Rebuilding an instance involves restoring its data from a backup or another database replica.
	// The instances being rebuilt usually serve as standby in the cluster.
	// Hence rebuilding instances is often also referred to as "standby reconstruction".
	//
	// +optional
	// +patchMergeKey=componentName
	// +patchStrategy=merge,retainKeys
	// +listType=map
	// +listMapKey=componentName
	// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="forbidden to update spec.rebuildFrom"
	RebuildFrom []RebuildInstance `json:"rebuildFrom,omitempty"  patchStrategy:"merge,retainKeys" patchMergeKey:"componentName"`

	// Specifies a custom operation defined by OpsDefinition.
	//
	// +optional
	CustomOps *CustomOps `json:"custom,omitempty"`
}

func (*SpecificOpsRequest) DeepCopy added in v0.9.0

func (in *SpecificOpsRequest) DeepCopy() *SpecificOpsRequest

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

func (*SpecificOpsRequest) DeepCopyInto added in v0.9.0

func (in *SpecificOpsRequest) DeepCopyInto(out *SpecificOpsRequest)

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

type StatefulSetSpec added in v0.6.0

type StatefulSetSpec struct {
	// Specifies the strategy for updating Pods.
	// For workloadType=`Consensus`, the update strategy can be one of the following:
	//
	// - `Serial`: Updates Members sequentially to minimize component downtime.
	// - `BestEffortParallel`: Updates Members in parallel to minimize component write downtime. Majority remains online
	// at all times.
	// - `Parallel`: Forces parallel updates.
	//
	// +kubebuilder:default=Serial
	// +optional
	UpdateStrategy UpdateStrategy `json:"updateStrategy,omitempty"`

	// Controls the creation of pods during initial scale up, replacement of pods on nodes, and scaling down.
	//
	// - `OrderedReady`: Creates pods in increasing order (pod-0, then pod-1, etc). The controller waits until each pod
	// is ready before continuing. Pods are removed in reverse order when scaling down.
	// - `Parallel`: Creates pods in parallel to match the desired scale without waiting. All pods are deleted at once
	// when scaling down.
	//
	// +optional
	LLPodManagementPolicy appsv1.PodManagementPolicyType `json:"llPodManagementPolicy,omitempty"`

	// Specifies the low-level StatefulSetUpdateStrategy to be used when updating Pods in the StatefulSet upon a
	// revision to the Template.
	// `UpdateStrategy` will be ignored if this is provided.
	//
	// +optional
	LLUpdateStrategy *appsv1.StatefulSetUpdateStrategy `json:"llUpdateStrategy,omitempty"`
}

StatefulSetSpec is deprecated since v0.7.

func (*StatefulSetSpec) DeepCopy added in v0.6.0

func (in *StatefulSetSpec) DeepCopy() *StatefulSetSpec

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

func (*StatefulSetSpec) DeepCopyInto added in v0.6.0

func (in *StatefulSetSpec) DeepCopyInto(out *StatefulSetSpec)

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

func (*StatefulSetSpec) FinalStsUpdateStrategy added in v0.6.0

func (*StatefulSetSpec) GetUpdateStrategy added in v0.6.0

func (r *StatefulSetSpec) GetUpdateStrategy() UpdateStrategy

type StatefulSetWorkload added in v0.6.0

type StatefulSetWorkload interface {
	FinalStsUpdateStrategy() (appsv1.PodManagementPolicyType, appsv1.StatefulSetUpdateStrategy)
	GetUpdateStrategy() UpdateStrategy
}

StatefulSetWorkload interface +kubebuilder:object:generate=false

type StatelessSetSpec added in v0.6.0

type StatelessSetSpec struct {
	// Specifies the deployment strategy that will be used to replace existing pods with new ones.
	//
	// +patchStrategy=retainKeys
	// +optional
	UpdateStrategy appsv1.DeploymentStrategy `json:"updateStrategy,omitempty"`
}

StatelessSetSpec is deprecated since v0.7.

func (*StatelessSetSpec) DeepCopy added in v0.6.0

func (in *StatelessSetSpec) DeepCopy() *StatelessSetSpec

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

func (*StatelessSetSpec) DeepCopyInto added in v0.6.0

func (in *StatelessSetSpec) DeepCopyInto(out *StatelessSetSpec)

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

type StorageConstraint added in v0.6.0

type StorageConstraint struct {
	// The minimum size of storage.
	// +kubebuilder:default="20Gi"
	// +optional
	Min *resource.Quantity `json:"min,omitempty"`

	// The maximum size of storage.
	// +kubebuilder:default="10Ti"
	// +optional
	Max *resource.Quantity `json:"max,omitempty"`
}

func (*StorageConstraint) DeepCopy added in v0.6.0

func (in *StorageConstraint) DeepCopy() *StorageConstraint

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

func (*StorageConstraint) DeepCopyInto added in v0.6.0

func (in *StorageConstraint) DeepCopyInto(out *StorageConstraint)

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

type SwitchPolicyType

type SwitchPolicyType string

SwitchPolicyType defines the types of switch policies that can be applied to a cluster.

Currently, only the Noop policy is supported. Support for MaximumAvailability and MaximumDataProtection policies is planned for future releases.

+enum +kubebuilder:validation:Enum={Noop}

const (
	// MaximumAvailability represents a switch policy that aims for maximum availability. This policy will switch if the
	// primary is active and the synchronization delay is 0 according to the user-defined lagProbe data delay detection
	// logic. If the primary is down, it will switch immediately.
	// This policy is intended for future support.
	MaximumAvailability SwitchPolicyType = "MaximumAvailability"

	// MaximumDataProtection represents a switch policy focused on maximum data protection. This policy will only switch
	// if the primary is active and the synchronization delay is 0, based on the user-defined lagProbe data lag detection
	// logic. If the primary is down, it will switch only if it can be confirmed that the primary and secondary data are
	// consistent. Otherwise, it will not switch.
	// This policy is planned for future implementation.
	MaximumDataProtection SwitchPolicyType = "MaximumDataProtection"

	// Noop indicates that KubeBlocks will not perform any high-availability switching for the components. Users are
	// required to implement their own HA solution or integrate an existing open-source HA solution.
	Noop SwitchPolicyType = "Noop"
)

type Switchover added in v0.6.0

type Switchover struct {
	// Specifies the name of the Component.
	ComponentOps `json:",inline"`

	// Specifies the instance to become the primary or leader during a switchover operation.
	//
	// The value of `instanceName` can be either:
	//
	// 1. "*" (wildcard value):
	// - Indicates no specific instance is designated as the primary or leader.
	// - Executes the switchover action from `clusterDefinition.componentDefs[*].switchoverSpec.withoutCandidate`.
	// - `clusterDefinition.componentDefs[x].switchoverSpec.withoutCandidate` must be defined when using "*".
	//
	// 2. A valid instance name (pod name):
	// - Designates a specific instance (pod) as the primary or leader.
	// - The name must match one of the pods in the component. Any non-valid pod name is considered invalid.
	// - Executes the switchover action from `clusterDefinition.componentDefs[*].switchoverSpec.withCandidate`.
	// - `clusterDefinition.componentDefs[*].switchoverSpec.withCandidate` must be defined when specifying a valid instance name.
	//
	// +kubebuilder:validation:Required
	InstanceName string `json:"instanceName"`
}

func (*Switchover) DeepCopy added in v0.6.0

func (in *Switchover) DeepCopy() *Switchover

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

func (*Switchover) DeepCopyInto added in v0.6.0

func (in *Switchover) DeepCopyInto(out *Switchover)

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

type SwitchoverAction added in v0.6.0

type SwitchoverAction struct {
	// Specifies the switchover command.
	//
	// +kubebuilder:validation:Required
	CmdExecutorConfig *CmdExecutorConfig `json:"cmdExecutorConfig"`

	// Used to select the script that need to be referenced.
	// When defined, the scripts defined in scriptSpecs can be referenced within the SwitchoverAction.CmdExecutorConfig.
	//
	// +kubebuilder:deprecatedversion:warning="This field is deprecated from KB 0.9.0"
	// +optional
	ScriptSpecSelectors []ScriptSpecSelector `json:"scriptSpecSelectors,omitempty"`
}

SwitchoverAction is deprecated since v0.8.

func (*SwitchoverAction) DeepCopy added in v0.6.0

func (in *SwitchoverAction) DeepCopy() *SwitchoverAction

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

func (*SwitchoverAction) DeepCopyInto added in v0.6.0

func (in *SwitchoverAction) DeepCopyInto(out *SwitchoverAction)

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

type SwitchoverShortSpec added in v0.6.0

type SwitchoverShortSpec struct {
	// Represents the configuration for the command executor.
	//
	// +kubebuilder:validation:Required
	CmdExecutorConfig *CommandExecutorEnvItem `json:"cmdExecutorConfig"`
}

SwitchoverShortSpec represents a condensed version of the SwitchoverSpec.

Deprecated since v0.9. This struct is maintained for backward compatibility and its use is discouraged.

func (*SwitchoverShortSpec) DeepCopy added in v0.6.0

func (in *SwitchoverShortSpec) DeepCopy() *SwitchoverShortSpec

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

func (*SwitchoverShortSpec) DeepCopyInto added in v0.6.0

func (in *SwitchoverShortSpec) DeepCopyInto(out *SwitchoverShortSpec)

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

type SwitchoverSpec added in v0.6.0

type SwitchoverSpec struct {
	// Represents the action of switching over to a specified candidate primary or leader instance.
	//
	// +optional
	WithCandidate *SwitchoverAction `json:"withCandidate,omitempty"`

	// Represents the action of switching over without specifying a candidate primary or leader instance.
	//
	// +optional
	WithoutCandidate *SwitchoverAction `json:"withoutCandidate,omitempty"`
}

SwitchoverSpec is deprecated since v0.8.

func (*SwitchoverSpec) DeepCopy added in v0.6.0

func (in *SwitchoverSpec) DeepCopy() *SwitchoverSpec

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

func (*SwitchoverSpec) DeepCopyInto added in v0.6.0

func (in *SwitchoverSpec) DeepCopyInto(out *SwitchoverSpec)

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

type SystemAccount added in v0.8.0

type SystemAccount struct {
	// Specifies the unique identifier for the account. This name is used by other entities to reference the account.
	//
	// This field is immutable once set.
	//
	// +kubebuilder:validation:Required
	Name string `json:"name"`

	// Indicates if this account is a system initialization account (e.g., MySQL root).
	//
	// This field is immutable once set.
	//
	// +kubebuilder:default=false
	// +optional
	InitAccount bool `json:"initAccount,omitempty"`

	// Defines the statement used to create the account with the necessary privileges.
	//
	// This field is immutable once set.
	//
	// +optional
	Statement string `json:"statement,omitempty"`

	// Specifies the policy for generating the account's password.
	//
	// This field is immutable once set.
	//
	// +optional
	PasswordGenerationPolicy PasswordConfig `json:"passwordGenerationPolicy"`

	// Refers to the secret from which data will be copied to create the new account.
	//
	// This field is immutable once set.
	//
	// +optional
	SecretRef *ProvisionSecretRef `json:"secretRef,omitempty"`
}

func (*SystemAccount) DeepCopy added in v0.8.0

func (in *SystemAccount) DeepCopy() *SystemAccount

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

func (*SystemAccount) DeepCopyInto added in v0.8.0

func (in *SystemAccount) DeepCopyInto(out *SystemAccount)

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

type SystemAccountConfig

type SystemAccountConfig struct {
	// The unique identifier of a system account.
	//
	// +kubebuilder:validation:Required
	Name AccountName `json:"name"`

	// Outlines the strategy for creating the account.
	//
	// +kubebuilder:validation:Required
	ProvisionPolicy ProvisionPolicy `json:"provisionPolicy"`
}

SystemAccountConfig specifies how to create and delete system accounts.

Deprecated since v0.9.

func (*SystemAccountConfig) DeepCopy added in v0.6.0

func (in *SystemAccountConfig) DeepCopy() *SystemAccountConfig

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

func (*SystemAccountConfig) DeepCopyInto added in v0.6.0

func (in *SystemAccountConfig) DeepCopyInto(out *SystemAccountConfig)

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

type SystemAccountShortSpec added in v0.6.0

type SystemAccountShortSpec struct {
	// Configures the method for obtaining the client SDK and executing statements.
	//
	// +kubebuilder:validation:Required
	CmdExecutorConfig *CommandExecutorEnvItem `json:"cmdExecutorConfig"`
}

SystemAccountShortSpec represents a condensed version of the SystemAccountSpec.

Deprecated since v0.9. This struct is maintained for backward compatibility and its use is discouraged.

func (*SystemAccountShortSpec) DeepCopy added in v0.6.0

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

func (*SystemAccountShortSpec) DeepCopyInto added in v0.6.0

func (in *SystemAccountShortSpec) DeepCopyInto(out *SystemAccountShortSpec)

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

type SystemAccountSpec

type SystemAccountSpec struct {
	// Configures how to obtain the client SDK and execute statements.
	//
	// +kubebuilder:validation:Required
	CmdExecutorConfig *CmdExecutorConfig `json:"cmdExecutorConfig"`

	// Defines the pattern used to generate passwords for system accounts.
	//
	// +kubebuilder:validation:Required
	PasswordConfig PasswordConfig `json:"passwordConfig"`

	// Defines the configuration settings for system accounts.
	//
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MinItems=1
	// +patchMergeKey=name
	// +patchStrategy=merge,retainKeys
	// +listType=map
	// +listMapKey=name
	Accounts []SystemAccountConfig `json:"accounts" patchStrategy:"merge,retainKeys" patchMergeKey:"name"`
}

SystemAccountSpec specifies information to create system accounts.

Deprecated since v0.8, be replaced by `componentDefinition.spec.systemAccounts` and `componentDefinition.spec.lifecycleActions.accountProvision`.

func (*SystemAccountSpec) DeepCopy added in v0.6.0

func (in *SystemAccountSpec) DeepCopy() *SystemAccountSpec

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

func (*SystemAccountSpec) DeepCopyInto added in v0.6.0

func (in *SystemAccountSpec) DeepCopyInto(out *SystemAccountSpec)

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

type TLSConfig added in v0.8.0

type TLSConfig struct {
	// A boolean flag that indicates whether the Component should use Transport Layer Security (TLS)
	// for secure communication.
	// When set to true, the Component will be configured to use TLS encryption for its network connections.
	// This ensures that the data transmitted between the Component and its clients or other Components is encrypted
	// and protected from unauthorized access.
	// If TLS is enabled, the Component may require additional configuration,
	// such as specifying TLS certificates and keys, to properly set up the secure communication channel.
	//
	// +kubebuilder:default=false
	// +optional
	Enable bool `json:"enable,omitempty"`

	// Specifies the configuration for the TLS certificates issuer.
	// It allows defining the issuer name and the reference to the secret containing the TLS certificates and key.
	// The secret should contain the CA certificate, TLS certificate, and private key in the specified keys.
	// Required when TLS is enabled.
	//
	// +optional
	Issuer *Issuer `json:"issuer,omitempty"`
}

func (*TLSConfig) DeepCopy added in v0.8.0

func (in *TLSConfig) DeepCopy() *TLSConfig

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

func (*TLSConfig) DeepCopyInto added in v0.8.0

func (in *TLSConfig) DeepCopyInto(out *TLSConfig)

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

type TLSSecretRef

type TLSSecretRef struct {
	// Name of the Secret that contains user-provided certificates.
	// +kubebuilder:validation:Required
	Name string `json:"name"`

	// Key of CA cert in Secret
	// +kubebuilder:validation:Required
	CA string `json:"ca"`

	// Key of Cert in Secret
	// +kubebuilder:validation:Required
	Cert string `json:"cert"`

	// Key of TLS private key in Secret
	// +kubebuilder:validation:Required
	Key string `json:"key"`
}

TLSSecretRef defines Secret contains Tls certs

func (*TLSSecretRef) DeepCopy added in v0.6.0

func (in *TLSSecretRef) DeepCopy() *TLSSecretRef

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

func (*TLSSecretRef) DeepCopyInto added in v0.6.0

func (in *TLSSecretRef) DeepCopyInto(out *TLSSecretRef)

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

type TargetInstance

type TargetInstance struct {
	// Specifies the role to select one or more replicas for backup.
	//
	// - If no replica with the specified role exists, the backup task will fail.
	//   Special case: If there is only one replica in the cluster, it will be used for backup,
	//   even if its role differs from the specified one.
	//   For example, if you specify backing up on a secondary replica, but the cluster is single-node
	//   with only one primary replica, the primary will be used for backup.
	//   Future versions will address this special case using role priorities.
	// - If multiple replicas satisfy the specified role, the choice (`Any` or `All`) will be made according to
	//   the `strategy` field below.
	Role string `json:"role"`

	// If `backupPolicy.componentDefs` is set, this field is required to specify the system account name.
	// This account must match one listed in `componentDefinition.spec.systemAccounts[*].name`.
	// The corresponding secret created by this account is used to connect to the database.
	//
	// If `backupPolicy.componentDefRef` (a legacy and deprecated API) is set, the secret defined in
	// `clusterDefinition.spec.ConnectionCredential` is used instead.
	//
	// +optional
	Account string `json:"account,omitempty"`

	// Specifies the PodSelectionStrategy to use when multiple pods are
	// selected for the backup target.
	// Valid values are:
	//
	// - Any: Selects any one pod that matches the labelsSelector.
	// - All: Selects all pods that match the labelsSelector.
	//
	// +optional
	Strategy dpv1alpha1.PodSelectionStrategy `json:"strategy,omitempty"`

	// Specifies the keys of the connection credential secret defined in `clusterDefinition.spec.ConnectionCredential`.
	// It will be ignored when the `account` is set.
	//
	// +optional
	ConnectionCredentialKey ConnectionCredentialKey `json:"connectionCredentialKey,omitempty"`
}

func (*TargetInstance) DeepCopy added in v0.6.0

func (in *TargetInstance) DeepCopy() *TargetInstance

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

func (*TargetInstance) DeepCopyInto added in v0.6.0

func (in *TargetInstance) DeepCopyInto(out *TargetInstance)

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

type TargetPodSelector added in v0.8.0

type TargetPodSelector string

TargetPodSelector defines how to select pod(s) to execute an Action. +enum +kubebuilder:validation:Enum={Any,All,Role,Ordinal}

const (
	AnyReplica      TargetPodSelector = "Any"
	AllReplicas     TargetPodSelector = "All"
	RoleSelector    TargetPodSelector = "Role"
	OrdinalSelector TargetPodSelector = "Ordinal"
)

type TenancyType

type TenancyType string

TenancyType defines the type of tenancy for cluster tenant resources.

+enum +kubebuilder:validation:Enum={SharedNode,DedicatedNode}

const (
	// SharedNode means multiple pods may share the same node.
	SharedNode TenancyType = "SharedNode"

	// DedicatedNode means each pod runs on their own dedicated node.
	DedicatedNode TenancyType = "DedicatedNode"
)

type TerminationPolicyType

type TerminationPolicyType string

TerminationPolicyType defines termination policy types.

+enum +kubebuilder:validation:Enum={DoNotTerminate,Halt,Delete,WipeOut}

const (
	// DoNotTerminate will block delete operation.
	DoNotTerminate TerminationPolicyType = "DoNotTerminate"

	// Halt will delete workload resources such as statefulset, deployment workloads but keep PVCs.
	Halt TerminationPolicyType = "Halt"

	// Delete is based on Halt and deletes PVCs.
	Delete TerminationPolicyType = "Delete"

	// WipeOut is based on Delete and wipe out all volume snapshots and snapshot data from backup storage location.
	WipeOut TerminationPolicyType = "WipeOut"
)

type TypedObjectRef added in v0.9.0

type TypedObjectRef struct {
	// Specifies the group for the resource being referenced.
	// If not specified, the referenced Kind must belong to the core API group.
	// For all third-party types, this is mandatory.
	// +kubebuilder:validation:Required
	APIGroup *string `json:"apiGroup"`

	// Specifies the type of resource being referenced.
	// +kubebuilder:validation:Required
	Kind string `json:"kind"`

	// Indicates the name of the resource being referenced.
	// +kubebuilder:validation:Required
	Name string `json:"name"`
}

func (*TypedObjectRef) DeepCopy added in v0.9.0

func (in *TypedObjectRef) DeepCopy() *TypedObjectRef

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

func (*TypedObjectRef) DeepCopyInto added in v0.9.0

func (in *TypedObjectRef) DeepCopyInto(out *TypedObjectRef)

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

type UpdateStrategy

type UpdateStrategy string

UpdateStrategy defines the update strategy for cluster components. This strategy determines how updates are applied across the cluster. The available strategies are `Serial`, `BestEffortParallel`, and `Parallel`.

+enum +kubebuilder:validation:Enum={Serial,BestEffortParallel,Parallel}

const (
	// SerialStrategy indicates that updates are applied one at a time in a sequential manner.
	// The operator waits for each replica to be updated and ready before proceeding to the next one.
	// This ensures that only one replica is unavailable at a time during the update process.
	SerialStrategy UpdateStrategy = "Serial"

	// ParallelStrategy indicates that updates are applied simultaneously to all Pods of a Component.
	// The replicas are updated in parallel, with the operator updating all replicas concurrently.
	// This strategy provides the fastest update time but may lead to a period of reduced availability or
	// capacity during the update process.
	ParallelStrategy UpdateStrategy = "Parallel"

	// BestEffortParallelStrategy indicates that the replicas are updated in parallel, with the operator making
	// a best-effort attempt to update as many replicas as possible concurrently
	// while maintaining the component's availability.
	// Unlike the `Parallel` strategy, the `BestEffortParallel` strategy aims to ensure that a minimum number
	// of replicas remain available during the update process to maintain the component's quorum and functionality.
	//
	// For example, consider a component with 5 replicas. To maintain the component's availability and quorum,
	// the operator may allow a maximum of 2 replicas to be simultaneously updated. This ensures that at least
	// 3 replicas (a quorum) remain available and functional during the update process.
	//
	// The `BestEffortParallel` strategy strikes a balance between update speed and component availability.
	BestEffortParallelStrategy UpdateStrategy = "BestEffortParallel"
)

type UpdatedParameters

type UpdatedParameters struct {
	// Maps newly added configuration files to their content.
	// +optional
	AddedKeys map[string]string `json:"addedKeys,omitempty"`

	// Lists the name of configuration files that have been deleted.
	// +optional
	DeletedKeys map[string]string `json:"deletedKeys,omitempty"`

	// Maps the name of configuration files to their updated content, detailing the changes made.
	// +optional
	UpdatedKeys map[string]string `json:"updatedKeys,omitempty"`
}

UpdatedParameters holds details about the modifications made to configuration parameters. Example:

```yaml updatedParameters:

updatedKeys:
  my.cnf: '{"mysqld":{"max_connections":"100"}}'

```

func (*UpdatedParameters) DeepCopy added in v0.6.0

func (in *UpdatedParameters) DeepCopy() *UpdatedParameters

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

func (*UpdatedParameters) DeepCopyInto added in v0.6.0

func (in *UpdatedParameters) DeepCopyInto(out *UpdatedParameters)

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

type Upgrade

type Upgrade struct {
	// Deprecated: since v0.9 because ClusterVersion is deprecated.
	// Specifies the name of the target ClusterVersion for the upgrade.
	//
	// +kubebuilder:deprecatedversion:warning="This field has been deprecated since 0.9.0"
	ClusterVersionRef *string `json:"clusterVersionRef,omitempty"`

	// Lists components to be upgrade based on desired ComponentDefinition and ServiceVersion.
	// From the perspective of cluster API, the reasonable combinations should be:
	// 1. (comp-def, service-ver) - upgrade to the specified service version and component definition, the user takes the responsibility to ensure that they are compatible.
	// 2. ("", service-ver) - upgrade to the specified service version, let the operator choose the latest compatible component definition.
	// 3. (comp-def, "") - upgrade to the specified component definition, let the operator choose the latest compatible service version.
	// 4. ("", "") - upgrade to the latest service version and component definition, the operator will ensure the compatibility between the selected versions.
	// +patchMergeKey=componentName
	// +patchStrategy=merge,retainKeys
	// +listType=map
	// +listMapKey=componentName
	// +kubebuilder:validation:MaxItems=1024
	// +optional
	Components []UpgradeComponent `json:"components,omitempty" patchStrategy:"merge,retainKeys" patchMergeKey:"componentName"`
}

Upgrade defines the parameters for an upgrade operation.

func (*Upgrade) DeepCopy added in v0.6.0

func (in *Upgrade) DeepCopy() *Upgrade

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

func (*Upgrade) DeepCopyInto added in v0.6.0

func (in *Upgrade) DeepCopyInto(out *Upgrade)

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

type UpgradeComponent added in v0.9.0

type UpgradeComponent struct {
	// Specifies the name of the Component.
	ComponentOps `json:",inline"`

	// Specifies the name of the ComponentDefinition.
	// +kubebuilder:validation:MaxLength=64
	// +optional
	ComponentDefinitionName *string `json:"componentDefinitionName,omitempty"`

	// Specifies the version of the Service expected to be provisioned by this Component.
	// Referring to the ServiceVersion defined by the ComponentDefinition and ComponentVersion.
	// And ServiceVersion in ClusterComponentSpec is optional, when no version is specified,
	// use the latest available version in ComponentVersion.
	// +kubebuilder:validation:MaxLength=32
	// +optional
	ServiceVersion *string `json:"serviceVersion,omitempty"`
}

func (*UpgradeComponent) DeepCopy added in v0.9.0

func (in *UpgradeComponent) DeepCopy() *UpgradeComponent

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

func (*UpgradeComponent) DeepCopyInto added in v0.9.0

func (in *UpgradeComponent) DeepCopyInto(out *UpgradeComponent)

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

type UpgradePolicy

type UpgradePolicy string

UpgradePolicy defines the policy of reconfiguring. +enum +kubebuilder:validation:Enum={simple,parallel,rolling,autoReload,operatorSyncUpdate,dynamicReloadBeginRestart}

const (
	NonePolicy                    UpgradePolicy = "none"
	NormalPolicy                  UpgradePolicy = "simple"
	RestartPolicy                 UpgradePolicy = "parallel"
	RollingPolicy                 UpgradePolicy = "rolling"
	AsyncDynamicReloadPolicy      UpgradePolicy = "autoReload"
	SyncDynamicReloadPolicy       UpgradePolicy = "operatorSyncUpdate"
	DynamicReloadAndRestartPolicy UpgradePolicy = "dynamicReloadBeginRestart"
)

type UserResourceRefs added in v0.8.0

type UserResourceRefs struct {
	// SecretRefs defines the user-defined Secrets.
	//
	// +patchMergeKey=name
	// +patchStrategy=merge,retainKeys
	// +listType=map
	// +listMapKey=name
	// +optional
	SecretRefs []SecretRef `json:"secretRefs,omitempty"`

	// ConfigMapRefs defines the user-defined ConfigMaps.
	//
	// +patchMergeKey=name
	// +patchStrategy=merge,retainKeys
	// +listType=map
	// +listMapKey=name
	// +optional
	ConfigMapRefs []ConfigMapRef `json:"configMapRefs,omitempty"`
}

UserResourceRefs defines references to user-defined Secrets and ConfigMaps.

func (*UserResourceRefs) DeepCopy added in v0.8.0

func (in *UserResourceRefs) DeepCopy() *UserResourceRefs

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

func (*UserResourceRefs) DeepCopyInto added in v0.8.0

func (in *UserResourceRefs) DeepCopyInto(out *UserResourceRefs)

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

type ValueFrom added in v0.7.0

type ValueFrom struct {
	// Determine the appropriate version of the backup tool image from ClusterVersion.
	//
	// Deprecated since v0.9, since ClusterVersion is deprecated.
	// +optional
	ClusterVersionRef []ValueMapping `json:"clusterVersionRef,omitempty"`

	// Determine the appropriate version of the backup tool image from ComponentDefinition.
	//
	// +optional
	ComponentDef []ValueMapping `json:"componentDef,omitempty"`
}

func (*ValueFrom) DeepCopy added in v0.7.0

func (in *ValueFrom) DeepCopy() *ValueFrom

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

func (*ValueFrom) DeepCopyInto added in v0.7.0

func (in *ValueFrom) DeepCopyInto(out *ValueFrom)

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

type ValueMapping added in v0.8.0

type ValueMapping struct {
	// Represents an array of names of ClusterVersion or ComponentDefinition that can be mapped to
	// the appropriate version of the backup tool image.
	//
	// This mapping allows different versions of component images to correspond to specific versions of backup tool images.
	//
	// +kubebuilder:validation:Required
	Names []string `json:"names"`

	// Specifies the appropriate version of the backup tool image.
	//
	// +kubebuilder:validation:Required
	MappingValue string `json:"mappingValue"`
}

func (*ValueMapping) DeepCopy added in v0.8.0

func (in *ValueMapping) DeepCopy() *ValueMapping

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

func (*ValueMapping) DeepCopyInto added in v0.8.0

func (in *ValueMapping) DeepCopyInto(out *ValueMapping)

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

type VarOption added in v0.8.0

type VarOption string

VarOption defines whether a variable is required or optional. +enum +kubebuilder:validation:Enum={Required,Optional}

var (
	VarRequired VarOption = "Required"
	VarOptional VarOption = "Optional"
)

type VarSource added in v0.8.0

type VarSource struct {
	// Selects a key of a ConfigMap.
	// +optional
	ConfigMapKeyRef *corev1.ConfigMapKeySelector `json:"configMapKeyRef,omitempty"`

	// Selects a key of a Secret.
	// +optional
	SecretKeyRef *corev1.SecretKeySelector `json:"secretKeyRef,omitempty"`

	// Selects a defined var of host-network resources.
	// +optional
	HostNetworkVarRef *HostNetworkVarSelector `json:"hostNetworkVarRef,omitempty"`

	// Selects a defined var of a Service.
	// +optional
	ServiceVarRef *ServiceVarSelector `json:"serviceVarRef,omitempty"`

	// Selects a defined var of a Credential (SystemAccount).
	// +optional
	CredentialVarRef *CredentialVarSelector `json:"credentialVarRef,omitempty"`

	// Selects a defined var of a ServiceRef.
	// +optional
	ServiceRefVarRef *ServiceRefVarSelector `json:"serviceRefVarRef,omitempty"`

	// Selects a defined var of a Component.
	// +optional
	ComponentVarRef *ComponentVarSelector `json:"componentVarRef,omitempty"`
}

VarSource represents a source for the value of an EnvVar.

func (*VarSource) DeepCopy added in v0.8.0

func (in *VarSource) DeepCopy() *VarSource

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

func (*VarSource) DeepCopyInto added in v0.8.0

func (in *VarSource) DeepCopyInto(out *VarSource)

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

type VersionsContext

type VersionsContext struct {
	// Provides override values for ClusterDefinition.spec.componentDefs.podSpec.initContainers.
	// Typically used in scenarios such as updating application container images.
	//
	// +kubebuilder:pruning:PreserveUnknownFields
	// +patchMergeKey=name
	// +patchStrategy=merge
	// +listType=map
	// +listMapKey=name
	// +optional
	InitContainers []corev1.Container `json:"initContainers,omitempty"`

	// Provides override values for ClusterDefinition.spec.componentDefs.podSpec.containers.
	// Typically used in scenarios such as updating application container images.
	//
	// +kubebuilder:pruning:PreserveUnknownFields
	// +patchMergeKey=name
	// +patchStrategy=merge
	// +listType=map
	// +listMapKey=name
	// +optional
	Containers []corev1.Container `json:"containers,omitempty"`
}

VersionsContext is deprecated since v0.9. This struct is maintained for backward compatibility and its use is discouraged.

func (*VersionsContext) DeepCopy added in v0.6.0

func (in *VersionsContext) DeepCopy() *VersionsContext

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

func (*VersionsContext) DeepCopyInto added in v0.6.0

func (in *VersionsContext) DeepCopyInto(out *VersionsContext)

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

type VerticalScaling

type VerticalScaling struct {
	// Specifies the name of the Component.
	ComponentOps `json:",inline"`

	// Defines the desired compute resources of the Component's instances.
	//
	// +kubebuilder:pruning:PreserveUnknownFields
	corev1.ResourceRequirements `json:",inline"`

	// Specifies the desired compute resources of the instance template that need to vertical scale.
	// +patchMergeKey=name
	// +patchStrategy=merge,retainKeys
	// +listType=map
	// +listMapKey=name
	// +optional
	Instances []InstanceResourceTemplate `json:"instances,omitempty"  patchStrategy:"merge,retainKeys" patchMergeKey:"name"`
}

VerticalScaling refers to the process of adjusting compute resources (e.g., CPU, memory) allocated to a Component. It defines the parameters required for the operation.

func (*VerticalScaling) DeepCopy added in v0.6.0

func (in *VerticalScaling) DeepCopy() *VerticalScaling

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

func (*VerticalScaling) DeepCopyInto added in v0.6.0

func (in *VerticalScaling) DeepCopyInto(out *VerticalScaling)

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

type VolumeExpansion

type VolumeExpansion struct {
	// Specifies the name of the Component.
	ComponentOps `json:",inline"`

	// Specifies a list of OpsRequestVolumeClaimTemplate objects, defining the volumeClaimTemplates
	// that are used to expand the storage and the desired storage size for each one.
	//
	// +kubebuilder:validation:Required
	// +patchMergeKey=name
	// +patchStrategy=merge,retainKeys
	// +listType=map
	// +listMapKey=name
	VolumeClaimTemplates []OpsRequestVolumeClaimTemplate `json:"volumeClaimTemplates" patchStrategy:"merge,retainKeys" patchMergeKey:"name"`

	// Specifies the desired storage size of the instance template that need to volume expand.
	// +patchMergeKey=name
	// +patchStrategy=merge,retainKeys
	// +listType=map
	// +listMapKey=name
	// +optional
	Instances []InstanceVolumeClaimTemplate `json:"instances,omitempty"  patchStrategy:"merge,retainKeys" patchMergeKey:"name"`
}

VolumeExpansion encapsulates the parameters required for a volume expansion operation.

func (*VolumeExpansion) DeepCopy added in v0.6.0

func (in *VolumeExpansion) DeepCopy() *VolumeExpansion

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

func (*VolumeExpansion) DeepCopyInto added in v0.6.0

func (in *VolumeExpansion) DeepCopyInto(out *VolumeExpansion)

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

type VolumeProtectionSpec added in v0.6.0

type VolumeProtectionSpec struct {
	// The high watermark threshold for volume space usage.
	// If there is any specified volumes who's space usage is over the threshold, the pre-defined "LOCK" action
	// will be triggered to degrade the service to protect volume from space exhaustion, such as to set the instance
	// as read-only. And after that, if all volumes' space usage drops under the threshold later, the pre-defined
	// "UNLOCK" action will be performed to recover the service normally.
	//
	// +kubebuilder:validation:Maximum=100
	// +kubebuilder:validation:Minimum=0
	// +kubebuilder:default=90
	// +optional
	HighWatermark int `json:"highWatermark,omitempty"`

	// The Volumes to be protected.
	//
	// +optional
	Volumes []ProtectedVolume `json:"volumes,omitempty"`
}

VolumeProtectionSpec is deprecated since v0.9, replaced with ComponentVolume.HighWatermark.

func (*VolumeProtectionSpec) DeepCopy added in v0.6.0

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

func (*VolumeProtectionSpec) DeepCopyInto added in v0.6.0

func (in *VolumeProtectionSpec) DeepCopyInto(out *VolumeProtectionSpec)

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

type VolumeType

type VolumeType string

VolumeType defines the type of volume, specifically distinguishing between volumes used for backup data and those used for logs.

+enum +kubebuilder:validation:Enum={data,log}

const (
	// VolumeTypeData indicates a volume designated for storing backup data. This type of volume is optimized for the
	// storage and retrieval of data backups, ensuring data persistence and reliability.
	VolumeTypeData VolumeType = "data"

	// VolumeTypeLog indicates a volume designated for storing logs. This type of volume is optimized for log data,
	// facilitating efficient log storage, retrieval, and management.
	VolumeTypeLog VolumeType = "log"
)

type VolumeTypeSpec

type VolumeTypeSpec struct {
	// Corresponds to the name of the VolumeMounts field in PodSpec.Container.
	//
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:Pattern:=`^[a-z0-9]([a-z0-9\.\-]*[a-z0-9])?$`
	Name string `json:"name"`

	// Type of data the volume will persistent.
	//
	// +optional
	Type VolumeType `json:"type,omitempty"`
}

VolumeTypeSpec is deprecated since v0.9, replaced with ComponentVolume.

func (*VolumeTypeSpec) DeepCopy added in v0.6.0

func (in *VolumeTypeSpec) DeepCopy() *VolumeTypeSpec

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

func (*VolumeTypeSpec) DeepCopyInto added in v0.6.0

func (in *VolumeTypeSpec) DeepCopyInto(out *VolumeTypeSpec)

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

type WorkloadType

type WorkloadType string

WorkloadType defines the type of workload for the components of the ClusterDefinition. It can be one of the following: `Stateless`, `Stateful`, `Consensus`, or `Replication`.

Deprecated since v0.8.

+enum +kubebuilder:validation:Enum={Stateless,Stateful,Consensus,Replication}

const (
	// Stateless represents a workload type where components do not maintain state, and instances are interchangeable.
	Stateless WorkloadType = "Stateless"

	// Stateful represents a workload type where components maintain state, and each instance has a unique identity.
	Stateful WorkloadType = "Stateful"

	// Consensus represents a workload type involving distributed consensus algorithms for coordinated decision-making.
	Consensus WorkloadType = "Consensus"

	// Replication represents a workload type that involves replication, typically used for achieving high availability
	// and fault tolerance.
	Replication WorkloadType = "Replication"
)

Jump to

Keyboard shortcuts

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