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

Add basic e2e tests for UBI image #5764

Merged
merged 1 commit into from
Mar 8, 2024

Conversation

xliuxu
Copy link
Contributor

@xliuxu xliuxu commented Dec 1, 2023

@xliuxu xliuxu force-pushed the xliu2-sanity-check-ubi branch 3 times, most recently from dfd3cb9 to b846ece Compare December 1, 2023 08:15
@xliuxu xliuxu force-pushed the xliu2-sanity-check-ubi branch 11 times, most recently from 3507aa0 to 56fff97 Compare January 25, 2024 05:56
@xliuxu xliuxu changed the title [Not For Review] Add sanity checks for UBI image in github actions Add basic e2e tests for UBI image Jan 25, 2024
@xliuxu xliuxu force-pushed the xliu2-sanity-check-ubi branch from 56fff97 to 5e1abf6 Compare January 25, 2024 05:58
@xliuxu xliuxu marked this pull request as ready for review January 25, 2024 05:59
@xliuxu xliuxu force-pushed the xliu2-sanity-check-ubi branch from 5e1abf6 to 5b3e126 Compare January 25, 2024 06:00
.github/workflows/kind.yml Outdated Show resolved Hide resolved
.github/workflows/kind.yml Outdated Show resolved Hide resolved
.github/workflows/conformance.yml Outdated Show resolved Hide resolved
@xliuxu xliuxu force-pushed the xliu2-sanity-check-ubi branch 8 times, most recently from 930025c to 7ccb2d3 Compare January 29, 2024 06:47
.github/workflows/build.yml Outdated Show resolved Hide resolved
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
- name: Install Kind
Copy link
Contributor

Choose a reason for hiding this comment

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

I am OK with running the basic kind test as part of this workflow even though it is not ideal. However, we should probably add a comment explaining why we are doing this (avoid an extra UBI build in a separate workflow)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I also don't think this is elegant. Should we move the test part out as a separate job?

Copy link
Contributor

@antoninbas antoninbas Jan 31, 2024

Choose a reason for hiding this comment

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

I think we can move it to kind_ubi.yml, even if that means that the UBI image is built twice (once in build.yml, once in kind_ubi.yml), which is the same as for the Ubuntu image
In the future, we may want to avoid building these images in build.yml for PRs, since there is no point in building them twice (we will still build it for Github push events, since we need to push the new images to the registry in that case). But this should probably be done in a separate PR, and not this one.

Copy link
Member

Choose a reason for hiding this comment

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

How about we make it daily/bidaily job to avoid adding extra time to very basic jobs? I'm more concerned more tests would be added like this if there is a precedent. We could potentially move more rarely failed but long running tests to daily/bidaily job.

Copy link
Contributor

Choose a reason for hiding this comment

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

In the original issue (#5729) I suggested adding a very basic job just to make sure that the UBI-based image is not broken in a pretty obvious way (like it was around 1.14). I was hoping impact on PR test time would be minimal.
One issue that we have today is that even if someone modifies the UBI Dockerfile, we do not check anything besides making sure that the image still builds.

I am not a big fan of the daily jobs, as they can be broken for a long time before someone actually starts looking into the failure.

I think if we go with my suggestion above: skip building the UBI image in build.yml for PRs, and build the image + sanity check it in kind_ubi.yml, the impact on test time will be minimal. The sanity check itself should only take a couple of minutes. Additionally, after I fix #5944, we should see build time reduction for most jobs.

I also think that we should add a trigger to conformance.yml so that we run the K8s conformance tests (at least for the UBI image) for every release PR.

fi
- name: Build Antrea image if required
if: ${{ steps.check-release.outputs.released == 'false' }}
run: |
./hack/build-antrea-linux-all.sh --pull
if [ ${{ inputs.antrea-controller-image-repository }} == 'antrea/antrea-controller-ubi' ] || [ ${{ inputs.antrea-agent-image-repository }} == 'antrea/antrea-agent-ubi' ]; then
Copy link
Contributor

Choose a reason for hiding this comment

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

I think I gave you a bad suggestion earlier, that's my bad. The new version doesn't make sense:

  • it doesn't support testing older minor versions of Antrea (pre image split)
  • it doesn't make sense when we need to build the image

So I think your earlier idea of having distribution workflow parameter was definitely better.

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 the insights. I will also revert this.

@xliuxu xliuxu force-pushed the xliu2-sanity-check-ubi branch 4 times, most recently from 2693fa5 to 300729a Compare February 1, 2024 08:25
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
- name: Install Kind
Copy link
Member

Choose a reason for hiding this comment

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

How about we make it daily/bidaily job to avoid adding extra time to very basic jobs? I'm more concerned more tests would be added like this if there is a precedent. We could potentially move more rarely failed but long running tests to daily/bidaily job.

type: choice
options:
- ubuntu
- ubi
Copy link
Member

Choose a reason for hiding this comment

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

I didn't know this before, so ubi image can also run on regular clusters?

Copy link
Contributor

Choose a reason for hiding this comment

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

yes, it should not be a problem

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. The only difference I noticed is that UBI images only have nf tables available. So it should be OK to test UBI images if the cluster is bootstrapped in nft mode

Copy link
Contributor

@antoninbas antoninbas Feb 2, 2024

Choose a reason for hiding this comment

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

That's a good point. Actually the iptables-wrapper repo has a note about this:

RHEL / CentOS / UBI

RHEL 7 ships iptables 1.4, which does not support nft mode. RHEL 8 ships a hacked version of iptables 1.8 that only supports nft mode. Therefore, neither can be used as a basis for a portable iptables-using container image.

I wonder if UBI 9 is different

Copy link
Contributor Author

Choose a reason for hiding this comment

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

9.0_release_notes indicates that iptables-nft has been marked as deprecated. But I think it is safe to use them in UBI 9.

- name: Install Kind
run: |
KIND_VERSION=$(head -n1 ./ci/kind/version)
KIND_VERSION=$(head -n1 ./ci/kind/version || echo v0.20.0)
Copy link
Member

Choose a reason for hiding this comment

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

thanks for fixing it, I had to switch to a tag when testing previous releases.

curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-$(uname)-amd64
chmod +x ./kind
sudo mv kind /usr/local/bin
- name: Run basic e2e tests
Copy link
Contributor

Choose a reason for hiding this comment

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

I would agree Antonin to put this kind of e2e test to a file kind_ubi.yml which should be similar like kind.yml.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Created #6031 to track the follow-up issue.

.github/workflows/conformance.yml Outdated Show resolved Hide resolved
@@ -91,6 +99,29 @@ jobs:
docker push antrea/antrea-ubi:latest
docker push antrea/antrea-agent-ubi:latest
docker push antrea/antrea-controller-ubi:latest
- name: Install Kind
Copy link
Contributor

Choose a reason for hiding this comment

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

It's a bit strange to test the image after pushing it to the registry, but as long as we address #6031 promptly that works for me

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. I can follow up with #6031 after this PR.

Comment on lines -238 to +265
COMMON_IMAGES_LIST+=("antrea/antrea-agent-ubuntu-coverage:latest" \
"antrea/antrea-controller-ubuntu-coverage:latest")
COMMON_IMAGES_LIST+=("${antrea_controller_image}-coverage:${antrea_image_tag}" \
"${antrea_agent_image}-coverage:${antrea_image_tag}")
Copy link
Contributor

Choose a reason for hiding this comment

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

it's a bit weird to append the -coverage suffix automatically when a user provides an image names.
I don't have a great solution, but I think we should fail the script if the --coverage flag is used with --antrea-controller-image or --antrea-agent-image.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added simple checks to make sure image names cannot be specified with coverage enabled.

@xliuxu xliuxu force-pushed the xliu2-sanity-check-ubi branch from aa8b0b4 to 097f0e1 Compare February 29, 2024 12:54
antoninbas
antoninbas previously approved these changes Feb 29, 2024
@antoninbas
Copy link
Contributor

@xliuxu Something weird is going on and it seems the new job keeps getting stuck in Github Actions, even after a second try. Could you take a look?

@xliuxu
Copy link
Contributor Author

xliuxu commented Mar 4, 2024

@xliuxu Something weird is going on and it seems the new job keeps getting stuck in Github Actions, even after a second try. Could you take a look?

I ran more tests at #6053 and suspect that the issue is related to insufficient disk space. The job can succeed if we clean up the build caches after building the image.
https://github.com/antrea-io/antrea/actions/runs/8137117739/job/22234796248
I think splitting the job into different stages and running them on multiple runners can also resolve this issue.

@antoninbas
Copy link
Contributor

@xliuxu Something weird is going on and it seems the new job keeps getting stuck in Github Actions, even after a second try. Could you take a look?

I ran more tests at #6053 and suspect that the issue is related to insufficient disk space. The job can succeed if we clean up the build caches after building the image. https://github.com/antrea-io/antrea/actions/runs/8137117739/job/22234796248 I think splitting the job into different stages and running them on multiple runners can also resolve this issue.

I think pruning the build cache after building the image is sufficient for now, since we are planning to improve things in #6031 anyway

Run basic e2e tests on a Kind cluster for the UBI image to make sure
the UBI image can be deployed as expected. Add a new input parameter
`distro` to the conformance workflow to allow testing of the UBI image.

Fixes: antrea-io#5729

Signed-off-by: Xu Liu <xliu2@vmware.com>
@antoninbas
Copy link
Contributor

/skip-all

@antoninbas antoninbas merged commit ac8aa95 into antrea-io:main Mar 8, 2024
51 of 55 checks passed
luolanzone pushed a commit to luolanzone/antrea that referenced this pull request Jun 14, 2024
Run basic e2e tests on a Kind cluster for the UBI image to make sure
the UBI image can be deployed as expected. Add a new input parameter
`distro` to the conformance workflow to allow testing of the UBI image.

Fixes: antrea-io#5729

Signed-off-by: Xu Liu <xliu2@vmware.com>
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.

Add a simple CI sanity check for antrea/antrea-ubi image
4 participants