v1alpha1

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package v1alpha1 contains API Schema definitions for the v1alpha1 API group +kubebuilder:object:generate=true +groupName=clickhouse.com

Index

Constants

View Source
const (
	// ConditionTypeSpecValid indicates that the Custom Resource passes validation.
	ConditionTypeSpecValid     ConditionType   = "SpecValid"
	ConditionReasonSpecInvalid ConditionReason = "SpecInvalid"
	ConditionReasonSpecValid   ConditionReason = "SpecValid"

	// ConditionTypeReconcileSucceeded indicates that latest reconciliation was successful.
	ConditionTypeReconcileSucceeded  ConditionType   = "ReconcileSucceeded"
	ConditionReasonStepFailed        ConditionReason = "ReconcileStepFailed"
	ConditionReasonReconcileFinished ConditionReason = "ReconcileFinished"

	// ConditionTypeReplicaStartupSucceeded indicates that all replicas of the cluster are able to start.
	ConditionTypeReplicaStartupSucceeded ConditionType   = "ReplicaStartupSucceeded"
	ConditionReasonReplicasRunning       ConditionReason = "ReplicasRunning"
	ConditionReasonReplicaError          ConditionReason = "ReplicaError"

	// ConditionTypeHealthy indicates that all replicas of the cluster are ready to accept connections.
	ConditionTypeHealthy            ConditionType   = "Healthy"
	ConditionReasonReplicasReady    ConditionReason = "ReplicasReady"
	ConditionReasonReplicasNotReady ConditionReason = "ReplicasNotReady"

	// ConditionTypeClusterSizeAligned indicates that cluster replica amount matches the requested value.
	ConditionTypeClusterSizeAligned ConditionType   = "ClusterSizeAligned"
	ConditionReasonUpToDate         ConditionReason = "UpToDate"
	ConditionReasonScalingDown      ConditionReason = "ScalingDown"
	ConditionReasonScalingUp        ConditionReason = "ScalingUp"

	// ConditionTypeConfigurationInSync indicates that cluster configuration is in desired state.
	ConditionTypeConfigurationInSync    ConditionType   = "ConfigurationInSync"
	ConditionReasonConfigurationChanged ConditionReason = "ConfigurationChanged"

	// ConditionTypeReady indicates that cluster is ready to serve client requests.
	ConditionTypeReady                      ConditionType   = "Ready"
	ClickHouseConditionAllShardsReady       ConditionReason = "AllShardsReady"
	ClickHouseConditionSomeShardsNotReady   ConditionReason = "SomeShardsNotReady"
	KeeperConditionReasonStandaloneReady    ConditionReason = "StandaloneReady"
	KeeperConditionReasonClusterReady       ConditionReason = "ClusterReady"
	KeeperConditionReasonNoLeader           ConditionReason = "NoLeader"
	KeeperConditionReasonInconsistentState  ConditionReason = "InconsistentState"
	KeeperConditionReasonNotEnoughFollowers ConditionReason = "NotEnoughFollowers"
)

Common condition types and reasons for all resources.

View Source
const (
	// ClickHouseConditionTypeSchemaInSync indicates that databases were created on all new replicas and deleted
	// replicas metadata was removed. This condition indicates that newly created replicas are ready to use or cluster
	// should operate normally after scale down, but it does not mean that all replicas have the same schema.
	ClickHouseConditionTypeSchemaInSync ConditionType = "SchemaInSync"

	ClickHouseConditionSchemaSyncDisabled   ConditionReason = "SchemaSyncDisabled"
	ClickHouseConditionReplicasInSync       ConditionReason = "ReplicasInSync"
	ClickHouseConditionDatabasesNotCreated  ConditionReason = "DatabasesNotCreated"
	ClickHouseConditionReplicasNotCleanedUp ConditionReason = "ReplicasNotCleanedUp"
)

ClickHouseCluster specific condition types and reasons.

View Source
const (
	// KeeperConditionTypeScaleAllowed indicates that cluster is ready to change quorum size.
	KeeperConditionTypeScaleAllowed ConditionType = "ScaleAllowed"

	KeeperConditionReasonReplicaHasPendingChanges ConditionReason = "ReplicaHasPendingChanges"
	KeeperConditionReasonReplicaNotReady          ConditionReason = "ReplicaNotReady"
	KeeperConditionReasonNoQuorum                 ConditionReason = "NoQuorum"
	KeeperConditionReasonWaitingFollowers         ConditionReason = "WaitingFollowers"
	KeeperConditionReasonReadyToScale             ConditionReason = "ReadyToScale"
)

KeeperCluster specific condition types and reasons.

View Source
const (
	DefaultKeeperContainerRepository = "docker.io/clickhouse/clickhouse-keeper"
	DefaultKeeperContainerTag        = "latest"
	DefaultKeeperContainerPolicy     = "IfNotPresent"

	DefaultKeeperCPULimit      = "1"
	DefaultKeeperCPURequest    = "250m"
	DefaultKeeperMemoryLimit   = "1Gi"
	DefaultKeeperMemoryRequest = "256Mi"

	DefaultKeeperReplicaCount = 3

	DefaultClickHouseContainerRepository = "docker.io/clickhouse/clickhouse-server"
	DefaultClickHouseContainerTag        = "latest"
	DefaultClickHouseContainerPolicy     = "IfNotPresent"

	DefaultClickHouseCPULimit      = "1"
	DefaultClickHouseCPURequest    = "250m"
	DefaultClickHouseMemoryLimit   = "1Gi"
	DefaultClickHouseMemoryRequest = "256Mi"

	DefaultClickHouseShardCount   = 1
	DefaultClickHouseReplicaCount = 3

	DefaultMaxLogFiles = 50

	// DefaultClusterDomain is the default Kubernetes cluster domain suffix for DNS resolution.
	DefaultClusterDomain = "cluster.local"
	DefaultAccessMode    = corev1.ReadWriteOnce
)
View Source
const (
	KeeperConfigMapNameSuffix = "configmap"
)

Variables

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

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

	// AddToScheme adds the types in this group-version to the given scheme.
	AddToScheme = SchemeBuilder.AddToScheme
)

Functions

This section is empty.

Types

type ClickHouseCluster

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

	Spec   ClickHouseClusterSpec   `json:"spec,omitempty"`
	Status ClickHouseClusterStatus `json:"status,omitempty"`
	// contains filtered or unexported fields
}

ClickHouseCluster is the Schema for the clickhouseclusters API. +kubebuilder:object:root=true +kubebuilder:subresource:status +kubebuilder:resource:shortName=chc;clickhouse +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.conditions[?(@.type==\"Ready\")].status" +kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.conditions[?(@.type==\"Ready\")].message" +kubebuilder:printcolumn:name="ReadyReplicas",type="number",JSONPath=".status.readyReplicas" +kubebuilder:printcolumn:name="Replicas",type="number",JSONPath=".spec.replicas" +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" +operator-sdk:csv:customresourcedefinitions:displayName="ClickHouse Cluster" +operator-sdk:csv:customresourcedefinitions:resources={{Pod,v1}} +operator-sdk:csv:customresourcedefinitions:resources={{PersistentVolumeClaim,v1}} +operator-sdk:csv:customresourcedefinitions:resources={{StatefulSet,v1}} +operator-sdk:csv:customresourcedefinitions:resources={{ConfigMap,v1}} +operator-sdk:csv:customresourcedefinitions:resources={{Secret,v1}} +operator-sdk:csv:customresourcedefinitions:resources={{Service,v1}} +operator-sdk:csv:customresourcedefinitions:resources={{PodDisruptionBudget,v1}}

func (*ClickHouseCluster) Conditions

func (v *ClickHouseCluster) Conditions() *[]metav1.Condition

Conditions returns pointer to the conditions slice.

func (*ClickHouseCluster) ConfigMapNameByReplicaID

func (v *ClickHouseCluster) ConfigMapNameByReplicaID(id ClickHouseReplicaID) string

ConfigMapNameByReplicaID returns name of the ConfigMap for the specific replica.

func (*ClickHouseCluster) DeepCopy

func (in *ClickHouseCluster) DeepCopy() *ClickHouseCluster

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

func (*ClickHouseCluster) DeepCopyInto

func (in *ClickHouseCluster) DeepCopyInto(out *ClickHouseCluster)

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

func (*ClickHouseCluster) DeepCopyObject

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

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

func (*ClickHouseCluster) GetStatus

GetStatus returns pointer to ClickHouseClusterStatus.

func (*ClickHouseCluster) HeadlessServiceName

func (v *ClickHouseCluster) HeadlessServiceName() string

HeadlessServiceName returns name of the headless service for the ClickHouseCluster.

func (*ClickHouseCluster) HostnameByID

func (v *ClickHouseCluster) HostnameByID(id ClickHouseReplicaID) string

HostnameByID returns domain name for the specific replica to access within Kubernetes cluster.

func (*ClickHouseCluster) NamespacedName

func (v *ClickHouseCluster) NamespacedName() types.NamespacedName

NamespacedName returns NamespacedName for the ClickHouseCluster.

func (*ClickHouseCluster) PodDisruptionBudgetNameByShard

func (v *ClickHouseCluster) PodDisruptionBudgetNameByShard(shard int32) string

PodDisruptionBudgetNameByShard returns name of the PodDisruptionBudget for the specific shard.

func (*ClickHouseCluster) ReplicaIDs

func (v *ClickHouseCluster) ReplicaIDs() iter.Seq[ClickHouseReplicaID]

ReplicaIDs returns sequence of ClickHouseReplicaID for every replica in the ClickHouseCluster.

func (*ClickHouseCluster) Replicas

func (v *ClickHouseCluster) Replicas() int32

Replicas returns requested number of replicas in each shard of the ClickHouseCluster.

func (*ClickHouseCluster) SecretName

func (v *ClickHouseCluster) SecretName() string

SecretName returns name of the Secret with operator generated values.

func (*ClickHouseCluster) Shards

func (v *ClickHouseCluster) Shards() int32

Shards returns requested number of shards in the ClickHouseCluster.

func (*ClickHouseCluster) SpecificName

func (v *ClickHouseCluster) SpecificName() string

SpecificName returns cluster name with resource suffix. Used to generate resource names that may be used in DNS.

func (*ClickHouseCluster) StatefulSetNameByReplicaID

func (v *ClickHouseCluster) StatefulSetNameByReplicaID(id ClickHouseReplicaID) string

StatefulSetNameByReplicaID returns name of the StatefulSet for the specific replica.

type ClickHouseClusterList

type ClickHouseClusterList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`

	Items []ClickHouseCluster `json:"items"`
}

ClickHouseClusterList contains a list of ClickHouseCluster.

func (*ClickHouseClusterList) DeepCopy

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

func (*ClickHouseClusterList) DeepCopyInto

func (in *ClickHouseClusterList) DeepCopyInto(out *ClickHouseClusterList)

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

func (*ClickHouseClusterList) DeepCopyObject

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

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

type ClickHouseClusterSpec

type ClickHouseClusterSpec struct {
	// Number of replicas in the single shard
	// This is a pointer to distinguish between explicit zero and unspecified.
	// +optional
	// +kubebuilder:default:=3
	// +kubebuilder:validation:Minimum=0
	// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Replica count in shard"
	Replicas *int32 `json:"replicas"`

	// Number of shards in the cluster
	// This is a pointer to distinguish between explicit zero and unspecified.
	// +optional
	// +kubebuilder:default:=1
	// +kubebuilder:validation:Minimum=0
	Shards *int32 `json:"shards"`

	// Reference to the KeeperCluster that is used for ClickHouse coordination.
	// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Keeper Cluster Reference"
	KeeperClusterRef *corev1.LocalObjectReference `json:"keeperClusterRef"`

	// Parameters passed to the Keeper pod spec.
	// +optional
	PodTemplate PodTemplateSpec `json:"podTemplate,omitempty"`

	// Parameters passed to the ClickHouse container spec.
	// +optional
	ContainerTemplate ContainerTemplateSpec `json:"containerTemplate,omitempty"`

	// Settings for the replicas storage.
	// +optional
	// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Data Volume Claim Spec"
	DataVolumeClaimSpec *corev1.PersistentVolumeClaimSpec `json:"dataVolumeClaimSpec,omitempty"`

	// Additional labels that are added to resources.
	// +optional
	Labels map[string]string `json:"labels,omitempty"`

	// Additional annotations that are added to resources.
	// +optional
	Annotations map[string]string `json:"annotations,omitempty"`

	// Configuration parameters for ClickHouse server.
	// +optional
	Settings ClickHouseSettings `json:"settings,omitempty"`

	// ClusterDomain is the Kubernetes cluster domain suffix used for DNS resolution.
	// Defaults to "cluster.local" if not specified.
	// +optional
	// +kubebuilder:default:="cluster.local"
	ClusterDomain string `json:"clusterDomain,omitempty"`
}

ClickHouseClusterSpec defines the desired state of ClickHouseCluster.

func (*ClickHouseClusterSpec) DeepCopy

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

func (*ClickHouseClusterSpec) DeepCopyInto

func (in *ClickHouseClusterSpec) DeepCopyInto(out *ClickHouseClusterSpec)

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

func (*ClickHouseClusterSpec) WithDefaults

func (s *ClickHouseClusterSpec) WithDefaults()

WithDefaults sets default values for ClickHouseClusterSpec fields.

type ClickHouseClusterStatus

type ClickHouseClusterStatus struct {
	// +listType=map
	// +listMapKey=type
	// +patchStrategy=merge
	// +patchMergeKey=type
	// +optional
	// +operator-sdk:csv:customresourcedefinitions:type=status
	Conditions []metav1.Condition `json:"conditions,omitempty"`
	// ReadyReplicas Total number of replicas ready to server requests.
	// +optional
	// +operator-sdk:csv:customresourcedefinitions:type=status
	ReadyReplicas int32 `json:"readyReplicas"`
	// ConfigurationRevision indicates target configuration revision for every replica.
	// +operator-sdk:csv:customresourcedefinitions:type=status
	ConfigurationRevision string `json:"configurationRevision,omitempty"`
	// StatefulSetRevision indicates target StatefulSet revision for every replica.
	// +operator-sdk:csv:customresourcedefinitions:type=status
	StatefulSetRevision string `json:"statefulSetRevision,omitempty"`

	// CurrentRevision indicates latest applied ClickHouseCluster spec revision.
	// +operator-sdk:csv:customresourcedefinitions:type=status
	CurrentRevision string `json:"currentRevision,omitempty"`
	// UpdateRevision indicates latest requested ClickHouseCluster spec revision.
	// +operator-sdk:csv:customresourcedefinitions:type=status
	UpdateRevision string `json:"updateRevision,omitempty"`
	// ObservedGeneration indicates latest generation observed by controller.
	// +operator-sdk:csv:customresourcedefinitions:type=status
	ObservedGeneration int64 `json:"observedGeneration,omitempty"`
}

ClickHouseClusterStatus defines the observed state of ClickHouseCluster.

func (*ClickHouseClusterStatus) DeepCopy

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

func (*ClickHouseClusterStatus) DeepCopyInto

func (in *ClickHouseClusterStatus) DeepCopyInto(out *ClickHouseClusterStatus)

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

type ClickHouseReplicaID

type ClickHouseReplicaID struct {
	ShardID int32
	Index   int32
}

ClickHouseReplicaID identifies a ClickHouse replica within the cluster. +kubebuilder:object:generate=false

func ClickHouseIDFromLabels

func ClickHouseIDFromLabels(labels map[string]string) (ClickHouseReplicaID, error)

ClickHouseIDFromLabels extracts ClickHouseReplicaID from given labels map.

func IDFromHostname

func IDFromHostname(v *ClickHouseCluster, hostname string) (ClickHouseReplicaID, error)

IDFromHostname extracts ClickHouseReplicaID from given hostname.

func (ClickHouseReplicaID) Labels

func (id ClickHouseReplicaID) Labels() map[string]string

Labels returns labels that should be set for every resource related to the specified replica.

func (ClickHouseReplicaID) MarshalLog

func (id ClickHouseReplicaID) MarshalLog() any

MarshalLog implements logr.Marshaler interface for pretty printing in logs.

func (ClickHouseReplicaID) String

func (id ClickHouseReplicaID) String() string

type ClickHouseSettings

type ClickHouseSettings struct {
	// Reference to the Secret key, which contains password for the user 'default'.
	// +optional
	DefaultUserPassword *DefaultPasswordSelector `json:"defaultUserPassword,omitempty"`

	// Optionally you can lower the logger level or disable logging to file at all.
	// +optional
	Logger LoggerConfig `json:"logger,omitempty"`

	// TLS settings, allows to enable TLS settings for ClickHouse.
	// +optional
	TLS ClusterTLSSpec `json:"tls,omitempty"`

	// Enables synchronization of ClickHouse databases to the newly created replicas by the operator.
	// Supports only Replicated and integration tables.
	// +optional
	// +kubebuilder:default:=true
	EnableDatabaseSync bool `json:"enableDatabaseSync,omitempty"`

	// Additional ClickHouse configuration that will be merged with the default one.
	// +nullable
	// +optional
	// +kubebuilder:pruning:PreserveUnknownFields
	ExtraConfig runtime.RawExtension `json:"extraConfig,omitempty"`

	// Additional ClickHouse users configuration that will be merged with the default one.
	// +nullable
	// +optional
	// +kubebuilder:pruning:PreserveUnknownFields
	ExtraUsersConfig runtime.RawExtension `json:"extraUsersConfig,omitempty"`
}

ClickHouseSettings defines ClickHouse server settings options.

func (*ClickHouseSettings) DeepCopy

func (in *ClickHouseSettings) DeepCopy() *ClickHouseSettings

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

func (*ClickHouseSettings) DeepCopyInto

func (in *ClickHouseSettings) DeepCopyInto(out *ClickHouseSettings)

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

type ClusterTLSSpec

type ClusterTLSSpec struct {
	// Enabled indicates whether TLS is enabled, determining if secure ports should be opened.
	// +kubebuilder:default:=false
	// +optional
	Enabled bool `json:"enabled"`
	// Required specifies whether TLS must be enforced for all connections. Disables not secure ports.
	// +kubebuilder:default:=false
	// +optional
	Required bool `json:"required,omitempty"`
	// ServerCertSecretRef is a reference to a TLS Secret containing the server certificate.
	// +optional
	ServerCertSecret *corev1.LocalObjectReference `json:"serverCertSecret,omitempty"`
	// CABundle is a reference to a TLS Secret containing the CA bundle.
	// If empty and ServerCertSecret is specified, the CA bundle from certificate will be used.
	// Otherwise, system trusted CA bundle will be used.
	// Key is defaulted to "ca.crt" if not specified.
	// +optional
	CABundle *SecretKeySelector `json:"caBundle,omitempty"`
}

ClusterTLSSpec defines cluster TLS configuration.

func (*ClusterTLSSpec) DeepCopy

func (in *ClusterTLSSpec) DeepCopy() *ClusterTLSSpec

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

func (*ClusterTLSSpec) DeepCopyInto

func (in *ClusterTLSSpec) DeepCopyInto(out *ClusterTLSSpec)

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

func (*ClusterTLSSpec) Validate

func (s *ClusterTLSSpec) Validate() error

Validate validates the ClusterTLSSpec configuration.

type ConditionReason

type ConditionReason string

ConditionReason represents the reason for a condition's Status.

type ConditionType

type ConditionType string

ConditionType represents the type of condition.

type ConfigMapKeySelector

type ConfigMapKeySelector struct {
	// The name of the configMap in the cluster's namespace to select from.
	// +kubebuilder:validation:Required
	Name string `json:"name,omitempty"`
	// The key of the configMap to select from. Must be a valid key.
	// +kubebuilder:validation:Required
	Key string `json:"key,omitempty"`
}

ConfigMapKeySelector selects a key of a ConfigMap.

func (*ConfigMapKeySelector) DeepCopy

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

func (*ConfigMapKeySelector) DeepCopyInto

func (in *ConfigMapKeySelector) DeepCopyInto(out *ConfigMapKeySelector)

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

type ContainerImage

type ContainerImage struct {
	// Container image registry name
	// Example: docker.io/clickhouse/clickhouse
	// +optional
	Repository string `json:"repository,omitempty"`

	// Container image tag
	// Example: 25.3
	// +optional
	Tag string `json:"tag,omitempty"`

	// Container image hash, mutually exclusive with 'tag'.
	// +optional
	Hash string `json:"hash,omitempty"`
}

ContainerImage defines a container image with repository, tag, and hash.

func (*ContainerImage) DeepCopy

func (in *ContainerImage) DeepCopy() *ContainerImage

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

func (*ContainerImage) DeepCopyInto

func (in *ContainerImage) DeepCopyInto(out *ContainerImage)

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

func (*ContainerImage) String

func (c *ContainerImage) String() string

type ContainerTemplateSpec

type ContainerTemplateSpec struct {
	// Image is the container image to be deployed.
	Image ContainerImage `json:"image,omitempty"`

	// ImagePullPolicy for the image, which defaults to IfNotPresent.
	// +optional
	// +kubebuilder:validation:Enum="Always";"Never";"IfNotPresent"
	ImagePullPolicy corev1.PullPolicy `json:"imagePullPolicy,omitempty"`

	// Resources is the resource requirements for the container.
	// This field cannot be updated once the cluster is created.
	// +optional
	Resources corev1.ResourceRequirements `json:"resources,omitempty"`

	// VolumeMounts is the list of volume mounts for the container.
	// +optional
	// +patchMergeKey=mountPath
	// +patchStrategy=merge
	// +listType=map
	// +listMapKey=mountPath
	VolumeMounts []corev1.VolumeMount `json:"volumeMounts,omitempty" patchMergeKey:"mountPath" patchStrategy:"merge"`

	// Env is the list of environment variables to set in the container.
	// +optional
	// +patchMergeKey=name
	// +patchStrategy=merge
	// +listType=map
	// +listMapKey=name
	Env []corev1.EnvVar `json:"env,omitempty" patchMergeKey:"name" patchStrategy:"merge"`

	// SecurityContext defines the security options the container should be run with.
	// If set, the fields of SecurityContext override the equivalent fields of PodSecurityContext.
	// More info: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
	// +optional
	SecurityContext *corev1.SecurityContext `json:"securityContext,omitempty"`
}

ContainerTemplateSpec describes the container configuration overrides for the cluster's containers.

func (*ContainerTemplateSpec) DeepCopy

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

func (*ContainerTemplateSpec) DeepCopyInto

func (in *ContainerTemplateSpec) DeepCopyInto(out *ContainerTemplateSpec)

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

type DefaultPasswordSelector

type DefaultPasswordSelector struct {
	// Type of the provided password. Consider documentation for possible values https://clickhouse.com/docs/operations/settings/settings-users#user-namepassword
	// +kubebuilder:default:=password
	PasswordType string `json:"passwordType,omitempty"`
	// Select password value from a Secret key
	// +optional
	Secret *SecretKeySelector `json:"secret,omitempty"`
	// Select password value from a ConfigMap key
	// +optional
	ConfigMap *ConfigMapKeySelector `json:"configMap,omitempty"`
}

DefaultPasswordSelector selects the source for the default user's password.

func (*DefaultPasswordSelector) DeepCopy

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

func (*DefaultPasswordSelector) DeepCopyInto

func (in *DefaultPasswordSelector) DeepCopyInto(out *DefaultPasswordSelector)

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

func (*DefaultPasswordSelector) Validate

func (s *DefaultPasswordSelector) Validate() error

Validate validates the DefaultPasswordSelector configuration.

type EventAction

type EventAction = string

EventAction represents the action associated with an event.

const (
	EventActionReconciling    EventAction = "Reconciling"
	EventActionScaling        EventAction = "Scaling"
	EventActionBecameReady    EventAction = "BecameReady"
	EventActionBecameNotReady EventAction = "BecameNotReady"
)

type EventReason

type EventReason = string

EventReason represents the reason for an event.

const (
	EventReasonFailedCreate EventReason = "FailedCreate"
	EventReasonFailedUpdate EventReason = "FailedUpdate"
	EventReasonFailedDelete EventReason = "FailedDelete"
)

Event reasons for owned resources lifecycle events.

const (
	EventReasonReplicaCreated           EventReason = "ReplicaCreated"
	EventReasonReplicaDeleted           EventReason = "ReplicaDeleted"
	EventReasonHorizontalScaleBlocked   EventReason = "HorizontalScaleBlocked"
	EventReasonHorizontalScaleStarted   EventReason = "HorizontalScaleStarted"
	EventReasonHorizontalScaleCompleted EventReason = "HorizontalScaleCompleted"
)

Event reasons for horizontal scaling events.

const (
	EventReasonClusterReady    EventReason = "ClusterReady"
	EventReasonClusterNotReady EventReason = "ClusterNotReady"
)

Event reasons for cluster health transitions.

type KeeperCluster

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

	Spec   KeeperClusterSpec   `json:"spec,omitempty"`
	Status KeeperClusterStatus `json:"status,omitempty"`
	// contains filtered or unexported fields
}

KeeperCluster is the Schema for the keeperclusters API. +kubebuilder:object:root=true +kubebuilder:subresource:status +kubebuilder:resource:shortName=chk;keeper +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.conditions[?(@.type==\"Ready\")].status" +kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.conditions[?(@.type==\"Ready\")].message" +kubebuilder:printcolumn:name="ReadyReplicas",type="number",JSONPath=".status.readyReplicas" +kubebuilder:printcolumn:name="Replicas",type="number",JSONPath=".spec.replicas" +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" +operator-sdk:csv:customresourcedefinitions:resources={{Pod,v1}} +operator-sdk:csv:customresourcedefinitions:resources={{PersistentVolumeClaim,v1}} +operator-sdk:csv:customresourcedefinitions:resources={{StatefulSet,v1}} +operator-sdk:csv:customresourcedefinitions:resources={{ConfigMap,v1}} +operator-sdk:csv:customresourcedefinitions:resources={{Service,v1}} +operator-sdk:csv:customresourcedefinitions:resources={{PodDisruptionBudget,v1}}

func (*KeeperCluster) Conditions

func (v *KeeperCluster) Conditions() *[]metav1.Condition

Conditions returns pointer to the conditions slice.

func (*KeeperCluster) ConfigMapNameByReplicaID

func (v *KeeperCluster) ConfigMapNameByReplicaID(replicaID KeeperReplicaID) string

ConfigMapNameByReplicaID returns ConfigMap name for given replica ID.

func (*KeeperCluster) DeepCopy

func (in *KeeperCluster) DeepCopy() *KeeperCluster

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

func (*KeeperCluster) DeepCopyInto

func (in *KeeperCluster) DeepCopyInto(out *KeeperCluster)

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

func (*KeeperCluster) DeepCopyObject

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

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

func (*KeeperCluster) GetStatus

func (v *KeeperCluster) GetStatus() *KeeperClusterStatus

GetStatus returns pointer to the KeeperClusterStatus.

func (*KeeperCluster) HeadlessServiceName

func (v *KeeperCluster) HeadlessServiceName() string

HeadlessServiceName returns headless service name for the Keeper cluster.

func (*KeeperCluster) HostnameByID

func (v *KeeperCluster) HostnameByID(id KeeperReplicaID) string

HostnameByID returns domain name for the specific replica to access within Kubernetes cluster.

func (*KeeperCluster) Hostnames

func (v *KeeperCluster) Hostnames() []string

Hostnames returns list of domain names for all replicas to access within Kubernetes cluster.

func (*KeeperCluster) NamespacedName

func (v *KeeperCluster) NamespacedName() types.NamespacedName

NamespacedName returns NamespacedName for the KeeperCluster.

func (*KeeperCluster) PodDisruptionBudgetName

func (v *KeeperCluster) PodDisruptionBudgetName() string

PodDisruptionBudgetName returns PodDisruptionBudget name for the Keeper cluster.

func (*KeeperCluster) QuorumConfigMapName

func (v *KeeperCluster) QuorumConfigMapName() string

QuorumConfigMapName returns ConfigMap name mounted in every replica.

func (*KeeperCluster) Replicas

func (v *KeeperCluster) Replicas() int32

Replicas returns requested number of replicas in the cluster.

func (*KeeperCluster) SpecificName

func (v *KeeperCluster) SpecificName() string

SpecificName returns cluster name with resource suffix. Used to generate resource names.

func (*KeeperCluster) StatefulSetNameByReplicaID

func (v *KeeperCluster) StatefulSetNameByReplicaID(replicaID KeeperReplicaID) string

StatefulSetNameByReplicaID returns StatefulSet name for given replica ID.

type KeeperClusterList

type KeeperClusterList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`

	Items []KeeperCluster `json:"items"`
}

KeeperClusterList contains a list of KeeperCluster.

func (*KeeperClusterList) DeepCopy

func (in *KeeperClusterList) DeepCopy() *KeeperClusterList

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

func (*KeeperClusterList) DeepCopyInto

func (in *KeeperClusterList) DeepCopyInto(out *KeeperClusterList)

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

func (*KeeperClusterList) DeepCopyObject

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

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

type KeeperClusterSpec

type KeeperClusterSpec struct {
	// Number of replicas in the cluster
	// This is a pointer to distinguish between explicit zero and unspecified.
	// +optional
	// +kubebuilder:default:=3
	// +kubebuilder:validation:Enum=0;1;3;5;7;9;11;13;15
	// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Replica count"
	Replicas *int32 `json:"replicas"`

	// Parameters passed to the Keeper pod spec.
	// +optional
	PodTemplate PodTemplateSpec `json:"podTemplate,omitempty"`

	// Parameters passed to the Keeper container spec.
	// +optional
	ContainerTemplate ContainerTemplateSpec `json:"containerTemplate,omitempty"`

	// Settings for the replicas storage.
	// +optional
	// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Data Volume Claim Spec"
	DataVolumeClaimSpec *corev1.PersistentVolumeClaimSpec `json:"dataVolumeClaimSpec,omitempty"`

	// Additional labels that are added to resources.
	// +optional
	Labels map[string]string `json:"labels,omitempty"`

	// Additional annotations that are added to resources.
	// +optional
	Annotations map[string]string `json:"annotations,omitempty"`

	// Configuration parameters for ClickHouse Keeper server.
	// +optional
	Settings KeeperSettings `json:"settings,omitempty"`

	// ClusterDomain is the Kubernetes cluster domain suffix used for DNS resolution.
	// Defaults to "cluster.local" if not specified.
	// +optional
	// +kubebuilder:default:="cluster.local"
	ClusterDomain string `json:"clusterDomain,omitempty"`
}

KeeperClusterSpec defines the desired state of KeeperCluster.

func (*KeeperClusterSpec) DeepCopy

func (in *KeeperClusterSpec) DeepCopy() *KeeperClusterSpec

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

func (*KeeperClusterSpec) DeepCopyInto

func (in *KeeperClusterSpec) DeepCopyInto(out *KeeperClusterSpec)

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

func (*KeeperClusterSpec) WithDefaults

func (s *KeeperClusterSpec) WithDefaults()

WithDefaults sets default values for KeeperClusterSpec fields.

type KeeperClusterStatus

type KeeperClusterStatus struct {
	// +listType=map
	// +listMapKey=type
	// +patchStrategy=merge
	// +patchMergeKey=type
	// +optional
	// +operator-sdk:csv:customresourcedefinitions:type=status
	Conditions []metav1.Condition `json:"conditions,omitempty"`
	// ReadyReplicas Total number of replicas ready to server requests.
	// +optional
	// +operator-sdk:csv:customresourcedefinitions:type=status
	ReadyReplicas int32 `json:"readyReplicas"`
	// ConfigurationRevision indicates target configuration revision for every replica.
	// +operator-sdk:csv:customresourcedefinitions:type=status
	ConfigurationRevision string `json:"configurationRevision,omitempty"`
	// StatefulSetRevision indicates target StatefulSet revision for every replica.
	// +operator-sdk:csv:customresourcedefinitions:type=status
	StatefulSetRevision string `json:"statefulSetRevision,omitempty"`

	// CurrentRevision indicates latest applied KeeperCluster spec revision.
	// +operator-sdk:csv:customresourcedefinitions:type=status
	CurrentRevision string `json:"currentRevision,omitempty"`
	// CurrentRevision indicates latest requested KeeperCluster spec revision.
	// +operator-sdk:csv:customresourcedefinitions:type=status
	UpdateRevision string `json:"updateRevision,omitempty"`
	// ObservedGeneration indicates latest generation observed by controller.
	// +operator-sdk:csv:customresourcedefinitions:type=status
	ObservedGeneration int64 `json:"observedGeneration,omitempty"`
}

KeeperClusterStatus defines the observed state of KeeperCluster.

func (*KeeperClusterStatus) DeepCopy

func (in *KeeperClusterStatus) DeepCopy() *KeeperClusterStatus

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

func (*KeeperClusterStatus) DeepCopyInto

func (in *KeeperClusterStatus) DeepCopyInto(out *KeeperClusterStatus)

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

type KeeperReplicaID

type KeeperReplicaID int32

KeeperReplicaID represents ClickHouse Keeper replica ID. Used for naming resources and RAFT configuration.

func KeeperReplicaIDFromLabels

func KeeperReplicaIDFromLabels(labels map[string]string) (KeeperReplicaID, error)

KeeperReplicaIDFromLabels extracts KeeperReplicaID from given labels map.

func (KeeperReplicaID) Labels

func (id KeeperReplicaID) Labels() map[string]string

Labels returns labels that should be set for every resource related to the specified replica.

type KeeperSettings

type KeeperSettings struct {
	// Optionally you can lower the logger level or disable logging to file at all.
	// +optional
	Logger LoggerConfig `json:"logger,omitempty"`

	// TLS settings, allows to enable TLS settings for Keeper.
	// +optional
	TLS ClusterTLSSpec `json:"tls,omitempty"`

	// Additional ClickHouse Keeper configuration that will be merged with the default one.
	// +nullable
	// +optional
	// +kubebuilder:pruning:PreserveUnknownFields
	ExtraConfig runtime.RawExtension `json:"extraConfig,omitempty"`
}

KeeperSettings defines ClickHouse Keeper server configuration.

func (*KeeperSettings) DeepCopy

func (in *KeeperSettings) DeepCopy() *KeeperSettings

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

func (*KeeperSettings) DeepCopyInto

func (in *KeeperSettings) DeepCopyInto(out *KeeperSettings)

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

type LoggerConfig

type LoggerConfig struct {
	// If false then disable all logging to file.
	// +optional
	// +kubebuilder:default:=true
	LogToFile bool `json:"logToFile,omitempty"`

	// If true, then log in JSON format.
	// +optional
	// +kubebuilder:default:=false
	JSONLogs bool `json:"jsonLogs,omitempty"`

	// +optional
	// +kubebuilder:validation:Enum:=test;trace;debug;information;notice;warning;error;critical;fatal
	// +kubebuilder:default:=trace
	Level string `json:"level,omitempty"`

	// Maximum log file size.
	// +optional
	// +kubebuilder:default:="1000M"
	Size string `json:"size,omitempty"`

	// Maximum number of log files to keep.
	// +optional
	// +kubebuilder:default:=50
	Count int64 `json:"count,omitempty"`
}

LoggerConfig defines logging configuration.

func (*LoggerConfig) DeepCopy

func (in *LoggerConfig) DeepCopy() *LoggerConfig

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

func (*LoggerConfig) DeepCopyInto

func (in *LoggerConfig) DeepCopyInto(out *LoggerConfig)

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

type PodTemplateSpec

type PodTemplateSpec struct {
	// Optional duration in seconds the pod needs to terminate gracefully. May be decreased in delete request.
	// Value must be non-negative integer. The value zero indicates stop immediately via
	// the kill signal (no opportunity to shut down).
	// If this value is nil, the default grace period will be used instead.
	// The grace period is the duration in seconds after the processes running in the pod are sent
	// a termination signal and the time when the processes are forcibly halted with a kill signal.
	// Set this value longer than the expected cleanup time for your process.
	// Defaults to 30 seconds.
	// +optional
	TerminationGracePeriodSeconds *int64 `json:"terminationGracePeriodSeconds,omitempty"`

	// TopologySpreadConstraints describes how a group of pods ought to spread across topology
	// domains. Scheduler will schedule pods in a way which abides by the constraints.
	// All topologySpreadConstraints are ANDed.
	// +optional
	// +patchMergeKey=topologyKey
	// +patchStrategy=merge
	// +listType=map
	// +listMapKey=topologyKey
	// +listMapKey=whenUnsatisfiable
	TopologySpreadConstraints []corev1.TopologySpreadConstraint `json:"topologySpreadConstraints,omitempty" patchMergeKey:"topologyKey" patchStrategy:"merge"`

	// ImagePullSecrets is an optional list of references to secrets in the same namespace to use for pulling any of the images used by this PodSpec.
	// If specified, these secrets will be passed to individual puller implementations for them to use.
	// More info: https://kubernetes.io/docs/concepts/containers/images#specifying-imagepullsecrets-on-a-pod
	// +optional
	// +patchMergeKey=name
	// +patchStrategy=merge
	// +listType=map
	// +listMapKey=name
	ImagePullSecrets []corev1.LocalObjectReference `json:"imagePullSecrets,omitempty" patchMergeKey:"name" patchStrategy:"merge"`

	// NodeSelector is a selector which must be true for the pod to fit on a node.
	// Selector which must match a node's labels for the pod to be scheduled on that node.
	// More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/
	// +optional
	// +mapType=atomic
	NodeSelector map[string]string `json:"nodeSelector,omitempty"`

	// If specified, the pod's scheduling constraints
	// +optional
	Affinity *corev1.Affinity `json:"affinity,omitempty"`

	// If specified, the pod's tolerations.
	// +optional
	// +listType=atomic
	Tolerations []corev1.Toleration `json:"tolerations,omitempty"`

	// If specified, the pod will be dispatched by specified scheduler.
	// If not specified, the pod will be dispatched by default scheduler.
	// +optional
	SchedulerName string `json:"schedulerName,omitempty"`

	// ServiceAccountName is the name of the ServiceAccount to use to run this pod.
	// More info: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/
	// +optional
	ServiceAccountName string `json:"serviceAccountName,omitempty"`

	// Volumes defines the list of volumes that can be mounted by containers belonging to the pod.
	// More info: https://kubernetes.io/docs/concepts/storage/volumes
	// +optional
	// +patchMergeKey=name
	// +patchStrategy=merge
	// +listType=map
	// +listMapKey=name
	Volumes []corev1.Volume `json:"volumes,omitempty" patchMergeKey:"name" patchStrategy:"merge"`

	// SecurityContext holds pod-level security attributes and common container settings.
	// +optional
	SecurityContext *corev1.PodSecurityContext `json:"securityContext,omitempty"`

	// TopologyZoneKey is the key of node labels.
	// Nodes that have a label with this key and identical values are considered to be in the same topology zone.
	// Set it to enable default TopologySpreadConstraints and Affinity rules to spread pods across zones.
	// Recommended to be set to "topology.kubernetes.io/zone"
	// +optional
	TopologyZoneKey *string `json:"topologyZoneKey,omitempty"`

	// NodeHostnameKey is the key of node labels.
	// Nodes that have a label with this key and identical values are considered to be on the same node.
	// Set it to enable default AntiAffinity rules to spread replicas from the different shards across nodes.
	// Recommended to be set to "kubernetes.io/hostname"
	// +optional
	NodeHostnameKey *string `json:"nodeHostnameKey,omitempty"`
}

PodTemplateSpec describes the pod configuration overrides for the cluster's pods.

func (*PodTemplateSpec) DeepCopy

func (in *PodTemplateSpec) DeepCopy() *PodTemplateSpec

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

func (*PodTemplateSpec) DeepCopyInto

func (in *PodTemplateSpec) DeepCopyInto(out *PodTemplateSpec)

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

type SecretKeySelector

type SecretKeySelector struct {
	// The name of the secret in the cluster's namespace to select from.
	// +kubebuilder:validation:Required
	Name string `json:"name,omitempty"`
	// The key of the secret to select from.  Must be a valid secret key.
	// +kubebuilder:validation:Required
	Key string `json:"key,omitempty"`
}

SecretKeySelector selects a key of a Secret.

func (*SecretKeySelector) DeepCopy

func (in *SecretKeySelector) DeepCopy() *SecretKeySelector

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

func (*SecretKeySelector) DeepCopyInto

func (in *SecretKeySelector) DeepCopyInto(out *SecretKeySelector)

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

Jump to

Keyboard shortcuts

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