mirror of
https://github.com/kairos-io/immucore.git
synced 2025-04-27 19:16:59 +00:00
🐛 Load overlay config from cos-layout.env (#71)
Load the base overlay config from the cos-layout.env file. This means we have to depend the base overlay mount to the load-config step, which moves things a bit in the DAG. Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
This commit is contained in:
parent
73c4c3e0af
commit
6ed15c7227
@ -1,3 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
docker run --privileged -v /var/run/docker.sock:/var/run/docker.sock --rm -t -v $(pwd):/workspace -v earthly-tmp:/tmp/earthly:rw earthly/earthly:v0.6.30 --allow-privileged $@
|
||||
docker run --privileged -v /var/run/docker.sock:/var/run/docker.sock --rm -t -v $(pwd):/workspace -v earthly-tmp:/tmp/earthly:rw earthly/earthly:v0.7.1 --allow-privileged $@
|
||||
|
@ -199,6 +199,7 @@ func GetOemTimeout() int {
|
||||
|
||||
// GetOverlayBase parses the cdmline and gets the overlay config
|
||||
// Format is rd.cos.overlay=tmpfs:20% or rd.cos.overlay=LABEL=$LABEL or rd.cos.overlay=UUID=$UUID
|
||||
// Notice that this can be later override by the config coming from cos-layout.env
|
||||
func GetOverlayBase() string {
|
||||
overlayConfig := ReadCMDLineArg("rd.cos.overlay=")
|
||||
if len(overlayConfig) == 0 {
|
||||
|
@ -140,6 +140,12 @@ func (s *State) LoadEnvLayoutDagStep(g *herd.Graph, deps ...string) error {
|
||||
// Remove any duplicates
|
||||
s.BindMounts = internalUtils.UniqueSlice(internalUtils.CleanupSlice(s.BindMounts))
|
||||
|
||||
// Load Overlay config
|
||||
overlayConfig := env["OVERLAY"]
|
||||
if overlayConfig != "" {
|
||||
s.OverlayBase = overlayConfig
|
||||
}
|
||||
|
||||
s.StateDir = env["PERSISTENT_STATE_TARGET"]
|
||||
if s.StateDir == "" {
|
||||
s.StateDir = cnst.PersistentStateTarget
|
||||
@ -190,8 +196,10 @@ func (s *State) MountOemDagStep(g *herd.Graph, deps ...string) error {
|
||||
}
|
||||
|
||||
// MountBaseOverlayDagStep will add mounting /run/overlay as an overlay dir
|
||||
// Requires the config-load step because some parameters can come from there
|
||||
func (s *State) MountBaseOverlayDagStep(g *herd.Graph) error {
|
||||
return g.Add(cnst.OpMountBaseOverlay,
|
||||
herd.WithDeps(cnst.OpLoadConfig),
|
||||
herd.WithCallback(
|
||||
func(ctx context.Context) error {
|
||||
op, err := baseOverlay(Overlay{
|
||||
@ -221,7 +229,7 @@ func (s *State) MountBaseOverlayDagStep(g *herd.Graph) error {
|
||||
// MountCustomOverlayDagStep will add mounting s.OverlayDirs under /run/overlay
|
||||
func (s *State) MountCustomOverlayDagStep(g *herd.Graph) error {
|
||||
return g.Add(cnst.OpOverlayMount,
|
||||
herd.WithDeps(cnst.OpLoadConfig),
|
||||
herd.WithDeps(cnst.OpLoadConfig, cnst.OpMountBaseOverlay),
|
||||
herd.WithCallback(
|
||||
func(ctx context.Context) error {
|
||||
var multierr *multierror.Error
|
||||
|
@ -78,39 +78,30 @@ func checkLiveCDDag(dag [][]herd.GraphEntry, actualDag string) {
|
||||
func checkDag(dag [][]herd.GraphEntry, actualDag string) {
|
||||
Expect(len(dag)).To(Equal(10), actualDag)
|
||||
Expect(len(dag[0])).To(Equal(1), actualDag)
|
||||
Expect(len(dag[1])).To(Equal(4), actualDag)
|
||||
Expect(len(dag[1])).To(Equal(3), actualDag)
|
||||
Expect(len(dag[2])).To(Equal(1), actualDag)
|
||||
Expect(len(dag[3])).To(Equal(1), actualDag)
|
||||
Expect(len(dag[4])).To(Equal(1), actualDag)
|
||||
Expect(len(dag[5])).To(Equal(1), actualDag)
|
||||
Expect(len(dag[6])).To(Equal(1), actualDag)
|
||||
Expect(len(dag[7])).To(Equal(2), actualDag)
|
||||
Expect(len(dag[8])).To(Equal(1), actualDag)
|
||||
Expect(len(dag[8])).To(Equal(2), actualDag)
|
||||
Expect(len(dag[9])).To(Equal(1), actualDag)
|
||||
|
||||
Expect(dag[0][0].Name).To(Equal("init"))
|
||||
Expect(dag[1][0].Name).To(Or(
|
||||
Equal("mount-tmpfs"),
|
||||
Equal("create-sentinel"),
|
||||
Equal("mount-base-overlay"),
|
||||
Equal("mount-state"),
|
||||
), actualDag)
|
||||
Expect(dag[1][1].Name).To(Or(
|
||||
Equal("mount-tmpfs"),
|
||||
Equal("create-sentinel"),
|
||||
Equal("mount-base-overlay"),
|
||||
Equal("mount-state"),
|
||||
), actualDag)
|
||||
Expect(dag[1][2].Name).To(Or(
|
||||
Equal("mount-tmpfs"),
|
||||
Equal("create-sentinel"),
|
||||
Equal("mount-base-overlay"),
|
||||
Equal("mount-state"),
|
||||
), actualDag)
|
||||
Expect(dag[1][3].Name).To(Or(
|
||||
Equal("mount-tmpfs"),
|
||||
Equal("create-sentinel"),
|
||||
Equal("mount-base-overlay"),
|
||||
Equal("mount-state"),
|
||||
), actualDag)
|
||||
Expect(dag[2][0].Name).To(Equal("discover-state"), actualDag)
|
||||
@ -118,8 +109,9 @@ func checkDag(dag [][]herd.GraphEntry, actualDag string) {
|
||||
Expect(dag[4][0].Name).To(Equal("mount-oem"), actualDag)
|
||||
Expect(dag[5][0].Name).To(Equal("rootfs-hook"), actualDag)
|
||||
Expect(dag[6][0].Name).To(Equal("load-config"), actualDag)
|
||||
Expect(dag[7][0].Name).To(Or(Equal("overlay-mount"), Equal("custom-mount")), actualDag)
|
||||
Expect(dag[7][1].Name).To(Or(Equal("overlay-mount"), Equal("custom-mount")), actualDag)
|
||||
Expect(dag[8][0].Name).To(Equal("mount-bind"), actualDag)
|
||||
Expect(dag[7][0].Name).To(Or(Equal("mount-base-overlay"), Equal("custom-mount")), actualDag)
|
||||
Expect(dag[7][1].Name).To(Or(Equal("mount-base-overlay"), Equal("custom-mount")), actualDag)
|
||||
Expect(dag[8][0].Name).To(Or(Equal("mount-bind"), Equal("overlay-mount")), actualDag)
|
||||
Expect(dag[8][1].Name).To(Or(Equal("mount-bind"), Equal("overlay-mount")), actualDag)
|
||||
Expect(dag[9][0].Name).To(Equal("write-fstab"), actualDag)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user