Help us shape the future of Go! Take the 2026 Go Developer Survey

helpers

package
v0.63.1 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// VAPName is the name of the ValidatingAdmissionPolicy that blocks kubelet from updating node leases and node status.
	VAPName = "integration-test-block-node-heartbeats"
	// VAPBName is the name of the ValidatingAdmissionPolicyBinding that binds the above ValidatingAdmissionPolicy to the cluster.
	VAPBName = "integration-test-block-node-heartbeats-binding"
)
View Source
const (

	// McdName is the name of the test machine deployment
	McdName = "test-machine-deployment"
	// McName is the name of the test machine
	McName = "test-machine"
)

Variables

This section is empty.

Functions

func NewMachineDeployment added in v0.63.0

func NewMachineDeployment(namespace string, gnaSecretName string, replicas int32) v1alpha1.MachineDeployment

NewMachineDeployment returns a MachineDeployment object with the specified namespace, gnaSecretName, replicas and machineLabels

func ParseK8sYaml

func ParseK8sYaml(filepath string) ([]runtime.Object, []*schema.GroupVersionKind, error)

ParseK8sYaml reads a yaml file and parses it based on the scheme

Types

type Cluster

type Cluster struct {
	Clientset *kubernetes.Clientset

	McmClient          *mcmClientset.Clientset
	RbacClient         *rbac.RbacV1Client
	KubeConfigFilePath string
	// contains filtered or unexported fields
}

Cluster type to hold cluster specific details

func NewCluster

func NewCluster(kubeConfigPath string) (c *Cluster, e error)

NewCluster returns a Cluster struct

func (*Cluster) ApplyFiles

func (c *Cluster) ApplyFiles(source string, namespace string) error

ApplyFiles invokes ApplyFile on a each file

func (*Cluster) AreMachinesFailedAndPreserved added in v0.63.0

func (c *Cluster) AreMachinesFailedAndPreserved(ctx context.Context, namespace string, machineNames []string) bool

AreMachinesFailedAndPreserved checks if all the specified machines are in the Failed phase and are preserved

func (*Cluster) AreMachinesRunning added in v0.63.0

func (c *Cluster) AreMachinesRunning(ctx context.Context, machineNames []string, namespace string) bool

AreMachinesRunning returns boolean value indicating whether all the machines names passed to it are in the running state or not

func (*Cluster) CreateMachine

func (c *Cluster) CreateMachine(namespace string, gnaSecretName string) error

CreateMachine creates a test-machine using machineclass "test-mc"

func (*Cluster) CreateMachineDeployment

func (c *Cluster) CreateMachineDeployment(namespace string, gnaSecretName string, replicas int32) error

CreateMachineDeployment creates a test-machine-deployment with a specified number of replicas and returns error if it occurs

func (*Cluster) CreateOrUpdateMcd added in v0.63.0

func (c *Cluster) CreateOrUpdateMcd(ctx context.Context, mcd v1alpha1.MachineDeployment, namespace string) error

CreateOrUpdateMcd creates or updates a MachineDeployment with the specified namespace, gnaSecretName, replicas and machineLabels

func (*Cluster) CreateVAPToBlockKubeletUpdates added in v0.63.0

func (c *Cluster) CreateVAPToBlockKubeletUpdates(ctx context.Context, nodeNames []string) error

CreateVAPToBlockKubeletUpdates is a utility method to create a ValidatingAdmissionPolicy and ValidatingAdmissionPolicyBinding to block kubelet from updating node leases and node status. This is used to cause nodes to go into the NotReady state to test the machine preservation feature of MCM.

func (*Cluster) DeleteResources

func (c *Cluster) DeleteResources(source string, namespace string) error

DeleteResources invokes DeleteResource on a each file

func (*Cluster) DeleteVAPToRestartKubeletUpdates added in v0.63.0

func (c *Cluster) DeleteVAPToRestartKubeletUpdates(ctx context.Context, nodeNames []string) error

DeleteVAPToRestartKubeletUpdates deletes the ValidatingAdmissionPolicy and ValidatingAdmissionPolicyBinding that were created to block kubelet from updating node leases and node status. Furthermore, it triggers node recovery for virtual clusters by adding annotation "kwok/fail-condition=Recover" for each node whose readiness was being blocked by the VAP.

func (*Cluster) FillClientSets

func (c *Cluster) FillClientSets() error

FillClientSets checks whether the cluster is accessible and returns an error if not

func (*Cluster) GetNumberOfNodes

func (c *Cluster) GetNumberOfNodes() int16

GetNumberOfNodes tries to retrieve the list of node objects in the cluster.

func (*Cluster) GetNumberOfReadyNodes

func (c *Cluster) GetNumberOfReadyNodes() int16

GetNumberOfReadyNodes tries to retrieve the list of node objects in the cluster.

func (*Cluster) GetRunningMachineList added in v0.63.0

func (c *Cluster) GetRunningMachineList(ctx context.Context, namespace string) ([]v1alpha1.Machine, error)

GetRunningMachineList lists all running machines that contain the given machine labels and returns the list of such machines

func (*Cluster) GetSecretData

func (c *Cluster) GetSecretData(machineClassName string, secretRefs ...*v1.SecretReference) (map[string][]byte, error)

GetSecretData combines secrets

func (*Cluster) IsMachineDeleted added in v0.63.0

func (c *Cluster) IsMachineDeleted(ctx context.Context, machineName string, namespace string) bool

IsMachineDeleted returns boolean value indicating whether the specified machine is deleted or not

func (*Cluster) IsMachineDeploymentDeleted added in v0.63.0

func (c *Cluster) IsMachineDeploymentDeleted(ctx context.Context, machineDeploymentName string, namespace string) bool

IsMachineDeploymentDeleted returns boolean value indicating whether the specified machine deployment is deleted or not

func (*Cluster) PatchMachineAnnotations added in v0.63.0

func (c *Cluster) PatchMachineAnnotations(ctx context.Context, mcName string, namespace string, annMap map[string]any) error

PatchMachineAnnotations patches the annotations of a machine with the specified name and namespace with the provided annotation map

func (*Cluster) ProbeNodes

func (c *Cluster) ProbeNodes() error

ProbeNodes tries to probe for nodes.

func (*Cluster) VerifyControlClusterNamespace added in v0.51.0

func (c *Cluster) VerifyControlClusterNamespace(isControlSeed string, controlClusterNamespace string) error

VerifyControlClusterNamespace validates the control namespace provided by the user. It checks the following:- 1. If it is a seed, then it should not use a default namespace as the control namespace. 2. The control namespace should be present in the control cluster.

type ResourcesTrackerInterface

type ResourcesTrackerInterface interface {
	IsOrphanedResourcesAvailable() bool
	InitializeResourcesTracker(
		machineClass *v1alpha1.MachineClass,
		secretData map[string][]byte,
		clusterName string,
	) error
}

ResourcesTrackerInterface provides an interface to check for orphan resources. The implementation should handle probing for resources while contructing or calling New method And reporting orphan resources whenever IsOrphanedResourcesAvailable is invoked

Jump to

Keyboard shortcuts

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