utils

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2025 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LabelPrefix    = "nodedrain.k8s.slyng.dk"
	LabelComponent = LabelPrefix + "/component"
)

Variables

This section is empty.

Functions

func ExecCmd added in v0.0.10

func ExecCmd(ctx context.Context, client kubernetes.Interface, config *rest.Config, pod types.NamespacedName,
	command string, stdin io.Reader, stdout io.Writer, stderr io.Writer) error

ExecCmd exec command on specific pod and wait the command's output.

func GetFieldOwner

func GetFieldOwner(managerNamespace string) string

func GetNode added in v0.0.10

func GetNode(ctx context.Context, kubeClient *kubernetes.Clientset, nodeName string) *corev1.Node

func IsPodCompleted added in v0.0.10

func IsPodCompleted(c kubernetes.Interface, podName, namespace string) wait.ConditionWithContextFunc

func IsPodRunning added in v0.0.10

func IsPodRunning(c kubernetes.Interface, podName, namespace string) wait.ConditionWithContextFunc

func PtrTo

func PtrTo[T any](v T) *T

func Wrap

func Wrap(z *zap.Logger) hclog.Logger

Types

type DrainManager

type DrainManager struct {
	// contains filtered or unexported fields
}

func NewDrainManager

func NewDrainManager(ctx context.Context, client kClient.Client, restConfig *rest.Config, recorder record.EventRecorder) (*DrainManager, error)

func (*DrainManager) IsClusterNodesHealthy

func (d *DrainManager) IsClusterNodesHealthy(ctx context.Context) (bool, error)

func (*DrainManager) IsDrainOk

func (d *DrainManager) IsDrainOk(ctx context.Context, node *drainv1.Node) (bool, error)

func (*DrainManager) IsHealthy

func (d *DrainManager) IsHealthy(ctx context.Context, node *drainv1.Node) (bool, error)

func (*DrainManager) RunPostDrain

func (d *DrainManager) RunPostDrain(ctx context.Context, node *drainv1.Node) error

func (*DrainManager) RunPreDrain

func (d *DrainManager) RunPreDrain(ctx context.Context, node *drainv1.Node) error

type Level

type Level = hclog.Level

type RebootManager

type RebootManager struct {
	// contains filtered or unexported fields
}

func NewRebootManager

func NewRebootManager(l *zap.Logger, client client.Client, restConfig *rest.Config, recorder record.EventRecorder, namespace string) (*RebootManager, error)

func (*RebootManager) CleanupNode

func (r *RebootManager) CleanupNode(ctx context.Context, nodeName string) error

func (*RebootManager) IsNodeRebooted

func (r *RebootManager) IsNodeRebooted(ctx context.Context, kubeNode *corev1.Node, oldBootId string) (bool, error)

func (*RebootManager) IsRebootRequired

func (r *RebootManager) IsRebootRequired(ctx context.Context, nodeName string) (bool, error)

func (*RebootManager) RebootNode

func (r *RebootManager) RebootNode(ctx context.Context, node *drainv1.Node) error

Jump to

Keyboard shortcuts

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