Documentation
¶
Index ¶
- Variables
- func CreateImage(ctx context.Context, s *Scenario) *config.Image
- func CreateSIGImageVersionFromDisk(ctx context.Context, s *Scenario, version string, diskResourceID string) *config.Image
- func CustomDataWithHack(s *Scenario, binaryURL string) (string, error)
- func GetFieldFromJsonObjectOnNode(ctx context.Context, s *Scenario, fileName string, jsonPath string) string
- func RunCommand(ctx context.Context, s *Scenario, command string) (armcompute.RunCommandResult, error)
- func RunScenario(t *testing.T, s *Scenario)
- func ServiceCanRestartValidator(ctx context.Context, s *Scenario, serviceName string, ...)
- func ValidateAKSLogCollector(ctx context.Context, s *Scenario)
- func ValidateAppArmorBasic(ctx context.Context, s *Scenario)
- func ValidateCiliumIsNotRunningWindows(ctx context.Context, s *Scenario)
- func ValidateCiliumIsRunningWindows(ctx context.Context, s *Scenario)
- func ValidateCommonLinux(ctx context.Context, s *Scenario)
- func ValidateCommonWindows(ctx context.Context, s *Scenario)
- func ValidateContainerRuntimePlugins(ctx context.Context, s *Scenario)
- func ValidateContainerd2Properties(ctx context.Context, s *Scenario, versions []string)
- func ValidateDirectoryContent(ctx context.Context, s *Scenario, path string, files []string)
- func ValidateDiskQueueService(ctx context.Context, s *Scenario)
- func ValidateDllIsNotLoadedWindows(ctx context.Context, s *Scenario, dllName string)
- func ValidateDllLoadedWindows(ctx context.Context, s *Scenario, dllName string)
- func ValidateEnableNvidiaResource(ctx context.Context, s *Scenario)
- func ValidateFileDoesNotExist(ctx context.Context, s *Scenario, fileName string)
- func ValidateFileExcludesContent(ctx context.Context, s *Scenario, fileName string, contents string)
- func ValidateFileExists(ctx context.Context, s *Scenario, fileName string)
- func ValidateFileHasContent(ctx context.Context, s *Scenario, fileName string, contents string)
- func ValidateFileIsRegularFile(ctx context.Context, s *Scenario, fileName string)
- func ValidateGPUWorkloadSchedulable(ctx context.Context, s *Scenario, gpuCount int)
- func ValidateIMDSRestrictionRule(ctx context.Context, s *Scenario, table string)
- func ValidateIPTablesCompatibleWithCiliumEBPF(ctx context.Context, s *Scenario)
- func ValidateInstalledPackageVersion(ctx context.Context, s *Scenario, component, version string)
- func ValidateJournalctlOutput(ctx context.Context, s *Scenario, serviceName string, expectedContent string)
- func ValidateJsonFileDoesNotHaveField(ctx context.Context, s *Scenario, fileName string, jsonPath string, ...)
- func ValidateJsonFileHasField(ctx context.Context, s *Scenario, fileName string, jsonPath string, ...)
- func ValidateKubeletHasFlags(ctx context.Context, s *Scenario, filePath string)
- func ValidateKubeletHasNotStopped(ctx context.Context, s *Scenario)
- func ValidateKubeletNodeIP(ctx context.Context, s *Scenario)
- func ValidateKubeletServingCertificateRotation(ctx context.Context, s *Scenario)
- func ValidateLeakedSecrets(ctx context.Context, s *Scenario)
- func ValidateLocalDNSResolution(ctx context.Context, s *Scenario, server string)
- func ValidateLocalDNSService(ctx context.Context, s *Scenario, state string)
- func ValidateMIGInstancesCreated(ctx context.Context, s *Scenario, migProfile string)
- func ValidateMIGModeEnabled(ctx context.Context, s *Scenario)
- func ValidateMultipleKubeProxyVersionsExist(ctx context.Context, s *Scenario)
- func ValidateNPDFilesystemCorruption(ctx context.Context, s *Scenario)
- func ValidateNPDGPUCountAfterFailure(ctx context.Context, s *Scenario)
- func ValidateNPDGPUCountCondition(ctx context.Context, s *Scenario)
- func ValidateNPDGPUCountPlugin(ctx context.Context, s *Scenario)
- func ValidateNPDHealthyNvidiaGridLicenseStatus(ctx context.Context, s *Scenario)
- func ValidateNPDIBLinkFlappingAfterFailure(ctx context.Context, s *Scenario)
- func ValidateNPDIBLinkFlappingCondition(ctx context.Context, s *Scenario)
- func ValidateNPDUnhealthyNvidiaDCGMServices(ctx context.Context, s *Scenario)
- func ValidateNPDUnhealthyNvidiaDCGMServicesAfterFailure(ctx context.Context, s *Scenario)
- func ValidateNPDUnhealthyNvidiaDCGMServicesCondition(ctx context.Context, s *Scenario)
- func ValidateNPDUnhealthyNvidiaDevicePlugin(ctx context.Context, s *Scenario)
- func ValidateNPDUnhealthyNvidiaDevicePluginAfterFailure(ctx context.Context, s *Scenario)
- func ValidateNPDUnhealthyNvidiaDevicePluginCondition(ctx context.Context, s *Scenario)
- func ValidateNPDUnhealthyNvidiaGridLicenseStatusAfterFailure(ctx context.Context, s *Scenario)
- func ValidateNodeAdvertisesGPUResources(ctx context.Context, s *Scenario, gpuCountExpected int64)
- func ValidateNodeCanRunAPod(ctx context.Context, s *Scenario)
- func ValidateNodeHasLabel(ctx context.Context, s *Scenario, labelKey, expectedValue string)
- func ValidateNodeProblemDetector(ctx context.Context, s *Scenario)
- func ValidateNonEmptyDirectory(ctx context.Context, s *Scenario, dirName string)
- func ValidateNvidiaDCGMExporterIsScrapable(ctx context.Context, s *Scenario)
- func ValidateNvidiaDCGMExporterScrapeCommonMetric(ctx context.Context, s *Scenario, metric string)
- func ValidateNvidiaDCGMExporterSystemDServiceRunning(ctx context.Context, s *Scenario)
- func ValidateNvidiaDevicePluginServiceRunning(ctx context.Context, s *Scenario)
- func ValidateNvidiaGRIDLicenseValid(ctx context.Context, s *Scenario)
- func ValidateNvidiaModProbeInstalled(ctx context.Context, s *Scenario)
- func ValidateNvidiaPersistencedRunning(ctx context.Context, s *Scenario)
- func ValidateNvidiaSMIInstalled(ctx context.Context, s *Scenario)
- func ValidateNvidiaSMINotInstalled(ctx context.Context, s *Scenario)
- func ValidatePodRunning(ctx context.Context, s *Scenario, pod *corev1.Pod)
- func ValidatePubkeySSHDisabled(ctx context.Context, s *Scenario)
- func ValidateRuncVersion(ctx context.Context, s *Scenario, versions []string)
- func ValidateSSHServiceDisabled(ctx context.Context, s *Scenario)
- func ValidateSSHServiceEnabled(ctx context.Context, s *Scenario)
- func ValidateServicesDoNotRestartKubelet(ctx context.Context, s *Scenario)
- func ValidateSysctlConfig(ctx context.Context, s *Scenario, customSysctls map[string]string)
- func ValidateSystemdUnitIsNotFailed(ctx context.Context, s *Scenario, serviceName string)
- func ValidateSystemdUnitIsNotRunning(ctx context.Context, s *Scenario, serviceName string)
- func ValidateSystemdUnitIsRunning(ctx context.Context, s *Scenario, serviceName string)
- func ValidateSystemdWatchdogForKubernetes132Plus(ctx context.Context, s *Scenario)
- func ValidateTLSBootstrapping(ctx context.Context, s *Scenario)
- func ValidateTaints(ctx context.Context, s *Scenario, expectedTaints string)
- func ValidateUlimitSettings(ctx context.Context, s *Scenario, ulimits map[string]string)
- func ValidateWindowsCiliumIsNotRunning(ctx context.Context, s *Scenario)
- func ValidateWindowsCiliumIsRunning(ctx context.Context, s *Scenario)
- func ValidateWindowsDisplayVersion(ctx context.Context, s *Scenario, displayVersion string)
- func ValidateWindowsProcessContainsArgumentStrings(ctx context.Context, s *Scenario, processName string, substrings []string)
- func ValidateWindowsProcessDoesNotContainArgumentStrings(ctx context.Context, s *Scenario, processName string, substrings []string)
- func ValidateWindowsProcessHasCliArguments(ctx context.Context, s *Scenario, processName string, arguments []string)
- func ValidateWindowsProductName(ctx context.Context, s *Scenario, productName string)
- func ValidateWindowsServiceIsNotRunning(ctx context.Context, s *Scenario, serviceName string)
- func ValidateWindowsServiceIsRunning(ctx context.Context, s *Scenario, serviceName string)
- func ValidateWindowsVersionFromWindowsSettings(ctx context.Context, s *Scenario, windowsVersion string)
- type Cluster
- type ClusterParams
- type ClusterRequest
- type Config
- type CreateGalleryImageRequest
- type CreateGalleryRequest
- type GetVHDRequest
- type Kubeclient
- func (k *Kubeclient) CreateDaemonset(ctx context.Context, ds *appsv1.DaemonSet) error
- func (k *Kubeclient) EnsureDebugDaemonsets(ctx context.Context, isAirgap bool, privateACRName string) error
- func (k *Kubeclient) GetHostNetworkDebugPod(ctx context.Context) (*corev1.Pod, error)
- func (k *Kubeclient) GetPodNetworkDebugPodForNode(ctx context.Context, kubeNodeName string) (*corev1.Pod, error)
- func (k *Kubeclient) WaitUntilNodeReady(ctx context.Context, t testing.TB, vmssName string) string
- func (k *Kubeclient) WaitUntilPodRunning(ctx context.Context, namespace string, labelSelector string, ...) (*corev1.Pod, error)
- type Scenario
- func (s *Scenario) GetClientPrivateKey() string
- func (s *Scenario) GetK8sVersion() string
- func (s *Scenario) GetServicePrincipalSecret() string
- func (s *Scenario) GetTLSBootstrapToken() string
- func (s *Scenario) HasServicePrincipalData() bool
- func (s *Scenario) IsLinux() bool
- func (s *Scenario) IsWindows() bool
- func (s *Scenario) KubeletConfigFileEnabled() bool
- func (s *Scenario) PrepareAKSNodeConfig()
- func (s *Scenario) PrepareVMSSModel(ctx context.Context, t testing.TB, vmss *armcompute.VirtualMachineScaleSet)
- func (s *Scenario) SecureTLSBootstrappingEnabled() bool
- type ScenarioRuntime
- type ScenarioVM
- type Tags
- type VNet
Constants ¶
This section is empty.
Variables ¶
var CachedCompileAndUploadAKSNodeController = cachedFunc(compileAndUploadAKSNodeController)
var CachedCreateGallery = cachedFunc(createGallery)
var CachedCreateGalleryImage = cachedFunc(createGalleryImage)
var CachedCreateVMManagedIdentity = cachedFunc(config.Azure.CreateVMManagedIdentity)
var CachedEnsureResourceGroup = cachedFunc(ensureResourceGroup)
var CachedPrepareVHD = cachedFunc(prepareVHD)
var ClusterAzureNetwork = cachedFunc(clusterAzureNetwork)
var ClusterAzureOverlayNetwork = cachedFunc(clusterAzureOverlayNetwork)
var ClusterAzureOverlayNetworkDualStack = cachedFunc(clusterAzureOverlayNetworkDualStack)
var ClusterCiliumNetwork = cachedFunc(clusterCiliumNetwork)
var ClusterKubenet = cachedFunc(clusterKubenet)
var ClusterKubenetAirgap = cachedFunc(clusterKubenetAirgap)
var ClusterKubenetAirgapNonAnon = cachedFunc(clusterKubenetAirgapNonAnon)
var ClusterLatestKubernetesVersion = cachedFunc(clusterLatestKubernetesVersion)
var (
SSHKeyPrivate, SSHKeyPublic = mustGetNewRSAKeyPair()
)
Functions ¶
func CreateSIGImageVersionFromDisk ¶
func CreateSIGImageVersionFromDisk(ctx context.Context, s *Scenario, version string, diskResourceID string) *config.Image
CreateSIGImageVersionFromDisk creates a new SIG image version directly from a VM disk
func CustomDataWithHack ¶
CustomDataWithHack is similar to nodeconfigutils.CustomData, but it uses a hack to run new aks-node-controller binary Original aks-node-controller isn't run because it fails systemd check validating aks-node-controller-config.json exists check aks-node-controller.service for details a new binary is downloaded from the given URL and run with provision command
func RunCommand ¶
func RunCommand(ctx context.Context, s *Scenario, command string) (armcompute.RunCommandResult, error)
RunCommand executes a command on the VMSS VM with instance ID "0" and returns the raw JSON response from Azure Unlike default approach, it doesn't use SSH and uses Azure tooling This approach is generally slower, but it works even if SSH is not available
func RunScenario ¶
func ValidateAKSLogCollector ¶
func ValidateAppArmorBasic ¶
ValidateAppArmorBasic validates that AppArmor is running without requiring aa-status
func ValidateCommonLinux ¶
func ValidateCommonWindows ¶
func ValidateFileExists ¶
func ValidateFileHasContent ¶
func ValidateIPTablesCompatibleWithCiliumEBPF ¶
ValidateIPTablesCompatibleWithCiliumEBPF validates that all iptables rules in each table match the provided patterns which are accounted for when eBPF host routing is enabled.
func ValidateJournalctlOutput ¶
func ValidateJournalctlOutput(ctx context.Context, s *Scenario, serviceName string, expectedContent string)
ValidateJournalctlOutput checks if specific content exists in the systemd service logs
func ValidateKubeletHasFlags ¶
ValidateKubeletHasFlags checks kubelet is started with the right flags and configs.
func ValidateKubeletNodeIP ¶
func ValidateLeakedSecrets ¶
func ValidateLocalDNSResolution ¶
ValidateLocalDNSResolution checks if the DNS resolution for an external domain is successful from localdns clusterlistenerIP. It uses the 'dig' command to check the DNS resolution and expects a successful response.
func ValidateLocalDNSService ¶
ValidateLocalDNSService checks if the localdns service is in the expected state (enabled or disabled).
func ValidateMIGModeEnabled ¶
func ValidateNodeCanRunAPod ¶
func ValidateNodeHasLabel ¶
ValidateNodeHasLabel checks if the node has the expected label with the expected value
func ValidatePodRunning ¶
func ValidatePubkeySSHDisabled ¶
ValidatePubkeySSHDisabled validates that SSH with private key authentication is disabled by checking sshd_config
func ValidateRuncVersion ¶
func ValidateSSHServiceDisabled ¶
ValidateSSHServiceDisabled validates that the SSH daemon service is disabled and stopped on the node
func ValidateSysctlConfig ¶
func ValidateTaints ¶
ValidateTaints checks if the node has the expected taints that are set in the kubelet config with --register-with-taints flag
func ValidateUlimitSettings ¶
Types ¶
type Cluster ¶
type Cluster struct {
Model *armcontainerservice.ManagedCluster
Kube *Kubeclient
KubeletIdentity *armcontainerservice.UserAssignedIdentity
SubnetID string
ClusterParams *ClusterParams
Maintenance *armcontainerservice.MaintenanceConfiguration
DebugPod *corev1.Pod
}
func (*Cluster) IsAzureCNI ¶
Returns true if the cluster is configured with Azure CNI
func (*Cluster) MaxPodsPerNode ¶
Returns the maximum number of pods per node of the cluster's agentpool
type ClusterParams ¶
type ClusterRequest ¶
ClusterRequest represents the parameters needed to create a cluster
type Config ¶
type Config struct {
// Cluster creates, updates or re-uses an AKS cluster for the scenario
Cluster func(ctx context.Context, request ClusterRequest) (*Cluster, error)
// VHD is the node image used by the scenario.
VHD *config.Image
// BootstrapConfigMutator is a function which mutates the base NodeBootstrappingConfig according to the scenario's requirements
BootstrapConfigMutator func(*datamodel.NodeBootstrappingConfiguration)
// AKSNodeConfigMutator if defined then aks-node-controller will be used to provision nodes
AKSNodeConfigMutator func(*aksnodeconfigv1.Configuration)
// VMConfigMutator is a function which mutates the base VMSS model according to the scenario's requirements
VMConfigMutator func(*armcompute.VirtualMachineScaleSet)
// Validator is a function where the scenario can perform any extra validation checks
Validator func(ctx context.Context, s *Scenario)
// SkipDefaultValidation is a flag to indicate whether the common validation (like spawning a pod) should be skipped.
// It shouldn't be used for majority of scenarios, currently only used for preparing VHD in a two-stage scenario
SkipDefaultValidation bool
// SkipSSHConnectivityValidation is a flag to indicate whether the ssh connectivity validation should be skipped.
// It shouldn't be used for majority of scenarios, currently only used for scenarios where the node is not expected to be reachable via ssh
SkipSSHConnectivityValidation bool
// WaitForSSHAfterReboot if set to non-zero duration, SSH connectivity validation will retry with exponential backoff
// for up to this duration when encountering reboot-related errors. This is useful for scenarios where the node
// reboots during provisioning (e.g., MIG-enabled GPU nodes). Default (zero value) means no retry.
WaitForSSHAfterReboot time.Duration
// if VHDCaching is set then a VHD will be created first for the test scenario and then a VM will be created from that VHD.
// The main purpose is to validate VHD Caching logic and ensure a reboot step between basePrep and nodePrep doesn't break anything.
VHDCaching bool
}
Config represents the configuration of an AgentBaker E2E scenario.
type CreateGalleryImageRequest ¶
type CreateGalleryImageRequest struct {
ResourceGroup string
GalleryName string
Location string
Arch string
Windows bool
HyperVGeneration *armcompute.HyperVGeneration
}
type CreateGalleryRequest ¶
type GetVHDRequest ¶
type Kubeclient ¶
type Kubeclient struct {
Dynamic client.Client
Typed kubernetes.Interface
RESTConfig *rest.Config
KubeConfig []byte
}
func (*Kubeclient) CreateDaemonset ¶
func (*Kubeclient) EnsureDebugDaemonsets ¶
func (k *Kubeclient) EnsureDebugDaemonsets(ctx context.Context, isAirgap bool, privateACRName string) error
this is a bit ugly, but we don't want to execute this piece concurrently with other tests
func (*Kubeclient) GetHostNetworkDebugPod ¶
GetHostNetworkDebugPod returns a pod that's a member of the 'debug' daemonset, running on an aks-nodepool node.
func (*Kubeclient) GetPodNetworkDebugPodForNode ¶
func (k *Kubeclient) GetPodNetworkDebugPodForNode(ctx context.Context, kubeNodeName string) (*corev1.Pod, error)
GetPodNetworkDebugPodForNode returns a pod that's a member of the 'debugnonhost' daemonset running in the cluster - this will return the name of the pod that is running on the node created for specifically for the test case which is running validation checks.
func (*Kubeclient) WaitUntilNodeReady ¶
type Scenario ¶
type Scenario struct {
// Description is a short description of what the scenario does and tests for
Description string
// Tags are used for filtering scenarios to run based on the tags provided
Tags Tags
// Config contains the configuration of the scenario
Config
// Location is the Azure location where the scenario will run. This can be
// used to override the default location.
Location string
// K8sSystemPoolSKU is the VM size to use for the system nodepool. If empty,
// a default size will be used.
K8sSystemPoolSKU string
// Runtime contains the runtime state of the scenario. It's populated in the beginning of the test run
Runtime *ScenarioRuntime
T testing.TB
}
Scenario represents an AgentBaker E2E scenario.
func (*Scenario) GetClientPrivateKey ¶
func (*Scenario) GetK8sVersion ¶
func (*Scenario) GetServicePrincipalSecret ¶
func (*Scenario) GetTLSBootstrapToken ¶
func (*Scenario) HasServicePrincipalData ¶
func (*Scenario) KubeletConfigFileEnabled ¶
func (*Scenario) PrepareAKSNodeConfig ¶
func (s *Scenario) PrepareAKSNodeConfig()
func (*Scenario) PrepareVMSSModel ¶
func (s *Scenario) PrepareVMSSModel(ctx context.Context, t testing.TB, vmss *armcompute.VirtualMachineScaleSet)
PrepareVMSSModel mutates the input VirtualMachineScaleSet based on the scenario's VMConfigMutator, if configured. This method will also use the scenario's configured VHD selector to modify the input VMSS to reference the correct VHD resource.
func (*Scenario) SecureTLSBootstrappingEnabled ¶
type ScenarioRuntime ¶
type ScenarioRuntime struct {
NBC *datamodel.NodeBootstrappingConfiguration
AKSNodeConfig *aksnodeconfigv1.Configuration
Cluster *Cluster
VM *ScenarioVM
VMSSName string
}
type ScenarioVM ¶
type ScenarioVM struct {
KubeName string
VMSS *armcompute.VirtualMachineScaleSet
VM *armcompute.VirtualMachineScaleSetVM
PrivateIP string
}
func ConfigureAndCreateVMSS ¶
func ConfigureAndCreateVMSS(ctx context.Context, s *Scenario) *ScenarioVM
func CreateVMSS ¶
func CreateVMSSWithRetry ¶
func CreateVMSSWithRetry(ctx context.Context, s *Scenario) (*ScenarioVM, error)
type Tags ¶
type Tags struct {
Name string
ImageName string
OS string
Arch string
Airgap bool
NonAnonymousACR bool
GPU bool
WASM bool
BootstrapTokenFallback bool
KubeletCustomConfig bool
Scriptless bool
VHDCaching bool
MockAzureChinaCloud bool
}
func (Tags) MatchesAnyFilter ¶
MatchesAnyFilter checks if the Tags struct matches at least one of the given filters. Filters are comma-separated "key=value" pairs (e.g., "gpu=true,os=x64"). Returns true if any filter matches, false if none match. Errors on invalid input.
func (Tags) MatchesFilters ¶
MatchesFilters checks if the Tags struct matches all given filters. Filters are comma-separated "key=value" pairs (e.g., "gpu=true,os=x64"). Returns true if all filters match, false otherwise. Errors on invalid input.