podmanager

package
v0.50.0 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPodSpec

func GetPodSpec(cluster *fdbtypes.FoundationDBCluster, processClass fdbtypes.ProcessClass, idNum int) (*corev1.PodSpec, error)

GetPodSpec provides an external interface for the internal GetPodSpec method This is necessary for compatibility reasons.

func GetProcessClass

func GetProcessClass(cluster *fdbtypes.FoundationDBCluster, pod *corev1.Pod) (fdbtypes.ProcessClass, error)

GetProcessClass fetches the process class from a Pod's metadata.

func GetProcessGroupID

func GetProcessGroupID(cluster *fdbtypes.FoundationDBCluster, pod *corev1.Pod) string

GetProcessGroupID returns the process group ID from the Pods metadata

func GetProcessGroupIDFromProcessID

func GetProcessGroupIDFromProcessID(id string) string

GetProcessGroupIDFromProcessID returns the process group ID for the process ID

func GetPublicIPSource

func GetPublicIPSource(pod *corev1.Pod) (fdbtypes.PublicIPSource, error)

GetPublicIPSource determines how a Pod has gotten its public IP.

func GetPublicIPs

func GetPublicIPs(pod *corev1.Pod) []string

GetPublicIPs returns the public IP of a pod.

func ParseProcessGroupID

func ParseProcessGroupID(id string) (fdbtypes.ProcessClass, int, error)

ParseProcessGroupID extracts the components of an process group ID.

Types

type PodLifecycleManager

type PodLifecycleManager interface {
	// GetPods lists the Pods in the cluster
	GetPods(client.Client, *fdbtypes.FoundationDBCluster, ctx.Context, ...client.ListOption) ([]*corev1.Pod, error)

	// CreatePods creates a new Pod based on a pod definition
	CreatePod(client.Client, ctx.Context, *corev1.Pod) error

	// DeletePods deletes a Pod
	DeletePod(client.Client, ctx.Context, *corev1.Pod) error

	// CanDeletePods checks whether it is safe to delete pods.
	CanDeletePods(fdbadminclient.AdminClient, ctx.Context, *fdbtypes.FoundationDBCluster) (bool, error)

	// UpdatePods updates a list of pods to match the latest specs.
	UpdatePods(client.Client, ctx.Context, *fdbtypes.FoundationDBCluster, []*corev1.Pod, bool) error

	// UpdateImageVersion updates a container's image.
	UpdateImageVersion(client.Client, ctx.Context, *fdbtypes.FoundationDBCluster, *corev1.Pod, int, string) error

	// UpdateMetadata updates a Pod's metadata.
	UpdateMetadata(client.Client, ctx.Context, *fdbtypes.FoundationDBCluster, *corev1.Pod) error

	// PodIsUpdated determines whether a Pod is up to date.
	//
	// This does not need to check the metadata or the pod spec hash. This only
	// needs to check aspects of the rollout that are not available in the
	// Pod's metadata.
	PodIsUpdated(client.Client, ctx.Context, *fdbtypes.FoundationDBCluster, *corev1.Pod) (bool, error)

	// GetDeletionMode returns the DeletionMode of the cluster if set or the default value.
	GetDeletionMode(*fdbtypes.FoundationDBCluster) fdbtypes.DeletionMode
}

PodLifecycleManager provides an abstraction around Pod management to allow using intermediary controllers that will manage the Pod lifecycle.

type StandardPodLifecycleManager

type StandardPodLifecycleManager struct{}

StandardPodLifecycleManager provides an implementation of PodLifecycleManager that directly creates pods.

func (StandardPodLifecycleManager) CanDeletePods

func (manager StandardPodLifecycleManager) CanDeletePods(adminClient fdbadminclient.AdminClient, context ctx.Context, cluster *fdbtypes.FoundationDBCluster) (bool, error)

CanDeletePods checks whether it is safe to delete Pods.

func (StandardPodLifecycleManager) CreatePod

func (manager StandardPodLifecycleManager) CreatePod(r client.Client, context ctx.Context, pod *corev1.Pod) error

CreatePod creates a new Pod based on a Pod definition

func (StandardPodLifecycleManager) DeletePod

func (manager StandardPodLifecycleManager) DeletePod(r client.Client, context ctx.Context, pod *corev1.Pod) error

DeletePod shuts down a Pod

func (StandardPodLifecycleManager) GetDeletionMode added in v0.48.0

GetDeletionMode returns the DeletionMode of the cluster if set or the default value Zone.

func (StandardPodLifecycleManager) GetPods

func (manager StandardPodLifecycleManager) GetPods(r client.Client, cluster *fdbtypes.FoundationDBCluster, context ctx.Context, options ...client.ListOption) ([]*corev1.Pod, error)

GetPods returns a list of Pods for FDB pods that have been created.

func (StandardPodLifecycleManager) PodIsUpdated

PodIsUpdated determines whether a Pod is up to date.

This does not need to check the metadata or the pod spec hash. This only needs to check aspects of the rollout that are not available in the PodIsUpdated metadata.

func (StandardPodLifecycleManager) UpdateImageVersion

func (manager StandardPodLifecycleManager) UpdateImageVersion(r client.Client, context ctx.Context, cluster *fdbtypes.FoundationDBCluster, pod *corev1.Pod, containerIndex int, image string) error

UpdateImageVersion updates a Pod container's image.

func (StandardPodLifecycleManager) UpdateMetadata

func (manager StandardPodLifecycleManager) UpdateMetadata(r client.Client, context ctx.Context, cluster *fdbtypes.FoundationDBCluster, pod *corev1.Pod) error

UpdateMetadata updates an Pod's metadata.

func (StandardPodLifecycleManager) UpdatePods

func (manager StandardPodLifecycleManager) UpdatePods(r client.Client, context ctx.Context, cluster *fdbtypes.FoundationDBCluster, pods []*corev1.Pod, unsafe bool) error

UpdatePods updates a list of Pods to match the latest specs.

Jump to

Keyboard shortcuts

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