From 5118d9d27774bef0b5ffd193a739f63c743ea574 Mon Sep 17 00:00:00 2001 From: Luca Seritan Date: Tue, 26 Mar 2024 10:47:15 +0200 Subject: [PATCH] fix(run): Don't erase existing volumes when passing volume arg This allows optionally providing a volume via the cli arg without overwriting the existing rootfs/volumes in the Kraftfile. Signed-off-by: Luca Seritan --- internal/cli/kraft/run/utils.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/cli/kraft/run/utils.go b/internal/cli/kraft/run/utils.go index 862cb604e..02bba97d4 100644 --- a/internal/cli/kraft/run/utils.go +++ b/internal/cli/kraft/run/utils.go @@ -189,8 +189,10 @@ func (opts *RunOptions) parseVolumes(ctx context.Context, machine *machineapi.Ma var err error controllers := map[string]volumeapi.VolumeService{} - machine.Spec.Volumes = []volumeapi.Volume{} + if machine.Spec.Volumes == nil { + machine.Spec.Volumes = make([]volumeapi.Volume, 0) + } for _, volLine := range opts.Volumes { var hostPath, mountPath string split := strings.Split(volLine, ":")