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

host-ctr: Add "current" generic persistent storage location #1416

Merged

Conversation

jpculp
Copy link
Member

@jpculp jpculp commented Mar 24, 2021

Issue number:

N/A

Description of changes:

This adds an additional mount of the /local/host-containers/NAME directory as /.bottlerocket/host-containers/current to provide a generic persistent storage location that isn't tied to the name of the container. This makes it easier for scripts to utilize the storage.

Testing done:

  • Built aws-ecs-1 ami and launched instance.
  • Instance connected to ecs cluster.
  • Test task deployed successfully.
  • Connected to control container via ssm session.
  • Verified that /.bottlerocket/host-containers/ contained both a control directory and a current directory.
  • Enabled and launched admin container.
  • Connected to admin container via ssh.
  • Verified that /.bottlerocket/host-containers/ contained both an admin directory and a current directory.
  • Verified that /.bottlerocket/host-containers/admin/ and /.bottlerocket/host-containers/current/ had the same contents.
  • Ran sudo sheltie to verify root shell was still available.
  • Checked for failed systemd units.

Terms of contribution:

By submitting this pull request, I agree that this contribution is dual-licensed under the terms of both the Apache License, version 2.0, and the MIT license.

sources/host-ctr/cmd/host-ctr/main.go Outdated Show resolved Hide resolved
README.md Show resolved Hide resolved
@etungsten
Copy link
Contributor

etungsten commented Mar 24, 2021

If the goal is to let scripts know where the host-container's persistent storage location is, maybe we can utilize environment variables instead of trying to mount the same thing twice.
https://pkg.go.dev/github.com/ktock/containerd/oci#WithEnv
So something like,

oci.WithEnv([]string{"HOST_CONTAINER_STORAGE=/.bottlerocket/host-containers/" + containerID})

@tjkirch
Copy link
Contributor

tjkirch commented Mar 24, 2021

If the goal is to let scripts know where the host-container's persistent storage location is, maybe we can utilize environment variables instead of trying to mount the same thing twice.
https://pkg.go.dev/github.com/ktock/containerd/oci#WithEnv
So something like,

oci.WithEnv([]string{"HOST_CONTAINER_STORAGE=/.bottlerocket/host-containers/" + containerID})

Or just set "HOST_CONTAINER_NAME="containerID so the examples we have in the README using that variable would work literally. It feels slightly more troublesome to me than just having a fixed directory name, because variables add other complications, but not huge.

@jpculp
Copy link
Member Author

jpculp commented Mar 24, 2021

There are definitely pros and cons to both methods. I'm leaning more towards what @etungsten is saying with the ENV, but using oci.WithEnv([]string{"HOST_CONTAINER_NAME"=containerID})". It keeps our current documentation correct and users don't need to unlearn anything. Is anyone strongly opposed?

@tjkirch
Copy link
Contributor

tjkirch commented Mar 24, 2021

There are definitely pros and cons to both methods. I'm leaning more towards what @etungsten is saying with the ENV, but using oci.WithEnv([]string{"HOST_CONTAINER_NAME"=containerID})". It keeps our current documentation correct and users don't need to unlearn anything. Is anyone strongly opposed?

Is it going to be possible to symlink /var/lib/amazon/ssm to the correct host-containers/FOO in bottlerocket-os/bottlerocket-control-container#12 in Dockerfile if this uses a variable instead of a mount? The variable wouldn't be present during the container build. It could be done in start_control_ssm.sh but it's better to do that statically where possible.

@jpculp
Copy link
Member Author

jpculp commented Mar 25, 2021

Right, the symlink would have to be created in start_control_ssm.sh, but I don't think that is necessarily a bad thing. The folder it is symlinking to is created in start_control_ssm.sh, so it may be better to keep that logic closer together.

@jpculp
Copy link
Member Author

jpculp commented Mar 25, 2021

I'm switching this PR to draft and proposing #1422 as an alternative.

@jpculp jpculp force-pushed the add-generic-mount-to-host-containers branch from cfdb8c9 to 9b414b4 Compare March 26, 2021 22:51
@jpculp
Copy link
Member Author

jpculp commented Mar 26, 2021

This adds an additional mount of the /local/host-containers/NAME
directory as /.bottlerocket/host-containers/current to provide a generic
persistent storage location that isn't tied to the name of the
container. This makes it easier for scripts to utilize the storage.
@jpculp jpculp force-pushed the add-generic-mount-to-host-containers branch from 9b414b4 to edffc82 Compare March 26, 2021 23:23
@jpculp
Copy link
Member Author

jpculp commented Mar 26, 2021

  • Small change to another section of the README.

@jpculp jpculp marked this pull request as ready for review March 26, 2021 23:24
@bcressey
Copy link
Contributor

Inspired by the discussion here, I opened #1424 for environment variables we should definitely set: HTTPS_PROXY and NO_PROXY.

README.md Show resolved Hide resolved
Copy link
Contributor

@zmrow zmrow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🍚

@jpculp jpculp merged commit 05357a0 into bottlerocket-os:develop Mar 30, 2021
@jpculp jpculp deleted the add-generic-mount-to-host-containers branch March 30, 2021 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants