model

package
v0.0.1-0...-ce92ebd Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2022 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
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"
)
View Source
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

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

func CreateConfigMapHostName(host *chop.ChiHost) string

CreateConfigMapHostName returns a name for a ConfigMap for replica's personal config

func CreateFQDN

func CreateFQDN(host *chop.ChiHost) string

CreateFQDN is a wrapper over pod FQDN function

func CreateFQDNs

func CreateFQDNs(obj interface{}, scope interface{}, excludeSelf bool) []string

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

func CreatePodHostname(host *chop.ChiHost) string

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

func CreateReplicaHostname(host *chop.ChiHost) string

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

func CreateShardName(shard *chop.ChiShard, index int) string

CreateShardName return a name of a shard

func CreateShardServiceName

func CreateShardServiceName(shard *chop.ChiShard) string

CreateShardServiceName returns a name of a shard's Service

func CreateStatefulSetName

func CreateStatefulSetName(host *chop.ChiHost) string

CreateStatefulSetName creates a name of a StatefulSet for ClickHouse instance

func CreateStatefulSetServiceName

func CreateStatefulSetServiceName(host *chop.ChiHost) string

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

func GetSelectorHostScope(host *chiv1.ChiHost) map[string]string

GetSelectorHostScope gets labels to select a Host-scoped object

func HostCanDeletePVC

func HostCanDeletePVC(host *chiv1.ChiHost, pvcName string) bool

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

func IsAutoGeneratedShardName(name string, shard *chop.ChiShard, index int) bool

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

func (ap *ActionPlan) String() string

String stringifies ActionPlan

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

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

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 NewCluster

func NewCluster() *Cluster

NewCluster creates new cluster object

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

func (c *Creator) CreateConfigMapCHICommonUsers() *corev1.ConfigMap

CreateConfigMapCHICommonUsers creates new corev1.ConfigMap

func (*Creator) CreateConfigMapHost

func (c *Creator) CreateConfigMapHost(host *chiv1.ChiHost) *corev1.ConfigMap

CreateConfigMapHost creates new corev1.ConfigMap

func (*Creator) CreateServiceCHI

func (c *Creator) CreateServiceCHI() *corev1.Service

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

func (c *Creator) CreateServiceHost(host *chiv1.ChiHost) *corev1.Service

CreateServiceHost creates new corev1.Service for specified host

func (*Creator) CreateServiceShard

func (c *Creator) CreateServiceShard(shard *chiv1.ChiShard) *corev1.Service

CreateServiceShard creates new corev1.Service for specified Shard

func (*Creator) CreateStatefulSet

func (c *Creator) CreateStatefulSet(host *chiv1.ChiHost, shutdown bool) *apps.StatefulSet

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

func (c *Creator) MakeConfigMapData(names, files []string) map[string]string

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

func (l *Labeler) GetSelectorCHIScope() map[string]string

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 NewRegistry

func NewRegistry() *Registry

NewRegistry creates new registry

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

func (r *Registry) NumConfigMap() int

NumConfigMap gets number of ConfigMap

func (*Registry) NumPV

func (r *Registry) NumPV() int

NumPV gets number of PV

func (*Registry) NumPVC

func (r *Registry) NumPVC() int

NumPVC gets number of PVC

func (*Registry) NumService

func (r *Registry) NumService() int

NumService gets number of Service

func (*Registry) NumStatefulSet

func (r *Registry) NumStatefulSet() int

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

func (r *Registry) String() string

String makes string representation of the registry

func (*Registry) Subtract

func (r *Registry) Subtract(sub *Registry) *Registry

Subtract subtracts specified registry from main

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

ExcludeHost specifies to exclude host

func (*RemoteServersGeneratorOptions) ExcludeReconcileAttributes

ExcludeReconcileAttributes specifies to exclude reconcile attributes

func (*RemoteServersGeneratorOptions) Include

func (o *RemoteServersGeneratorOptions) Include(host *chiv1.ChiHost) bool

Include specifies to include the host

func (*RemoteServersGeneratorOptions) Skip

Skip specifies to skip the host

type Schemer

type Schemer struct {
	*Cluster
}

Schemer specifies schema manager

func NewSchemer

func NewSchemer(scheme, username, password string, port int) *Schemer

NewSchemer creates new Schemer object

func (*Schemer) CHIDropDnsCache

func (s *Schemer) CHIDropDnsCache(ctx context.Context, chi *chop.ClickHouseInstallation) error

CHIDropDnsCache runs 'DROP DNS CACHE' over the whole CHI

func (*Schemer) HostActiveQueriesNum

func (s *Schemer) HostActiveQueriesNum(ctx context.Context, host *chop.ChiHost) (int, error)

HostActiveQueriesNum returns how many active queries are on the host

func (*Schemer) HostCreateTables

func (s *Schemer) HostCreateTables(ctx context.Context, host *chop.ChiHost) error

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

func (s *Schemer) HostDropReplica(ctx context.Context, hostToRun, hostToDrop *chop.ChiHost) error

HostDropReplica calls SYSTEM DROP REPLICA

func (*Schemer) HostDropTables

func (s *Schemer) HostDropTables(ctx context.Context, host *chop.ChiHost) error

HostDropTables drops tables on a host

func (*Schemer) HostSyncTables

func (s *Schemer) HostSyncTables(ctx context.Context, host *chop.ChiHost) error

HostSyncTables calls SYSTEM SYNC REPLICA for replicated tables

func (*Schemer) IsHostInCluster

func (s *Schemer) IsHostInCluster(ctx context.Context, host *chop.ChiHost) bool

IsHostInCluster checks whether host is a member of at least one ClickHouse cluster

Directories

Path Synopsis
builder
xml

Jump to

Keyboard shortcuts

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