Documentation ¶
Index ¶
- Constants
- Variables
- func AppendLabelReady(meta *meta.ObjectMeta)
- func CreateCHIServiceFQDN(chi *chop.ClickHouseInstallation) string
- func CreateCHIServiceName(chi *chop.ClickHouseInstallation) string
- func CreateClusterServiceName(cluster *chop.ChiCluster) string
- func CreateConfigMapCommonName(chi *chop.ClickHouseInstallation) string
- func CreateConfigMapCommonUsersName(chi *chop.ClickHouseInstallation) string
- func CreateConfigMapHostName(host *chop.ChiHost) string
- func CreateFQDN(host *chop.ChiHost) string
- func CreateFQDNs(obj interface{}, scope interface{}, excludeSelf bool) []string
- func CreateHostName(host *chop.ChiHost, shard *chop.ChiShard, shardIndex int, ...) string
- func CreatePVCName(host *chop.ChiHost, _ *v1.VolumeMount, template *chop.ChiVolumeClaimTemplate) string
- func CreatePodHostname(host *chop.ChiHost) string
- func CreatePodName(obj interface{}) string
- func CreatePodRegexp(chi *chop.ClickHouseInstallation, template string) string
- func CreateReplicaHostname(host *chop.ChiHost) string
- func CreateReplicaName(replica *chop.ChiReplica, index int) string
- func CreateShardName(shard *chop.ChiShard, index int) string
- func CreateShardServiceName(shard *chop.ChiShard) string
- func CreateStatefulSetName(host *chop.ChiHost) string
- func CreateStatefulSetServiceName(host *chop.ChiHost) string
- func DeleteLabelReady(meta *meta.ObjectMeta)
- func GetCHINameFromObjectMeta(meta *meta.ObjectMeta) (string, error)
- func GetClusterNameFromObjectMeta(meta *meta.ObjectMeta) (string, error)
- func GetReclaimPolicy(meta meta.ObjectMeta) chiv1.PVCReclaimPolicy
- func GetSelectorHostScope(host *chiv1.ChiHost) map[string]string
- func HostCanDeletePVC(host *chiv1.ChiHost, pvcName string) bool
- func IsAutoGeneratedHostName(name string, host *chop.ChiHost, shard *chop.ChiShard, shardIndex int, ...) bool
- func IsAutoGeneratedReplicaName(name string, replica *chop.ChiReplica, index int) bool
- func IsAutoGeneratedShardName(name string, shard *chop.ChiShard, index int) bool
- func IsCHOPGeneratedObject(meta *meta.ObjectMeta) bool
- func IsObjectTheSame(meta1, meta2 *meta.ObjectMeta) bool
- func IsStatefulSetGeneration(statefulSet *apps.StatefulSet, generation int64) bool
- func IsStatefulSetNotReady(statefulSet *apps.StatefulSet) bool
- func IsStatefulSetReady(statefulSet *apps.StatefulSet) bool
- func MakeObjectVersionLabel(meta *meta.ObjectMeta, obj interface{})
- func MakeSelectorFromObjectMeta(objMeta *meta.ObjectMeta) (kublabels.Selector, error)
- func StrStatefulSetStatus(status *apps.StatefulSetStatus) string
- type ActionPlan
- func (ap *ActionPlan) GetNewHostsNum() int
- func (ap *ActionPlan) GetRemovedHostsNum() int
- func (ap *ActionPlan) HasActionsToDo() bool
- func (ap *ActionPlan) String() string
- func (ap *ActionPlan) WalkAdded(clusterFunc func(cluster *v1.ChiCluster), shardFunc func(shard *v1.ChiShard), ...)
- func (ap *ActionPlan) WalkModified(clusterFunc func(cluster *v1.ChiCluster), shardFunc func(shard *v1.ChiShard), ...)
- func (ap *ActionPlan) WalkRemoved(clusterFunc func(cluster *v1.ChiCluster), shardFunc func(shard *v1.ChiShard), ...)
- type Annotator
- type ClickHouseConfigFilesGenerator
- func (c *ClickHouseConfigFilesGenerator) CreateConfigFilesGroupCommon(options *ClickHouseConfigFilesGeneratorOptions) map[string]string
- func (c *ClickHouseConfigFilesGenerator) CreateConfigFilesGroupHost(host *chi.ChiHost) map[string]string
- func (c *ClickHouseConfigFilesGenerator) CreateConfigFilesGroupUsers() map[string]string
- type ClickHouseConfigFilesGeneratorOptions
- type ClickHouseConfigGenerator
- func (c *ClickHouseConfigGenerator) CHIHostsNum(options *RemoteServersGeneratorOptions) int
- func (c *ClickHouseConfigGenerator) ClusterHostsNum(cluster *chiv1.ChiCluster, options *RemoteServersGeneratorOptions) int
- func (c *ClickHouseConfigGenerator) GetFiles(section chiv1.SettingsSection, includeUnspecified bool, host *chiv1.ChiHost) map[string]string
- func (c *ClickHouseConfigGenerator) GetHostMacros(host *chiv1.ChiHost) string
- func (c *ClickHouseConfigGenerator) GetHostPorts(host *chiv1.ChiHost) string
- func (c *ClickHouseConfigGenerator) GetHostZookeeper(host *chiv1.ChiHost) string
- func (c *ClickHouseConfigGenerator) GetProfiles() string
- func (c *ClickHouseConfigGenerator) GetQuotas() string
- func (c *ClickHouseConfigGenerator) GetRemoteServers(options *RemoteServersGeneratorOptions) string
- func (c *ClickHouseConfigGenerator) GetSettings(host *chiv1.ChiHost) string
- func (c *ClickHouseConfigGenerator) GetUsers() string
- func (c *ClickHouseConfigGenerator) ShardHostsNum(shard *chiv1.ChiShard, options *RemoteServersGeneratorOptions) int
- type Cluster
- func (c *Cluster) ExecCHI(ctx context.Context, chi *chop.ClickHouseInstallation, SQLs []string, ...) error
- func (c *Cluster) ExecCluster(ctx context.Context, cluster *chop.ChiCluster, SQLs []string, ...) error
- func (c *Cluster) ExecHost(ctx context.Context, host *chop.ChiHost, SQLs []string, ...) error
- func (c *Cluster) ExecShard(ctx context.Context, shard *chop.ChiShard, SQLs []string, ...) error
- func (c *Cluster) QueryHost(ctx context.Context, host *chop.ChiHost, sql string, ...) (*clickhouse.QueryResult, error)
- func (c *Cluster) QueryHostInt(ctx context.Context, host *chop.ChiHost, sql string, ...) (int, error)
- func (c *Cluster) QueryUnzip2Columns(ctx context.Context, endpoints []string, sql string) ([]string, []string, error)
- func (c *Cluster) SetEndpointCredentials(endpointCredentials *clickhouse.ClusterEndpointCredentials) *Cluster
- type Creator
- func (c *Creator) CreateConfigMapCHICommon(options *ClickHouseConfigFilesGeneratorOptions) *corev1.ConfigMap
- func (c *Creator) CreateConfigMapCHICommonUsers() *corev1.ConfigMap
- func (c *Creator) CreateConfigMapHost(host *chiv1.ChiHost) *corev1.ConfigMap
- func (c *Creator) CreateServiceCHI() *corev1.Service
- func (c *Creator) CreateServiceCluster(cluster *chiv1.ChiCluster) *corev1.Service
- func (c *Creator) CreateServiceHost(host *chiv1.ChiHost) *corev1.Service
- func (c *Creator) CreateServiceShard(shard *chiv1.ChiShard) *corev1.Service
- func (c *Creator) CreateStatefulSet(host *chiv1.ChiHost, shutdown bool) *apps.StatefulSet
- func (c *Creator) GetStatefulSetVersion(statefulSet *apps.StatefulSet) (string, bool)
- func (c *Creator) MakeConfigMapData(names, files []string) map[string]string
- func (c *Creator) NewPodDisruptionBudget() *v1beta1.PodDisruptionBudget
- func (c *Creator) PreparePersistentVolume(pv *corev1.PersistentVolume, host *chiv1.ChiHost) *corev1.PersistentVolume
- func (c *Creator) PreparePersistentVolumeClaim(pvc *corev1.PersistentVolumeClaim, host *chiv1.ChiHost, ...) *corev1.PersistentVolumeClaim
- type EntityType
- type Labeler
- type Normalizer
- type Registry
- func (r *Registry) HasConfigMap(meta v1.ObjectMeta) bool
- func (r *Registry) HasPV(meta v1.ObjectMeta) bool
- func (r *Registry) HasPVC(meta v1.ObjectMeta) bool
- func (r *Registry) HasService(meta v1.ObjectMeta) bool
- func (r *Registry) HasStatefulSet(meta v1.ObjectMeta) bool
- func (r *Registry) Len(_what ...EntityType) int
- func (r *Registry) NumConfigMap() int
- func (r *Registry) NumPV() int
- func (r *Registry) NumPVC() int
- func (r *Registry) NumService() int
- func (r *Registry) NumStatefulSet() int
- func (r *Registry) RegisterConfigMap(meta v1.ObjectMeta)
- func (r *Registry) RegisterPV(meta v1.ObjectMeta)
- func (r *Registry) RegisterPVC(meta v1.ObjectMeta)
- func (r *Registry) RegisterService(meta v1.ObjectMeta)
- func (r *Registry) RegisterStatefulSet(meta v1.ObjectMeta)
- func (r *Registry) String() string
- func (r *Registry) Subtract(sub *Registry) *Registry
- func (r *Registry) Walk(f func(entityType EntityType, meta v1.ObjectMeta))
- type RemoteServersGeneratorOptions
- func (o *RemoteServersGeneratorOptions) ExcludeHost(host *chiv1.ChiHost) *RemoteServersGeneratorOptions
- func (o *RemoteServersGeneratorOptions) ExcludeReconcileAttributes(attrs *chiv1.ChiHostReconcileAttributes) *RemoteServersGeneratorOptions
- func (o *RemoteServersGeneratorOptions) Include(host *chiv1.ChiHost) bool
- func (o *RemoteServersGeneratorOptions) Skip(host *chiv1.ChiHost) bool
- type Schemer
- func (s *Schemer) CHIDropDnsCache(ctx context.Context, chi *chop.ClickHouseInstallation) error
- func (s *Schemer) HostActiveQueriesNum(ctx context.Context, host *chop.ChiHost) (int, error)
- func (s *Schemer) HostCreateTables(ctx context.Context, host *chop.ChiHost) error
- func (s *Schemer) HostCreateTablesSQLs(ctx context.Context, host *chop.ChiHost) (replicatedObjectNames []string, replicatedCreateSQLs []string, ...)
- func (s *Schemer) HostDropReplica(ctx context.Context, hostToRun, hostToDrop *chop.ChiHost) error
- func (s *Schemer) HostDropTables(ctx context.Context, host *chop.ChiHost) error
- func (s *Schemer) HostSyncTables(ctx context.Context, host *chop.ChiHost) error
- func (s *Schemer) IsHostInCluster(ctx context.Context, host *chop.ChiHost) bool
Constants ¶
const ( // ClickHouseContainerName specifies name of the clickhouse container in the pod ClickHouseContainerName = "clickhouse" // ClickHouseLogContainerName specifies name of the logger container in the pod ClickHouseLogContainerName = "clickhouse-log" )
const ( LabelReadyName = clickhousealtinitycom.GroupName + "/ready" LabelReadyValue = "yes" LabelAppName = clickhousealtinitycom.GroupName + "/app" LabelAppValue = "chop" LabelCHOP = clickhousealtinitycom.GroupName + "/chop" LabelCHOPCommit = clickhousealtinitycom.GroupName + "/chop-commit" LabelCHOPDate = clickhousealtinitycom.GroupName + "/chop-date" LabelNamespace = clickhousealtinitycom.GroupName + "/namespace" LabelCHIName = clickhousealtinitycom.GroupName + "/chi" LabelClusterName = clickhousealtinitycom.GroupName + "/cluster" LabelShardName = clickhousealtinitycom.GroupName + "/shard" LabelReplicaName = clickhousealtinitycom.GroupName + "/replica" LabelConfigMap = clickhousealtinitycom.GroupName + "/ConfigMap" LabelService = clickhousealtinitycom.GroupName + "/Service" LabelPVCReclaimPolicyName = clickhousealtinitycom.GroupName + "/reclaimPolicy" LabelZookeeperConfigVersion = clickhousealtinitycom.GroupName + "/zookeeper-version" LabelSettingsConfigVersion = clickhousealtinitycom.GroupName + "/settings-version" LabelObjectVersion = clickhousealtinitycom.GroupName + "/object-version" LabelShardScopeIndex = clickhousealtinitycom.GroupName + "/shardScopeIndex" LabelReplicaScopeIndex = clickhousealtinitycom.GroupName + "/replicaScopeIndex" LabelCHIScopeIndex = clickhousealtinitycom.GroupName + "/chiScopeIndex" LabelCHIScopeCycleSize = clickhousealtinitycom.GroupName + "/chiScopeCycleSize" LabelCHIScopeCycleIndex = clickhousealtinitycom.GroupName + "/chiScopeCycleIndex" LabelCHIScopeCycleOffset = clickhousealtinitycom.GroupName + "/chiScopeCycleOffset" LabelClusterScopeIndex = clickhousealtinitycom.GroupName + "/clusterScopeIndex" LabelClusterScopeCycleSize = clickhousealtinitycom.GroupName + "/clusterScopeCycleSize" LabelClusterScopeCycleIndex = clickhousealtinitycom.GroupName + "/clusterScopeCycleIndex" LabelClusterScopeCycleOffset = clickhousealtinitycom.GroupName + "/clusterScopeCycleOffset" )
Set of kubernetes labels used by the operator
Variables ¶
var ( // ErrSecretFieldNotFound specifies error when secret key is not found ErrSecretFieldNotFound = fmt.Errorf("not found") )
Functions ¶
func AppendLabelReady ¶
func AppendLabelReady(meta *meta.ObjectMeta)
AppendLabelReady adds "ready" label with value = UTC now
func CreateCHIServiceFQDN ¶
func CreateCHIServiceFQDN(chi *chop.ClickHouseInstallation) string
CreateCHIServiceFQDN creates a FQD name of a root ClickHouseInstallation Service resource
func CreateCHIServiceName ¶
func CreateCHIServiceName(chi *chop.ClickHouseInstallation) string
CreateCHIServiceName creates a name of a root ClickHouseInstallation Service resource
func CreateClusterServiceName ¶
func CreateClusterServiceName(cluster *chop.ChiCluster) string
CreateClusterServiceName returns a name of a cluster's Service
func CreateConfigMapCommonName ¶
func CreateConfigMapCommonName(chi *chop.ClickHouseInstallation) string
CreateConfigMapCommonName returns a name for a ConfigMap for replica's common config
func CreateConfigMapCommonUsersName ¶
func CreateConfigMapCommonUsersName(chi *chop.ClickHouseInstallation) string
CreateConfigMapCommonUsersName returns a name for a ConfigMap for replica's common users config
func CreateConfigMapHostName ¶
CreateConfigMapHostName returns a name for a ConfigMap for replica's personal config
func CreateFQDN ¶
CreateFQDN is a wrapper over pod FQDN function
func CreateFQDNs ¶
CreateFQDNs is a wrapper over set of create FQDN functions obj specifies source object to create FQDNs from scope specifies target scope - what entity to create FQDNs for - be it CHI, cluster, shard or a host excludeSelf specifies whether to exclude the host itself from the result. Applicable only in case obj is a host
func CreateHostName ¶
func CreateHostName(host *chop.ChiHost, shard *chop.ChiShard, shardIndex int, replica *chop.ChiReplica, replicaIndex int) string
CreateHostName return a name of a host
func CreatePVCName ¶
func CreatePVCName(host *chop.ChiHost, _ *v1.VolumeMount, template *chop.ChiVolumeClaimTemplate) string
CreatePVCName create PVC name from components, to which PVC belongs to
func CreatePodHostname ¶
CreatePodHostname returns a name of a Pod of a ClickHouse instance
func CreatePodName ¶
func CreatePodName(obj interface{}) string
CreatePodName create Pod name based on specified StatefulSet or Host
func CreatePodRegexp ¶
func CreatePodRegexp(chi *chop.ClickHouseInstallation, template string) string
CreatePodRegexp creates pod regexp template is defined in operator config: CHConfigNetworksHostRegexpTemplate: chi-{chi}-[^.]+\\d+-\\d+\\.{namespace}.svc.cluster.local$"
func CreateReplicaHostname ¶
CreateReplicaHostname returns hostname (pod-hostname + service or FQDN) which can be used as a replica name in all places where ClickHouse requires replica name. These are such places as: 1. "remote_servers.xml" config file 2. statements like SYSTEM DROP REPLICA <replica_name> any other places Function operations are based on .Spec.Defaults.ReplicasUseFQDN
func CreateReplicaName ¶
func CreateReplicaName(replica *chop.ChiReplica, index int) string
CreateReplicaName return a name of a replica. Here replica is a CHOp-internal replica - i.e. a vertical slice of hosts field. In case you are looking for replica name in terms of a hostname to address particular host as in remote_servers.xml you need to take a look on CreateReplicaHostname function
func CreateShardName ¶
CreateShardName return a name of a shard
func CreateShardServiceName ¶
CreateShardServiceName returns a name of a shard's Service
func CreateStatefulSetName ¶
CreateStatefulSetName creates a name of a StatefulSet for ClickHouse instance
func CreateStatefulSetServiceName ¶
CreateStatefulSetServiceName returns a name of a StatefulSet-related Service for ClickHouse instance
func DeleteLabelReady ¶
func DeleteLabelReady(meta *meta.ObjectMeta)
DeleteLabelReady deletes "ready" label
func GetCHINameFromObjectMeta ¶
func GetCHINameFromObjectMeta(meta *meta.ObjectMeta) (string, error)
GetCHINameFromObjectMeta extracts CHI name from ObjectMeta by labels
func GetClusterNameFromObjectMeta ¶
func GetClusterNameFromObjectMeta(meta *meta.ObjectMeta) (string, error)
GetClusterNameFromObjectMeta extracts cluster name from ObjectMeta by labels
func GetReclaimPolicy ¶
func GetReclaimPolicy(meta meta.ObjectMeta) chiv1.PVCReclaimPolicy
GetReclaimPolicy gets reclaim policy from meta
func GetSelectorHostScope ¶
GetSelectorHostScope gets labels to select a Host-scoped object
func HostCanDeletePVC ¶
HostCanDeletePVC checks whether PVC on a host can be deleted
func IsAutoGeneratedHostName ¶
func IsAutoGeneratedHostName( name string, host *chop.ChiHost, shard *chop.ChiShard, shardIndex int, replica *chop.ChiReplica, replicaIndex int, ) bool
IsAutoGeneratedHostName checks whether name is auto-generated
func IsAutoGeneratedReplicaName ¶
func IsAutoGeneratedReplicaName(name string, replica *chop.ChiReplica, index int) bool
IsAutoGeneratedReplicaName checks whether provided name is auto-generated
func IsAutoGeneratedShardName ¶
IsAutoGeneratedShardName checks whether provided name is auto-generated
func IsCHOPGeneratedObject ¶
func IsCHOPGeneratedObject(meta *meta.ObjectMeta) bool
IsCHOPGeneratedObject check whether object is generated by an operator. Check is label-based
func IsObjectTheSame ¶
func IsObjectTheSame(meta1, meta2 *meta.ObjectMeta) bool
IsObjectTheSame checks whether objects are the same
func IsStatefulSetGeneration ¶
func IsStatefulSetGeneration(statefulSet *apps.StatefulSet, generation int64) bool
IsStatefulSetGeneration returns whether StatefulSet has requested generation or not
func IsStatefulSetNotReady ¶
func IsStatefulSetNotReady(statefulSet *apps.StatefulSet) bool
IsStatefulSetNotReady returns whether StatefulSet is not ready
func IsStatefulSetReady ¶
func IsStatefulSetReady(statefulSet *apps.StatefulSet) bool
IsStatefulSetReady returns whether StatefulSet is ready
func MakeObjectVersionLabel ¶
func MakeObjectVersionLabel(meta *meta.ObjectMeta, obj interface{})
MakeObjectVersionLabel makes object version label
func MakeSelectorFromObjectMeta ¶
func MakeSelectorFromObjectMeta(objMeta *meta.ObjectMeta) (kublabels.Selector, error)
MakeSelectorFromObjectMeta makes selector from meta TODO review usage
func StrStatefulSetStatus ¶
func StrStatefulSetStatus(status *apps.StatefulSetStatus) string
StrStatefulSetStatus returns human-friendly string representation of StatefulSet status
Types ¶
type ActionPlan ¶
type ActionPlan struct {
// contains filtered or unexported fields
}
ActionPlan is an action plan with list of differences between two CHIs
func NewActionPlan ¶
func NewActionPlan(old, new *v1.ClickHouseInstallation) *ActionPlan
NewActionPlan makes new ActionPlan out of two CHIs
func (*ActionPlan) GetNewHostsNum ¶
func (ap *ActionPlan) GetNewHostsNum() int
GetNewHostsNum - total number of hosts to be achieved
func (*ActionPlan) GetRemovedHostsNum ¶
func (ap *ActionPlan) GetRemovedHostsNum() int
GetRemovedHostsNum - how many hosts would be removed
func (*ActionPlan) HasActionsToDo ¶
func (ap *ActionPlan) HasActionsToDo() bool
HasActionsToDo checks whether there are any actions to do - meaning changes between states to reconcile
func (*ActionPlan) WalkAdded ¶
func (ap *ActionPlan) WalkAdded( clusterFunc func(cluster *v1.ChiCluster), shardFunc func(shard *v1.ChiShard), hostFunc func(host *v1.ChiHost), )
WalkAdded walk added cluster items
func (*ActionPlan) WalkModified ¶
func (ap *ActionPlan) WalkModified( clusterFunc func(cluster *v1.ChiCluster), shardFunc func(shard *v1.ChiShard), hostFunc func(host *v1.ChiHost), )
WalkModified walk modified cluster items
func (*ActionPlan) WalkRemoved ¶
func (ap *ActionPlan) WalkRemoved( clusterFunc func(cluster *v1.ChiCluster), shardFunc func(shard *v1.ChiShard), hostFunc func(host *v1.ChiHost), )
WalkRemoved walk removed cluster items
type Annotator ¶
type Annotator struct {
// contains filtered or unexported fields
}
Annotator is an entity which can annotate CHI artifacts
func NewAnnotator ¶
func NewAnnotator(chi *chiv1.ClickHouseInstallation) *Annotator
NewAnnotator creates new annotator with context
type ClickHouseConfigFilesGenerator ¶
type ClickHouseConfigFilesGenerator struct {
// contains filtered or unexported fields
}
ClickHouseConfigFilesGenerator specifies clickhouse configuration generator object
func NewClickHouseConfigFilesGenerator ¶
func NewClickHouseConfigFilesGenerator( chConfigGenerator *ClickHouseConfigGenerator, chopConfig *chi.OperatorConfig, ) *ClickHouseConfigFilesGenerator
NewClickHouseConfigFilesGenerator creates new clickhouse configuration generator object
func (*ClickHouseConfigFilesGenerator) CreateConfigFilesGroupCommon ¶
func (c *ClickHouseConfigFilesGenerator) CreateConfigFilesGroupCommon(options *ClickHouseConfigFilesGeneratorOptions) map[string]string
CreateConfigFilesGroupCommon creates common config files
func (*ClickHouseConfigFilesGenerator) CreateConfigFilesGroupHost ¶
func (c *ClickHouseConfigFilesGenerator) CreateConfigFilesGroupHost(host *chi.ChiHost) map[string]string
CreateConfigFilesGroupHost creates host config files
func (*ClickHouseConfigFilesGenerator) CreateConfigFilesGroupUsers ¶
func (c *ClickHouseConfigFilesGenerator) CreateConfigFilesGroupUsers() map[string]string
CreateConfigFilesGroupUsers creates users config files
type ClickHouseConfigFilesGeneratorOptions ¶
type ClickHouseConfigFilesGeneratorOptions struct {
RemoteServersGeneratorOptions *RemoteServersGeneratorOptions
}
ClickHouseConfigFilesGeneratorOptions specifies options for clickhouse configuration generator
func NewClickHouseConfigFilesGeneratorOptions ¶
func NewClickHouseConfigFilesGeneratorOptions() *ClickHouseConfigFilesGeneratorOptions
NewClickHouseConfigFilesGeneratorOptions creates new options for clickhouse configuration generator
func (*ClickHouseConfigFilesGeneratorOptions) GetRemoteServersGeneratorOptions ¶
func (o *ClickHouseConfigFilesGeneratorOptions) GetRemoteServersGeneratorOptions() *RemoteServersGeneratorOptions
GetRemoteServersGeneratorOptions gets remote-servers generator options
func (*ClickHouseConfigFilesGeneratorOptions) SetRemoteServersGeneratorOptions ¶
func (o *ClickHouseConfigFilesGeneratorOptions) SetRemoteServersGeneratorOptions(opts *RemoteServersGeneratorOptions) *ClickHouseConfigFilesGeneratorOptions
SetRemoteServersGeneratorOptions sets remote-servers generator options
type ClickHouseConfigGenerator ¶
type ClickHouseConfigGenerator struct {
// contains filtered or unexported fields
}
ClickHouseConfigGenerator generates ClickHouse configuration files content for specified CHI ClickHouse configuration files content is an XML ATM, so config generator provides set of Get*() functions which produces XML which are parts of ClickHouse configuration and can/should be used as ClickHouse config files.
func NewClickHouseConfigGenerator ¶
func NewClickHouseConfigGenerator(chi *chiv1.ClickHouseInstallation) *ClickHouseConfigGenerator
NewClickHouseConfigGenerator returns new ClickHouseConfigGenerator struct
func (*ClickHouseConfigGenerator) CHIHostsNum ¶
func (c *ClickHouseConfigGenerator) CHIHostsNum(options *RemoteServersGeneratorOptions) int
CHIHostsNum count hosts according to the options
func (*ClickHouseConfigGenerator) ClusterHostsNum ¶
func (c *ClickHouseConfigGenerator) ClusterHostsNum(cluster *chiv1.ChiCluster, options *RemoteServersGeneratorOptions) int
ClusterHostsNum count hosts according to the options
func (*ClickHouseConfigGenerator) GetFiles ¶
func (c *ClickHouseConfigGenerator) GetFiles(section chiv1.SettingsSection, includeUnspecified bool, host *chiv1.ChiHost) map[string]string
GetFiles creates data for custom common config files
func (*ClickHouseConfigGenerator) GetHostMacros ¶
func (c *ClickHouseConfigGenerator) GetHostMacros(host *chiv1.ChiHost) string
GetHostMacros creates "macros.xml" content
func (*ClickHouseConfigGenerator) GetHostPorts ¶
func (c *ClickHouseConfigGenerator) GetHostPorts(host *chiv1.ChiHost) string
GetHostPorts creates "ports.xml" content
func (*ClickHouseConfigGenerator) GetHostZookeeper ¶
func (c *ClickHouseConfigGenerator) GetHostZookeeper(host *chiv1.ChiHost) string
GetHostZookeeper creates data for "zookeeper.xml"
func (*ClickHouseConfigGenerator) GetProfiles ¶
func (c *ClickHouseConfigGenerator) GetProfiles() string
GetProfiles creates data for profiles section. Used as "profiles.xml"
func (*ClickHouseConfigGenerator) GetQuotas ¶
func (c *ClickHouseConfigGenerator) GetQuotas() string
GetQuotas creates data for "quotas.xml"
func (*ClickHouseConfigGenerator) GetRemoteServers ¶
func (c *ClickHouseConfigGenerator) GetRemoteServers(options *RemoteServersGeneratorOptions) string
GetRemoteServers creates "remote_servers.xml" content and calculates data generation parameters for other sections
func (*ClickHouseConfigGenerator) GetSettings ¶
func (c *ClickHouseConfigGenerator) GetSettings(host *chiv1.ChiHost) string
GetSettings creates data for "settings.xml"
func (*ClickHouseConfigGenerator) GetUsers ¶
func (c *ClickHouseConfigGenerator) GetUsers() string
GetUsers creates data for users section. Used as "users.xml"
func (*ClickHouseConfigGenerator) ShardHostsNum ¶
func (c *ClickHouseConfigGenerator) ShardHostsNum(shard *chiv1.ChiShard, options *RemoteServersGeneratorOptions) int
ShardHostsNum count hosts according to the options
type Cluster ¶
type Cluster struct {
*clickhouse.Cluster
}
Cluster specifies ClickHouse cluster
func (*Cluster) ExecCHI ¶
func (c *Cluster) ExecCHI(ctx context.Context, chi *chop.ClickHouseInstallation, SQLs []string, _opts ...*clickhouse.QueryOptions) error
ExecCHI runs set of SQL queries over the whole CHI
func (*Cluster) ExecCluster ¶
func (c *Cluster) ExecCluster(ctx context.Context, cluster *chop.ChiCluster, SQLs []string, _opts ...*clickhouse.QueryOptions) error
ExecCluster runs set of SQL queries over the cluster
func (*Cluster) ExecHost ¶
func (c *Cluster) ExecHost(ctx context.Context, host *chop.ChiHost, SQLs []string, _opts ...*clickhouse.QueryOptions) error
ExecHost runs set of SQL queries over the replica
func (*Cluster) ExecShard ¶
func (c *Cluster) ExecShard(ctx context.Context, shard *chop.ChiShard, SQLs []string, _opts ...*clickhouse.QueryOptions) error
ExecShard runs set of SQL queries over the shard replicas
func (*Cluster) QueryHost ¶
func (c *Cluster) QueryHost(ctx context.Context, host *chop.ChiHost, sql string, _opts ...*clickhouse.QueryOptions) (*clickhouse.QueryResult, error)
QueryHost runs specified query on specified host
func (*Cluster) QueryHostInt ¶
func (c *Cluster) QueryHostInt(ctx context.Context, host *chop.ChiHost, sql string, _opts ...*clickhouse.QueryOptions) (int, error)
QueryHostInt runs specified query on specified host and returns one int as a result
func (*Cluster) QueryUnzip2Columns ¶
func (c *Cluster) QueryUnzip2Columns(ctx context.Context, endpoints []string, sql string) ([]string, []string, error)
QueryUnzip2Columns unzips query result into two columns
func (*Cluster) SetEndpointCredentials ¶
func (c *Cluster) SetEndpointCredentials(endpointCredentials *clickhouse.ClusterEndpointCredentials) *Cluster
SetEndpointCredentials sets endpoint credentials
type Creator ¶
type Creator struct {
// contains filtered or unexported fields
}
Creator specifies creator object
func NewCreator ¶
func NewCreator(chi *chiv1.ClickHouseInstallation) *Creator
NewCreator creates new Creator object
func (*Creator) CreateConfigMapCHICommon ¶
func (c *Creator) CreateConfigMapCHICommon(options *ClickHouseConfigFilesGeneratorOptions) *corev1.ConfigMap
CreateConfigMapCHICommon creates new corev1.ConfigMap
func (*Creator) CreateConfigMapCHICommonUsers ¶
CreateConfigMapCHICommonUsers creates new corev1.ConfigMap
func (*Creator) CreateConfigMapHost ¶
CreateConfigMapHost creates new corev1.ConfigMap
func (*Creator) CreateServiceCHI ¶
CreateServiceCHI creates new corev1.Service for specified CHI
func (*Creator) CreateServiceCluster ¶
func (c *Creator) CreateServiceCluster(cluster *chiv1.ChiCluster) *corev1.Service
CreateServiceCluster creates new corev1.Service for specified Cluster
func (*Creator) CreateServiceHost ¶
CreateServiceHost creates new corev1.Service for specified host
func (*Creator) CreateServiceShard ¶
CreateServiceShard creates new corev1.Service for specified Shard
func (*Creator) CreateStatefulSet ¶
CreateStatefulSet creates new apps.StatefulSet
func (*Creator) GetStatefulSetVersion ¶
func (c *Creator) GetStatefulSetVersion(statefulSet *apps.StatefulSet) (string, bool)
GetStatefulSetVersion gets version of the StatefulSet TODO property of the labeler?
func (*Creator) MakeConfigMapData ¶
MakeConfigMapData makes data for a config mao
func (*Creator) NewPodDisruptionBudget ¶
func (c *Creator) NewPodDisruptionBudget() *v1beta1.PodDisruptionBudget
NewPodDisruptionBudget creates new PodDisruptionBudget
func (*Creator) PreparePersistentVolume ¶
func (c *Creator) PreparePersistentVolume(pv *corev1.PersistentVolume, host *chiv1.ChiHost) *corev1.PersistentVolume
PreparePersistentVolume prepares PV labels
func (*Creator) PreparePersistentVolumeClaim ¶
func (c *Creator) PreparePersistentVolumeClaim( pvc *corev1.PersistentVolumeClaim, host *chiv1.ChiHost, template *chiv1.ChiVolumeClaimTemplate, ) *corev1.PersistentVolumeClaim
PreparePersistentVolumeClaim prepares labels and annotations of the PVC
type EntityType ¶
type EntityType string
EntityType specifies registry entity type
const ( StatefulSet EntityType = "StatefulSet" ConfigMap EntityType = "ConfigMap" Service EntityType = "Service" PVC EntityType = "PVC" PV EntityType = "PV" )
Possible entity types
type Labeler ¶
type Labeler struct {
// contains filtered or unexported fields
}
Labeler is an entity which can label CHI artifacts
func NewLabeler ¶
func NewLabeler(chi *chiv1.ClickHouseInstallation) *Labeler
NewLabeler creates new labeler with context
func (*Labeler) GetSelectorCHIScope ¶
GetSelectorCHIScope gets labels to select a CHI-scoped object
type Normalizer ¶
type Normalizer struct {
// contains filtered or unexported fields
}
Normalizer specifies structures normalizer
func NewNormalizer ¶
func NewNormalizer(kubeClient kube.Interface) *Normalizer
NewNormalizer creates new normalizer
func (*Normalizer) CreateTemplatedCHI ¶
func (n *Normalizer) CreateTemplatedCHI(chi *chiV1.ClickHouseInstallation) (*chiV1.ClickHouseInstallation, error)
CreateTemplatedCHI produces ready-to-use CHI object
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry specifies registry struct
func (*Registry) HasConfigMap ¶
func (r *Registry) HasConfigMap(meta v1.ObjectMeta) bool
HasConfigMap checks whether registry has specified ConfigMap
func (*Registry) HasPV ¶
func (r *Registry) HasPV(meta v1.ObjectMeta) bool
HasPV checks whether registry has specified PV
func (*Registry) HasPVC ¶
func (r *Registry) HasPVC(meta v1.ObjectMeta) bool
HasPVC checks whether registry has specified PVC
func (*Registry) HasService ¶
func (r *Registry) HasService(meta v1.ObjectMeta) bool
HasService checks whether registry has specified Service
func (*Registry) HasStatefulSet ¶
func (r *Registry) HasStatefulSet(meta v1.ObjectMeta) bool
HasStatefulSet checks whether registry has specified StatefulSet
func (*Registry) Len ¶
func (r *Registry) Len(_what ...EntityType) int
Len return len of the whole registry or specified entity types
func (*Registry) NumConfigMap ¶
NumConfigMap gets number of ConfigMap
func (*Registry) NumStatefulSet ¶
NumStatefulSet gets number of StatefulSet
func (*Registry) RegisterConfigMap ¶
func (r *Registry) RegisterConfigMap(meta v1.ObjectMeta)
RegisterConfigMap register ConfigMap
func (*Registry) RegisterPV ¶
func (r *Registry) RegisterPV(meta v1.ObjectMeta)
RegisterPV register PV
func (*Registry) RegisterPVC ¶
func (r *Registry) RegisterPVC(meta v1.ObjectMeta)
RegisterPVC register PVC
func (*Registry) RegisterService ¶
func (r *Registry) RegisterService(meta v1.ObjectMeta)
RegisterService register Service
func (*Registry) RegisterStatefulSet ¶
func (r *Registry) RegisterStatefulSet(meta v1.ObjectMeta)
RegisterStatefulSet registers StatefulSet
func (*Registry) Walk ¶
func (r *Registry) Walk(f func(entityType EntityType, meta v1.ObjectMeta))
Walk walks over registry
type RemoteServersGeneratorOptions ¶
type RemoteServersGeneratorOptions struct {
// contains filtered or unexported fields
}
RemoteServersGeneratorOptions specifies options for remote-servers generator
func NewRemoteServersGeneratorOptions ¶
func NewRemoteServersGeneratorOptions() *RemoteServersGeneratorOptions
NewRemoteServersGeneratorOptions creates new remote-servers generator options
func (*RemoteServersGeneratorOptions) ExcludeHost ¶
func (o *RemoteServersGeneratorOptions) ExcludeHost(host *chiv1.ChiHost) *RemoteServersGeneratorOptions
ExcludeHost specifies to exclude host
func (*RemoteServersGeneratorOptions) ExcludeReconcileAttributes ¶
func (o *RemoteServersGeneratorOptions) ExcludeReconcileAttributes(attrs *chiv1.ChiHostReconcileAttributes) *RemoteServersGeneratorOptions
ExcludeReconcileAttributes specifies to exclude reconcile attributes
type Schemer ¶
type Schemer struct {
*Cluster
}
Schemer specifies schema manager
func NewSchemer ¶
NewSchemer creates new Schemer object
func (*Schemer) CHIDropDnsCache ¶
CHIDropDnsCache runs 'DROP DNS CACHE' over the whole CHI
func (*Schemer) HostActiveQueriesNum ¶
HostActiveQueriesNum returns how many active queries are on the host
func (*Schemer) HostCreateTables ¶
HostCreateTables creates tables on a new host
func (*Schemer) HostCreateTablesSQLs ¶
func (s *Schemer) HostCreateTablesSQLs(ctx context.Context, host *chop.ChiHost) ( replicatedObjectNames []string, replicatedCreateSQLs []string, distributedObjectNames []string, distributedCreateSQLs []string, )
HostCreateTablesSQLs makes all SQL for migrating tables
func (*Schemer) HostDropReplica ¶
HostDropReplica calls SYSTEM DROP REPLICA
func (*Schemer) HostDropTables ¶
HostDropTables drops tables on a host
func (*Schemer) HostSyncTables ¶
HostSyncTables calls SYSTEM SYNC REPLICA for replicated tables