cluster

package
v4.1.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2020 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Overview

Package cluster holds the cluster CRD logic and definitions A cluster is comprised of a primary service, replica service, primary deployment, and replica deployment

Package cluster holds the cluster CRD logic and definitions A cluster is comprised of a primary service, replica service, primary deployment, and replica deployment

Package cluster holds the cluster CRD logic and definitions A cluster is comprised of a primary service, replica service, primary deployment, and replica deployment

Package cluster holds the cluster CRD logic and definitions A cluster is comprised of a primary service, replica service, primary deployment, and replica deployment

Package cluster holds the cluster CRD logic and definitions A cluster is comprised of a primary service, replica service, primary deployment, and replica deployment

Package cluster holds the cluster CRD logic and definitions A cluster is comprised of a primary service, replica service, primary deployment, and replica deployment

Package cluster holds the cluster CRD logic and definitions A cluster is comprised of a primary service, replica service, primary deployment, and replica deployment

Package cluster holds the cluster CRD logic and definitions A cluster is comprised of a primary service, replica service, primary deployment, and replica deployment

Index

Constants

View Source
const FAILOVER_EVENT_NOT_READY = "NotReady"
View Source
const FAILOVER_EVENT_READY = "Ready"
View Source
const PGBOUNCER_SUFFIX = "-pgbouncer"
View Source
const PGPOOL_SUFFIX = "-pgpool"
View Source
const ReplicaSuffix = "-replica"

ReplicaSuffix ...

Variables

This section is empty.

Functions

func AddCluster

func AddCluster(clientset *kubernetes.Clientset, client *rest.RESTClient, cl *crv1.Pgcluster, namespace string, primaryPVCName string) error

AddCluster ...

func AddClusterBase

func AddClusterBase(clientset *kubernetes.Clientset, client *rest.RESTClient, cl *crv1.Pgcluster, namespace string)

func AddPgbouncer

func AddPgbouncer(clientset *kubernetes.Clientset, restclient *rest.RESTClient, cl *crv1.Pgcluster, namespace string, createService bool, updateCreds bool) error

ProcessPgbouncer ...

func AddPgbouncerFromTask

func AddPgbouncerFromTask(clientset *kubernetes.Clientset, restclient *rest.RESTClient, task *crv1.Pgtask, namespace string)

func AddPgpool

func AddPgpool(clientset *kubernetes.Clientset, cl *crv1.Pgcluster, namespace string, createService bool) error

ProcessPgpool ...

func AddPgpoolFromTask

func AddPgpoolFromTask(clientset *kubernetes.Clientset, restclient *rest.RESTClient, task *crv1.Pgtask, namespace string)

func AddUpgrade

func AddUpgrade(clientset *kubernetes.Clientset, restclient *rest.RESTClient, upgrade *crv1.Pgtask, namespace string)

AddUpgrade implements the upgrade workflow for cluster minor upgrade

func AutofailBase

func AutofailBase(clientset *kubernetes.Clientset, restclient *rest.RESTClient, ready bool, clusterName, namespace string)

AutofailBase ...

func CreatePgpoolSecret

func CreatePgpoolSecret(clientset *kubernetes.Clientset, primary, replica, db, secretName, namespace string) error

CreatePgpoolSecret create a secret used by pgpool

func CreateRmdataJob

func CreateRmdataJob(clientset *kubernetes.Clientset, cl *crv1.Pgcluster, namespace string, removeData, removeBackup, isReplica, isBackup bool) error

CreateService ...

func CreateService

func CreateService(clientset *kubernetes.Clientset, fields *ServiceTemplateFields, namespace string) error

CreateService ...

func DeleteCluster

func DeleteCluster(clientset *kubernetes.Clientset, restclient *rest.RESTClient, cl *crv1.Pgcluster, namespace string) error

DeleteCluster ...

func DeleteClusterBase

func DeleteClusterBase(clientset *kubernetes.Clientset, restclient *rest.RESTClient, cl *crv1.Pgcluster, namespace string)

DeleteClusterBase ...

func DeletePgbouncer

func DeletePgbouncer(clientset *kubernetes.Clientset, clusterName, namespace string)

DeletePgbouncer

func DeletePgbouncerFromTask

func DeletePgbouncerFromTask(clientset *kubernetes.Clientset, restclient *rest.RESTClient, task *crv1.Pgtask, namespace string)

func DeletePgpool

func DeletePgpool(clientset *kubernetes.Clientset, clusterName, namespace string)

DeletePgpool

func DeletePgpoolFromTask

func DeletePgpoolFromTask(clientset *kubernetes.Clientset, restclient *rest.RESTClient, task *crv1.Pgtask, namespace string)

func DeletePgreplicas

func DeletePgreplicas(restclient *rest.RESTClient, clusterName, namespace string)

DeletePgreplicas

func DeleteReplica

func DeleteReplica(clientset *kubernetes.Clientset, cl *crv1.Pgreplica, namespace string) error

DeleteReplica ...

func Failover

func Failover(identifier string, clientset *kubernetes.Clientset, client *rest.RESTClient, clusterName string, task *crv1.Pgtask, namespace string, restconfig *rest.Config) error

func FailoverBase

func FailoverBase(namespace string, clientset *kubernetes.Clientset, client *rest.RESTClient, task *crv1.Pgtask, restconfig *rest.Config)

FailoverBase ... gets called first on a failover

func InitializeAutoFailover

func InitializeAutoFailover(clientset *kubernetes.Clientset, restclient *rest.RESTClient, nsList []string) error

at operator startup, check for autofail enabled pods in Not Ready status in each namespace the operator is watching, trigger a failover if found

func PatchpgtaskFailoverStatus

func PatchpgtaskFailoverStatus(restclient *rest.RESTClient, oldCrd *crv1.Pgtask, namespace string) error

func ProcessNextUpgradeItem

func ProcessNextUpgradeItem(clientset *kubernetes.Clientset, restclient *rest.RESTClient, cluster crv1.Pgcluster, upgradeTaskName, namespace string)

ProcessNextUpgradeItem - processes the next deployment for a cluster being upgraded One deployment is done per call in the following order: replicas, backrest, primary If more than one replica is in the list, they are done one at a time, once per call with an item getting removed from the list each time. This method should get called after the pod goes ready from the previous item, which is handled by the pod controller.

func ProcessPolicies

func ProcessPolicies(clientset *kubernetes.Clientset, restclient *rest.RESTClient, stopchan chan struct{}, namespace string)

ProcessPolicies ...

func ReconfigurePgbouncerFromTask

func ReconfigurePgbouncerFromTask(clientset *kubernetes.Clientset, restclient *rest.RESTClient, task *crv1.Pgtask, namespace string)

func ReconfigurePgpoolFromTask

func ReconfigurePgpoolFromTask(clientset *kubernetes.Clientset, restclient *rest.RESTClient, task *crv1.Pgtask, namespace string)

func Scale

func Scale(clientset *kubernetes.Clientset, client *rest.RESTClient, replica *crv1.Pgreplica, namespace, pvcName string, cluster *crv1.Pgcluster) error

Scale ...

func ScaleBase

func ScaleBase(clientset *kubernetes.Clientset, client *rest.RESTClient, replica *crv1.Pgreplica, namespace string)

ScaleBase ...

func ScaleDownBase

func ScaleDownBase(clientset *kubernetes.Clientset, client *rest.RESTClient, replica *crv1.Pgreplica, namespace string)

ScaleDownBase ...

func UpdatePgBouncerAuthorizations

func UpdatePgBouncerAuthorizations(clientset *kubernetes.Clientset, namespace, username, password, secretName, clusterName, podIP string) error

Types

type AutoFailoverTask

type AutoFailoverTask struct {
}

func (*AutoFailoverTask) AddEvent

func (*AutoFailoverTask) AddEvent(restclient *rest.RESTClient, clusterName, eventType, namespace string)

func (*AutoFailoverTask) Clear

func (*AutoFailoverTask) Clear(restclient *rest.RESTClient, clusterName, namespace string)

func (*AutoFailoverTask) Exists

func (*AutoFailoverTask) Exists(restclient *rest.RESTClient, clusterName, namespace string) bool

func (*AutoFailoverTask) GetEvents

func (*AutoFailoverTask) GetEvents(restclient *rest.RESTClient, clusterName, namespace string) (string, map[string]string)

func (*AutoFailoverTask) Print

func (*AutoFailoverTask) Print(restclient *rest.RESTClient, namespace string)

type FailoverEvent

type FailoverEvent struct {
	EventType string
	EventTime time.Time
}

FailoverEvent holds a record of a NotReady or other event that is used by the failover algorithm, FailoverEvents can build up for a given cluster

type PgbouncerConfFields

type PgbouncerConfFields struct {
	PG_PRIMARY_SERVICE_NAME string
	PG_REPLICA_SERVICE_NAME string
	PG_USERNAME             string
	PG_PASSWORD             string
	PG_PORT                 string
	PG_DATABASE             string
}

type PgbouncerHBAFields

type PgbouncerHBAFields struct {
}

type PgbouncerPasswdFields

type PgbouncerPasswdFields struct {
	Username string
	Password string
}

type PgbouncerTemplateFields

type PgbouncerTemplateFields struct {
	Name               string
	ClusterName        string
	PGBouncerSecret    string
	CCPImagePrefix     string
	CCPImageTag        string
	Port               string
	PrimaryServiceName string
	ReplicaServiceName string
	ContainerResources string
}

type PgpoolConfFields

type PgpoolConfFields struct {
	PG_PRIMARY_SERVICE_NAME string
	PG_REPLICA_SERVICE_NAME string
	PG_USERNAME             string
	PG_PASSWORD             string
}

type PgpoolHBAFields

type PgpoolHBAFields struct {
}

type PgpoolPasswdFields

type PgpoolPasswdFields struct {
	Username string
	Password string
}

type PgpoolTemplateFields

type PgpoolTemplateFields struct {
	Name               string
	ClusterName        string
	PGPoolSecret       string
	CCPImagePrefix     string
	CCPImageTag        string
	ContainerResources string
	Port               string
	PrimaryServiceName string
	ReplicaServiceName string
	PGUserSecret       string
}

type RmdataJob

type RmdataJob struct {
	JobName        string
	ClusterName    string
	PGOImagePrefix string
	PGOImageTag    string
	//		SecurityContext string
	RemoveData         string
	RemoveBackup       string
	IsBackup           string
	IsReplica          string
	ContainerResources string
}

type ServiceTemplateFields

type ServiceTemplateFields struct {
	Name         string
	ServiceName  string
	ClusterName  string
	Port         string
	PGBadgerPort string
	ExporterPort string
	ServiceType  string
}

ServiceTemplateFields ...

type StateMachine

type StateMachine struct {
	Clientset    *kubernetes.Clientset
	RESTClient   *rest.RESTClient
	Namespace    string
	ClusterName  string
	SleepSeconds int
}

StateMachine holds a state machine that is created when a cluster has received a NotReady event, this is the start The StateMachine is executed in a separate goroutine for any cluster founds to be NotReady

func (*StateMachine) Evaluate

func (s *StateMachine) Evaluate(status string, events map[string]string) bool

Evaluate returns true if the autofail status is NotReady

func (*StateMachine) Print

func (s *StateMachine) Print()

func (*StateMachine) Run

func (s *StateMachine) Run()

Run is the heart of the failover state machine, started when a NotReady event is caught by the cluster watcher process, this statemachine runs until

Jump to

Keyboard shortcuts

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