sealer
sealer copied to clipboard
Feature: build cluster image with buildah
Describe what this PR does / why we need it
Sealer has integrated the buildah to build a cluster image. But There are some todos.
-
How to save container images? solution: scan the whole kubefile, pre-download all "http://" to build context. And check the
image:
of them, then save then in registry under build context. Finally add an instructionCOPY registry /
before real building procedure. -
Semantic translator. All basic instructions are
FROM
,ADD
,COPY
,RUN
. We will implement all new instructions based on these basics. So we are going to need a Semantic translator.
A brief flow as following:
todos:
- [x] deal with the flags from buildah
- [x] commit images by buildah.
- [x] find a place for flags
- [x] find a place for global info. Like authfile
- [x] support for sealer rootfs
- [x] sealer v1.Image refactor. And annotate it to oci image.
- [x] list sealer images only for
images
. Add label to image. - [ ] clean environment after build.
- [ ] multiple platform support.
Maybe the sealer imageSpec and image is not in need any more.
// ImageSpec defines the desired state of Image
type ImageSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file
// Foo is an example field of Image. Edit Image_types.go to remove/update
ID string `json:"id,omitempty"`
Layers []Layer `json:"layers,omitempty"`
SealerVersion string `json:"sealer_version,omitempty"`
Platform Platform `json:"platform"`
ImageConfig ImageConfig `json:"image_config"`
}
The ImageConfig is valuable probably.
type ImageConfig struct {
// define this image is application image or normal image.
ImageType string `json:"image_type,omitempty"`
Cmd ImageCmd `json:"cmd,omitempty"`
Args ImageArg `json:"args,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
}
We can store essential information in annotations of manifest from OCI v1 image.
type ImageCmd struct {
//cmd list of base image
Parent []string `json:"parent,omitempty"`
//cmd list of current image
Current []string `json:"current,omitempty"`
}
type ImageArg struct {
//arg set of base image
Parent map[string]string `json:"parent,omitempty"`
//arg set of current image
Current map[string]string `json:"current,omitempty"`
}
For the Cmd and Arg, I think we don't need to record the data from parent image.
@sealerio/sealer-maintainers @sealerio/sealer-reviewers Help me review this, plz.
Codecov Report
Merging #1611 (4e6d169) into main (2a89fa5) will increase coverage by
0.03%
. The diff coverage is0.00%
.
@@ Coverage Diff @@
## main #1611 +/- ##
==========================================
+ Coverage 14.04% 14.08% +0.03%
==========================================
Files 78 78
Lines 6691 6675 -16
==========================================
Hits 940 940
+ Misses 5637 5621 -16
Partials 114 114
Impacted Files | Coverage Δ | |
---|---|---|
apply/apply.go | 0.00% <0.00%> (ø) |
|
pkg/filesystem/filesystem.go | 0.00% <0.00%> (ø) |
|
utils/os/readers.go | 0.00% <0.00%> (ø) |
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.
related issues will be fixed. https://github.com/sealerio/sealer/issues/1581 https://github.com/sealerio/sealer/issues/1538
@justadogistaken Conflict happens. Please update this ASAP. And we will merge this with high priority.
/test apply
LGTM, great work 👍🏻