Documentation ¶
Index ¶
- Constants
- Variables
- func AsSelector(s metav1.LabelSelector) (labels.Selector, error)
- func ConfigVolumeMount() corev1.VolumeMount
- func DataVolumeMount() corev1.VolumeMount
- func DownwardAPIVolumeMount() corev1.VolumeMount
- func Engine(instance *v1.KDBInstance) string
- func EngineVersion(instance *v1.KDBInstance) (*version.Version, error)
- func GenerateInstanceStatefulSetMeta(instance *v1.KDBInstance, index int) metav1.ObjectMeta
- func HaProxy(instance *v1.KDBInstance) string
- func InstanceConfigMap(instance *v1.KDBInstance) metav1.ObjectMeta
- func InstanceDataPvcSpec(instance *v1.KDBInstance) shared.PVCSpec
- func InstanceDataVolume(runner *appsv1.StatefulSet) metav1.ObjectMeta
- func InstanceLogPvcSpec(instance *v1.KDBInstance) *shared.PVCSpec
- func InstanceLogVolume(runner *appsv1.StatefulSet) metav1.ObjectMeta
- func InstanceRBAC(instance *v1.KDBInstance) metav1.ObjectMeta
- func InstanceSetSpec(instance *v1.KDBInstance) shared.InstanceSetSpec
- func InstanceStatefulSetName(instanceSetName string, index int) string
- func IsInstanceReady(instance *v1.KDBInstance) bool
- func IsMasterInstance(instance *v1.KDBInstance) bool
- func IsMasterPod(pod *corev1.Pod) bool
- func IsMySQLEngine(instance *v1.KDBInstance) bool
- func IsPGEngine(instance *v1.KDBInstance) bool
- func KDBCluster(clusterName string) metav1.LabelSelector
- func KDBInstance(instanceName string) metav1.LabelSelector
- func KDBInstanceClusterID(instance *v1.KDBInstance) string
- func KDBInstanceHaProxy(instance *v1.KDBInstance) metav1.LabelSelector
- func KDBInstanceMasterHostname(instance *v1.KDBInstance) string
- func KDBInstanceMasterIp(instance *v1.KDBInstance) string
- func KDBInstances(cluster string) metav1.LabelSelector
- func LogVolumeMount() corev1.VolumeMount
- func Merge(sets ...map[string]string) labels.Set
Constants ¶
const ( MySQLPortAnno = annoPrefix + "mysqlPort" // StopReconcile the cluster stop reconcile. StopReconcile = annoPrefix + "stop-reconcile" )
const ( SidecarConfigKey = "sidecar" DatabaseConfigKey = "database" SidecarConfigMapFileKey = "config.yaml" MySQLConfigMapFileKey = "my.cnf" )
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" )
const ( MasterRole = "master" ReplicaRole = "replica" )
const ( MySQLEngine = "mysql" PostgresEngine = "pg" )
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" )
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" )
const ( // ContainerDatabase is the name of the container running KDB database container ContainerDatabase = "database" ContainerSidecar = "mgr" )
const (
// Finalizer marks an object to be garbage collected by this module.
Finalizer = finalizerPrefix + "finalizer"
)
const GlobalConfigSecret = "kdb-global-config"
const GlobalConfigSecretKey = "global"
const (
// PortDatabase is the name of a port that connects to kdb instance.
PortDatabase = "database"
)
const (
YamlGeneratedWarning = "" +
"# Generated by kdb-operator. DO NOT EDIT.\n" +
"# Your changes will not be saved.\n"
)
Variables ¶
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 IsInstanceReady ¶
func IsInstanceReady(instance *v1.KDBInstance) bool
func IsMasterInstance ¶
func IsMasterInstance(instance *v1.KDBInstance) bool
func IsMasterPod ¶
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.
Types ¶
This section is empty.