-
Notifications
You must be signed in to change notification settings - Fork 32
Add Podman quadlet .image file support #501
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| --- | ||
| - name: Deploy candlepin image unit | ||
| ansible.builtin.include_role: | ||
| name: images | ||
| tasks_from: deploy_image.yaml | ||
| vars: | ||
| images_definition: | ||
| name: candlepin | ||
| image: "{{ candlepin_container_image }}:{{ candlepin_container_tag }}" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| --- | ||
| - name: Deploy foreman image unit | ||
| ansible.builtin.include_role: | ||
| name: images | ||
| tasks_from: deploy_image.yaml | ||
| vars: | ||
| images_definition: | ||
| name: foreman | ||
| image: "{{ foreman_container_image }}:{{ foreman_container_tag }}" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| --- | ||
| - name: Deploy foreman-proxy image unit | ||
| ansible.builtin.include_role: | ||
| name: images | ||
| tasks_from: deploy_image.yaml | ||
| vars: | ||
| images_definition: | ||
| name: foreman-proxy | ||
| image: "{{ foreman_proxy_container_image }}:{{ foreman_proxy_container_tag }}" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| --- | ||
| images_quadlet_dir: /etc/containers/systemd | ||
| images_registry_auth_file: /etc/foreman/registry-auth.json |
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,17 @@ | ||||||||||
| --- | ||||||||||
| - name: Generate image file for {{ images_definition.name }} | ||||||||||
| containers.podman.podman_image: | ||||||||||
|
Member
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. Following up on #501 (comment): I think we should set Then we can use podman auto-update to force updates. |
||||||||||
| name: "{{ images_definition.image }}" | ||||||||||
| state: quadlet | ||||||||||
| quadlet_dir: "{{ images_quadlet_dir }}" | ||||||||||
| quadlet_filename: "{{ images_definition.name }}" | ||||||||||
| quadlet_file_mode: "0644" | ||||||||||
| quadlet_options: | ||||||||||
| - "Policy=missing" | ||||||||||
| - "Environment=REGISTRY_AUTH_FILE={{ images_registry_auth_file }}" | ||||||||||
|
Member
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. Per containers/ansible-podman-collections#1034 (comment) you can use
Suggested change
Member
Author
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. Nope. This will set
Contributor
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.
Suggested change
we can't use Environment or REGISTRY_AUTH_FILE directly in
Contributor
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. and mostly CI is also failing because of same reason |
||||||||||
|
|
||||||||||
| - name: Create drop-in directory for {{ images_definition.name }} | ||||||||||
|
Member
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. we don't deploy anything here, right? it's just "so it's there so someone else can do it"?
Member
Author
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. Yes. So, arguably, I can drop this here and just let whatever needs to do this create them (e.g. downstreams with different images or upstream release RPMs). Thoughts?
Member
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. I thought packages would not touch it here anyway but use /usr/lib?
Member
Author
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.
One argument is these are specialized and thus the directory should be created at the time of use. This adds a step the user or developer has to remember. Whereas, having the directory allows quick and easy drop in with less overhead remembering two steps. What do you think?
Member
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.
IMHO you can't count on things existing just because Ansible created it so I'd prefer the tools to be robust by having a |
||||||||||
| ansible.builtin.file: | ||||||||||
| path: "{{ images_quadlet_dir }}/{{ images_definition.name }}.image.d" | ||||||||||
| state: directory | ||||||||||
| mode: "0755" | ||||||||||
Uh oh!
There was an error while loading. Please reload this page.
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.
From what i understand is this only writes .image files to /etc/containers/systemd/ and does a daemon_reload but does that actually pulls a image? i mean does it download the images that can be used without re-pulling in deploy?
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.
https://docs.podman.io/en/latest/markdown/podman-image.unit.5.html#usage-summary says
enerating a systemd .service that runs podman image pull.is confusing, does it pull by default or on start of .serviceThere 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.
I think it generates a
.service(likeforeman.image.service) file but it requires someone/something to start it. Whether that's a user runningsystemctlor another service depending on it (I'd expectforeman.serviceto).In this case I'd expect
foremanctl pull-imagesto ensure the service is started, but some questions that pop up:foreman.image.service) was already started? Is it a noop or does it run again?Looking at the docs Policy influences this.
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.
The quadlet generator makes each .image unit a Type=oneshot service. When a container starts, systemd activates its image service dependency, which runs podman image pull (or no-ops if the image already exists), then exits. The service transitions active → inactive when the oneshot finishes.
This strategy has lots of benefits and one small downside, on systemctl start foreman.target:
Because of this I had to increase the foreman.target retries when we test start/stop/restart of it.
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.
The docs mention
Policy=alwaysand that implies it always connects over the network. Perhaps we should usePolicy=missingso it's only a local operation after the first installation?Then we do need an explicit process to update images, but we already have an update and upgrade guide. Perhaps that's good anyway? Otherwise you can unexpectedly pull in z-streams after a reboot.
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.
so technically it happens when containers start not when we run
foremanctl pull-images? thats seems odd with what we expect from pull-images, as a user i can pull-images and then deploy which reduces the deployment time as i already have latest images.or i am interpreting wrong?