model

package
v0.0.0-...-2193c2b Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2019 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Kubernetes labels
	LabelApp      = clickhousealtinitycom.GroupName + "/app"
	LabelAppValue = "chop"
	LabelChop     = clickhousealtinitycom.GroupName + "/chop"
	LabelChi      = clickhousealtinitycom.GroupName + "/chi"
	LabelCluster  = clickhousealtinitycom.GroupName + "/cluster"
	LabelShard    = clickhousealtinitycom.GroupName + "/shard"
	LabelReplica  = clickhousealtinitycom.GroupName + "/replica"
	// Supplementary service labels - used to cooperate with k8s
	LabelZookeeperConfigVersion = clickhousealtinitycom.GroupName + "/zookeeper-version"
	LabelSettingsConfigVersion  = clickhousealtinitycom.GroupName + "/settings-version"
)
View Source
const (

	// Name of container within Pod with ClickHouse instance. Pod may have other containers included, such as monitoring
	ClickHouseContainerName    = "clickhouse"
	ClickHouseLogContainerName = "clickhouse-log"
)

Variables

This section is empty.

Functions

func CreateChiServiceFQDN

func CreateChiServiceFQDN(chi *chop.ClickHouseInstallation) string

CreateChiServiceName creates a name of a Installation Service resource

func CreateChiServiceName

func CreateChiServiceName(chi *chop.ClickHouseInstallation) string

CreateChiServiceName creates a name of a Installation 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 chopConfig

func CreateConfigMapCommonUsersName

func CreateConfigMapCommonUsersName(chi *chop.ClickHouseInstallation) string

CreateConfigMapCommonUsersName returns a name for a ConfigMap for replica's common chopConfig

func CreateConfigMapPodName

func CreateConfigMapPodName(host *chop.ChiHost) string

CreateConfigMapPodName returns a name for a ConfigMap for ClickHouse pod

func CreatePVCName

func CreatePVCName(template *chop.ChiVolumeClaimTemplate, host *chop.ChiHost) string

CreatePVCName create PVC name from PVC Template and host, to which PVC belongs to

func CreatePodFQDN

func CreatePodFQDN(host *chop.ChiHost) string

CreatePodFQDN creates a fully qualified domain name of a pod ss-1eb454-2-0.my-dev-domain.svc.cluster.local

func CreatePodFQDNsOfChi

func CreatePodFQDNsOfChi(chi *chop.ClickHouseInstallation) []string

CreatePodFQDNsOfChi creates fully qualified domain names of all pods in a CHI

func CreatePodFQDNsOfCluster

func CreatePodFQDNsOfCluster(cluster *chop.ChiCluster) []string

CreatePodFQDNsOfCluster creates fully qualified domain names of all pods in a cluster

func CreatePodFQDNsOfShard

func CreatePodFQDNsOfShard(shard *chop.ChiShard) []string

CreatePodFQDNsOfShards creates fully qualified domain names of all pods in a shard

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 Replica

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 GetChiNameFromObjectMeta

func GetChiNameFromObjectMeta(meta *meta.ObjectMeta) (string, error)

func GetClusterNameFromObjectMeta

func GetClusterNameFromObjectMeta(meta *meta.ObjectMeta) (string, error)

func GetSelectorHostFromObjectMeta

func GetSelectorHostFromObjectMeta(obj *meta.ObjectMeta) (kublabels.Set, error)

func HostCanDeletePVC

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

func IsChopGeneratedObject

func IsChopGeneratedObject(objectMeta *meta.ObjectMeta) bool

IsChopGeneratedObject check whether object is generated by an operator. Check is label-based

func NewConfigSections

func NewConfigSections(chConfigGenerator *ClickHouseConfigGenerator, chopConfig *chi.Config) *configSections

Types

type ClickHouseConfigGenerator

type ClickHouseConfigGenerator struct {
	// contains filtered or unexported fields
}

func NewClickHouseConfigGenerator

func NewClickHouseConfigGenerator(chi *chiv1.ClickHouseInstallation) *ClickHouseConfigGenerator

NewClickHouseConfigGenerator returns new ClickHouseConfigGenerator struct

func (*ClickHouseConfigGenerator) GetFiles

func (c *ClickHouseConfigGenerator) GetFiles() map[string]string

GetFiles creates data for custom common config files specified by user in .spec.configuration.files section

func (*ClickHouseConfigGenerator) GetHostMacros

func (c *ClickHouseConfigGenerator) GetHostMacros(host *chiv1.ChiHost) string

GetHostMacros creates "macros.xml" content

func (*ClickHouseConfigGenerator) GetProfiles

func (c *ClickHouseConfigGenerator) GetProfiles() string

GetProfiles creates data for "profiles.xml"

func (*ClickHouseConfigGenerator) GetQuotas

func (c *ClickHouseConfigGenerator) GetQuotas() string

GetQuotas creates data for "quotas.xml"

func (*ClickHouseConfigGenerator) GetRemoteServers

func (c *ClickHouseConfigGenerator) GetRemoteServers() string

GetRemoteServers creates "remote_servers.xml" content and calculates data generation parameters for other sections

func (*ClickHouseConfigGenerator) GetSettings

func (c *ClickHouseConfigGenerator) GetSettings() string

GetSettings creates data for "settings.xml"

func (*ClickHouseConfigGenerator) GetUsers

func (c *ClickHouseConfigGenerator) GetUsers() string

GetUsers creates data for "users.xml"

func (*ClickHouseConfigGenerator) GetZookeeper

func (c *ClickHouseConfigGenerator) GetZookeeper() string

GetZookeeper creates data for "zookeeper.xml"

type Creator

type Creator struct {
	// contains filtered or unexported fields
}

func NewCreator

func NewCreator(
	chi *chiv1.ClickHouseInstallation,
	chopConfig *chiv1.Config,
	appVersion string,
) *Creator

func (*Creator) CreateConfigMapChiCommon

func (c *Creator) CreateConfigMapChiCommon() *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) *apps.StatefulSet

createStatefulSet creates new apps.StatefulSet

type Labeler

type Labeler struct {
	// contains filtered or unexported fields
}

func NewLabeler

func NewLabeler(version string, chi *chi.ClickHouseInstallation) *Labeler

func (*Labeler) GetSelectorHostScope

func (l *Labeler) GetSelectorHostScope(host *chi.ChiHost) map[string]string

type Normalizer

type Normalizer struct {
	// contains filtered or unexported fields
}

func NewNormalizer

func NewNormalizer(config *chiv1.Config) *Normalizer

func (*Normalizer) CreateTemplatedChi

func (n *Normalizer) CreateTemplatedChi(chi *chiv1.ClickHouseInstallation, withDefaultCluster bool) (*chiv1.ClickHouseInstallation, error)

CreateTemplatedChi produces ready-to-use CHI object

func (*Normalizer) DoChi

DoChi normalizes CHI. Returns normalized CHI

type Schemer

type Schemer struct {
	Username string
	Password string
	Port     int
}

func NewSchemer

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

func (*Schemer) ChiApplySQLs

func (s *Schemer) ChiApplySQLs(chi *chop.ClickHouseInstallation, sqls []string, retry bool) error

ChiApplySQLs runs set of SQL queries over the whole CHI

func (*Schemer) ChiDropDnsCache

func (s *Schemer) ChiDropDnsCache(chi *chop.ClickHouseInstallation) error

ChiDropDnsCache runs 'DROP DNS CACHE' over the whole CHI

func (*Schemer) ClusterApplySQLs

func (s *Schemer) ClusterApplySQLs(cluster *chop.ChiCluster, sqls []string, retry bool) error

ClusterApplySQLs runs set of SQL queries over the cluster

func (*Schemer) ClusterGetCreateDatabases

func (s *Schemer) ClusterGetCreateDatabases(chi *chop.ClickHouseInstallation, cluster *chop.ChiCluster) ([]string, []string, error)

ClusterGetCreateDatabases returns list of DB names and list of 'CREATE DATABASE ...' SQLs for these DBs

func (*Schemer) ClusterGetCreateDistributedObjects

func (s *Schemer) ClusterGetCreateDistributedObjects(chi *chop.ClickHouseInstallation, cluster *chop.ChiCluster) ([]string, []string, error)

GetCreateDistributedObjects returns a list of objects that needs to be created on a shard in a cluster That incldues all Distributed tables, corresponding local tables, and databases, if necessary

func (*Schemer) ClusterGetCreateTables

func (s *Schemer) ClusterGetCreateTables(chi *chop.ClickHouseInstallation, cluster *chop.ChiCluster) ([]string, []string, error)

ClusterGetCreateTables returns list of table names and list of 'CREATE TABLE ...' SQLs for these tables

func (*Schemer) GetCreateReplicatedObjects

func (s *Schemer) GetCreateReplicatedObjects(
	chi *chop.ClickHouseInstallation,
	cluster *chop.ChiCluster,
	host *chop.ChiHost,
) ([]string, []string, error)

GetCreateReplicatedObjects returns a list of objects that needs to be created on a host in a cluster

func (*Schemer) HostApplySQLs

func (s *Schemer) HostApplySQLs(host *chop.ChiHost, sqls []string, retry bool) error

ReplicaApplySQLs runs set of SQL queries over the replica

func (*Schemer) HostGetDropTables

func (s *Schemer) HostGetDropTables(host *chop.ChiHost) ([]string, []string, error)

ReplicaGetDropTables returns set of 'DROP TABLE ...' SQLs

func (*Schemer) ShardApplySQLs

func (s *Schemer) ShardApplySQLs(shard *chop.ChiShard, sqls []string, retry bool) error

ShardApplySQLs runs set of SQL queries over the shard replicas

Directories

Path Synopsis
builder
xml

Jump to

Keyboard shortcuts

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