common

package
v1.9.4 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2025 License: Apache-2.0 Imports: 21 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 DefaultKubernetesCacheOpts added in v1.9.4

func DefaultKubernetesCacheOpts() cache.Options

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 LoadOSConfig added in v1.9.4

func LoadOSConfig(ctx context.Context, k8sClient client.Client, secretKey client.ObjectKey) (OpenStackConfig, error)

func LoadOSConfigFile added in v1.9.4

func LoadOSConfigFile() (OpenStackConfig, error)

func (OpenStackConfig) Connect added in v1.9.3

func (osConf OpenStackConfig) Connect(ctx context.Context) (*gophercloud.ProviderClient, gophercloud.EndpointOpts, 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
JackTT - Gopher 🇻🇳