Add containers.conf read-only flag support #16545
Add containers.conf read-only flag support #16545openshift-merge-robot merged 1 commit intocontainers:mainfrom
Conversation
|
@alexlarsson @ygalblum PTAL |
There was a problem hiding this comment.
Suggest "those commands."
There was a problem hiding this comment.
These are auto-generated.
|
@rhatdan Can you squash these PR comment commits please into your actual one, they increase the commit count for no reason and if I browse the commit log they provide no clue about the change. |
Luap99
left a comment
There was a problem hiding this comment.
Should we just use
securityContext:
readOnlyRootFilesystem: true
https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/
in the yaml instead of adding this as flag?
|
I think we might want to use both. The goal is to allow automotive to force Pods to be read-only, potentially similar in quadlet. |
|
Actually my code breaks this use case. |
|
Since we already have an yaml options for this, I think we should use that, and then add support for changing its default value. Then quadlet can e.g. do |
|
Similarly, we could have |
|
As @Luap99 and @alexlarsson wrote, since there is a field for it in the K8S schema, |
|
To me that is a bit of a contradiction to have the ability to override just in quadlet but not from the command line. But I am not wed to having this option. Most of the framework of this PR is still required to allow quadlet to set that default. |
|
Maybe I wasn't clear. I didn't mean for these flags to be |
40eb724 to
7d8f1e3
Compare
cmd/podman/kube/play.go
Outdated
There was a problem hiding this comment.
| flags.BoolVar(&playOptions.ReadOnlyCLI, "read-only", false, "Make all containers root filesystem read-only") | |
| flags.BoolVar(&playOptions.ReadOnlyCLI, "read-only", false, "Make all containers' root filesystems read-only") |
There was a problem hiding this comment.
This change should be broken out into another commit. It's causing a lot of noise.
pkg/domain/infra/tunnel/kube.go
Outdated
There was a problem hiding this comment.
I don't see plumbing for it on the server side.
6c28ffc to
1a9bb58
Compare
|
Considering the fact that the Pod manifest already has a field (at the container level) to control the "read-only" attribute, do we still want to add this flag? |
|
The manifest is primary, but if the user overrides the flag, then the flag takes precedence. podman kube play foobar.yaml # Yaml wins |
b819fc0 to
c9df82e
Compare
vrothberg
left a comment
There was a problem hiding this comment.
Minor nits. Some code comments may help resolve my confusion.
8082c44 to
ebedf12
Compare
|
@containers/podman-maintainers PTAL |
pkg/specgen/generate/storage.go
Outdated
There was a problem hiding this comment.
From the last line of the outer loop, I can see that the dest field is also used as the key in the mounts map. If so, can you replace this loop with checking if dest exists in the map?
pkg/specgen/specgen.go
Outdated
There was a problem hiding this comment.
Typo in the json name, should be read_write_tmpfs
pkg/specgenutil/specgen.go
Outdated
There was a problem hiding this comment.
This comment is based on the assumption that ReadWriteTmpFS's default is true. But, the default value is defined somewhere else (in cmd). If for some reason, the default is changed, no one will know to change this comment and it will left with wrong information. Maybe it's better to leave the user out of this commnet
There was a problem hiding this comment.
I want future maintainers to understand what this logic is doing, so I attempted to improve the comment.
32d92c5 to
018f8cb
Compare
Happens to me all the time as well. |
pkg/specgenutil/specgen.go
Outdated
There was a problem hiding this comment.
- You have
container istwice - Shouldn't this be
ReadWrite tmpfs is not disabled?
There was a problem hiding this comment.
Yup, hopefully no more typos...
If you are running temporary containers within podman play kube we should really be running these in read-only mode. For automotive they plan on running all of their containers in read-only temporal mode. Adding this option guarantees that the container image is not being modified during the running of the container. The containers can only write to tmpfs mounted directories. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
|
LGTM |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: flouthoc, rhatdan, vrothberg The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
If you are running temporary containers within podman play kube
we should really be running these in read-only mode. For automotive
they plan on running all of their containers in read-only temporal
mode. Adding this option guarantees that the container image is not
being modified during the running of the container.
The containers can only write to tmpfs mounted directories.
Signed-off-by: Daniel J Walsh dwalsh@redhat.com