Skip to content

feat: Target container #303

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

feat: Target container #303

wants to merge 4 commits into from

Conversation

danielstokes
Copy link
Contributor

@danielstokes danielstokes commented Jun 5, 2025

Description

Type of change

operator:

  • Fixes support for resources/ resource requirments on the agent init container (available as resourceRequirements)
  • Releases the lease on exit, rather than waiting for it to expire. Every version hereafter shouldn't need to have a delay after a new deployment before accepting instrumentation
  • Fixes possible issue where the generated app name may be incorrect for the deployment
  • Adds support for getting the cronjob name when generating a app name
  • Initial framework for replicating env secrets, env configmaps and agent configmaps to the target namespace (not enabled)

api v1beta1:

  • Fixes possible issue where a agent config map was set on an language agent other than java could be set. (so side effects other than sad faces with an unsupported feature for other language agents)

api v1beta2:

  • Add support for targeting a single, a group or all containers based on selectors, in containerSelector

    • imageSelector - target specific containers based on the url for the repository
    • envSelector - target specific containers based on the env keys and values (ignores entries with .valueFrom)
    • nameSelector - target specific containers by name, if it's either a init container or regular container
    • namesFromPodAnnotation - target specific containers based on any custom annotation, added in the pod
  • Add support for imagePullPolicy on the agent init container

  • Add support for securityContext on the agent init container

  • Add support for resources/ resource requirments on the health agent init/sidecar container (available as resourceRequirements)

  • Add support for imagePullPolicy on the healthAgent init/sidecar container

  • Add support for securityContext on the healthAgent init/sidecar container

  • Report the observed version in the status when collecting health info

  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

  • New feature / enhancement (non-breaking change which adds functionality)

  • Security fix

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • Documentation has been updated
  • This change requires changes in testing:
    • unit tests
    • E2E tests

Copy link

codecov bot commented Jun 17, 2025

Codecov Report

Attention: Patch coverage is 66.88354% with 509 lines in your changes missing coverage. Please review.

Project coverage is 65.99%. Comparing base (92c1920) to head (94d6d2c).

Files with missing lines Patch % Lines
api/v1beta2/instrumentation_webhook.go 13.86% 116 Missing and 2 partials ⚠️
internal/selector/selector.go 38.54% 104 Missing and 14 partials ⚠️
internal/instrumentation/mutator.go 79.26% 87 Missing and 26 partials ⚠️
api/v1beta1/instrumentation_conversion.go 81.60% 14 Missing and 2 partials ⚠️
internal/apm/base.go 73.33% 10 Missing and 6 partials ⚠️
api/v1beta2/image_selector.go 65.71% 8 Missing and 4 partials ⚠️
api/v1beta2/name_selector.go 65.71% 8 Missing and 4 partials ⚠️
internal/webhook/podmutationhandler.go 45.00% 8 Missing and 3 partials ⚠️
api/v1beta2/env_selector.go 70.00% 6 Missing and 3 partials ⚠️
api/v1beta2/instrumentation_types.go 52.63% 9 Missing ⚠️
... and 15 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #303      +/-   ##
==========================================
+ Coverage   65.12%   65.99%   +0.86%     
==========================================
  Files          36       45       +9     
  Lines        2644     3352     +708     
==========================================
+ Hits         1722     2212     +490     
- Misses        824      975     +151     
- Partials       98      165      +67     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link

@Philip-R-Beckwith Philip-R-Beckwith left a comment

Choose a reason for hiding this comment

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

This probably should have been multiple PRs instead of only one.
We're adding a lot of changes here that aren't necessarily related which makes reviewing fairly difficult.
I'm not seeing anything blocking.
I think we should move away from variable names like m, fn, sp.
It's a lot easier to follow logic if you don't have to scroll up to remember what a variable is supposed to be.
However small var names is the current paradigm of this repo and asking for re-naming on a PR this large is not really realistic.
The only issue is that currently CodeCov is blocking this PR due to missing unit tests.
Once that is sorted I'll give you the 🟢

@danielstokes danielstokes reopened this Jul 8, 2025
@@ -128,7 +128,7 @@ jobs:
matrix:
# Latest patch version can be found in https://github.com/kubernetes/website/blob/main/content/en/releases/patch-releases.md
# Some versions might not be available yet in https://storage.googleapis.com/kubernetes-release/release/v1.X.Y/bin/linux/amd64/kubelet
k8sVersion: [ "v1.31.1", "v1.30.5", "v1.29.9", "v1.28.14", "v1.27.16", "v1.26.15" ]
k8sVersion: [ "v1.33.1", "v1.32.5", "v1.31.9", "v1.30.13", "v1.29.15", "v1.28.15", "v1.31.1", "v1.30.5", "v1.29.9", "v1.28.14", "v1.27.16", "v1.26.15" ]
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we really need to support multiple point version for the same K8s version? If not, we should consider removing the older ones to save on GHA minutes.

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 would like to remove all the older or unsupported versions, but they are still required pipelines.

Copy link
Contributor

Choose a reason for hiding this comment

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

Okay, let's leave them in on this PR, but as a fast follow we should remove them and update GH.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants