Skip to content

[bugfix]: clean OCI leftovers before the wasp-agent pod is removed#104

Merged
enp0s3 merged 2 commits intoopenshift-virtualization:mainfrom
enp0s3:clean-oci-leftovers
Apr 29, 2026
Merged

[bugfix]: clean OCI leftovers before the wasp-agent pod is removed#104
enp0s3 merged 2 commits intoopenshift-virtualization:mainfrom
enp0s3:clean-oci-leftovers

Conversation

@enp0s3
Copy link
Copy Markdown
Member

@enp0s3 enp0s3 commented Apr 29, 2026

Signed-off-by: Igor Bezukh ibezukh@redhat.com

two OCI files are being copied by wasp-agent into the host:
hook configuration and hook script. These files remain on the
filesystem even after wasp-agent is being removed from the node.
This causes redundant execution of the OCI hook.

these changes suggest removing the files before the pod terminates.
The preStop hook is being called before SIGTERM is being sent to the pod.

In case of forcefull deletion the hook will be skipped

@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented Apr 29, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign enp0s3 for approval. For more information see the Code Review Process.

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

Details 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

@enp0s3 enp0s3 force-pushed the clean-oci-leftovers branch from c96996a to 4e62d3f Compare April 29, 2026 11:23
enp0s3 added 2 commits April 29, 2026 14:23
two OCI files are being copied by wasp-agent into the host:
hook configuration and hook script. These files remain on the
filesystem even after wasp-agent is being removed from the node.
This causes redundant execution of the OCI hook.

these changes suggest removing the files before the pod terminates.
The preStop hook is being called before SIGTERM is being sent to the pod.

In case of forcefull deletion the hook will be skipped.

Signed-off-by: Igor Bezukh <ibezukh@redhat.com>
OCI hook file path was hard-coded in multiple packages.
move the path into a dedicated package for maintain consistency
among multiple consumer packages.

Signed-off-by: Igor Bezukh <ibezukh@redhat.com>
@enp0s3 enp0s3 force-pushed the clean-oci-leftovers branch from 4e62d3f to 7adec95 Compare April 29, 2026 11:24
@enp0s3 enp0s3 requested a review from Barakmor1 April 29, 2026 11:24
@enp0s3
Copy link
Copy Markdown
Member Author

enp0s3 commented Apr 29, 2026

Addresses #91

Copy link
Copy Markdown
Member

@Barakmor1 Barakmor1 left a comment

Choose a reason for hiding this comment

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

Thank you!

Copy link
Copy Markdown

@akalenyu akalenyu left a comment

Choose a reason for hiding this comment

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

just few alternative to consider:

  • emptydir (tied to pod lifecycle) stop using predicted paths on the host, let cri-o somehow know where it should look
  • signal handlers in the go program (roughly equivalent to current suggestion, arguably missing those in general for faster teardown)

@enp0s3
Copy link
Copy Markdown
Member Author

enp0s3 commented Apr 29, 2026

just few alternative to consider:

  • emptydir (tied to pod lifecycle) stop using predicted paths on the host, let cri-o somehow know where it should look
  • signal handlers in the go program (roughly equivalent to current suggestion, arguably missing those in general for faster teardown)

@akalenyu Thanks for the feedback!

I was considering using signal handlers, but then realized that I can offload it to k8s, so less code to maintain. Also it seems like in the SIGKILL case both of them are useless :(
Regarding the path I can actually improve the CRI-O configuration parser, then we will only rely on their project defaults.

@akalenyu
Copy link
Copy Markdown

just few alternative to consider:

  • emptydir (tied to pod lifecycle) stop using predicted paths on the host, let cri-o somehow know where it should look
  • signal handlers in the go program (roughly equivalent to current suggestion, arguably missing those in general for faster teardown)

@akalenyu Thanks for the feedback!

I was considering using signal handlers, but then realized that I can offload it to k8s, so less code to maintain. Also it seems like in the SIGKILL case both of them are useless :( Regarding the path I can actually improve the CRI-O configuration parser, then we will only rely on their project defaults.

sounds good

@enp0s3 enp0s3 merged commit f47b70c into openshift-virtualization:main Apr 29, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants