common

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var WeekdayMap = map[string]time.Weekday{
	"monday":    time.Monday,
	"mon":       time.Monday,
	"tuesday":   time.Tuesday,
	"tue":       time.Tuesday,
	"wednesday": time.Wednesday,
	"wed":       time.Wednesday,
	"thursday":  time.Thursday,
	"thu":       time.Thursday,
	"friday":    time.Friday,
	"fri":       time.Friday,
	"saturday":  time.Saturday,
	"sat":       time.Saturday,
	"sunday":    time.Sunday,
	"sun":       time.Sunday,
}

Functions

func EnsureDrain

func EnsureDrain(ctx context.Context, node *corev1.Node, log logr.Logger, params DrainParameters) error

Drains Pods from the given node, if required.

func EnsureSchedulable

func EnsureSchedulable(ctx context.Context, k8sClient client.Client, node *corev1.Node, schedulable bool) error

Checks if the is Schedulable according to schedulable and patches the node if necessary.

func GetAPIServerVersion added in v0.18.0

func GetAPIServerVersion(ki kubernetes.Interface) (semver.Version, error)

func GetPodsForDrain

func GetPodsForDrain(ctx context.Context, k8sClient client.Client, nodeName string) ([]corev1.Pod, error)

Gets a list of pods to be deleted for a node to be considered drained. Shortened https://github.com/kinvolk/flatcar-linux-update-operator/blob/master/pkg/k8sutil/drain.go .

func WaitForPodDeletions

func WaitForPodDeletions(ctx context.Context, k8sClient client.Client, pods []corev1.Pod, params WaitParameters) error

Deletes the given pods and awaits there deletion.

func WeekdayFromString

func WeekdayFromString(s string) (time.Weekday, error)

Types

type DrainParameters added in v0.18.0

type DrainParameters struct {
	// how long to wait for pods to vanish
	AwaitDeletion WaitParameters
	// how long to wait for eviction creation to succeed
	Eviction WaitParameters
	Client   client.Client
	// for eviction API as that is not callable from client.Client
	Clientset kubernetes.Interface
	// when set to true and eviction creation fails
	// within the eviction timeout, call a direct delete
	// on pods afterwards.
	ForceEviction      bool
	GracePeriodSeconds *int64
}

type OpenStackConfig added in v0.19.0

type OpenStackConfig struct {
	Region     string
	AuthURL    string
	Username   string
	Password   string
	Domainname string
	ProjectID  string
}

func LoadOpenStackConfig added in v0.19.0

func LoadOpenStackConfig() (OpenStackConfig, error)

type WaitFunc added in v0.18.0

type WaitFunc = func() error

type WaitParameters

type WaitParameters struct {
	Period  time.Duration
	Timeout time.Duration
}

Jump to

Keyboard shortcuts

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