external

package
v1.20.2 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package external contains the functions needed to manage servers which are external to this PostgreSQL cluster

Index

Constants

This section is empty.

Variables

View Source
var CustomExternalSecretsPath string

CustomExternalSecretsPath is the custom path where the cryptographic material needed to connect to an external cluster will be dumped. This will be used by the unit tests.

Functions

func ConfigureConnectionToServer

func ConfigureConnectionToServer(
	ctx context.Context, client ctrl.Client,
	namespace string, server *apiv1.ExternalCluster,
) (string, string, error)

ConfigureConnectionToServer creates a connection string to the external server, using the configuration inside the cluster and dumping the secret when needed. This function will return a connection string, the name of the pgpass file to be used, and an error state

func CreatePgPassFile

func CreatePgPassFile(serverName, password string) (string, error)

CreatePgPassFile creates a pgpass file inside the user home directory

func DumpSecretKeyRefToFile

func DumpSecretKeyRefToFile(
	ctx context.Context, client ctrl.Client,
	namespace string, serverName string, selector *corev1.SecretKeySelector,
) (string, error)

DumpSecretKeyRefToFile dumps a certain secret to a file inside a temporary folder using 0600 as permission bits.

This function overlaps with the Kubernetes ability to mount a secret in a pod, with the difference that we can change the attached secret without restarting the pod. We also need to have more control over when the secret content is updated.

func ReadSecretKeyRef

func ReadSecretKeyRef(
	ctx context.Context, client ctrl.Client,
	namespace string, selector *corev1.SecretKeySelector,
) (string, error)

ReadSecretKeyRef dumps a certain secret to a file inside a temporary folder using 0600 as permission bits

Types

This section is empty.

Jump to

Keyboard shortcuts

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