vdb

package
v1.11.2 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2023 License: Apache-2.0 Imports: 64 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AWSRegionParm          = "awsregion"
	GCloudRegionParm       = "GCSRegion"
	S3SseCustomerAlgorithm = "S3SseCustomerAlgorithm"
	S3ServerSideEncryption = "S3ServerSideEncryption"
	S3SseCustomerKey       = "S3SseCustomerKey"
	SseAlgorithmAES256     = "AES256"
	SseAlgorithmAWSKMS     = "aws:kms"
)
View Source
const (
	ServerContainer      = "server"
	ServerContainerIndex = 0
)
View Source
const (
	// Must maintain the same size when reconciling statefulsets
	ObjReconcileModePreserveScaling = 1 << iota
	// Must maintain the same delete policy when reconciling statefulsets
	ObjReconcileModePreserveUpdateStrategy
	// Reconcile to consider every change. Without this we will skip svc objects.
	ObjReconcileModeAll
)
View Source
const (
	ClusterShutdownOfflineMsgIndex = iota
	ReschedulePodsOfflineMsgIndex
	ClusterRestartOfflineMsgIndex
)
View Source
const (
	// Amount of time to wait after a restart failover before doing another requeue.
	RequeueWaitTimeInSeconds = 10
	// Percent of livenessProbe time to wait when requeuing due to waiting on
	// livenessProbe. This is just a heuristic we use to avoid going into a long
	// exponential backoff wait for the livenessProbe to fail.
	PctOfLivenessProbeWait = 0.25
)
View Source
const (
	// This is a file that we run with the create_db to run custome SQL. This is
	// passed with the --sql parameter when running create_db.
	PostDBCreateSQLFile = "/home/dbadmin/post-db-create.sql"
)

Variables

View Source
var OfflineUpgradeStatusMsgs = []string{
	"Shutting down cluster",
	"Rescheduling pods with new image",
	"Restarting cluster with new image",
}

Functions

func MakeAgentReconciler added in v1.10.1

func MakeAgentReconciler(vrec *VerticaDBReconciler,
	vdb *vapi.VerticaDB, prunner cmds.PodRunner, pfacts *PodFacts) controllers.ReconcileActor

MakeAgentReconciler will build a AgentReonciler object

func MakeAnnotateAndLabelPodReconciler added in v1.7.0

func MakeAnnotateAndLabelPodReconciler(vdbrecon *VerticaDBReconciler,
	vdb *vapi.VerticaDB, pfacts *PodFacts) controllers.ReconcileActor

MakeAnnotateAndLabelPodReconciler will build a AnnotateAndLabelPodReconciler object

func MakeClientRoutingLabelReconciler

func MakeClientRoutingLabelReconciler(vdbrecon *VerticaDBReconciler,
	vdb *vapi.VerticaDB, pfacts *PodFacts, applyMethod ApplyMethodType, scName string) controllers.ReconcileActor

func MakeCreateDBReconciler

func MakeCreateDBReconciler(vdbrecon *VerticaDBReconciler, log logr.Logger,
	vdb *vapi.VerticaDB, prunner cmds.PodRunner, pfacts *PodFacts,
	dispatcher vadmin.Dispatcher) controllers.ReconcileActor

MakeCreateDBReconciler will build a CreateDBReconciler object

func MakeDBAddNodeReconciler

func MakeDBAddNodeReconciler(vdbrecon *VerticaDBReconciler, log logr.Logger,
	vdb *vapi.VerticaDB, prunner cmds.PodRunner, pfacts *PodFacts, dispatcher vadmin.Dispatcher,
) controllers.ReconcileActor

MakeDBAddNodeReconciler will build a DBAddNodeReconciler object

func MakeDBAddSubclusterReconciler

func MakeDBAddSubclusterReconciler(vdbrecon *VerticaDBReconciler, log logr.Logger,
	vdb *vapi.VerticaDB, prunner cmds.PodRunner, pfacts *PodFacts, dispatcher vadmin.Dispatcher) controllers.ReconcileActor

MakeDBAddSubclusterReconciler will build a DBAddSubclusterReconciler object

func MakeDBRemoveNodeReconciler

func MakeDBRemoveNodeReconciler(vdbrecon *VerticaDBReconciler, log logr.Logger,
	vdb *vapi.VerticaDB, prunner cmds.PodRunner, pfacts *PodFacts, dispatcher vadmin.Dispatcher) controllers.ReconcileActor

MakeDBRemoveNodeReconciler will build and return the DBRemoveNodeReconciler object.

func MakeDBRemoveSubclusterReconciler

func MakeDBRemoveSubclusterReconciler(vdbrecon *VerticaDBReconciler, log logr.Logger,
	vdb *vapi.VerticaDB, prunner cmds.PodRunner, pfacts *PodFacts, dispatcher vadmin.Dispatcher) controllers.ReconcileActor

MakeDBRemoveSubclusterReconciler will build a DBRemoveSubclusterReconciler object

func MakeDrainNodeReconciler

func MakeDrainNodeReconciler(vdbrecon *VerticaDBReconciler,
	vdb *vapi.VerticaDB, prunner cmds.PodRunner, pfacts *PodFacts) controllers.ReconcileActor

func MakeHTTPServerCertGenReconciler added in v1.7.0

func MakeHTTPServerCertGenReconciler(vdbrecon *VerticaDBReconciler, vdb *vapi.VerticaDB) controllers.ReconcileActor

func MakeHTTPServerCtrlReconciler added in v1.11.0

func MakeHTTPServerCtrlReconciler(vdbrecon *VerticaDBReconciler,
	vdb *vapi.VerticaDB, prunner cmds.PodRunner, pfacts *PodFacts) controllers.ReconcileActor

func MakeInstallReconciler

func MakeInstallReconciler(vdbrecon *VerticaDBReconciler, log logr.Logger,
	vdb *vapi.VerticaDB, prunner cmds.PodRunner, pfacts *PodFacts) controllers.ReconcileActor

MakeInstallReconciler will build and return the InstallReconciler object.

func MakeLocalDataCheckReconciler added in v1.10.0

func MakeLocalDataCheckReconciler(vdbrecon *VerticaDBReconciler, vdb *vapi.VerticaDB, pfacts *PodFacts) controllers.ReconcileActor

MakeLocalDataCheckReconciler will build a LocalDataCheckReconciler object

func MakeMetricReconciler

func MakeMetricReconciler(vrec *VerticaDBReconciler, vdb *vapi.VerticaDB,
	prunner cmds.PodRunner, pfacts *PodFacts) controllers.ReconcileActor

MakeMetricReconciler will build a MetricReconciler object

func MakeObjReconciler

func MakeObjReconciler(vdbrecon *VerticaDBReconciler, log logr.Logger, vdb *vapi.VerticaDB, pfacts *PodFacts,
	mode ObjReconcileModeType) controllers.ReconcileActor

MakeObjReconciler will build an ObjReconciler object

func MakeOfflineUpgradeReconciler

func MakeOfflineUpgradeReconciler(vdbrecon *VerticaDBReconciler, log logr.Logger,
	vdb *vapi.VerticaDB, prunner cmds.PodRunner, pfacts *PodFacts, dispatcher vadmin.Dispatcher) controllers.ReconcileActor

MakeOfflineUpgradeReconciler will build an OfflineUpgradeReconciler object

func MakeOnlineUpgradeReconciler

func MakeOnlineUpgradeReconciler(vdbrecon *VerticaDBReconciler, log logr.Logger,
	vdb *vapi.VerticaDB, prunner cmds.PodRunner, pfacts *PodFacts, dispatcher vadmin.Dispatcher) controllers.ReconcileActor

MakeOnlineUpgradeReconciler will build an OnlineUpgradeReconciler object

func MakeRebalanceShardsReconciler

func MakeRebalanceShardsReconciler(vdbrecon *VerticaDBReconciler, log logr.Logger,
	vdb *vapi.VerticaDB, prunner cmds.PodRunner, pfacts *PodFacts, scName string) controllers.ReconcileActor

MakeRebalanceShardsReconciler will build a RebalanceShardsReconciler object

func MakeResizePVReconciler added in v1.7.0

func MakeResizePVReconciler(vdbrecon *VerticaDBReconciler,
	vdb *vapi.VerticaDB, prunner cmds.PodRunner, pfacts *PodFacts) controllers.ReconcileActor

MakeResizePVReconciler will build and return the ResizePVReconcile object.

func MakeRestartReconciler

func MakeRestartReconciler(vdbrecon *VerticaDBReconciler, log logr.Logger,
	vdb *vapi.VerticaDB, prunner cmds.PodRunner, pfacts *PodFacts, restartReadOnly bool,
	dispatcher vadmin.Dispatcher) controllers.ReconcileActor

MakeRestartReconciler will build a RestartReconciler object

func MakeReviveDBReconciler

func MakeReviveDBReconciler(vdbrecon *VerticaDBReconciler, log logr.Logger,
	vdb *vapi.VerticaDB, prunner cmds.PodRunner, pfacts *PodFacts,
	dispatcher vadmin.Dispatcher) controllers.ReconcileActor

MakeReviveDBReconciler will build a ReviveDBReconciler object

func MakeStatusReconciler

func MakeStatusReconciler(cli client.Client, scheme *runtime.Scheme, log logr.Logger,
	vdb *vapi.VerticaDB, pfacts *PodFacts) controllers.ReconcileActor

MakeStatusReconciler will build a StatusReconciler object

func MakeStopDBReconciler added in v1.6.0

func MakeStopDBReconciler(
	vdbrecon *VerticaDBReconciler, vdb *vapi.VerticaDB, prunner cmds.PodRunner, pfacts *PodFacts,
	dispatcher vadmin.Dispatcher,
) controllers.ReconcileActor

MakeStopDBReconciler will build a StopDBReconciler object

func MakeUninstallReconciler

func MakeUninstallReconciler(vdbrecon *VerticaDBReconciler, log logr.Logger,
	vdb *vapi.VerticaDB, prunner cmds.PodRunner, pfacts *PodFacts) controllers.ReconcileActor

MakeUninstallReconciler will build and return the UninstallReconciler object.

func MakeUpgradeOperator120Reconciler

func MakeUpgradeOperator120Reconciler(vdbrecon *VerticaDBReconciler, log logr.Logger,
	vdb *vapi.VerticaDB) controllers.ReconcileActor

MakeUpgradeOperator120Reconciler will build a UpgradeOperatorFrom120Reconciler object

func MakeVersionReconciler

func MakeVersionReconciler(vdbrecon *VerticaDBReconciler, log logr.Logger,
	vdb *vapi.VerticaDB, prunner cmds.PodRunner, pfacts *PodFacts,
	enforceUpgradePath bool) controllers.ReconcileActor

MakeVersionReconciler will build a VersionReconciler object

Types

type AgentReconciler added in v1.10.1

type AgentReconciler struct {
	VRec    *VerticaDBReconciler
	Vdb     *vapi.VerticaDB // Vdb is the CRD we are acting on.
	PRunner cmds.PodRunner
	PFacts  *PodFacts
}

AgentReconciler will ensure the agent is running

func (*AgentReconciler) Reconcile added in v1.10.1

func (a *AgentReconciler) Reconcile(ctx context.Context, req *ctrl.Request) (ctrl.Result, error)

Reconcile will ensure the agent is running and start it if it isn't

type AnnotateAndLabelPodReconciler added in v1.7.0

type AnnotateAndLabelPodReconciler struct {
	VRec   *VerticaDBReconciler
	Vdb    *vapi.VerticaDB
	PFacts *PodFacts
}

AnnotateAndLabelPodReconciler will maintain annotations and labels in pods about the running system

func (*AnnotateAndLabelPodReconciler) Reconcile added in v1.7.0

Reconcile will add annotations to each of the pods so that we flow down system information with the downwardAPI. The intent of this additional data is for inclusion in Vertica data collector (DC) tables.

type ApplyMethodType

type ApplyMethodType string
const (
	AddNodeApplyMethod       ApplyMethodType = "Add"           // Called after a db_add_node
	PodRescheduleApplyMethod ApplyMethodType = "PodReschedule" // Called after pod was rescheduled and vertica restarted
	DelNodeApplyMethod       ApplyMethodType = "RemoveNode"    // Called before a db_remove_node
)

type CheckerFunc added in v1.8.0

type CheckerFunc func(context.Context, *vapi.VerticaDB, *PodFact, *GatherState) error

CheckerFunc is the function signature for individual functions that help populate a PodFact.

type ClientRoutingLabelReconciler

type ClientRoutingLabelReconciler struct {
	VRec        *VerticaDBReconciler
	Vdb         *vapi.VerticaDB // Vdb is the CRD we are acting on.
	PFacts      *PodFacts
	ApplyMethod ApplyMethodType
	ScName      string // Subcluster we are going to reconcile.  Blank if all subclusters.
}

func (*ClientRoutingLabelReconciler) Reconcile

Reconcile will add or remove labels that control whether it accepts client connections. Pods that have at least one shard owned will have a label added so that it receives traffic. For pods that don't own a shard or about to be scaled down will have the label removed so that traffic isn't routed to it.

type CreateDBReconciler

type CreateDBReconciler struct {
	VRec                *VerticaDBReconciler
	Log                 logr.Logger
	Vdb                 *vapi.VerticaDB // Vdb is the CRD we are acting on.
	PRunner             cmds.PodRunner
	PFacts              *PodFacts
	Dispatcher          vadmin.Dispatcher
	ConfigurationParams *vtypes.CiMap
}

CreateDBReconciler will create a database if one wasn't created yet.

func (*CreateDBReconciler) Reconcile

func (c *CreateDBReconciler) Reconcile(ctx context.Context, req *ctrl.Request) (ctrl.Result, error)

Reconcile will ensure a DB exists and create one if it doesn't

type DBAddNodeReconciler

type DBAddNodeReconciler struct {
	VRec       *VerticaDBReconciler
	Log        logr.Logger
	Vdb        *vapi.VerticaDB // Vdb is the CRD we are acting on.
	PRunner    cmds.PodRunner
	PFacts     *PodFacts
	Dispatcher vadmin.Dispatcher
}

DBAddNodeReconciler will ensure each pod is added to the database.

func (*DBAddNodeReconciler) Reconcile

func (d *DBAddNodeReconciler) Reconcile(ctx context.Context, req *ctrl.Request) (ctrl.Result, error)

Reconcile will ensure a DB exists and create one if it doesn't

type DBAddSubclusterReconciler

type DBAddSubclusterReconciler struct {
	VRec       *VerticaDBReconciler
	Log        logr.Logger
	Vdb        *vapi.VerticaDB // Vdb is the CRD we are acting on.
	PRunner    cmds.PodRunner
	PFacts     *PodFacts
	ATPod      *PodFact // The pod that we run admintools from
	Dispatcher vadmin.Dispatcher
}

DBAddSubclusterReconciler will create a new subcluster if necessary

func (*DBAddSubclusterReconciler) Reconcile

Reconcile will ensure a subcluster exists for each one defined in the vdb.

type DBRemoveNodeReconciler

type DBRemoveNodeReconciler struct {
	VRec       *VerticaDBReconciler
	Log        logr.Logger
	Vdb        *vapi.VerticaDB // Vdb is the CRD we are acting on.
	PRunner    cmds.PodRunner
	PFacts     *PodFacts
	Dispatcher vadmin.Dispatcher
}

DBRemoveNodeReconciler will handle removing a node from the database during scale down.

func (*DBRemoveNodeReconciler) CollectPFacts

func (d *DBRemoveNodeReconciler) CollectPFacts(ctx context.Context) error

func (*DBRemoveNodeReconciler) GetClient

func (d *DBRemoveNodeReconciler) GetClient() client.Client

func (*DBRemoveNodeReconciler) GetVDB

func (d *DBRemoveNodeReconciler) GetVDB() *vapi.VerticaDB

func (*DBRemoveNodeReconciler) Reconcile

func (d *DBRemoveNodeReconciler) Reconcile(ctx context.Context, req *ctrl.Request) (ctrl.Result, error)

Reconcile will handle calling remove node when scale down is detected.

This reconcile function is meant to be called before we create/delete any kubernetes objects. It allows us to look at the state before applying everything in Vdb. We will know if we are scaling down by comparing the expected subcluster size with the current.

type DBRemoveSubclusterReconciler

type DBRemoveSubclusterReconciler struct {
	VRec       *VerticaDBReconciler
	Log        logr.Logger
	Vdb        *vapi.VerticaDB // Vdb is the CRD we are acting on.
	PRunner    cmds.PodRunner
	PFacts     *PodFacts
	ATPod      *PodFact // The pod that we run admintools from
	Dispatcher vadmin.Dispatcher
}

DBRemoveSubclusterReconciler will remove subclusters from the database

func (*DBRemoveSubclusterReconciler) Reconcile

Reconcile will remove any subcluster that no longer exists in the vdb.

type DatabaseInitializer

type DatabaseInitializer interface {
	// contains filtered or unexported methods
}

type DrainNodeReconciler

type DrainNodeReconciler struct {
	VRec    *VerticaDBReconciler
	Vdb     *vapi.VerticaDB // Vdb is the CRD we are acting on.
	PRunner cmds.PodRunner
	PFacts  *PodFacts
}

func (*DrainNodeReconciler) Reconcile

func (s *DrainNodeReconciler) Reconcile(ctx context.Context, req *ctrl.Request) (ctrl.Result, error)

Reconcile will wait for active connections to leave in any pod that is marked as pending delete. This will drain those pods that we are going to scale down before we actually remove them from the cluster.

type GatherState added in v1.8.0

type GatherState struct {
	InstallIndicatorExists bool            `json:"installIndicatorExists"`
	EulaAccepted           bool            `json:"eulaAccepted"`
	DirExists              map[string]bool `json:"dirExists"`
	FileExists             map[string]bool `json:"fileExists"`
	DBExists               bool            `json:"dbExists"`
	VerticaPIDRunning      bool            `json:"verticaPIDRunning"`
	StartupComplete        bool            `json:"startupComplete"`
	Compat21NodeName       string          `json:"compat21NodeName"`
	VNodeName              string          `json:"vnodeName"`
	LocalDataSize          int             `json:"localDataSize"`
	LocalDataAvail         int             `json:"localDataAvail"`
	AgentRunning           bool            `json:"agentRunning"`
	ImageHasAgentKeys      bool            `json:"imageHasAgentKeys"`
	IsHTTPServerRunning    bool            `json:"isHTTPServerRunning"`
}

GatherState is the data exchanged with the gather pod facts script. We parse the data from the script in YAML into this struct.

type GenericDatabaseInitializer

type GenericDatabaseInitializer struct {
	VRec                *VerticaDBReconciler
	Log                 logr.Logger
	Vdb                 *vapi.VerticaDB
	PRunner             cmds.PodRunner
	PFacts              *PodFacts
	ConfigurationParams *vtypes.CiMap
	// contains filtered or unexported fields
}

func (*GenericDatabaseInitializer) ConstructConfigParms added in v1.11.2

func (g *GenericDatabaseInitializer) ConstructConfigParms(ctx context.Context) (ctrl.Result, error)

ConstructConfigParms builds a map of all of the config parameters to use.

type HTTPServerCertGenReconciler added in v1.7.0

type HTTPServerCertGenReconciler struct {
	VRec *VerticaDBReconciler
	Vdb  *vapi.VerticaDB // Vdb is the CRD we are acting on.
}

HTTPServerCertGenReconciler will create a secret that has TLS credentials. This secret will be used to authenticate with the http server.

func (*HTTPServerCertGenReconciler) Reconcile added in v1.7.0

Reconcile will create a TLS secret for the http server if one is missing

type HTTPServerCtrlReconciler added in v1.11.0

type HTTPServerCtrlReconciler struct {
	VRec    *VerticaDBReconciler
	Vdb     *vapi.VerticaDB // Vdb is the CRD we are acting on.
	PRunner cmds.PodRunner
	PFacts  *PodFacts
}

HTTPServerCtrlReconciler will start the http server if needed.

func (*HTTPServerCtrlReconciler) Reconcile added in v1.11.0

func (h *HTTPServerCtrlReconciler) Reconcile(ctx context.Context, req *ctrl.Request) (ctrl.Result, error)

type InstallReconciler

type InstallReconciler struct {
	VRec     *VerticaDBReconciler
	Log      logr.Logger
	Vdb      *vapi.VerticaDB // Vdb is the CRD we are acting on.
	PRunner  cmds.PodRunner
	PFacts   *PodFacts
	ATWriter atconf.Writer
}

InstallReconciler will handle reconcile for install of vertica

func (*InstallReconciler) Reconcile

func (d *InstallReconciler) Reconcile(ctx context.Context, req *ctrl.Request) (ctrl.Result, error)

Reconcile will ensure Vertica is installed and running in the pods.

type LocalDataCheckReconciler added in v1.10.0

type LocalDataCheckReconciler struct {
	VRec      *VerticaDBReconciler
	Vdb       *vapi.VerticaDB
	PFacts    *PodFacts
	NumEvents int // Number of events written
}

LocalDataCheckReconciler will check the free space available in the PV and log events if they it is too low.

func (*LocalDataCheckReconciler) Reconcile added in v1.10.0

func (l *LocalDataCheckReconciler) Reconcile(ctx context.Context, req *ctrl.Request) (ctrl.Result, error)

Reconcile will look at all pods to see if any have low disk space available.

type MetricReconciler

type MetricReconciler struct {
	VRec    *VerticaDBReconciler
	Vdb     *vapi.VerticaDB // Vdb is the CRD we are acting on.
	PFacts  *PodFacts
	PRunner cmds.PodRunner
}

MetricReconciler will refresh any metrics based on latest podfacts

func (*MetricReconciler) Reconcile

func (p *MetricReconciler) Reconcile(ctx context.Context, req *ctrl.Request) (ctrl.Result, error)

Reconcile will update the metrics based on the pod facts

type ObjReconcileModeType

type ObjReconcileModeType uint8

type ObjReconciler

type ObjReconciler struct {
	VRec   *VerticaDBReconciler
	Log    logr.Logger
	Vdb    *vapi.VerticaDB // Vdb is the CRD we are acting on.
	PFacts *PodFacts
	Mode   ObjReconcileModeType
}

ObjReconciler will reconcile for all dependent Kubernetes objects. This is used for a single reconcile iteration.

func (*ObjReconciler) Reconcile

func (o *ObjReconciler) Reconcile(ctx context.Context, req *ctrl.Request) (ctrl.Result, error)

Reconcile is the main driver for reconciliation of Kubernetes objects. This will ensure the desired svc and sts objects exist and are in the correct state.

type OfflineUpgradeReconciler

type OfflineUpgradeReconciler struct {
	VRec       *VerticaDBReconciler
	Log        logr.Logger
	Vdb        *vapi.VerticaDB // Vdb is the CRD we are acting on.
	PRunner    cmds.PodRunner
	PFacts     *PodFacts
	Finder     iter.SubclusterFinder
	Manager    UpgradeManager
	Dispatcher vadmin.Dispatcher
}

OfflineUpgradeReconciler will handle the process of doing an offline upgrade of the Vertica server.

func (*OfflineUpgradeReconciler) Reconcile

func (o *OfflineUpgradeReconciler) Reconcile(ctx context.Context, req *ctrl.Request) (ctrl.Result, error)

Reconcile will handle the process of the vertica image changing. For example, this can automate the process for an upgrade.

type OnlineUpgradeReconciler

type OnlineUpgradeReconciler struct {
	VRec          *VerticaDBReconciler
	Log           logr.Logger
	Vdb           *vapi.VerticaDB  // Vdb is the CRD we are acting on.
	TransientSc   *vapi.Subcluster // Set to the transient subcluster if applicable
	PRunner       cmds.PodRunner
	PFacts        *PodFacts
	Finder        iter.SubclusterFinder
	Manager       UpgradeManager
	Dispatcher    vadmin.Dispatcher
	PrimaryImages []string // Known images in the primaries.  Should be of length 1 or 2.
	StatusMsgs    []string // Precomputed status messages
	MsgIndex      int      // Current index in StatusMsgs
}

OnlineUpgradeReconciler will handle the process when the vertica image changes. It does this while keeping the database online.

func (*OnlineUpgradeReconciler) Reconcile

func (o *OnlineUpgradeReconciler) Reconcile(ctx context.Context, req *ctrl.Request) (ctrl.Result, error)

Reconcile will handle the process of the vertica image changing. For example, this can automate the process for an upgrade.

type PodFact

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

PodFact keeps track of facts for a specific pod

type PodFactDetail

type PodFactDetail map[types.NamespacedName]*PodFact

type PodFacts

type PodFacts struct {
	VRec           *VerticaDBReconciler
	PRunner        cmds.PodRunner
	Detail         PodFactDetail
	NeedCollection bool
	OverrideFunc   CheckerFunc // Set this if you want to be able to control the PodFact
}

A collection of facts for many pods.

func MakePodFacts

func MakePodFacts(vrec *VerticaDBReconciler, prunner cmds.PodRunner) PodFacts

MakePodFacts will create a PodFacts object and return it

func (*PodFacts) Collect

func (p *PodFacts) Collect(ctx context.Context, vdb *vapi.VerticaDB) error

Collect will gather up the for facts if a collection is needed If the facts are already up to date, this function does nothing.

func (*PodFacts) Invalidate

func (p *PodFacts) Invalidate()

Invalidate will mark the pod facts as requiring a refresh. Next call to Collect will gather up the facts again.

type RebalanceShardsReconciler

type RebalanceShardsReconciler struct {
	VRec    *VerticaDBReconciler
	Log     logr.Logger
	Vdb     *vapi.VerticaDB // Vdb is the CRD we are acting on.
	PRunner cmds.PodRunner
	PFacts  *PodFacts
	ScName  string // Name of the subcluster to rebalance.  Leave this blank if you want to handle all subclusters.
}

RebalanceShardsReconciler will ensure each node has at least one shard subscription

func (*RebalanceShardsReconciler) Reconcile

Reconcile will ensure each node has at least one shard subscription

type ResizePVReconcile added in v1.7.0

type ResizePVReconcile struct {
	VRec    *VerticaDBReconciler
	Vdb     *vapi.VerticaDB
	PRunner cmds.PodRunner
	PFacts  *PodFacts
}

ResizePVReconcile will handle resizing of the PV when the local data size changes

func (*ResizePVReconcile) Reconcile added in v1.7.0

func (r *ResizePVReconcile) Reconcile(ctx context.Context, req *ctrl.Request) (ctrl.Result, error)

Reconcile will ensure Vertica is installed and running in the pods.

type RestartReconciler

type RestartReconciler struct {
	VRec            *VerticaDBReconciler
	Log             logr.Logger
	Vdb             *vapi.VerticaDB // Vdb is the CRD we are acting on.
	PRunner         cmds.PodRunner
	PFacts          *PodFacts
	InitiatorPod    types.NamespacedName // The pod that we run admin commands from
	InitiatorPodIP  string               // The IP of the initiating pod
	RestartReadOnly bool                 // Whether to restart nodes that are in read-only mode
	Dispatcher      vadmin.Dispatcher
}

RestartReconciler will ensure each pod has a running vertica process

func (*RestartReconciler) Reconcile

func (r *RestartReconciler) Reconcile(ctx context.Context, req *ctrl.Request) (ctrl.Result, error)

Reconcile will ensure each pod is UP in the vertica sense. On success, each node will have a running vertica process.

type ReviveDBReconciler

type ReviveDBReconciler struct {
	VRec                *VerticaDBReconciler
	Log                 logr.Logger
	Vdb                 *vapi.VerticaDB // Vdb is the CRD we are acting on.
	PRunner             cmds.PodRunner
	PFacts              *PodFacts
	Planr               reviveplanner.Planner
	Dispatcher          vadmin.Dispatcher
	ConfigurationParams *vtypes.CiMap
}

ReviveDBReconciler will revive a database if one doesn't exist in the vdb yet.

func (*ReviveDBReconciler) Reconcile

func (r *ReviveDBReconciler) Reconcile(ctx context.Context, req *ctrl.Request) (ctrl.Result, error)

Reconcile will ensure a DB exists and revive one if it doesn't

type ScaledownActor

type ScaledownActor interface {
	GetClient() client.Client
	GetVDB() *vapi.VerticaDB
	CollectPFacts(ctx context.Context) error
}

ScaledownActor is an interface that handles a part of scale down, either db_remove_node or uninstall.

type StatusReconciler

type StatusReconciler struct {
	client.Client
	Scheme *runtime.Scheme
	Log    logr.Logger
	Vdb    *vapi.VerticaDB // Vdb is the CRD we are acting on.
	PFacts *PodFacts
}

StatusReconciler will update the status field of the vdb.

func (*StatusReconciler) Reconcile

func (s *StatusReconciler) Reconcile(ctx context.Context, req *ctrl.Request) (ctrl.Result, error)

Reconcile will update the status of the Vdb based on the pod facts

type StopDBReconciler added in v1.6.0

type StopDBReconciler struct {
	VRec       *VerticaDBReconciler
	Vdb        *vapi.VerticaDB // Vdb is the CRD we are acting on.
	PRunner    cmds.PodRunner
	PFacts     *PodFacts
	Dispatcher vadmin.Dispatcher
}

StopDBReconciler will stop the cluster and clear the restart needed status condition

func (*StopDBReconciler) Reconcile added in v1.6.0

func (s *StopDBReconciler) Reconcile(ctx context.Context, req *ctrl.Request) (ctrl.Result, error)

Reconcile will stop vertica if the status condition indicates a restart is needed

type SubclustersSet

type SubclustersSet map[string]bool

type UninstallReconciler

type UninstallReconciler struct {
	VRec     *VerticaDBReconciler
	Log      logr.Logger
	Vdb      *vapi.VerticaDB // Vdb is the CRD we are acting on.
	PRunner  cmds.PodRunner
	PFacts   *PodFacts
	ATWriter atconf.Writer
}

UninstallReconciler will handle reconcile looking specifically for scale down events.

func (*UninstallReconciler) CollectPFacts

func (s *UninstallReconciler) CollectPFacts(ctx context.Context) error

func (*UninstallReconciler) GetClient

func (s *UninstallReconciler) GetClient() client.Client

func (*UninstallReconciler) GetVDB

func (s *UninstallReconciler) GetVDB() *vapi.VerticaDB

func (*UninstallReconciler) Reconcile

func (s *UninstallReconciler) Reconcile(ctx context.Context, req *ctrl.Request) (ctrl.Result, error)

Reconcile will handle state where a pod in a subcluster is being scaled down. During a scale down we need to drive uninstall logic for each applicable pod.

This reconcile function is meant to be called before we create/delete any kubernetes objects. It allows us to look at the state before applying everything in Vdb. We will know if we are scaling down by comparing the expected subcluster size with the current.

type UpgradeManager

type UpgradeManager struct {
	VRec              *VerticaDBReconciler
	Vdb               *vapi.VerticaDB
	Log               logr.Logger
	Finder            iter.SubclusterFinder
	ContinuingUpgrade bool // true if UpdateInProgress was already set upon entry
	StatusCondition   vapi.VerticaDBConditionType
	// Function that will check if the image policy allows for a type of upgrade (offline or online)
	IsAllowedForUpgradePolicyFunc func(vdb *vapi.VerticaDB) bool
}

func MakeUpgradeManager

func MakeUpgradeManager(vdbrecon *VerticaDBReconciler, log logr.Logger, vdb *vapi.VerticaDB,
	statusCondition vapi.VerticaDBConditionType,
	isAllowedForUpgradePolicyFunc func(vdb *vapi.VerticaDB) bool) *UpgradeManager

MakeUpgradeManager will construct a UpgradeManager object

func (*UpgradeManager) IsUpgradeNeeded

func (i *UpgradeManager) IsUpgradeNeeded(ctx context.Context) (bool, error)

IsUpgradeNeeded checks whether an upgrade is needed and/or in progress. It will return true for the first parm if an upgrade should proceed.

type UpgradeOperator120Reconciler

type UpgradeOperator120Reconciler struct {
	VRec *VerticaDBReconciler
	Log  logr.Logger
	Vdb  *vapi.VerticaDB // Vdb is the CRD we are acting on.
}

UpgradeOperator120Reconciler will handle any upgrade actions for k8s objects created in 1.2.0 or prior.

func (*UpgradeOperator120Reconciler) Reconcile

Reconcile will handle any upgrade actions for k8s objects created in 1.2.0 or prior.

type VersionReconciler

type VersionReconciler struct {
	VRec               *VerticaDBReconciler
	Log                logr.Logger
	Vdb                *vapi.VerticaDB // Vdb is the CRD we are acting on.
	PRunner            cmds.PodRunner
	PFacts             *PodFacts
	EnforceUpgradePath bool                    // Fail the reconcile if we find incompatible version
	FindPodFunc        func() (*PodFact, bool) // Function to call to find pod
}

VersionReconciler will set the version as annotations in the vdb.

func (*VersionReconciler) Reconcile

func (v *VersionReconciler) Reconcile(ctx context.Context, req *ctrl.Request) (ctrl.Result, error)

Reconcile will update the annotation in the Vdb with Vertica version info

type VerticaDBReconciler

type VerticaDBReconciler struct {
	client.Client
	Log    logr.Logger
	Scheme *runtime.Scheme
	Cfg    *rest.Config
	EVRec  record.EventRecorder
	OpCfg  opcfg.OperatorConfig
	builder.DeploymentNames
}

VerticaDBReconciler reconciles a VerticaDB object

func (*VerticaDBReconciler) Event

func (r *VerticaDBReconciler) Event(vdb runtime.Object, eventtype, reason, message string)

Event a wrapper for Event() that also writes a log entry

func (*VerticaDBReconciler) Eventf

func (r *VerticaDBReconciler) Eventf(vdb runtime.Object, eventtype, reason, messageFmt string, args ...interface{})

Eventf is a wrapper for Eventf() that also writes a log entry

func (*VerticaDBReconciler) GetSuperuserPassword

func (r *VerticaDBReconciler) GetSuperuserPassword(ctx context.Context, vdb *vapi.VerticaDB, log logr.Logger) (string, error)

GetSuperuserPassword returns the superuser password if it has been provided

func (*VerticaDBReconciler) Reconcile

func (r *VerticaDBReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state.

For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.7.2/pkg/reconcile

func (*VerticaDBReconciler) SetupWithManager

func (r *VerticaDBReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

Jump to

Keyboard shortcuts

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