This repository has been archived by the owner on Dec 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 228
Do not use the Storage/Client in ignite-spawn #257
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,6 @@ package operations | |
|
||
import ( | ||
"fmt" | ||
"github.com/weaveworks/ignite/pkg/logs" | ||
"io" | ||
"io/ioutil" | ||
"path" | ||
|
@@ -11,14 +10,13 @@ import ( | |
|
||
log "github.com/sirupsen/logrus" | ||
api "github.com/weaveworks/ignite/pkg/apis/ignite" | ||
meta "github.com/weaveworks/ignite/pkg/apis/meta/v1alpha1" | ||
"github.com/weaveworks/ignite/pkg/constants" | ||
"github.com/weaveworks/ignite/pkg/dmlegacy" | ||
"github.com/weaveworks/ignite/pkg/logs" | ||
"github.com/weaveworks/ignite/pkg/operations/lookup" | ||
"github.com/weaveworks/ignite/pkg/providers" | ||
"github.com/weaveworks/ignite/pkg/runtime" | ||
"github.com/weaveworks/ignite/pkg/util" | ||
patchutil "github.com/weaveworks/ignite/pkg/util/patch" | ||
"github.com/weaveworks/ignite/pkg/version" | ||
) | ||
|
||
|
@@ -49,7 +47,7 @@ func StartVM(vm *api.VM, debug bool) error { | |
} | ||
|
||
config := &runtime.ContainerConfig{ | ||
Cmd: []string{vm.GetUID().String(), "--log-level", logs.Logger.Level.String()}, | ||
Cmd: []string{fmt.Sprintf("--log-level=%s", logs.Logger.Level.String()), vm.GetUID().String()}, | ||
Labels: map[string]string{"ignite.name": vm.GetName()}, | ||
Binds: []*runtime.Bind{ | ||
{ | ||
|
@@ -60,6 +58,11 @@ func StartVM(vm *api.VM, debug bool) error { | |
HostPath: kernelDir, | ||
ContainerPath: kernelDir, | ||
}, | ||
{ | ||
// Mount the metadata.json file specifically into the container, to a well-known place for ignite-spawn to access | ||
HostPath: path.Join(vmDir, constants.METADATA), | ||
ContainerPath: constants.IGNITE_SPAWN_VM_FILE_PATH, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is good as well |
||
}, | ||
}, | ||
CapAdds: []string{ | ||
"SYS_ADMIN", // Needed to run "dmsetup remove" inside the container | ||
|
@@ -103,20 +106,6 @@ func StartVM(vm *api.VM, debug bool) error { | |
|
||
log.Infof("Started Firecracker VM %q in a container with ID %q", vm.GetUID(), containerID) | ||
|
||
// Set an annotation on the VM object with the containerID for now | ||
patch, err := patchutil.Create(vm, func(obj meta.Object) error { | ||
patchVM := obj.(*api.VM) | ||
patchVM.SetAnnotation("v1alpha1.ignite.weave.works.containerID", containerID) | ||
return nil | ||
}) | ||
if err != nil { | ||
return err | ||
} | ||
// Perform the patch | ||
if err := providers.Client.VMs().Patch(vm.GetUID(), patch); err != nil { | ||
return err | ||
} | ||
|
||
// TODO: Follow-up the container here with a defer, or dedicated goroutine. We should output | ||
// if it started successfully or not | ||
// TODO: This is temporary until we have proper communication to the container | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call!