Skip to content

Commit

Permalink
fix(run): Don't erase existing volumes when passing volume arg
Browse files Browse the repository at this point in the history
This allows optionally providing a volume via the cli arg without
overwriting the existing rootfs/volumes in the Kraftfile.

Signed-off-by: Luca Seritan <[email protected]>
  • Loading branch information
LucaSeri committed Mar 26, 2024
1 parent 8f6a71e commit 5118d9d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion internal/cli/kraft/run/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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, ":")
Expand Down

0 comments on commit 5118d9d

Please sign in to comment.