Documentation
¶
Index ¶
- Constants
- func NewMachineDeployment(namespace string, gnaSecretName string, replicas int32) v1alpha1.MachineDeployment
- func ParseK8sYaml(filepath string) ([]runtime.Object, []*schema.GroupVersionKind, error)
- type Cluster
- func (c *Cluster) ApplyFiles(source string, namespace string) error
- func (c *Cluster) AreMachinesFailedAndPreserved(ctx context.Context, namespace string, machineNames []string) bool
- func (c *Cluster) AreMachinesRunning(ctx context.Context, machineNames []string, namespace string) bool
- func (c *Cluster) CreateMachine(namespace string, gnaSecretName string) error
- func (c *Cluster) CreateMachineDeployment(namespace string, gnaSecretName string, replicas int32) error
- func (c *Cluster) CreateOrUpdateMcd(ctx context.Context, mcd v1alpha1.MachineDeployment, namespace string) error
- func (c *Cluster) CreateVAPToBlockKubeletUpdates(ctx context.Context, nodeNames []string) error
- func (c *Cluster) DeleteResources(source string, namespace string) error
- func (c *Cluster) DeleteVAPToRestartKubeletUpdates(ctx context.Context, nodeNames []string) error
- func (c *Cluster) FillClientSets() error
- func (c *Cluster) GetNumberOfNodes() int16
- func (c *Cluster) GetNumberOfReadyNodes() int16
- func (c *Cluster) GetRunningMachineList(ctx context.Context, namespace string) ([]v1alpha1.Machine, error)
- func (c *Cluster) GetSecretData(machineClassName string, secretRefs ...*v1.SecretReference) (map[string][]byte, error)
- func (c *Cluster) IsMachineDeleted(ctx context.Context, machineName string, namespace string) bool
- func (c *Cluster) IsMachineDeploymentDeleted(ctx context.Context, machineDeploymentName string, namespace string) bool
- func (c *Cluster) PatchMachineAnnotations(ctx context.Context, mcName string, namespace string, annMap map[string]any) error
- func (c *Cluster) ProbeNodes() error
- func (c *Cluster) VerifyControlClusterNamespace(isControlSeed string, controlClusterNamespace string) error
- type ResourcesTrackerInterface
Constants ¶
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" )
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 ¶
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 ¶
NewCluster returns a Cluster struct
func (*Cluster) ApplyFiles ¶
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 ¶
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
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 ¶
DeleteResources invokes DeleteResource on a each file
func (*Cluster) DeleteVAPToRestartKubeletUpdates ¶ added in v0.63.0
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 ¶
FillClientSets checks whether the cluster is accessible and returns an error if not
func (*Cluster) GetNumberOfNodes ¶
GetNumberOfNodes tries to retrieve the list of node objects in the cluster.
func (*Cluster) GetNumberOfReadyNodes ¶
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
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 ¶
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