-
Notifications
You must be signed in to change notification settings - Fork 195
tests: add test case for kata agent API configuration #4677
Conversation
Hi! I'm labeling 'rfc' this PR because so far my goal is to collect feedback. I'm introducing a method ( I noticed that when I enable the "CC" handler in containerd's configuration and I don't enable image offloading on kata side then it fails to start the container. Is it expected behavior? i.e. once you add the handler, you are completely disabling the image pulls from containerd (delegated to the kata agent) so it is mandatory to enable image offload on kata? My last remark is that it seems we don't necessarily need to test agent API configuration with CC. If that is the case maybe I should try to merge that test case straight to the main branch. Or am I missing something? |
cf64957
to
a5380eb
Compare
Updates to this pull request:
|
a5380eb
to
9aafec7
Compare
Updates to this pull request:
|
Added a e2e test to check that when a pod is created with an agent API config that blocked certain endpoints that requests to these are rejected. Fixes kata-containers#4676 Signed-off-by: Wainer dos Santos Moschetta <[email protected]>
Moved the assert functions from confidential/agent_image.bats to a library file (asserts.sh) so that they can be re-used in various tests files. Signed-off-by: Wainer dos Santos Moschetta <[email protected]>
In order to use the assert_logs_contain() in agent_api.bats, it was needed to change the function so that journalctl grabs logs from "kata", "containerd" and "crio" identifiers. Signed-off-by: Wainer dos Santos Moschetta <[email protected]>
Created assert_can_exec_on_container() and refactored assert_container(), then use both on agent_api tests. Signed-off-by: Wainer dos Santos Moschetta <[email protected]>
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.
Hi Wainer, sorry I missed this PR. I think it looks good and having a method to add files to the guest image is going to be really helpful and something we should switch to using in ccv0.sh
.
With respect to your question about where to test agent API - I think you are correct that the function went into main
and your test case would be valid in a non CC environment.
start_date=$(date +"%Y-%m-%d %H:%M:%S") | ||
sandbox_name="kata-cc-busybox-sandbox" | ||
pod_config="${FIXTURES_DIR}/pod-config.yaml" | ||
pod_id="" | ||
|
||
echo "Delete any existing ${sandbox_name} pod" | ||
crictl_delete_cc_pod_if_exists "$sandbox_name" | ||
|
||
echo "Prepare containerd for Confidential Container" | ||
SAVED_CONTAINERD_CONF_FILE="/etc/containerd/config.toml.$$" | ||
configure_cc_containerd "$SAVED_CONTAINERD_CONF_FILE" | ||
|
||
echo "Reconfigure Kata Containers" | ||
clear_kernel_params | ||
switch_image_service_offload on |
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.
As this code matches the agent_image.bats
I wonder if there is merit in moving it to a shared library to avoid the duplication?
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.
Yeah, It does make sense to remove that duplication. I wish it was Python (or any OO language) where we could use heritage. Mind if I send it in a follow up PR?
9aafec7
to
0c2a2f6
Compare
…mg() This added added the code to copy files into an initrd image. Signed-off-by: Wainer dos Santos Moschetta <[email protected]>
0c2a2f6
to
40d7f5d
Compare
Hi @stevenhorsman ,
Can we adapt ** it seems we don't have an issue to track that work. At least the closest that I found was about removing skopeo/umoci (kata-containers/kata-containers#3970) Regarding where to merge this PR...I think it is too late to merge on |
/test |
Hey Wainer, sorry for the lack of clarity, my comments weren't supposed to be merge stoppers, just something to consider.
Agreed, I meant this is great code we should try and switch to using in
Yep, that's fine by me. I think the scenario would be valid with the current |
Hey @wainersm - as you mentioned that it was missing, I've created kata-containers/kata-containers#4111 to cover using the new |
Added a e2e test to check that when a pod is created with an agent API
config that blocked certain endpoints that requests to these are rejected.
Fixes #4676
Signed-off-by: Wainer dos Santos Moschetta [email protected]