Skip to content

Commit

Permalink
chore: allow mounting files from the host
Browse files Browse the repository at this point in the history
Allow mounting files from host into extension services as per the [OCI
spec](https://github.com/opencontainers/runtime-spec/blob/main/config.md#mounts)

Signed-off-by: Noel Georgi <[email protected]>
  • Loading branch information
frezbo committed Apr 21, 2022
1 parent f3e330a commit 51a68c3
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions internal/app/machined/pkg/system/services/extension.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package services

import (
"context"
"errors"
"fmt"
"os"
"path/filepath"
Expand Down Expand Up @@ -102,6 +103,13 @@ func (svc *Extension) Runner(r runtime.Runtime) (runner.Runner, error) {
}

for _, mount := range svc.Spec.Container.Mounts {
if _, err := os.Stat(mount.Source); err == nil {
// already exists, skip
continue
} else if !errors.Is(err, os.ErrNotExist) {
return nil, err
}

if err := os.MkdirAll(mount.Source, 0o700); err != nil {
return nil, err
}
Expand Down

0 comments on commit 51a68c3

Please sign in to comment.