Skip to content

Commit 88fc6bb

Browse files
committed
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>
1 parent ba8cd30 commit 88fc6bb

4 files changed

Lines changed: 16 additions & 5 deletions

File tree

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ uki-certs: talosctl ## Generate test certificates for SecureBoot/PCR Signing
519519
.PHONY: cache-create
520520
cache-create: installer imager ## Generate image cache.
521521
@docker run --entrypoint /usr/local/bin/e2e.test registry.k8s.io/conformance:$(KUBECTL_VERSION) --list-images | \
522-
$(TALOSCTL_EXECUTABLE) images integration --installer-tag=$(IMAGE_TAG)-amd64-secureboot --registry-and-user=$(REGISTRY_AND_USERNAME) | \
522+
$(TALOSCTL_EXECUTABLE) images integration --installer-tag=$(IMAGE_TAG) --registry-and-user=$(REGISTRY_AND_USERNAME) | \
523523
$(TALOSCTL_EXECUTABLE) images cache-create --image-cache-path=/tmp/cache.tar --images=- --force
524524
@crane push /tmp/cache.tar $(REGISTRY_AND_USERNAME)/image-cache:$(IMAGE_TAG)
525525
@$(MAKE) image-iso IMAGER_ARGS="--image-cache=$(REGISTRY_AND_USERNAME)/image-cache:$(IMAGE_TAG) --extra-kernel-arg='console=ttyS0'"

internal/integration/cli/image.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ func (suite *ImageSuite) TestList() {
4848
)
4949
}
5050

51-
var imageCacheQuery = []string{"get", "imagecacheconfig", "--output", "jsonpath='{.spec.copyStatus}'"}
51+
var imageCacheQuery = []string{"get", "imagecacheconfig", "--output", "jsonpath='{.spec.status}'"}
5252

5353
// TestPull verifies pulling images to the CRI.
5454
func (suite *ImageSuite) TestPull() {

internal/integration/cli/list.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func (suite *ListSuite) TestDepth() {
5151

5252
if stdout, _ := suite.RunCLI(imageCacheQuery); strings.Contains(stdout, "ready") {
5353
// Image cache paths parts are longer
54-
maxSeps = 9
54+
maxSeps = 8
5555
}
5656

5757
// checks that enough separators are encountered in the output

pkg/provision/providers/qemu/launch.go

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,10 @@ type LaunchConfig struct {
8787
// API
8888
APIPort int
8989

90+
// sd-stub
91+
sdStubExtraCmdline string
92+
sdStubExtraCmdlineConfig string
93+
9094
// filled by CNI invocation
9195
tapName string
9296
vmMAC string
@@ -319,7 +323,7 @@ func launchVM(config *LaunchConfig) error {
319323
"-no-reboot",
320324
"-boot", fmt.Sprintf("order=%s,reboot-timeout=5000", bootOrder),
321325
"-smbios", fmt.Sprintf("type=1,uuid=%s", config.NodeUUID),
322-
"-smbios", "type=11,value=io.systemd.stub.kernel-cmdline-extra=console=ttyS0",
326+
"-smbios", fmt.Sprintf("type=11,value=io.systemd.stub.kernel-cmdline-extra=%s", config.sdStubExtraCmdline),
323327
"-chardev", fmt.Sprintf("socket,path=%s/%s.sock,server=on,wait=off,id=qga0", config.StatePath, config.Hostname),
324328
"-device", "virtio-serial",
325329
"-device", "virtserialport,chardev=qga0,name=org.qemu.guest_agent.0",
@@ -487,12 +491,14 @@ func launchVM(config *LaunchConfig) error {
487491
"-kernel", config.UKIPath,
488492
"-append", config.KernelArgs,
489493
)
494+
config.sdStubExtraCmdline += config.sdStubExtraCmdlineConfig
490495
case config.KernelImagePath != "":
491496
args = append(args,
492497
"-kernel", config.KernelImagePath,
493498
"-initrd", config.InitrdPath,
494499
"-append", config.KernelArgs,
495500
)
501+
config.sdStubExtraCmdline += config.sdStubExtraCmdlineConfig
496502
}
497503
}
498504

@@ -592,7 +598,12 @@ func Launch() error {
592598
defer httpServer.Shutdown(ctx) //nolint:errcheck
593599

594600
// patch kernel args
595-
config.KernelArgs = strings.ReplaceAll(config.KernelArgs, "{TALOS_CONFIG_URL}", fmt.Sprintf("http://%s/config.yaml", httpServer.GetAddr()))
601+
config.sdStubExtraCmdline = "console=ttyS0"
602+
603+
if strings.Contains(config.KernelArgs, "{TALOS_CONFIG_URL}") {
604+
config.KernelArgs = strings.ReplaceAll(config.KernelArgs, "{TALOS_CONFIG_URL}", fmt.Sprintf("http://%s/config.yaml", httpServer.GetAddr()))
605+
config.sdStubExtraCmdlineConfig = fmt.Sprintf(" talos.config=http://%s/config.yaml", httpServer.GetAddr())
606+
}
596607

597608
return withCNI(ctx, &config, func(config *LaunchConfig) error {
598609
for {

0 commit comments

Comments
 (0)