app

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2021 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PoolReplicaPhaseAnnotationKey = "pvpool.puppet.com/replica.phase"

	PoolReplicaPhaseAnnotationValueInitializing = "Initializing"
	PoolReplicaPhaseAnnotationValueAvailable    = "Available"
)
View Source
const (
	CheckoutReclaimPolicyAnnotationKey = "pvpool.puppet.com/checkout.reclaim-policy"
)

Variables

View Source
var (
	DefaultPoolReplicaInitJobSpec = batchv1.JobSpec{
		Template: corev1.PodTemplateSpec{
			Spec: corev1.PodSpec{
				Containers: []corev1.Container{
					{
						Name: "init",

						Image: "busybox@sha256:8d0c42425011ea3fb5b4ec5a121dde4ce986c2efea46be9d981a478fe1d206ec",
					},
				},
			},
		},
		BackoffLimit: pointer.Int32Ptr(pvpoolv1alpha1validation.MountJobMaxBackoffLimit),
	}
)
View Source
var DependencyManager = ownerext.NewManager("pvpool.puppet.com/owner")

Functions

func ConfigureCheckout

func ConfigureCheckout(cs *CheckoutState) *pvpoolv1alpha1obj.Checkout

func ConfigurePool

func ConfigurePool(ps *PoolState) *pvpoolv1alpha1obj.Pool

func UpdateCondition

func UpdateCondition(prev, next v1alpha1.Condition) v1alpha1.Condition

Types

type CheckoutState

type CheckoutState struct {
	Checkout *pvpoolv1alpha1obj.Checkout

	// PersistentVolumeClaim is the final, settled PVC that should be made
	// available to the requestor.
	PersistentVolumeClaim *corev1obj.PersistentVolumeClaim

	// PersistentVolume is the PV corresponding to the PVC owned by this
	// checkout. If this object exists, but not PersistentVolumeClaim, we merely
	// need to set up the PVC to point at this PV.
	PersistentVolume *corev1obj.PersistentVolume

	// LockedPersistentVolumeClaim is a PVC that we use to take a PV from the
	// pool for this checkout. This PVC is necessary if we need to perform
	// modifications to the underlying PV before we can present it to the
	// requestor (for example, setting fields on the volume source).
	//
	// Using this intermediate means the somewhat complicated logic to detect
	// whether a pool replica has become stale can be left alone while we mess
	// with the PV here instead.
	LockedPersistentVolumeClaim *corev1obj.PersistentVolumeClaim

	// LockedPersistentVolume is the PV corresponding to the locked PVC, i.e.,
	// the original PV from the pool.
	LockedPersistentVolume *corev1obj.PersistentVolume

	// Conds represent status updates for given conditions.
	Conds map[pvpoolv1alpha1.CheckoutConditionType]pvpoolv1alpha1.Condition
}

func ConfigureCheckoutState

func ConfigureCheckoutState(cs *CheckoutState) (*CheckoutState, error)

func NewCheckoutState

func NewCheckoutState(c *pvpoolv1alpha1obj.Checkout) *CheckoutState

func (*CheckoutState) Load

func (cs *CheckoutState) Load(ctx context.Context, cl client.Client) (bool, error)

func (*CheckoutState) Persist

func (cs *CheckoutState) Persist(ctx context.Context, cl client.Client) error

type PoolReplica

type PoolReplica struct {
	Pool                  *pvpoolv1alpha1obj.Pool
	PersistentVolumeClaim *corev1obj.PersistentVolumeClaim
	PersistentVolume      *corev1obj.PersistentVolume
	InitJob               *batchv1obj.Job
}

func ApplyPoolReplica

func ApplyPoolReplica(ctx context.Context, cl client.Client, p *pvpoolv1alpha1obj.Pool, id string) (*PoolReplica, error)

func ConfigurePoolReplica

func ConfigurePoolReplica(pr *PoolReplica) *PoolReplica

func NewPoolReplica

func NewPoolReplica(p *pvpoolv1alpha1obj.Pool, key client.ObjectKey) *PoolReplica

func (*PoolReplica) Available

func (pr *PoolReplica) Available() bool

func (*PoolReplica) Delete

func (pr *PoolReplica) Delete(ctx context.Context, cl client.Client, opts ...lifecycle.DeleteOption) (bool, error)

func (*PoolReplica) Load

func (pr *PoolReplica) Load(ctx context.Context, cl client.Client) (bool, error)

func (*PoolReplica) Persist

func (pr *PoolReplica) Persist(ctx context.Context, cl client.Client) error

func (*PoolReplica) Stale

func (pr *PoolReplica) Stale() bool

type PoolReplicas

type PoolReplicas []*PoolReplica

func (*PoolReplicas) Pop

func (prs *PoolReplicas) Pop(rng rand.Rand) (*PoolReplica, bool, error)

type PoolReplicasSortByCreationTimestamp

type PoolReplicasSortByCreationTimestamp []*PoolReplica

func (PoolReplicasSortByCreationTimestamp) Len

func (PoolReplicasSortByCreationTimestamp) Less

func (PoolReplicasSortByCreationTimestamp) Swap

type PoolState

type PoolState struct {
	Pool         *pvpoolv1alpha1obj.Pool
	Initializing PoolReplicas
	Available    PoolReplicas
	Stale        PoolReplicas

	// Conds represent status updates for given conditions.
	Conds map[pvpoolv1alpha1.PoolConditionType]pvpoolv1alpha1.Condition
}

func ConfigurePoolState

func ConfigurePoolState(ps *PoolState) *PoolState

func NewPoolState

func NewPoolState(p *pvpoolv1alpha1obj.Pool) *PoolState

func (*PoolState) Delete

func (ps *PoolState) Delete(ctx context.Context, cl client.Client, opts ...lifecycle.DeleteOption) (bool, error)

func (*PoolState) Load

func (ps *PoolState) Load(ctx context.Context, cl client.Client) (bool, error)

func (*PoolState) Persist

func (ps *PoolState) Persist(ctx context.Context, cl client.Client) error

Jump to

Keyboard shortcuts

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