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

hook: Match on pod name #22

Merged
merged 1 commit into from
May 17, 2024
Merged

hook: Match on pod name #22

merged 1 commit into from
May 17, 2024

Conversation

fabiand
Copy link
Collaborator

@fabiand fabiand commented May 17, 2024

Annotations are denylisted due to cri-o/cri-o#8090 and related

Annotations are denylisted due to cri-o/cri-o#8090
and related

Signed-off-by: Fabian Deutsch <[email protected]>
Copy link
Collaborator Author

@fabiand fabiand left a comment

Choose a reason for hiding this comment

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

Fixes the recent regression, however, a bit ugly because pod match is in shell, not in hook config.

@enp0s3 please review.

@@ -4,9 +4,7 @@
"path": "/opt/oci-hook-swap.sh"
},
"when": {
"annotations": {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ideally here we match on io.kubernetes.pod.name but I was not able to make it work with

-        "always": true
+        "annotations": {
+          "^io\\.kubernetes\\.pod\\.name$": "^virt-launcher.*"

in hook.json


if [[ "$CG_PATH" =~ .*"burst".* ]];
if [[ "$CG_PATH" =~ .*"burst".* && "$POD_NAME" =~ "virt-launcher".* ]];
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Workaround, because

-        "always": true
+        "annotations": {
+          "^io\\.kubernetes\\.pod\\.name$": "^virt-launcher.*"

in hook.json did not work.

@fabiand
Copy link
Collaborator Author

fabiand commented May 17, 2024

Self-merging to get a working image.

@fabiand fabiand merged commit 82c6b91 into main May 17, 2024
1 check passed
@fabiand fabiand deleted the match-on-podname branch May 17, 2024 10:42
Copy link
Member

@enp0s3 enp0s3 left a comment

Choose a reason for hiding this comment

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

/approve
@fabiand Great catch!

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.

2 participants