Documentation
¶
Index ¶
- Constants
- Variables
- func AcquireLease(ctx context.Context, cl client.Client, leaseName, holder, namespace string, ...) error
- func GetLatestBackup(ctx context.Context, cli client.Client, cr *pgv2.PerconaPGCluster) (*pgv2.PerconaPGBackup, error)
- func GetLease(ctx context.Context, client client.Client, leaseName, namespace string) (*coordinationv1.Lease, error)
- func GetOperatorNamespace() (string, error)
- func GetWatchNamespace() (string, error)
- func GroupExists(dc *discovery.DiscoveryClient, group string) (bool, error)
- func GroupVersionKindExists(dc *discovery.DiscoveryClient, groupVersion, kind string) (bool, error)
- func InitContainer(cluster *v1beta1.PostgresCluster, componentName, image string, ...) corev1.Container
- func InitImage(ctx context.Context, cl client.Reader, cluster *v1beta1.PostgresCluster, ...) (string, error)
- func ObjectHash(obj runtime.Object) (string, error)
- func ReleaseLease(ctx context.Context, cl client.Client, leaseName, holder, namespace string) error
- type ComponentWithInit
- type IsHolderStaleFunc
Constants ¶
const WatchNamespaceEnvVar = "WATCH_NAMESPACE"
Variables ¶
var ( ErrRunningBackup = errors.New("backups are running") ErrNoBackups = errors.New("no backups found") )
var ErrLeaseAlreadyHeld = errors.New("lease held by another holder")
Functions ¶
func AcquireLease ¶
func AcquireLease(ctx context.Context, cl client.Client, leaseName, holder, namespace string, checkStale IsHolderStaleFunc) error
AcquireLease attempts to acquire a named lease for the given holder. If isHolderStale is non-nil and the lease is held by a different holder, the callback is invoked to determine whether the current holder is stale. A stale holder is evicted atomically and the lease is granted to the new holder.
func GetLatestBackup ¶
func GetLatestBackup(ctx context.Context, cli client.Client, cr *pgv2.PerconaPGCluster) (*pgv2.PerconaPGBackup, error)
func GetOperatorNamespace ¶
GetOperatorNamespace returns the namespace of the operator pod
func GetWatchNamespace ¶
GetWatchNamespace returns the namespace the operator should be watching for changes
func GroupExists ¶
func GroupExists(dc *discovery.DiscoveryClient, group string) (bool, error)
GroupExists checks whether a given API group exists in the Kubernetes API Server.
func GroupVersionKindExists ¶
func GroupVersionKindExists(dc *discovery.DiscoveryClient, groupVersion, kind string) (bool, error)
GroupVersionKindExists checks to see whether a given Kind for a given GroupVersion exists in the Kubernetes API Server.
func InitContainer ¶
func InitContainer(cluster *v1beta1.PostgresCluster, componentName, image string, pullPolicy corev1.PullPolicy, secCtx *corev1.SecurityContext, resources corev1.ResourceRequirements, component ComponentWithInit, ) corev1.Container
func InitImage ¶
func InitImage(ctx context.Context, cl client.Reader, cluster *v1beta1.PostgresCluster, componentWithInit ComponentWithInit) (string, error)
func ReleaseLease ¶
ReleaseLease deletes the lease only if it is still held by the given holder. UID and ResourceVersion preconditions prevent accidentally deleting a lease that was re-created by a concurrent acquirer between the Get and Delete.
Types ¶
type ComponentWithInit ¶
type ComponentWithInit interface {
GetInitContainer() *v1beta1.InitContainerSpec
}