naming

package
v0.0.0-...-df89844 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MySQLPortAnno = annoPrefix + "mysqlPort"

	// StopReconcile the cluster stop reconcile.
	StopReconcile = annoPrefix + "stop-reconcile"
)
View Source
const (
	SidecarConfigKey        = "sidecar"
	DatabaseConfigKey       = "database"
	SidecarConfigMapFileKey = "config.yaml"
	MySQLConfigMapFileKey   = "my.cnf"
)
View Source
const (
	// DataMountPath is where to mount the main data volume.
	DataMountPath = "/kdbdata"

	// LogMountPath is where to mount the optional WAL volume.
	LogMountPath = "/kdblog"

	// DownwardAPIPath is where to mount the downwardAPI volume.
	DownwardAPIPath = "/etc/containerinfo"

	// ConfigMountPath is where to mount the config volume.
	ConfigMountPath = "/etc/config"
)
View Source
const (
	MasterRole  = "master"
	ReplicaRole = "replica"
)
View Source
const (
	MySQLEngine    = "mysql"
	PostgresEngine = "pg"
)
View Source
const (
	// LabelClusterID et al. provides the fundamental labels for Postgres instances
	LabelClusterID   = labelPrefix + "clusterID"
	LabelInstance    = labelPrefix + "instance"
	LabelInstanceSet = labelPrefix + "instanceSet"

	LabelMasterHostname = labelPrefix + "masterHostname"
	LabelMasterIP       = labelPrefix + "masterIP"

	LabelHaProxy = labelPrefix + "ha"

	LabelRole = labelPrefix + "role"

	// LabelData is used to identify Pods and Volumes data store KDB data.
	LabelData = labelPrefix + "data"
	// LabelLog is used to identify Pods and Volumes log store KDB data.
	LabelLog = labelPrefix + "log"
)
View Source
const (
	MysqlLabelKeyInstanceName = "kdb.com/instance-name"

	MysqlLableKeyWorkingPodName = "kdb.com/working-pod-name"

	// restore from backup
	// mysql cluster to recover
	MysqlAnnoKeyRestoreClusterId = "kdb.com/restore-clusterid"
	// the point-in-time to recover
	MysqlAnnoKeyRestorePointInTime = "kdb.com/restore-unix-pit"

	// full backup cron expression
	MysqlAnnoKeyFullBackupCron = "kdb.com/fullbackup-cron"
	// incr backup cron expression
	MysqlAnnoKeyIncrBackupCron = "kdb.com/incrbackup-cron"
	// MySQL serverId config
	MySQLAnnoKeyServerId = "kdb.com/server-id"
	// MySQL master instance name
	MySQLAnnoKeyMasterInstanceName = "kdb.com/master-instance"
	// MySQL master sigma cluster
	MySQLAnnoKeyMasterSigmaCluster = "kdb.com/master-sigma-cluster"
)
View Source
const (
	// ContainerDatabase is the name of the container running KDB database container
	ContainerDatabase = "database"

	ContainerSidecar = "mgr"
)
View Source
const (

	// Finalizer marks an object to be garbage collected by this module.
	Finalizer = finalizerPrefix + "finalizer"
)
View Source
const GlobalConfigSecret = "kdb-global-config"
View Source
const GlobalConfigSecretKey = "global"
View Source
const (
	// PortDatabase is the name of a port that connects to kdb instance.
	PortDatabase = "database"
)
View Source
const (
	YamlGeneratedWarning = "" +
		"# Generated by kdb-operator. DO NOT EDIT.\n" +
		"# Your changes will not be saved.\n"
)

Variables

View Source
var (
	OneMillicore = resource.MustParse("1m")
	OneMebibyte  = resource.MustParse("1Mi")
)

Functions

func AsSelector

func AsSelector(s metav1.LabelSelector) (labels.Selector, error)

AsSelector is a wrapper around metav1.LabelSelectorAsSelector() which converts the LabelSelector API type into something that implements labels.Selector.

func ConfigVolumeMount

func ConfigVolumeMount() corev1.VolumeMount

ConfigVolumeMount returns the name and mount path of the kdb config volume.

func DataVolumeMount

func DataVolumeMount() corev1.VolumeMount

DataVolumeMount returns the name and mount path of the kdb data volume.

func DownwardAPIVolumeMount

func DownwardAPIVolumeMount() corev1.VolumeMount

DownwardAPIVolumeMount returns the name and mount path of the DownwardAPI volume.

func Engine

func Engine(instance *v1.KDBInstance) string

func EngineVersion

func EngineVersion(instance *v1.KDBInstance) (*version.Version, error)

EngineVersion return instance engine major version.

func GenerateInstanceStatefulSetMeta

func GenerateInstanceStatefulSetMeta(
	instance *v1.KDBInstance,
	index int,
) metav1.ObjectMeta

GenerateInstanceStatefulSetMeta returns a instance statefulSet meta.

func HaProxy

func HaProxy(instance *v1.KDBInstance) string

HaProxy returns the "scope" haproxy uses for instance.

func InstanceConfigMap

func InstanceConfigMap(instance *v1.KDBInstance) metav1.ObjectMeta

InstanceConfigMap returns the ObjectMeta necessary to lookup cluster's shared ConfigMap.

func InstanceDataPvcSpec

func InstanceDataPvcSpec(instance *v1.KDBInstance) shared.PVCSpec

func InstanceDataVolume

func InstanceDataVolume(runner *appsv1.StatefulSet) metav1.ObjectMeta

InstanceDataVolume returns the ObjectMeta for the KDB data volume for instance.

func InstanceLogPvcSpec

func InstanceLogPvcSpec(instance *v1.KDBInstance) *shared.PVCSpec

func InstanceLogVolume

func InstanceLogVolume(runner *appsv1.StatefulSet) metav1.ObjectMeta

InstanceLogVolume returns the ObjectMeta for the KDB log volume for instance.

func InstanceRBAC

func InstanceRBAC(instance *v1.KDBInstance) metav1.ObjectMeta

InstanceRBAC returns the ObjectMeta necessary to lookup the ServiceAccount, Role, and RoleBinding for cluster's kdb instances.

func InstanceSetSpec

func InstanceSetSpec(instance *v1.KDBInstance) shared.InstanceSetSpec

func InstanceStatefulSetName

func InstanceStatefulSetName(instanceSetName string, index int) string

func IsInstanceReady

func IsInstanceReady(instance *v1.KDBInstance) bool

func IsMasterInstance

func IsMasterInstance(instance *v1.KDBInstance) bool

func IsMasterPod

func IsMasterPod(pod *corev1.Pod) bool

func IsMySQLEngine

func IsMySQLEngine(instance *v1.KDBInstance) bool

func IsPGEngine

func IsPGEngine(instance *v1.KDBInstance) bool

func KDBCluster

func KDBCluster(clusterName string) metav1.LabelSelector

KDBCluster selects things for a single clusterName in a cluster.

func KDBInstance

func KDBInstance(instanceName string) metav1.LabelSelector

KDBInstance selects things for a single instance in a cluster.

func KDBInstanceClusterID

func KDBInstanceClusterID(instance *v1.KDBInstance) string

KDBInstanceClusterID return cluster id .

func KDBInstanceHaProxy

func KDBInstanceHaProxy(instance *v1.KDBInstance) metav1.LabelSelector

KDBInstanceHaProxy selects things labeled for haProxy or sentinel in cluster.

func KDBInstanceMasterHostname

func KDBInstanceMasterHostname(instance *v1.KDBInstance) string

KDBInstanceMasterHostname return master-slave master pod name .

func KDBInstanceMasterIp

func KDBInstanceMasterIp(instance *v1.KDBInstance) string

KDBInstanceMasterIp return master-slave master pod ip .

func KDBInstances

func KDBInstances(cluster string) metav1.LabelSelector

KDBInstances selects things for KDB instances in one cluster.

func LogVolumeMount

func LogVolumeMount() corev1.VolumeMount

LogVolumeMount returns the name and mount path of the kdb WAL volume.

func Merge

func Merge(sets ...map[string]string) labels.Set

Merge takes sets of labels and merges them. The last set provided will win in case of conflicts.

Types

This section is empty.

Jump to

Keyboard shortcuts

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