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

Optional podman support for running tests locally #9294

Merged
merged 1 commit into from
Jan 6, 2023

Conversation

kirs
Copy link
Contributor

@kirs kirs commented Nov 11, 2022

Some environments don't allow Docker for Desktop for licensing concerns and use Podman instead.

This is an attempt to allow some optional support for Podman, at least for running local tests.

You can try it with RUNTIME=podman build/run-in-docker.sh test/test-lua.sh.

I spoke to @ElvinEfendi mentioned that the team would be open to swapping docker for local development with podman completely, I might take an attempt at some point - but right now I believe this smaller diff can unblock us faster to run tests locally.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Nov 11, 2022
@k8s-ci-robot
Copy link
Contributor

@kirs: This issue is currently awaiting triage.

If Ingress contributors determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. needs-kind Indicates a PR lacks a `kind/foo` label and requires one. labels Nov 11, 2022
@k8s-ci-robot
Copy link
Contributor

Hi @kirs. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added needs-priority size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Nov 11, 2022
INGRESS_VOLUME=$(mktemp -d)
if [[ "$OSTYPE" == darwin* ]] && [[ "$RUNTIME" == podman ]]; then
mkdir -p "tmp"
INGRESS_VOLUME=$(pwd)/$(mktemp -d tmp/XXXXXX)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This dance is needed because /var/folders/<some-tmp-name> created on Mac is not available on the VM managed by Podman. It has to be something in the local dir of the project.

@longwuyuan
Copy link
Contributor

@kirs thank you for this. Its an awesome help.

But is this agnostic to OS ? Does it currently only work on M1 Mac or Intel Mac ? Does it need any change to be used on Linux lpatop/dekstop ?

@rikatz
Copy link
Contributor

rikatz commented Nov 13, 2022

besides @longwuyuan question (which I agree) it is great! Thanks for that! Let me know if you need someone to test this on a Mac Intel :D

@kirs
Copy link
Contributor Author

kirs commented Nov 14, 2022

@longwuyuan there's nothing here that would be M1 or Intel specific. As long as Podman is compatible with both this should just work. Same for Linux, I expect it to work as is.

@rikatz I'd appreciate if you could help to test this on Mac Intel just in case 🙏

@longwuyuan
Copy link
Contributor

@kirs thanks for updating. If you did test on linux, please confirm. Sorry for persisting because there are some nuances experienced earlier relating to running tests in VMs

@kirs kirs force-pushed the optional-podman-support branch 2 times, most recently from 22e8e50 to a4f511a Compare November 15, 2022 05:46
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Nov 15, 2022
@kirs
Copy link
Contributor Author

kirs commented Nov 15, 2022

Tested on Linux:

$ git status
On branch optional-podman-support
Your branch is up to date with 'origin/optional-podman-support'.

nothing to commit, working tree clean
$ uname -a
Linux kirs-k8s-devbox 5.10.0-19-cloud-amd64 #1 SMP Debian 5.10.149-2 (2022-10-21) x86_64 GNU/Linux
$ RUNTIME=podman build/run-in-docker.sh test/test-lua.sh
..printing env & other vars to stdout
...
+ set -o errexit
+ set -o nounset
+ set -o pipefail
+ BUSTED_ARGS='-v --pattern=_test'
+ resty -I ./rootfs/etc/nginx/lua --shdict 'configuration_data 5M' --shdict 'certificate_data 16M' --shdict 'certificate_servers 1M' --shdict 'ocsp_response_cache 1M' --shdict 'balancer_ewma 1M' --shdict 'balancer_ewma_last_touched_at 1M' --shdict 'balancer_ewma_locks 512k' --shdict 'global_throttle_cache 5M' ./rootfs/etc/nginx/lua/test/run.lua -v --pattern=_test ./rootfs/etc/nginx/lua/test/ ./rootfs/etc/nginx/lua/plugins/hello_world/test
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
196 successes / 0 failures / 0 errors / 0 pending : 0.209227 seconds

@longwuyuan
Copy link
Contributor

@kirs thank you very much for the test.
/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Nov 15, 2022
@longwuyuan
Copy link
Contributor

@kirs CI failing. I can try to answer question if any. PTAL

@tao12345666333
Copy link
Member

Thanks, this idea LGTM

One question, do we need to cover this scenario in CI? For example, test it with Podman?

@tao12345666333
Copy link
Member

I keep an eye on some of Podman's features and documentation, but I don't really use it, especially on macOS

@longwuyuan
Copy link
Contributor

Original idea in this PR is not for CI. Just for local use. So ideally, CI should ignore this now.

In future, if many other projects are happy for several months with podman, then its ok to explore CI with podman.

So I think currently just need to adjust CI so that it does not fail on podman. Not even sure if the latest CI failure is because of this change.

-v "/var/run/docker.sock:/var/run/docker.sock" \
-v "${INGRESS_VOLUME}:/etc/ingress-controller/" \
-w "/go/src/${PKG}" \
${E2E_IMAGE} /bin/bash -c "${FLAGS}"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Had to rewrite this because of that extra flag for docker below.

@kirs kirs force-pushed the optional-podman-support branch 5 times, most recently from c8fce85 to 64e7186 Compare January 5, 2023 07:50
args="$args -v /var/run/docker.sock:/var/run/docker.sock"
fi

args="$args -v "${INGRESS_VOLUME}:/etc/ingress-controller/" -w "/go/src/${PKG}""
Copy link
Member

Choose a reason for hiding this comment

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

I think you could make this part of the args initialization above. Maybe you wanted to keep the order of args unchanged? I'd think order does not matter.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for pointing this out, updated!

@ElvinEfendi
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 6, 2023
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ElvinEfendi, kirs

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 6, 2023
@k8s-ci-robot k8s-ci-robot merged commit 5bfd3e2 into kubernetes:main Jan 6, 2023
@kirs kirs deleted the optional-podman-support branch January 6, 2023 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-kind Indicates a PR lacks a `kind/foo` label and requires one. needs-priority needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants