operator

package
v1.27.0 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2025 License: Apache-2.0 Imports: 37 Imported by: 0

Documentation

Overview

Package operator provides functions to handle and manage the operator

Package operator provide functions to handle operator install/uninstall process

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Architectures

func Architectures(operatorPod *corev1.Pod) ([]string, error)

Architectures returns all the supported operator architectures

func CreateConfigMap

func CreateConfigMap(
	ctx context.Context,
	crudClient client.Client,
	pgOperatorNamespace, configName string,
	isOnline bool,
)

CreateConfigMap creates the operator namespace and enables/disable the online upgrade for the instance manager

func Dump

func Dump(ctx context.Context, crudClient client.Client, namespace, filename string)

Dump logs the JSON for the deployment in an operator namespace, its pods and endpoints

func GetAvailableReleases

func GetAvailableReleases(releasesPath string) ([]*semver.Version, error)

GetAvailableReleases retrieves all the available releases from the list of YAML files in the top-level `releases/` directory.

func GetDeployment

func GetDeployment(ctx context.Context, crudClient client.Client) (appsv1.Deployment, error)

GetDeployment returns the operator Deployment if there is a single one running, error otherwise

func GetLeaderInfoFromLease

func GetLeaderInfoFromLease(
	ctx context.Context,
	kubeInterface kubernetes.Interface,
	operatorNamespace string,
) (string, error)

GetLeaderInfoFromLease gathers leader holderIdentity from the lease

func GetMostRecentReleaseTag

func GetMostRecentReleaseTag(releasesPath string) (string, error)

GetMostRecentReleaseTag retrieves the most recent release tag from the list of YAML files in the top-level `releases/` directory. Used for testing upgrades, so: if we're in a release branch, the MostRecent should be the next-to-last release

func GetMutatingWebhookByName

func GetMutatingWebhookByName(
	ctx context.Context,
	crudClient client.Client,
	name string,
) (
	*admissionregistrationv1.MutatingWebhookConfiguration, int, error,
)

GetMutatingWebhookByName get the MutatingWebhook filtered by the name of one of the webhooks

func GetPod

func GetPod(ctx context.Context, crudClient client.Client) (corev1.Pod, error)

GetPod returns the operator pod if there is a single one running, error otherwise

func GetPodName

func GetPodName(ctx context.Context, crudClient client.Client) (string, error)

GetPodName returns the name of the current operator pod NOTE: will return an error if the pod is being deleted

func GetValidatingWebhookByName

func GetValidatingWebhookByName(
	ctx context.Context,
	crudClient client.Client,
	name string,
) (
	*admissionregistrationv1.ValidatingWebhookConfiguration, int, error,
)

GetValidatingWebhookByName get ValidatingWebhook by the name of one of the webhooks

func HasBeenUpgraded

func HasBeenUpgraded(ctx context.Context, crudClient client.Client) bool

HasBeenUpgraded determines if the operator has been upgraded by checking if there is a deletion timestamp. If there isn't, it returns true

func InstallLatest

func InstallLatest(
	crudClient client.Client,
	releaseTag string,
)

InstallLatest installs an operator version with the most recent release tag

func IsReady

func IsReady(
	ctx context.Context,
	crudClient client.Client,
	checkWebhook bool,
) (bool, error)

IsReady ensures that the operator will be ready.

func NamespaceName

func NamespaceName(ctx context.Context, crudClient client.Client) (string, error)

NamespaceName returns the namespace the operator Deployment is running in

func PodRenamed

func PodRenamed(operatorPod corev1.Pod, expectedOperatorPodName string) bool

PodRenamed checks if the operator pod was renamed

func PodRestarted

func PodRestarted(operatorPod corev1.Pod) bool

PodRestarted checks if the operator pod was restarted

func ReloadDeployment

func ReloadDeployment(
	ctx context.Context,
	crudClient client.Client,
	timeoutSeconds uint,
) error

ReloadDeployment finds and deletes the operator pod. Returns error if the new pod is not ready within a defined timeout

func ScaleOperatorDeployment

func ScaleOperatorDeployment(
	ctx context.Context, crudClient client.Client, replicas int32,
) error

ScaleOperatorDeployment will scale the operator to n replicas and return an error in case of failure

func UpdateMutatingWebhookConf

func UpdateMutatingWebhookConf(
	ctx context.Context,
	kubeInterface kubernetes.Interface,
	wh *admissionregistrationv1.MutatingWebhookConfiguration,
) error

UpdateMutatingWebhookConf update MutatingWebhookConfiguration object

func UpdateValidatingWebhookConf

func UpdateValidatingWebhookConf(
	ctx context.Context,
	kubeInterface kubernetes.Interface,
	wh *admissionregistrationv1.ValidatingWebhookConfiguration,
) error

UpdateValidatingWebhookConf update the ValidatingWebhook object

func Version

func Version(namespace, podName string) (string, error)

Version returns the current operator version

func WaitForReady added in v1.25.3

func WaitForReady(
	ctx context.Context,
	crudClient client.Client,
	timeoutSeconds uint,
	checkWebhook bool,
) error

WaitForReady waits for the operator deployment to be ready. If checkWebhook is true, it will also check that the webhook is replying

Types

This section is empty.

Jump to

Keyboard shortcuts

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