Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

install: Add "extra" space #287

Open
cgwalters opened this issue Jan 29, 2024 · 9 comments
Open

install: Add "extra" space #287

cgwalters opened this issue Jan 29, 2024 · 9 comments
Labels
area/install Issues related to `bootc install`

Comments

@cgwalters
Copy link
Collaborator

cgwalters commented Jan 29, 2024

Today, bootc install to-disk has --root-size. But that's not in the install config. I think we should delete --root-size, moving this to the install config.

Add min and max "constraints"

For generic base images, we can't sanely provide a default size because the user may add an arbitrary amount of data. So the first idea here is that we support base images providing an "elastic" default that takes as input the base image size. Something like this:

[install.filesystem.root]
size-constraints-min = "double-image,extra=2Gi"

Where size-constraints-min is a comma separated list of "constraints". double-image here means that we allocate space at least for 2x the container image size (for inplace upgrades), and extra=2Gi of free space on top of that.

For "final" images derived by the end consumer, they can do e.g.

[install.filesystem.root]
size-max = "10Gi"

if they want to have a fixed size that they know exactly. (Do we error out if size-constraints-min would be greater than size-max, or just ignore it? Note at least they can always just RUN rm /usr/lib/bootc/install/* if they want to fully take ownership)

@cgwalters cgwalters added the area/install Issues related to `bootc install` label Jan 29, 2024
cgwalters added a commit to cgwalters/bootc that referenced this issue Jan 29, 2024
Keep (but soft-deprecate) the existing `root-fs-type`, and add a
more general set of tables in `install.filesystem.root`, with `type`
as a field underneath that.

This somewhat resembles the [Image Builder blueprint](https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/9/html/composing_a_customized_rhel_system_image/creating-system-images-with-composer-command-line-interface_composing-a-customized-rhel-system-image#composer-blueprint-format_creating-system-images-with-composer-command-line-interface) design.

In particular, this aims to leave space for
containers#287
where we'd add e.g.

```
[install.filesystem.root]
extra = "5G"
```

for size specification.

Another obvious extension would be `options` to pass through
options to `mkfs.$fs`; not clear to me we totally want to go
there, but we clearly need something a bit more general.

Signed-off-by: Colin Walters <walters@verbum.org>
@cgwalters
Copy link
Collaborator Author

cgwalters commented Jan 29, 2024

Prep PR in #289

cgwalters added a commit to cgwalters/bootc that referenced this issue Jan 29, 2024
Keep (but soft-deprecate) the existing `root-fs-type`, and add a
more general set of tables in `install.filesystem.root`, with `type`
as a field underneath that.

This somewhat resembles the [Image Builder blueprint](https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/9/html/composing_a_customized_rhel_system_image/creating-system-images-with-composer-command-line-interface_composing-a-customized-rhel-system-image#composer-blueprint-format_creating-system-images-with-composer-command-line-interface) design.

In particular, this aims to leave space for
containers#287
where we'd add e.g.

```
[install.filesystem.root]
extra = "5G"
```

for size specification.

Another obvious extension would be `options` to pass through
options to `mkfs.$fs`; not clear to me we totally want to go
there, but we clearly need something a bit more general.

Signed-off-by: Colin Walters <walters@verbum.org>
cgwalters added a commit to cgwalters/bootc that referenced this issue Jan 29, 2024
Keep (but soft-deprecate) the existing `root-fs-type`, and add a
more general set of tables in `install.filesystem.root`, with `type`
as a field underneath that.

This somewhat resembles the [Image Builder blueprint](https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/9/html/composing_a_customized_rhel_system_image/creating-system-images-with-composer-command-line-interface_composing-a-customized-rhel-system-image#composer-blueprint-format_creating-system-images-with-composer-command-line-interface) design.

In particular, this aims to leave space for
containers#287
where we'd add e.g.

```
[install.filesystem.root]
extra = "5G"
```

for size specification.

Another obvious extension would be `options` to pass through
options to `mkfs.$fs`; not clear to me we totally want to go
there, but we clearly need something a bit more general.

Signed-off-by: Colin Walters <walters@verbum.org>
@travier
Copy link
Member

travier commented Jan 30, 2024

Add "extra" space

One thing that came up is the idea that the container should be able to define a default "rootfs" size. However what I think would work better is a model where the container can specify extra space beyond the container image size. Something like this:

[install.rootfs]
extra = "5G"

This way, someone deriving from a base image (and adding e.g. 2 gigs of extra content) would automatically have the rootfs expand, and still have 5G of extra space.

This also mean that each installation has potentially a different size for the rootfs, depending on the size of the container at the installation time. Not great for reproducibility/predictability.

@cgwalters
Copy link
Collaborator Author

cgwalters commented Jan 30, 2024 via email

@travier
Copy link
Member

travier commented Jan 30, 2024

Hmm though maybe we should have something that defaults to double the image size plus extra, to ensure in place upgrades work by default.

This is potentially a better default indeed if we prefer being dynamic.

@cgwalters
Copy link
Collaborator Author

I've updated the initial comment here with a more fleshed out proposal.

@cgwalters
Copy link
Collaborator Author

@ondrejbudai WDYT?

@achilleas-k
Copy link

[install.filesystem.root]
size-constraints-min = "double-image,extra=2Gi"

I like the idea here of specifically referring to the base size, though not sure about the format and naming.
Could be cleaner to break it down further?

[install.filesystem.root]
min-size = "double-image"
extra-space = "2Gi"

(not too fond of that format either).

Could introduce some preset variable names instead:

min-size = "{{imagesize}}*2 + 2 Gi"

but now it feels like we're inventing a whole language for it.

@cgwalters
Copy link
Collaborator Author

[install.filesystem.root]
min-size = "double-image"
extra-space = "2Gi"

In this one, is min-size just a single value? What other values could it take (beyond "" as "no minimum"). Are we leaving space for e.g. triple-image in the future?

min-size = "{{imagesize}}*2 + 2 Gi"

Yeah...would hope to not need an expression language for this. It is in some ways the most obvious thing to do, and probably not hard, but feels less declarative. That said, not opposed either if folks feel strongly.

Looking at repart.d relevant prior art looks like the Weight value alongside the obvious SizeMinBytes and SizeMaxBytes.

But, repart is pretty designed for "fixed" inputs in general apart from CopyFiles...and I think we do want to just special case this "container image input size".

Here's another idea syntax proposal:

size-min = "image-multiple=2"
size-extra = "2Gi"

This would also support size-min = "image-multiple=3" etc. Also changed to more consistently prefix size-related things with size-.

@achilleas-k
Copy link

Yeah...would hope to not need an expression language for this. It is in some ways the most obvious thing to do, and probably not hard, but feels less declarative.

Agreed.

Here's another idea syntax proposal:

size-min = "image-multiple=2"
size-extra = "2Gi"

This would also support size-min = "image-multiple=3" etc. Also changed to more consistently prefix size-related things with size-.

I like this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/install Issues related to `bootc install`
Projects
None yet
Development

No branches or pull requests

3 participants