-
Notifications
You must be signed in to change notification settings - Fork 92
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
chef isn't installed into the container when using podman and kitchen-dokken #255
Comments
Inside the container, /opt/chef, /opt/kitchen and /opt/verifier are completely empty. |
This happened to me when the Platform were mixed between the OS container and Chef Container. The version of Chef I was using only had a linux/amd64 version while the OS container was run on linx/arm64 |
Interesting. Although in my case, everything is linux/amd64. |
I have been looking into this quite a bit recently! My basic hypothesis has been that this was related to SELinux, but I get the same results when I am running test-kitchen as root. Looking around in the podman repositories, this issue seems relevant: containers/podman#12638 I have tried fiddling with kitchen-dokken to add a trailing
|
My current belief is that podman's docker API emulation isn't handling |
So I dug into this a while back but didn't get around to opening up the issue here. There is a workaround for this that you can use. There’s a difference between the ways that docker and podman create containers from images and when a volume gets populated from the image. In Docker:
In Podman:
We need the container in Podman to actually run in order to load the data into the volume. It’s important to note that the executable true doesn’t run long enough to fully start the instance and therefore won’t load the data into the volume. You need to use a different executable. I found that sh works. So, in order to get kitchen-dokken working with Podman, you’ll want to manually create and start the Here’s what I did:
You CAN do all of that with lifecycle hooks, so I was able to build a kitchen.yml file that accounts for having podman and will ensure that the appropriate chef-latest image was created and run so the volume is populated. Note, if you’re using a specific version of chef, and not chef-latest, then you need to reference the correct version in your Here’s my kitchen.yml for chef-latest: ---
driver:
name: dokken
privileged: true # allows systemd services to start
provisioner:
name: dokken
transport:
name: dokken
verifier:
name: inspec
platforms:
# @see https://github.com/chef-cookbooks/testing_examples/blob/main/kitchen.dokken.yml
# @see https://hub.docker.com/u/dokken
- name: ubuntu-20.04
driver:
image: dokken/ubuntu-20.04
pid_one_command: /bin/systemd
intermediate_instructions:
- RUN /usr/bin/apt-get update
- name: centos-8
driver:
image: dokken/centos-8
pid_one_command: /usr/lib/systemd/systemd
suites:
- name: default
run_list:
- recipe[test_linux::default]
verifier:
inspec_tests:
- test/integration/default
lifecycle:
pre_create:
- podman create --name chef-latest --replace docker.io/chef/chef:latest sh
- podman start chef-latest
post_destroy:
- podman volume prune -f
attributes: As I rethink about this now, you could probably use an environment variable to set the chef-client version you want to use and have that populate things in your kitchen.yml Something like this: ---
driver:
name: dokken
privileged: true # allows systemd services to start
chef_version: <%= ENV['CHEF_VERSION'] %>
provisioner:
name: dokken
transport:
name: dokken
verifier:
name: inspec
platforms:
# @see https://github.com/chef-cookbooks/testing_examples/blob/main/kitchen.dokken.yml
# @see https://hub.docker.com/u/dokken
- name: ubuntu-20.04
driver:
image: dokken/ubuntu-20.04
pid_one_command: /bin/systemd
intermediate_instructions:
- RUN /usr/bin/apt-get update
- name: centos-8
driver:
image: dokken/centos-8
pid_one_command: /usr/lib/systemd/systemd
suites:
- name: default
run_list:
- recipe[test_linux::default]
verifier:
inspec_tests:
- test/integration/default
lifecycle:
pre_create:
- podman create --name chef-<%= ENV['CHEF_VERSION'] %> --replace docker.io/chef/chef:<%= ENV['CHEF_VERSION'] %> sh
- podman start chef-<%= ENV['CHEF_VERSION'] %>
post_destroy:
- podman volume prune -f
attributes: |
Closes #255 Signed-off-by: Dan Webb <dan.webb@damacus.io>
Closes #255 Signed-off-by: Dan Webb <dan.webb@damacus.io>
Rather than using the
Notes:
|
Due to differences in how podman and docker treat volumes, we have to hack in a workaround for podman to start the chef container up before it runs a suite. Otherwise you get a failure to find the chef-client binary test-kitchen/kitchen-dokken#255 has more information on the cause
Due to differences in how podman and docker treat volumes, we have to hack in a workaround for podman to start the chef container up before it runs a suite. Otherwise you get a failure to find the chef-client binary test-kitchen/kitchen-dokken#255 has more information on the cause
🗣️ Foreword
👻 Brief Description
chef isn't installed into the container when using podman and kitchen-dokken
Version
Chef Infra Client: 17.7.29
Test Kitchen: 3.1.1
kitchen-dokken: 2.16.0
Environment
Ubuntu 20.04
Scenario
I'm trying to replace docker with podman.
Steps to Reproduce
run
kitchen test
in a basically empty cookbook.kitchen.yml:
metadata.rb:
recipes/default.rb and test/integration/default/default_test.rb are empty
Expected Result
Actual Result
➕ Additional context
Not sure if this is a bug or I'm doing something wrong...
The text was updated successfully, but these errors were encountered: