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

feat(agent): add object selector for pod webhook #1018

Merged
merged 1 commit into from
Jan 16, 2025

Conversation

ebaron
Copy link
Member

@ebaron ebaron commented Jan 16, 2025

Welcome to Cryostat! 👋

Before contributing, make sure you have:

  • Read the contributing guidelines
  • Linked a relevant issue which this PR resolves
  • Linked any other relevant issues, PR's, or documentation, if any
  • Resolved all conflicts, if any
  • Rebased your branch PR on top of the latest upstream main branch
  • Attached at least one of the following labels to the PR: [chore, ci, docs, feat, fix, test]
  • Signed all commits: git commit -S -m "YOUR_COMMIT_MESSAGE"

Fixes: #993

Description of the change:

  • Patches the MutatingWebhookConfiguration with an object selector that causes the pod webhook to only be invoked if it contains the required cryostat.io/name and cryostat.io/namespace labels

Motivation for the change:

  • Increases performance by using Kubernetes to perform server-side filtering so our webhook isn't invoked upon every pod creation event in the cluster

How to manually test:

  1. Deploy PR and create a default CR
  2. make sample_app, there should be no log messages from pod-webhook. If the filtering didn't work, we would see the new "pod is missing required labels" log message.
  3. make sample_app_agent_injected. You should see a pod-webhook log message like "configured Cryostat agent for pod" and the sample app should be properly instrumented

@ebaron ebaron added the feat New feature or request label Jan 16, 2025
@ebaron ebaron requested a review from a team January 16, 2025 19:10
@mergify mergify bot added the safe-to-test label Jan 16, 2025
@ebaron
Copy link
Member Author

ebaron commented Jan 16, 2025

/build_test

Copy link

/build_test completed successfully ✅.
View Actions Run.

@ebaron ebaron merged commit 3f7413e into cryostatio:main Jan 16, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat New feature or request safe-to-test
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[Story] Use an object selector to filter pods for webhook
2 participants