Documentation ¶
Index ¶
- Constants
- func AppendAnnotationReady(meta *meta.ObjectMeta) bool
- func AppendLabelReady(meta *meta.ObjectMeta) bool
- func CreateCHIServiceFQDN(chi *api.ClickHouseInstallation) string
- func CreateCHIServiceName(chi *api.ClickHouseInstallation) string
- func CreateClusterAutoSecretName(cluster *api.Cluster) string
- func CreateClusterServiceName(cluster *api.Cluster) string
- func CreateConfigMapCommonName(chi *api.ClickHouseInstallation) string
- func CreateConfigMapCommonUsersName(chi *api.ClickHouseInstallation) string
- func CreateConfigMapHostName(host *api.ChiHost) string
- func CreateFQDN(host *api.ChiHost) string
- func CreateFQDNs(obj interface{}, scope interface{}, excludeSelf bool) []string
- func CreateHostName(host *api.ChiHost, shard *api.ChiShard, shardIndex int, ...) string
- func CreateHostTemplateName(host *api.ChiHost) string
- func CreateInstanceHostname(host *api.ChiHost) string
- func CreatePVCNameByVolumeClaimTemplate(host *api.ChiHost, volumeClaimTemplate *api.VolumeClaimTemplate) string
- func CreatePVCNameByVolumeMount(host *api.ChiHost, volumeMount *core.VolumeMount) (string, bool)
- func CreatePodHostname(host *api.ChiHost) string
- func CreatePodHostnameRegexp(chi *api.ClickHouseInstallation, template string) string
- func CreatePodName(obj interface{}) string
- func CreatePodNames(obj interface{}) []string
- func CreateReplicaName(replica *api.ChiReplica, index int) string
- func CreateShardName(shard *api.ChiShard, index int) string
- func CreateShardServiceName(shard *api.ChiShard) string
- func CreateStatefulSetName(host *api.ChiHost) string
- func CreateStatefulSetServiceName(host *api.ChiHost) string
- func DeleteAnnotationReady(meta *meta.ObjectMeta) bool
- func DeleteLabelReady(meta *meta.ObjectMeta) bool
- func GetCHINameFromObjectMeta(meta *meta.ObjectMeta) (string, error)
- func GetClusterNameFromObjectMeta(meta *meta.ObjectMeta) (string, error)
- func GetObjectVersion(meta meta.ObjectMeta) (string, bool)
- func GetPVCProvisioner(host *api.ChiHost, template *api.VolumeClaimTemplate) api.PVCProvisioner
- func GetReclaimPolicy(meta meta.ObjectMeta) api.PVCReclaimPolicy
- func GetSelectorClusterScope(cluster *api.Cluster) map[string]string
- func GetSelectorClusterScopeReady(cluster *api.Cluster) map[string]string
- func GetSelectorHostScope(host *api.ChiHost) map[string]string
- func GetSelectorShardScopeReady(shard *api.ChiShard) map[string]string
- func GetVolumeClaimTemplate(host *api.ChiHost, volumeMount *core.VolumeMount) (*api.VolumeClaimTemplate, bool)
- func HostCanDeleteAllPVCs(host *api.ChiHost) bool
- func HostCanDeletePVC(host *api.ChiHost, pvcName string) bool
- func HostHasTablesCreated(host *api.ChiHost) bool
- func HostIsNewOne(host *api.ChiHost) bool
- func HostWalkAssignedPorts(host *api.ChiHost, ...)
- func HostWalkInvalidPorts(host *api.ChiHost, ...)
- func HostWalkPorts(host *api.ChiHost, ...)
- func IsAutoGeneratedHostName(name string, host *api.ChiHost, shard *api.ChiShard, shardIndex int, ...) bool
- func IsAutoGeneratedReplicaName(name string, replica *api.ChiReplica, index int) bool
- func IsAutoGeneratedShardName(name string, shard *api.ChiShard, index int) bool
- func IsCHOPGeneratedObject(meta *meta.ObjectMeta) bool
- func IsConfigurationChangeRequiresReboot(host *api.ChiHost) bool
- func IsObjectTheSame(meta1, meta2 *meta.ObjectMeta) bool
- func MakeObjectVersion(meta *meta.ObjectMeta, obj interface{})
- func MakeSelectorFromObjectMeta(objMeta *meta.ObjectMeta) (k8sLabels.Selector, error)
- func MergeAffinity(dst *core.Affinity, src *core.Affinity) *core.Affinity
- func NewAffinity(template *api.PodTemplate) *core.Affinity
- func PrepareAffinity(podTemplate *api.PodTemplate, host *api.ChiHost)
- 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 *api.Cluster), shardFunc func(shard *api.ChiShard), ...)
- func (ap *ActionPlan) WalkModified(clusterFunc func(cluster *api.Cluster), shardFunc func(shard *api.ChiShard), ...)
- func (ap *ActionPlan) WalkRemoved(clusterFunc func(cluster *api.Cluster), shardFunc func(shard *api.ChiShard), ...)
- type Annotator
- func (a *Annotator) GetClusterScope(cluster *api.Cluster) map[string]string
- func (a *Annotator) GetConfigMapCHICommon() map[string]string
- func (a *Annotator) GetConfigMapCHICommonUsers() map[string]string
- func (a *Annotator) GetConfigMapHost(host *api.ChiHost) map[string]string
- func (a *Annotator) GetHostScope(host *api.ChiHost) map[string]string
- func (a *Annotator) GetPV(pv *core.PersistentVolume, host *api.ChiHost) map[string]string
- func (a *Annotator) GetPVC(pvc *core.PersistentVolumeClaim, host *api.ChiHost, ...) map[string]string
- func (a *Annotator) GetServiceCHI(chi *api.ClickHouseInstallation) map[string]string
- func (a *Annotator) GetServiceCluster(cluster *api.Cluster) map[string]string
- func (a *Annotator) GetServiceHost(host *api.ChiHost) map[string]string
- func (a *Annotator) GetServiceShard(shard *api.ChiShard) map[string]string
- type ClickHouseConfigFilesGenerator
- func (c *ClickHouseConfigFilesGenerator) CreateConfigFilesGroupCommon(options *ClickHouseConfigFilesGeneratorOptions) map[string]string
- func (c *ClickHouseConfigFilesGenerator) CreateConfigFilesGroupHost(host *api.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 *api.Cluster, options *RemoteServersGeneratorOptions) int
- func (c *ClickHouseConfigGenerator) GetHostHostnameAndPorts(host *api.ChiHost) string
- func (c *ClickHouseConfigGenerator) GetHostMacros(host *api.ChiHost) string
- func (c *ClickHouseConfigGenerator) GetHostZookeeper(host *api.ChiHost) string
- func (c *ClickHouseConfigGenerator) GetProfiles() string
- func (c *ClickHouseConfigGenerator) GetQuotas() string
- func (c *ClickHouseConfigGenerator) GetRemoteServers(options *RemoteServersGeneratorOptions) string
- func (c *ClickHouseConfigGenerator) GetSectionFromFiles(section api.SettingsSection, includeUnspecified bool, host *api.ChiHost) map[string]string
- func (c *ClickHouseConfigGenerator) GetSettings(host *api.ChiHost) string
- func (c *ClickHouseConfigGenerator) GetSettingsGlobal() string
- func (c *ClickHouseConfigGenerator) GetUsers() string
- func (c *ClickHouseConfigGenerator) ShardHostsNum(shard *api.ChiShard, options *RemoteServersGeneratorOptions) int
- type EntityType
- type Labeler
- func (l *Labeler) GetClusterScope(cluster *api.Cluster) map[string]string
- func (l *Labeler) GetConfigMapCHICommon() map[string]string
- func (l *Labeler) GetConfigMapCHICommonUsers() map[string]string
- func (l *Labeler) GetConfigMapHost(host *api.ChiHost) map[string]string
- func (l *Labeler) GetHostScope(host *api.ChiHost, applySupplementaryServiceLabels bool) map[string]string
- func (l *Labeler) GetHostScopeReady(host *api.ChiHost, applySupplementaryServiceLabels bool) map[string]string
- func (l *Labeler) GetPV(pv *core.PersistentVolume, host *api.ChiHost) map[string]string
- func (l *Labeler) GetPVC(pvc *core.PersistentVolumeClaim, host *api.ChiHost, ...) map[string]string
- func (l *Labeler) GetSelectorCHIScope() map[string]string
- func (l *Labeler) GetSelectorCHIScopeReady() map[string]string
- func (l *Labeler) GetServiceCHI(chi *api.ClickHouseInstallation) map[string]string
- func (l *Labeler) GetServiceCluster(cluster *api.Cluster) map[string]string
- func (l *Labeler) GetServiceHost(host *api.ChiHost) map[string]string
- func (l *Labeler) GetServiceShard(shard *api.ChiShard) map[string]string
- type MacrosEngine
- type Registry
- func (r *Registry) HasConfigMap(meta meta.ObjectMeta) bool
- func (r *Registry) HasPDB(meta meta.ObjectMeta) bool
- func (r *Registry) HasPVC(meta meta.ObjectMeta) bool
- func (r *Registry) HasSecret(meta meta.ObjectMeta) bool
- func (r *Registry) HasService(meta meta.ObjectMeta) bool
- func (r *Registry) HasStatefulSet(meta meta.ObjectMeta) bool
- func (r *Registry) Len(what ...EntityType) int
- func (r *Registry) NumConfigMap() int
- func (r *Registry) NumPDB() int
- func (r *Registry) NumPVC() int
- func (r *Registry) NumSecret() int
- func (r *Registry) NumService() int
- func (r *Registry) NumStatefulSet() int
- func (r *Registry) RegisterConfigMap(meta meta.ObjectMeta)
- func (r *Registry) RegisterPDB(meta meta.ObjectMeta)
- func (r *Registry) RegisterPVC(meta meta.ObjectMeta)
- func (r *Registry) RegisterSecret(meta meta.ObjectMeta)
- func (r *Registry) RegisterService(meta meta.ObjectMeta)
- func (r *Registry) RegisterStatefulSet(meta meta.ObjectMeta)
- func (r *Registry) String() string
- func (r *Registry) Subtract(sub *Registry) *Registry
- func (r *Registry) Walk(f func(entityType EntityType, meta meta.ObjectMeta))
- func (r *Registry) WalkConfigMap(f func(meta meta.ObjectMeta))
- func (r *Registry) WalkPDB(f func(meta meta.ObjectMeta))
- func (r *Registry) WalkPVC(f func(meta meta.ObjectMeta))
- func (r *Registry) WalkSecret(f func(meta meta.ObjectMeta))
- func (r *Registry) WalkService(f func(meta meta.ObjectMeta))
- func (r *Registry) WalkStatefulSet(f func(meta meta.ObjectMeta))
- type RemoteServersGeneratorOptions
- func (o *RemoteServersGeneratorOptions) Exclude(host *api.ChiHost) bool
- func (o *RemoteServersGeneratorOptions) ExcludeHost(host *api.ChiHost) *RemoteServersGeneratorOptions
- func (o *RemoteServersGeneratorOptions) ExcludeHosts(hosts ...*api.ChiHost) *RemoteServersGeneratorOptions
- func (o *RemoteServersGeneratorOptions) ExcludeReconcileAttributes(attrs *api.HostReconcileAttributes) *RemoteServersGeneratorOptions
- func (o *RemoteServersGeneratorOptions) Include(host *api.ChiHost) bool
- func (o *RemoteServersGeneratorOptions) String() string
Constants ¶
const ( // DirPathCommonConfig specifies full path to folder, where generated common XML files for ClickHouse would be placed // for the following sections: // 1. remote servers // 2. operator-provided additional config files DirPathCommonConfig = "/etc/clickhouse-server/" + api.CommonConfigDir + "/" // DirPathUsersConfig specifies full path to folder, where generated users XML files for ClickHouse would be placed // for the following sections: // 1. users // 2. quotas // 3. profiles // 4. operator-provided additional config files DirPathUsersConfig = "/etc/clickhouse-server/" + api.UsersConfigDir + "/" // DirPathHostConfig specifies full path to folder, where generated host XML files for ClickHouse would be placed // for the following sections: // 1. macros // 2. zookeeper // 3. settings // 4. files // 5. operator-provided additional config files DirPathHostConfig = "/etc/clickhouse-server/" + api.HostConfigDir + "/" // DirPathSecretFilesConfig specifies full path to folder, where secrets are mounted DirPathSecretFilesConfig = "/etc/clickhouse-server/secrets.d/" // DirPathClickHouseData specifies full path of data folder where ClickHouse would place its data storage DirPathClickHouseData = "/var/lib/clickhouse" // DirPathClickHouseLog specifies full path of data folder where ClickHouse would place its log files DirPathClickHouseLog = "/var/log/clickhouse-server" // DirPathDockerEntrypointInit specified full path of docker-entrypoint-initdb.d // For more details please check: https://github.com/ClickHouse/ClickHouse/issues/3319 DirPathDockerEntrypointInit = "/docker-entrypoint-initdb.d" )
const ( // DefaultClickHouseDockerImage specifies default ClickHouse docker image to be used DefaultClickHouseDockerImage = "clickhouse/clickhouse-server:latest" // DefaultBusyBoxDockerImage specifies default BusyBox docker image to be used DefaultBusyBoxDockerImage = "busybox" // DefaultUbiDockerImage specifies default ubi docker image to be used DefaultUbiDockerImage = "registry.access.redhat.com/ubi8/ubi-minimal:latest" // 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 ( // ClickHouse open ports names and values ChDefaultTCPPortName = "tcp" ChDefaultTCPPortNumber = int32(9000) ChDefaultTLSPortName = "secureclient" ChDefaultTLSPortNumber = int32(9440) ChDefaultHTTPPortName = "http" ChDefaultHTTPPortNumber = int32(8123) ChDefaultHTTPSPortName = "https" ChDefaultHTTPSPortNumber = int32(8443) ChDefaultInterserverHTTPPortName = "interserver" ChDefaultInterserverHTTPPortNumber = int32(9009) )
const ( // ZkDefaultPort specifies Zookeeper default port ZkDefaultPort = 2181 // ZkDefaultRootTemplate specifies default ZK root - /clickhouse/{namespace}/{chi name} ZkDefaultRootTemplate = "/clickhouse/%s/%s" )
const ( // Pattern for string path used in <distributed_ddl><path>XXX</path></distributed_ddl> DistributedDDLPathPattern = "/clickhouse/%s/task_queue/ddl" // Special auto-generated clusters. Each of these clusters lay over all replicas in CHI // 1. Cluster with one shard and all replicas. Used to duplicate data over all replicas. // 2. Cluster with all shards (1 replica). Used to gather/scatter data over all replicas. OneShardAllReplicasClusterName = "all-replicated" AllShardsOneReplicaClusterName = "all-sharded" )
const ( SchemaPolicyReplicaNone = "None" SchemaPolicyReplicaAll = "All" SchemaPolicyShardNone = "None" SchemaPolicyShardAll = "All" SchemaPolicyShardDistributedTablesOnly = "DistributedTablesOnly" )
Values for Schema Policy
const ( LabelReadyName = clickhouse_altinity_com.APIGroupName + "/" + "ready" LabelReadyValueReady = "yes" LabelReadyValueNotReady = "no" LabelAppName = clickhouse_altinity_com.APIGroupName + "/" + "app" LabelAppValue = "chop" LabelCHOP = clickhouse_altinity_com.APIGroupName + "/" + "chop" LabelCHOPCommit = clickhouse_altinity_com.APIGroupName + "/" + "chop-commit" LabelCHOPDate = clickhouse_altinity_com.APIGroupName + "/" + "chop-date" LabelNamespace = clickhouse_altinity_com.APIGroupName + "/" + "namespace" LabelCHIName = clickhouse_altinity_com.APIGroupName + "/" + "chi" LabelClusterName = clickhouse_altinity_com.APIGroupName + "/" + "cluster" LabelShardName = clickhouse_altinity_com.APIGroupName + "/" + "shard" LabelReplicaName = clickhouse_altinity_com.APIGroupName + "/" + "replica" LabelConfigMap = clickhouse_altinity_com.APIGroupName + "/" + "ConfigMap" LabelService = clickhouse_altinity_com.APIGroupName + "/" + "Service" LabelPVCReclaimPolicyName = clickhouse_altinity_com.APIGroupName + "/" + "reclaimPolicy" LabelZookeeperConfigVersion = clickhouse_altinity_com.APIGroupName + "/" + "zookeeper-version" LabelSettingsConfigVersion = clickhouse_altinity_com.APIGroupName + "/" + "settings-version" LabelObjectVersion = clickhouse_altinity_com.APIGroupName + "/" + "object-version" LabelShardScopeIndex = clickhouse_altinity_com.APIGroupName + "/" + "shardScopeIndex" LabelReplicaScopeIndex = clickhouse_altinity_com.APIGroupName + "/" + "replicaScopeIndex" LabelCHIScopeIndex = clickhouse_altinity_com.APIGroupName + "/" + "chiScopeIndex" LabelCHIScopeCycleSize = clickhouse_altinity_com.APIGroupName + "/" + "chiScopeCycleSize" LabelCHIScopeCycleIndex = clickhouse_altinity_com.APIGroupName + "/" + "chiScopeCycleIndex" LabelCHIScopeCycleOffset = clickhouse_altinity_com.APIGroupName + "/" + "chiScopeCycleOffset" LabelClusterScopeIndex = clickhouse_altinity_com.APIGroupName + "/" + "clusterScopeIndex" LabelClusterScopeCycleSize = clickhouse_altinity_com.APIGroupName + "/" + "clusterScopeCycleSize" LabelClusterScopeCycleIndex = clickhouse_altinity_com.APIGroupName + "/" + "clusterScopeCycleIndex" LabelClusterScopeCycleOffset = clickhouse_altinity_com.APIGroupName + "/" + "clusterScopeCycleOffset" )
Set of kubernetes labels used by the operator
const (
InternodeClusterSecretEnvName = "CLICKHOUSE_INTERNODE_CLUSTER_SECRET"
)
const (
// Default value for ClusterIP service
TemplateDefaultsServiceClusterIP = "None"
)
Variables ¶
This section is empty.
Functions ¶
func AppendAnnotationReady ¶
func AppendAnnotationReady(meta *meta.ObjectMeta) bool
AppendAnnotationReady appends "Ready" annotation to ObjectMeta.Annotations Returns true in case annotation was not in place and was added.
func AppendLabelReady ¶
func AppendLabelReady(meta *meta.ObjectMeta) bool
AppendLabelReady appends "Ready" label to ObjectMeta.Labels. Returns true in case label was not in place and was added.
func CreateCHIServiceFQDN ¶
func CreateCHIServiceFQDN(chi *api.ClickHouseInstallation) string
CreateCHIServiceFQDN creates a FQD name of a root ClickHouseInstallation Service resource
func CreateCHIServiceName ¶
func CreateCHIServiceName(chi *api.ClickHouseInstallation) string
CreateCHIServiceName creates a name of a root ClickHouseInstallation Service resource
func CreateClusterAutoSecretName ¶
CreateClusterAutoSecretName creates Secret name where auto-generated secret is kept
func CreateClusterServiceName ¶
CreateClusterServiceName returns a name of a cluster's Service
func CreateConfigMapCommonName ¶
func CreateConfigMapCommonName(chi *api.ClickHouseInstallation) string
CreateConfigMapCommonName returns a name for a ConfigMap for replica's common config
func CreateConfigMapCommonUsersName ¶
func CreateConfigMapCommonUsersName(chi *api.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 *api.ChiHost, shard *api.ChiShard, shardIndex int, replica *api.ChiReplica, replicaIndex int) string
CreateHostName returns a name of a host
func CreateHostTemplateName ¶
CreateHostTemplateName returns a name of a HostTemplate
func CreateInstanceHostname ¶
CreateInstanceHostname 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 CreatePVCNameByVolumeClaimTemplate ¶
func CreatePVCNameByVolumeClaimTemplate(host *api.ChiHost, volumeClaimTemplate *api.VolumeClaimTemplate) string
CreatePVCNameByVolumeClaimTemplate creates PVC name
func CreatePVCNameByVolumeMount ¶
CreatePVCNameByVolumeMount creates PVC name
func CreatePodHostname ¶
CreatePodHostname returns a hostname of a Pod of a ClickHouse instance. Is supposed to be used where network connection to a Pod is required. NB: right now Pod's hostname points to a Service, through which Pod can be accessed.
func CreatePodHostnameRegexp ¶
func CreatePodHostnameRegexp(chi *api.ClickHouseInstallation, template string) string
CreatePodHostnameRegexp creates pod hostname regexp. For example, `template` can be defined in operator config: HostRegexpTemplate: chi-{chi}-[^.]+\\d+-\\d+\\.{namespace}.svc.cluster.local$"
func CreatePodName ¶
func CreatePodName(obj interface{}) string
CreatePodName creates Pod name based on specified StatefulSet or Host
func CreatePodNames ¶
func CreatePodNames(obj interface{}) []string
CreatePodNames is a wrapper over set of create pod names functions obj specifies source object to create names from
func CreateReplicaName ¶
func CreateReplicaName(replica *api.ChiReplica, index int) string
CreateReplicaName returns 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 CreateInstanceHostname function
func CreateShardName ¶
CreateShardName returns 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 DeleteAnnotationReady ¶
func DeleteAnnotationReady(meta *meta.ObjectMeta) bool
DeleteAnnotationReady deletes "Ready" annotation from ObjectMeta.Annotations Returns true in case annotation was in place and was deleted.
func DeleteLabelReady ¶
func DeleteLabelReady(meta *meta.ObjectMeta) bool
DeleteLabelReady deletes "Ready" label from ObjectMeta.Labels Returns true in case label was in place and was deleted.
func GetCHINameFromObjectMeta ¶
func GetCHINameFromObjectMeta(meta *meta.ObjectMeta) (string, error)
GetCHINameFromObjectMeta extracts CHI name from ObjectMeta. Based on labels.
func GetClusterNameFromObjectMeta ¶
func GetClusterNameFromObjectMeta(meta *meta.ObjectMeta) (string, error)
GetClusterNameFromObjectMeta extracts cluster name from ObjectMeta. Based on labels.
func GetObjectVersion ¶
func GetObjectVersion(meta meta.ObjectMeta) (string, bool)
GetObjectVersion gets version of the object
func GetPVCProvisioner ¶
func GetPVCProvisioner(host *api.ChiHost, template *api.VolumeClaimTemplate) api.PVCProvisioner
func GetReclaimPolicy ¶
func GetReclaimPolicy(meta meta.ObjectMeta) api.PVCReclaimPolicy
GetReclaimPolicy gets reclaim policy from meta
func GetSelectorClusterScope ¶
GetSelectorClusterScope gets labels to select a Cluster-scoped object
func GetSelectorClusterScopeReady ¶
GetSelectorClusterScope gets labels to select a ready-labelled Cluster-scoped object
func GetSelectorHostScope ¶
GetSelectorHostScope gets labels to select a Host-scoped object
func GetSelectorShardScopeReady ¶
GetSelectorShardScopeReady gets labels to select a ready-labelled Shard-scoped object
func GetVolumeClaimTemplate ¶
func GetVolumeClaimTemplate(host *api.ChiHost, volumeMount *core.VolumeMount) (*api.VolumeClaimTemplate, bool)
func HostCanDeleteAllPVCs ¶
HostCanDeleteAllPVCs checks whether all PVCs can be deleted
func HostCanDeletePVC ¶
HostCanDeletePVC checks whether PVC on a host can be deleted
func HostHasTablesCreated ¶
HostHasTablesCreated checks whether host has tables listed as already created
func HostIsNewOne ¶
HostIsNewOne checks whether host is a newly created TODO there should be better way to detect newly created CHI TODO unify with api host.IsNew
func HostWalkAssignedPorts ¶
func HostWalkInvalidPorts ¶
func HostWalkPorts ¶
func IsAutoGeneratedHostName ¶
func IsAutoGeneratedHostName( name string, host *api.ChiHost, shard *api.ChiShard, shardIndex int, replica *api.ChiReplica, replicaIndex int, ) bool
IsAutoGeneratedHostName checks whether name is auto-generated
func IsAutoGeneratedReplicaName ¶
func IsAutoGeneratedReplicaName(name string, replica *api.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 IsConfigurationChangeRequiresReboot ¶
IsConfigurationChangeRequiresReboot checks whether configuration changes requires a reboot
func IsObjectTheSame ¶
func IsObjectTheSame(meta1, meta2 *meta.ObjectMeta) bool
IsObjectTheSame checks whether objects are the same
func MakeObjectVersion ¶
func MakeObjectVersion(meta *meta.ObjectMeta, obj interface{})
MakeObjectVersion makes object version label
func MakeSelectorFromObjectMeta ¶
func MakeSelectorFromObjectMeta(objMeta *meta.ObjectMeta) (k8sLabels.Selector, error)
MakeSelectorFromObjectMeta makes selector from meta TODO review usage
func MergeAffinity ¶
MergeAffinity merges from src into dst and returns dst
func NewAffinity ¶
func NewAffinity(template *api.PodTemplate) *core.Affinity
NewAffinity creates new Affinity struct
func PrepareAffinity ¶
func PrepareAffinity(podTemplate *api.PodTemplate, host *api.ChiHost)
PrepareAffinity
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 *api.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 *api.Cluster), shardFunc func(shard *api.ChiShard), hostFunc func(host *api.ChiHost), )
WalkAdded walk added cluster items
func (*ActionPlan) WalkModified ¶
func (ap *ActionPlan) WalkModified( clusterFunc func(cluster *api.Cluster), shardFunc func(shard *api.ChiShard), hostFunc func(host *api.ChiHost), )
WalkModified walk modified cluster items
func (*ActionPlan) WalkRemoved ¶
func (ap *ActionPlan) WalkRemoved( clusterFunc func(cluster *api.Cluster), shardFunc func(shard *api.ChiShard), hostFunc func(host *api.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 *api.ClickHouseInstallation) *Annotator
NewAnnotator creates new annotator with context
func (*Annotator) GetClusterScope ¶
GetClusterScope gets annotations for Cluster-scoped object
func (*Annotator) GetConfigMapCHICommon ¶
GetConfigMapCHICommon
func (*Annotator) GetConfigMapCHICommonUsers ¶
GetConfigMapCHICommonUsers
func (*Annotator) GetConfigMapHost ¶
GetConfigMapHost
func (*Annotator) GetHostScope ¶
GetHostScope gets annotations for Host-scoped object
func (*Annotator) GetPVC ¶
func (a *Annotator) GetPVC( pvc *core.PersistentVolumeClaim, host *api.ChiHost, template *api.VolumeClaimTemplate, ) map[string]string
GetPVC
func (*Annotator) GetServiceCHI ¶
func (a *Annotator) GetServiceCHI(chi *api.ClickHouseInstallation) map[string]string
GetServiceCHI
func (*Annotator) GetServiceCluster ¶
GetServiceCluster
func (*Annotator) GetServiceHost ¶
GetServiceHost
type ClickHouseConfigFilesGenerator ¶
type ClickHouseConfigFilesGenerator struct {
// contains filtered or unexported fields
}
ClickHouseConfigFilesGenerator specifies clickhouse configuration generator object
func NewClickHouseConfigFilesGenerator ¶
func NewClickHouseConfigFilesGenerator( chConfigGenerator *ClickHouseConfigGenerator, chopConfig *api.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 *api.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 *api.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 *api.Cluster, options *RemoteServersGeneratorOptions) int
ClusterHostsNum count hosts according to the options
func (*ClickHouseConfigGenerator) GetHostHostnameAndPorts ¶
func (c *ClickHouseConfigGenerator) GetHostHostnameAndPorts(host *api.ChiHost) string
GetHostHostnameAndPorts creates "ports.xml" content
func (*ClickHouseConfigGenerator) GetHostMacros ¶
func (c *ClickHouseConfigGenerator) GetHostMacros(host *api.ChiHost) string
GetHostMacros creates "macros.xml" content
func (*ClickHouseConfigGenerator) GetHostZookeeper ¶
func (c *ClickHouseConfigGenerator) GetHostZookeeper(host *api.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) GetSectionFromFiles ¶
func (c *ClickHouseConfigGenerator) GetSectionFromFiles(section api.SettingsSection, includeUnspecified bool, host *api.ChiHost) map[string]string
GetSectionFromFiles creates data for custom common config files
func (*ClickHouseConfigGenerator) GetSettings ¶
func (c *ClickHouseConfigGenerator) GetSettings(host *api.ChiHost) string
GetSettings creates data for "settings.xml"
func (*ClickHouseConfigGenerator) GetSettingsGlobal ¶
func (c *ClickHouseConfigGenerator) GetSettingsGlobal() string
GetSettingsGlobal 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 *api.ChiShard, options *RemoteServersGeneratorOptions) int
ShardHostsNum count hosts according to the options
type EntityType ¶
type EntityType string
EntityType specifies registry entity type
const ( // StatefulSet describes StatefulSet entity type StatefulSet EntityType = "StatefulSet" // ConfigMap describes ConfigMap entity type ConfigMap EntityType = "ConfigMap" // Service describes Service entity type Service EntityType = "Service" // Secret describes Secret entity type Secret EntityType = "Secret" // PVC describes PersistentVolumeClaim entity type PVC EntityType = "PVC" // Comment out PV // PV describes PersistentVolume entity type //PV EntityType = "PV" // PDB describes PodDisruptionBudget entity type PDB EntityType = "PDB" )
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 *api.ClickHouseInstallation) *Labeler
NewLabeler creates new labeler with context
func (*Labeler) GetClusterScope ¶
GetClusterScope gets labels for Cluster-scoped object
func (*Labeler) GetConfigMapCHICommon ¶
GetConfigMapCHICommon
func (*Labeler) GetConfigMapCHICommonUsers ¶
GetConfigMapCHICommonUsers
func (*Labeler) GetConfigMapHost ¶
GetConfigMapHost
func (*Labeler) GetHostScope ¶
func (l *Labeler) GetHostScope(host *api.ChiHost, applySupplementaryServiceLabels bool) map[string]string
GetHostScope gets labels for Host-scoped object
func (*Labeler) GetHostScopeReady ¶
func (l *Labeler) GetHostScopeReady(host *api.ChiHost, applySupplementaryServiceLabels bool) map[string]string
GetHostScopeReady gets labels for Host-scoped object including Ready label
func (*Labeler) GetPVC ¶
func (l *Labeler) GetPVC( pvc *core.PersistentVolumeClaim, host *api.ChiHost, template *api.VolumeClaimTemplate, ) map[string]string
GetPVC
func (*Labeler) GetSelectorCHIScope ¶
GetSelectorCHIScope gets labels to select a CHI-scoped object
func (*Labeler) GetSelectorCHIScopeReady ¶
GetSelectorCHIScopeReady gets labels to select a ready-labelled CHI-scoped object
func (*Labeler) GetServiceCHI ¶
func (l *Labeler) GetServiceCHI(chi *api.ClickHouseInstallation) map[string]string
GetServiceCHI
func (*Labeler) GetServiceCluster ¶
GetServiceCluster
func (*Labeler) GetServiceHost ¶
GetServiceHost
type MacrosEngine ¶
type MacrosEngine struct {
// contains filtered or unexported fields
}
MacrosEngine
func (*MacrosEngine) Line ¶
func (m *MacrosEngine) Line(line string) string
Line expands line with macros(es)
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry specifies registry struct
func (*Registry) HasConfigMap ¶
func (r *Registry) HasConfigMap(meta meta.ObjectMeta) bool
HasConfigMap checks whether registry has specified ConfigMap
func (*Registry) HasPDB ¶
func (r *Registry) HasPDB(meta meta.ObjectMeta) bool
HasPDB checks whether registry has specified PDB
func (*Registry) HasPVC ¶
func (r *Registry) HasPVC(meta meta.ObjectMeta) bool
HasPVC checks whether registry has specified PVC
func (*Registry) HasSecret ¶
func (r *Registry) HasSecret(meta meta.ObjectMeta) bool
HasSecret checks whether registry has specified Secret
func (*Registry) HasService ¶
func (r *Registry) HasService(meta meta.ObjectMeta) bool
HasService checks whether registry has specified Service
func (*Registry) HasStatefulSet ¶
func (r *Registry) HasStatefulSet(meta meta.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 Note that this is unsafe to call recursively, including in calls to other synchronized Registry functions like Walk (and therefore in the "work" function passed into iterators like Walk and walkEntityType).
func (*Registry) NumConfigMap ¶
NumConfigMap gets number of ConfigMap
func (*Registry) NumStatefulSet ¶
NumStatefulSet gets number of StatefulSet
func (*Registry) RegisterConfigMap ¶
func (r *Registry) RegisterConfigMap(meta meta.ObjectMeta)
RegisterConfigMap register ConfigMap
func (*Registry) RegisterPDB ¶
func (r *Registry) RegisterPDB(meta meta.ObjectMeta)
RegisterPDB register PDB
func (*Registry) RegisterPVC ¶
func (r *Registry) RegisterPVC(meta meta.ObjectMeta)
RegisterPVC register PVC
func (*Registry) RegisterSecret ¶
func (r *Registry) RegisterSecret(meta meta.ObjectMeta)
RegisterSecret register Secret
func (*Registry) RegisterService ¶
func (r *Registry) RegisterService(meta meta.ObjectMeta)
RegisterService register Service
func (*Registry) RegisterStatefulSet ¶
func (r *Registry) RegisterStatefulSet(meta meta.ObjectMeta)
RegisterStatefulSet registers StatefulSet
func (*Registry) Walk ¶
func (r *Registry) Walk(f func(entityType EntityType, meta meta.ObjectMeta))
Walk walks over registry. Note: this is fairly expensive in the sense that it locks the entire registry from being written for the full duration of whatever workload is applied throughout iteration. Avoid calling when you know the entity type you want.
func (*Registry) WalkConfigMap ¶
func (r *Registry) WalkConfigMap(f func(meta meta.ObjectMeta))
WalkConfigMap walk over specified entity types
func (*Registry) WalkPDB ¶
func (r *Registry) WalkPDB(f func(meta meta.ObjectMeta))
WalkPDB walk over specified entity types
func (*Registry) WalkPVC ¶
func (r *Registry) WalkPVC(f func(meta meta.ObjectMeta))
WalkPVC walk over specified entity types
func (*Registry) WalkSecret ¶
func (r *Registry) WalkSecret(f func(meta meta.ObjectMeta))
WalkSecret walk over specified entity types
func (*Registry) WalkService ¶
func (r *Registry) WalkService(f func(meta meta.ObjectMeta))
WalkService walk over specified entity types
func (*Registry) WalkStatefulSet ¶
func (r *Registry) WalkStatefulSet(f func(meta meta.ObjectMeta))
WalkStatefulSet walk over specified entity types
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) Exclude ¶
func (o *RemoteServersGeneratorOptions) Exclude(host *api.ChiHost) bool
Exclude tells whether to exclude the host
func (*RemoteServersGeneratorOptions) ExcludeHost ¶
func (o *RemoteServersGeneratorOptions) ExcludeHost(host *api.ChiHost) *RemoteServersGeneratorOptions
ExcludeHost specifies to exclude a host
func (*RemoteServersGeneratorOptions) ExcludeHosts ¶
func (o *RemoteServersGeneratorOptions) ExcludeHosts(hosts ...*api.ChiHost) *RemoteServersGeneratorOptions
ExcludeHosts specifies to exclude list of hosts
func (*RemoteServersGeneratorOptions) ExcludeReconcileAttributes ¶
func (o *RemoteServersGeneratorOptions) ExcludeReconcileAttributes(attrs *api.HostReconcileAttributes) *RemoteServersGeneratorOptions
ExcludeReconcileAttributes specifies to exclude reconcile attributes
func (*RemoteServersGeneratorOptions) Include ¶
func (o *RemoteServersGeneratorOptions) Include(host *api.ChiHost) bool
Include tells whether to include the host
func (*RemoteServersGeneratorOptions) String ¶
func (o *RemoteServersGeneratorOptions) String() string
String returns string representation