Documentation
¶
Overview ¶
Package cnpgi provides the implementation for the sidecar container.
Index ¶
Constants ¶
const ArchiveConfigKey = "klio-archive"
ArchiveConfigKey is the config key of the archive PluginConfiguration. It must stay in sync with ArchiveConfigKey in operator/internal/klioconfig.
const KlioConfigDir = "/var/lib/postgresql/klio"
KlioConfigDir is the mount point of the projected klio-config volume, holding one file per resolved PluginConfiguration (e.g. klio-archive, the recovery source, the replica source). It must stay in sync with the mount path injected by the operator (KlioConfigDir in operator/internal/klioconfig).
Variables ¶
var ( // ErrVerificationCorruption is returned when backup verification detects corruption. ErrVerificationCorruption = errors.New("backup verification detected corruption") // ErrPodNameNotSet is returned when the POD_NAME environment variable is not set. ErrPodNameNotSet = errors.New("POD_NAME environment variable is not set") )
var ErrConfigFileChanged = errors.New("config file changed, restarting")
ErrConfigFileChanged is returned when the config file changes on disk.
var ErrInstanceIsReplica = errors.New("instance is a replica")
ErrInstanceIsReplica is raised as a send-wal process cause when this instance got demoted.
Functions ¶
func NewConfigFileWatcher ¶
func NewConfigFileWatcher( configPath string, interval time.Duration, ) manager.RunnableFunc
NewConfigFileWatcher creates a manager.RunnableFunc that polls a config file, or every file in a config directory, and returns an error when the content changes. This causes the manager to shut down, and the kubelet will restart the container.
Polling is used instead of fsnotify because Kubernetes updates secret volumes via symlink swaps, which fsnotify may not detect reliably.
Types ¶
type BackupCapabilityOptions ¶
type BackupCapabilityOptions struct {
Tier2 bool
}
BackupCapabilityOptions contains options for configuring the backup capability.
type CNPGI ¶
type CNPGI struct {
Client client.Client
PluginPath string
// contains filtered or unexported fields
}
CNPGI is the implementation of the PostgreSQL sidecar.
func (*CNPGI) AddBackupCapability ¶
func (c *CNPGI) AddBackupCapability(opts BackupCapabilityOptions)
AddBackupCapability adds the backup capability to the CNPGI service.
func (*CNPGI) AddRestoreCapability ¶
AddRestoreCapability adds the restore capability to the CNPGI service.
func (*CNPGI) AddWALCapability ¶
func (c *CNPGI) AddWALCapability(opts WALCapabilityOptions)
AddWALCapability adds the WAL restore capabilities to the CNPGI service.
type SendWalClusterReconciler ¶
type SendWalClusterReconciler struct {
client.Client
// PodName is the name of this instance
PodName string
KlioConfigFile string
// contains filtered or unexported fields
}
SendWalClusterReconciler reconciles a Cluster object.
func (*SendWalClusterReconciler) Reconcile ¶
func (r *SendWalClusterReconciler) Reconcile( ctx context.Context, req reconcile.Request, ) (reconcile.Result, error)
Reconcile is invoked every time something changes in the cluster.
func (*SendWalClusterReconciler) SetupWithManager ¶
func (r *SendWalClusterReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager sets up the controller with the Manager.
type WALCapabilityOptions ¶
type WALCapabilityOptions struct {
Debug bool
}
WALCapabilityOptions are the options to configure the WAL service.