test: fix UKI preserving talos.config and image cache

Fix image cache installer ref, and preserve talos.config with UKIs for
`talosctl cluster create`.

Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
This commit is contained in:
Andrey Smirnov 2025-03-04 18:22:35 +04:00
parent ba8cd304d2
commit 88fc6bbebe
No known key found for this signature in database
GPG Key ID: FE042E3D4085A811
4 changed files with 16 additions and 5 deletions

View File

@ -519,7 +519,7 @@ uki-certs: talosctl ## Generate test certificates for SecureBoot/PCR Signing
.PHONY: cache-create
cache-create: installer imager ## Generate image cache.
@docker run --entrypoint /usr/local/bin/e2e.test registry.k8s.io/conformance:$(KUBECTL_VERSION) --list-images | \
$(TALOSCTL_EXECUTABLE) images integration --installer-tag=$(IMAGE_TAG)-amd64-secureboot --registry-and-user=$(REGISTRY_AND_USERNAME) | \
$(TALOSCTL_EXECUTABLE) images integration --installer-tag=$(IMAGE_TAG) --registry-and-user=$(REGISTRY_AND_USERNAME) | \
$(TALOSCTL_EXECUTABLE) images cache-create --image-cache-path=/tmp/cache.tar --images=- --force
@crane push /tmp/cache.tar $(REGISTRY_AND_USERNAME)/image-cache:$(IMAGE_TAG)
@$(MAKE) image-iso IMAGER_ARGS="--image-cache=$(REGISTRY_AND_USERNAME)/image-cache:$(IMAGE_TAG) --extra-kernel-arg='console=ttyS0'"

View File

@ -48,7 +48,7 @@ func (suite *ImageSuite) TestList() {
)
}
var imageCacheQuery = []string{"get", "imagecacheconfig", "--output", "jsonpath='{.spec.copyStatus}'"}
var imageCacheQuery = []string{"get", "imagecacheconfig", "--output", "jsonpath='{.spec.status}'"}
// TestPull verifies pulling images to the CRI.
func (suite *ImageSuite) TestPull() {

View File

@ -51,7 +51,7 @@ func (suite *ListSuite) TestDepth() {
if stdout, _ := suite.RunCLI(imageCacheQuery); strings.Contains(stdout, "ready") {
// Image cache paths parts are longer
maxSeps = 9
maxSeps = 8
}
// checks that enough separators are encountered in the output

View File

@ -87,6 +87,10 @@ type LaunchConfig struct {
// API
APIPort int
// sd-stub
sdStubExtraCmdline string
sdStubExtraCmdlineConfig string
// filled by CNI invocation
tapName string
vmMAC string
@ -319,7 +323,7 @@ func launchVM(config *LaunchConfig) error {
"-no-reboot",
"-boot", fmt.Sprintf("order=%s,reboot-timeout=5000", bootOrder),
"-smbios", fmt.Sprintf("type=1,uuid=%s", config.NodeUUID),
"-smbios", "type=11,value=io.systemd.stub.kernel-cmdline-extra=console=ttyS0",
"-smbios", fmt.Sprintf("type=11,value=io.systemd.stub.kernel-cmdline-extra=%s", config.sdStubExtraCmdline),
"-chardev", fmt.Sprintf("socket,path=%s/%s.sock,server=on,wait=off,id=qga0", config.StatePath, config.Hostname),
"-device", "virtio-serial",
"-device", "virtserialport,chardev=qga0,name=org.qemu.guest_agent.0",
@ -487,12 +491,14 @@ func launchVM(config *LaunchConfig) error {
"-kernel", config.UKIPath,
"-append", config.KernelArgs,
)
config.sdStubExtraCmdline += config.sdStubExtraCmdlineConfig
case config.KernelImagePath != "":
args = append(args,
"-kernel", config.KernelImagePath,
"-initrd", config.InitrdPath,
"-append", config.KernelArgs,
)
config.sdStubExtraCmdline += config.sdStubExtraCmdlineConfig
}
}
@ -592,7 +598,12 @@ func Launch() error {
defer httpServer.Shutdown(ctx) //nolint:errcheck
// patch kernel args
config.KernelArgs = strings.ReplaceAll(config.KernelArgs, "{TALOS_CONFIG_URL}", fmt.Sprintf("http://%s/config.yaml", httpServer.GetAddr()))
config.sdStubExtraCmdline = "console=ttyS0"
if strings.Contains(config.KernelArgs, "{TALOS_CONFIG_URL}") {
config.KernelArgs = strings.ReplaceAll(config.KernelArgs, "{TALOS_CONFIG_URL}", fmt.Sprintf("http://%s/config.yaml", httpServer.GetAddr()))
config.sdStubExtraCmdlineConfig = fmt.Sprintf(" talos.config=http://%s/config.yaml", httpServer.GetAddr())
}
return withCNI(ctx, &config, func(config *LaunchConfig) error {
for {