Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions hack/e2e/net.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,5 @@
</nat>
</forward>
<bridge name='metal3'/>
<ip address='192.168.222.1' netmask='255.255.255.0'>
<dhcp>
<range start='192.168.222.3' end='192.168.222.99'/>
<bootp file='http://192.168.222.2:6180/boot.ipxe'/>
</dhcp>
</ip>
<ip address='192.168.222.1' netmask='255.255.255.0'/>
</network>
2 changes: 1 addition & 1 deletion test/e2e/automated_cleaning_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ var _ = Describe("Automated cleaning", Label("required", "automated-cleaning"),
CredentialsName: "bmc-credentials",
DisableCertificateVerification: bmc.DisableCertificateVerification,
},
BootMode: metal3api.Legacy,
BootMode: metal3api.BootMode(e2eConfig.GetVariable("BOOT_MODE")),
BootMACAddress: bmc.BootMacAddress,
AutomatedCleaningMode: metal3api.CleaningModeMetadata,
},
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/basic_ops_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ var _ = Describe("basic", Label("required", "basic"), func() {
CredentialsName: "bmc-credentials",
DisableCertificateVerification: bmc.DisableCertificateVerification,
},
BootMode: metal3api.Legacy,
BootMode: metal3api.BootMode(e2eConfig.GetVariable("BOOT_MODE")),
BootMACAddress: bmc.BootMacAddress,
},
}
Expand Down
28 changes: 28 additions & 0 deletions test/e2e/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -778,3 +778,31 @@ type WaitForIronicInput struct {
Namespace string
Intervals []interface{} // e.g. []interface{}{time.Minute * 15, time.Second * 5}
}

// ConfigureProvisioningNetwork adds the provisioning IP with /24 netmask to the kind cluster node.
// TODO(lentzi90): Implement support for this in the keepalived image we use.
// This is a workaround for the fact that keepalived only adds a /32 address, which causes
// dnsmasq to fail with "no address range available for DHCP request" because it cannot
// find a matching subnet for the DHCP range.
// See https://github.com/metal3-io/baremetal-operator/issues/2792
func ConfigureProvisioningNetwork(ctx context.Context, clusterName string, provisioningIP string) {
containerName := clusterName + "-control-plane"
// Add the provisioning IP with /24 netmask to eth0
// This allows dnsmasq to see the DHCP range as part of the local subnet
ipWithCIDR := provisioningIP + "/24"

Logf("Configuring provisioning network: adding %s to %s", ipWithCIDR, containerName)

cmd := testexec.NewCommand(
testexec.WithCommand("docker"),
testexec.WithArgs("exec", containerName, "ip", "addr", "add", ipWithCIDR, "dev", "eth0"),
)

stdout, stderr, err := cmd.Run(ctx)
// Ignore "RTNETLINK answers: File exists" error - the address may already be configured
if err != nil && !strings.Contains(string(stderr), "File exists") {
Logf("Warning: failed to configure provisioning network: %v\nstdout: %s\nstderr: %s", err, string(stdout), string(stderr))
} else {
Logf("Provisioning network configured successfully")
}
}
3 changes: 3 additions & 0 deletions test/e2e/config/fixture.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ variables:
CERT_MANAGER_VERSION: "v1.17.1"
SSH_CHECK_PROVISIONED: "false"
FETCH_IRONIC_NODES: "false"
IRONIC_PROVISIONING_IP: "192.168.222.2"
# Boot mode can be legacy, UEFI or UEFISecureBoot
BOOT_MODE: "UEFI"

NAMESPACE_SCOPED: "false"

Expand Down
2 changes: 2 additions & 0 deletions test/e2e/config/ironic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ variables:
IRONIC_PASSWORD: "changeme"
IRONIC_PROVISIONING_IP: "192.168.222.2"
IRONIC_PROVISIONING_PORT: "6385"
# Boot mode can be legacy, UEFI or UEFISecureBoot
BOOT_MODE: "UEFI"

NAMESPACE_SCOPED: "true"

Expand Down
4 changes: 4 additions & 0 deletions test/e2e/e2e_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ var _ = SynchronizedBeforeSuite(func() []byte {
})
Expect(clusterProvider).ToNot(BeNil(), "Failed to create a cluster")
kubeconfigPath = clusterProvider.GetKubeconfigPath()

// Configure provisioning network for dnsmasq to work properly.
// TODO(lentzi90): This is a workaround. Fix it properly and get rid of it.
ConfigureProvisioningNetwork(ctx, "bmo-e2e", e2eConfig.GetVariable("IRONIC_PROVISIONING_IP"))
}
Expect(kubeconfigPath).To(BeAnExistingFile(), "Failed to get the kubeconfig file for the cluster")

Expand Down
4 changes: 2 additions & 2 deletions test/e2e/external_inspection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ var _ = Describe("External Inspection", Label("required", "external-inspection")
CredentialsName: "bmc-credentials-annotation",
DisableCertificateVerification: bmc.DisableCertificateVerification,
},
BootMode: metal3api.Legacy,
BootMode: metal3api.BootMode(e2eConfig.GetVariable("BOOT_MODE")),
BootMACAddress: bmc.BootMacAddress,
},
}
Expand Down Expand Up @@ -283,7 +283,7 @@ var _ = Describe("External Inspection", Label("required", "external-inspection")
CredentialsName: "bmc-credentials-hardware-data",
DisableCertificateVerification: bmc.DisableCertificateVerification,
},
BootMode: metal3api.Legacy,
BootMode: metal3api.BootMode(e2eConfig.GetVariable("BOOT_MODE")),
BootMACAddress: bmc.BootMacAddress,
InspectionMode: metal3api.InspectionModeDisabled,
},
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/externally_provisioned_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ var _ = Describe("Create as externally provisioned, deprovision", Label("require
CredentialsName: testSecretName,
DisableCertificateVerification: bmc.DisableCertificateVerification,
},
BootMode: metal3api.Legacy,
BootMode: metal3api.BootMode(e2eConfig.GetVariable("BOOT_MODE")),
BootMACAddress: bmc.BootMacAddress,
ExternallyProvisioned: false, // Start with false to allow inspection
},
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/inspection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ var _ = Describe("Inspection", Label("required", "inspection"), func() {
CredentialsName: "bmc-credentials",
DisableCertificateVerification: bmc.DisableCertificateVerification,
},
BootMode: metal3api.Legacy,
BootMode: metal3api.BootMode(e2eConfig.GetVariable("BOOT_MODE")),
BootMACAddress: bmc.BootMacAddress,
},
}
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/live_iso_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ var _ = Describe("Live-ISO", Label("required", "live-iso"), func() {
URL: imageURL,
DiskFormat: pointer.String("live-iso"),
},
BootMode: metal3api.Legacy,
BootMode: metal3api.BootMode(e2eConfig.GetVariable("BOOT_MODE")),
BootMACAddress: bmc.BootMacAddress,
AutomatedCleaningMode: metal3api.CleaningModeDisabled,
},
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/provisioning_and_annotation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ var _ = Describe("Provision, detach, recreate from status and deprovision", Labe
CredentialsName: "bmc-credentials",
DisableCertificateVerification: bmc.DisableCertificateVerification,
},
BootMode: metal3api.Legacy,
BootMode: metal3api.BootMode(e2eConfig.GetVariable("BOOT_MODE")),
BootMACAddress: bmc.BootMacAddress,
AutomatedCleaningMode: "disabled",
},
Expand Down Expand Up @@ -208,7 +208,7 @@ var _ = Describe("Provision, detach, recreate from status and deprovision", Labe
CredentialsName: "bmc-credentials",
DisableCertificateVerification: bmc.DisableCertificateVerification,
},
BootMode: metal3api.Legacy,
BootMode: metal3api.BootMode(e2eConfig.GetVariable("BOOT_MODE")),
BootMACAddress: bmc.BootMacAddress,
AutomatedCleaningMode: "disabled",
Image: &metal3api.Image{
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/re_inspection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ var _ = Describe("Re-Inspection", Label("required", "re-inspection"), func() {
CredentialsName: "bmc-credentials",
DisableCertificateVerification: bmc.DisableCertificateVerification,
},
BootMode: metal3api.Legacy,
BootMode: metal3api.BootMode(e2eConfig.GetVariable("BOOT_MODE")),
BootMACAddress: bmc.BootMacAddress,
},
}
Expand Down
28 changes: 0 additions & 28 deletions test/e2e/sushy-tools/sushy-emulator.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,7 @@ SUSHY_EMULATOR_LISTEN_IP = u'192.168.222.1'
# Bind to TCP port 8000
SUSHY_EMULATOR_LISTEN_PORT = 8000

# Serve this SSL certificate to the clients
SUSHY_EMULATOR_SSL_CERT = None

# If SSL certificate is being served, this is its RSA private key
SUSHY_EMULATOR_SSL_KEY = None

# The OpenStack cloud ID to use. This option enables OpenStack driver.
SUSHY_EMULATOR_OS_CLOUD = None
# The libvirt URI to use. This option enables libvirt driver.
SUSHY_EMULATOR_LIBVIRT_URI = u'qemu:///system'

# Instruct the libvirt driver to ignore any instructions to
# set the boot device. Allowing the UEFI firmware to instead
# rely on the EFI Boot Manager
# Note: This sets the legacy boot element to dev="fd"
# and relies on the floppy not existing, it likely wont work
# your VM has a floppy drive.
SUSHY_EMULATOR_IGNORE_BOOT_DEVICE = False

SUSHY_EMULATOR_STORAGE_POOL = 'baremetal-e2e'

# The map of firmware loaders dependant on the boot mode and
# system architecture. Ideally the x86_64 loader will be capable
# of secure boot or not based on the chosen nvram.
SUSHY_EMULATOR_BOOT_LOADER_MAP = {
u'UEFI': {
u'x86_64': u'/usr/share/OVMF/OVMF_CODE.secboot.fd'
},
u'Legacy': {
u'x86_64': None
}
}
6 changes: 5 additions & 1 deletion test/e2e/upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ func RunUpgradeTest(ctx context.Context, input *BMOIronicUpgradeInput, upgradeCl
CredentialsName: secretName,
DisableCertificateVerification: bmc.DisableCertificateVerification,
},
BootMode: metal3api.Legacy,
BootMode: metal3api.BootMode(e2eConfig.GetVariable("BOOT_MODE")),
BootMACAddress: bmc.BootMacAddress,
},
}
Expand Down Expand Up @@ -378,6 +378,10 @@ var _ = Describe("Upgrade", Label("optional", "upgrade"), func() {
})
Expect(upgradeClusterProvider).ToNot(BeNil(), "Failed to create a cluster")
kubeconfigPath = upgradeClusterProvider.GetKubeconfigPath()

// Configure provisioning network for dnsmasq to work properly.
// TODO(lentzi90): This is a workaround. Fix it properly and get rid of it.
ConfigureProvisioningNetwork(ctx, upgradeClusterName, e2eConfig.GetVariable("IRONIC_PROVISIONING_IP"))
}
Expect(kubeconfigPath).To(BeAnExistingFile(), "Failed to get the kubeconfig file for the cluster")
scheme := runtime.NewScheme()
Expand Down
5 changes: 4 additions & 1 deletion test/vbmctl/templates/VM.xml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
<memory unit='KiB'>4194304</memory>
<currentMemory unit='KiB'>4194304</currentMemory>
<vcpu placement='static'>2</vcpu>
<os>
<os firmware="efi">
<type arch='x86_64' machine='pc-q35-6.2'>hvm</type>
<firmware>
<feature enabled="no" name="secure-boot"/>
</firmware>
<boot dev='hd'/>
</os>
<features>
Expand Down