Skip to content

[APMLP-819] Add imageresolver.Config to initialize ImageResolvers#43308

Merged
dd-mergequeue[bot] merged 25 commits intomainfrom
erikayasuda/imageresolver_config
Jan 7, 2026
Merged

[APMLP-819] Add imageresolver.Config to initialize ImageResolvers#43308
dd-mergequeue[bot] merged 25 commits intomainfrom
erikayasuda/imageresolver_config

Conversation

@erikayasuda
Copy link
Contributor

@erikayasuda erikayasuda commented Nov 20, 2025

What does this PR do?

Adds a new Config type in a separate imageresolver package. The config should contain all necessary configurations to determine what type of ImageResolver implementation should be used.

There is no functionality/behavior change from this PR.

Motivation

  • Code clean up -- Removes the different varieties of RC ImageResolver constructors that made it difficult to follow the code.
  • Simpler interface -- Calling NewImageResolver() now only requires the ImageResolverConfig, which can be updated later if needed.
  • imageresolver package -- Starting this so other ImageResolver specific code can be nested in here in a follow up PR

Describe how you validated your changes

Local E2E validation using injector-dev to ensure existing behavior is retained

Additional Notes

@github-actions github-actions bot added medium review PR review might take time team/container-platform The Container Platform Team team/injection-platform labels Nov 20, 2025
@erikayasuda erikayasuda added changelog/no-changelog No changelog entry needed qa/done QA done before merge and regressions are covered by tests labels Nov 20, 2025
@agent-platform-auto-pr
Copy link
Contributor

agent-platform-auto-pr bot commented Nov 20, 2025

Go Package Import Differences

Baseline: 4e6b4c9
Comparison: 90244eb

binaryosarchchange
cluster-agentlinuxamd64
+1, -0
+github.com/DataDog/datadog-agent/pkg/clusteragent/admission/mutate/autoinstrumentation/imageresolver
cluster-agentlinuxarm64
+1, -0
+github.com/DataDog/datadog-agent/pkg/clusteragent/admission/mutate/autoinstrumentation/imageresolver

Comment on lines +38 to +39
MaxInitRetries: 5,
InitRetryDelay: 1 * time.Second,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This could possibly be configured via config/env var, but this is already static in current state, so retaining that for now

Copy link
Member

Choose a reason for hiding this comment

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

Would love to see all of these configurable by ddConfig!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The first two already are, and the last 2 will be removed with the pivot to tag-based, so I might not add them to ddConfig (unless you think it could still be useful in the meantime, then I'm open to adding them)

@erikayasuda erikayasuda changed the title Add ImageResolverConfig Add imageresolver.Config to initialize ImageResolvers Nov 20, 2025
@erikayasuda erikayasuda marked this pull request as ready for review November 20, 2025 22:13
@erikayasuda erikayasuda requested review from a team as code owners November 20, 2025 22:13
@agent-platform-auto-pr
Copy link
Contributor

agent-platform-auto-pr bot commented Nov 20, 2025

Static quality checks

✅ Please find below the results from static quality gates
Comparison made with ancestor 4e6b4c9
📊 Static Quality Gates Dashboard

Successful checks

Info

Quality gate Delta On disk size (MiB) Delta On wire size (MiB)
agent_deb_amd64 $${0}$$ $${707.15}$$ < $${707.24}$$ $${+0.02}$$ $${173.47}$$ < $${174.02}$$
agent_deb_amd64_fips $${0}$$ $${702.45}$$ < $${702.86}$$ $${+0.03}$$ $${172.39}$$ < $${173.5}$$
agent_heroku_amd64 $${0}$$ $${328.77}$$ < $${329.53}$$ $${-0}$$ $${87.43}$$ < $${88.43}$$
agent_msi $${0}$$ $${570.83}$$ < $${982.08}$$ $${-0.02}$$ $${142.73}$$ < $${143.02}$$
agent_rpm_amd64 $${0}$$ $${707.14}$$ < $${707.23}$$ $${-0.05}$$ $${175.98}$$ < $${177.24}$$
agent_rpm_amd64_fips $${0}$$ $${702.44}$$ < $${702.85}$$ $${+0.02}$$ $${175.57}$$ < $${176.32}$$
agent_rpm_arm64 $${0}$$ $${688.92}$$ < $${692.59}$$ $${+0.01}$$ $${159.57}$$ < $${160.9}$$
agent_rpm_arm64_fips $${0}$$ $${685.04}$$ < $${687.54}$$ $${+0.01}$$ $${159.03}$$ < $${160.11}$$
agent_suse_amd64 $${0}$$ $${707.14}$$ < $${707.23}$$ $${-0.05}$$ $${175.98}$$ < $${177.24}$$
agent_suse_amd64_fips $${0}$$ $${702.44}$$ < $${702.85}$$ $${+0.02}$$ $${175.57}$$ < $${176.32}$$
agent_suse_arm64 $${0}$$ $${688.92}$$ < $${692.59}$$ $${+0.01}$$ $${159.57}$$ < $${160.9}$$
agent_suse_arm64_fips $${0}$$ $${685.04}$$ < $${687.54}$$ $${+0.01}$$ $${159.03}$$ < $${160.11}$$
docker_agent_amd64 $${0}$$ $${768.94}$$ < $${769.58}$$ $${+0}$$ $${261.22}$$ < $${261.89}$$
docker_agent_arm64 $${+0}$$ $${775.29}$$ < $${779.27}$$ $${-0}$$ $${250.27}$$ < $${252.08}$$
docker_agent_jmx_amd64 $${+0}$$ $${959.82}$$ < $${960.46}$$ $${-0}$$ $${329.85}$$ < $${330.53}$$
docker_agent_jmx_arm64 $${+0}$$ $${954.88}$$ < $${958.87}$$ $${+0}$$ $${314.88}$$ < $${316.71}$$
docker_cluster_agent_amd64 $${-0}$$ $${180.71}$$ < $${181.08}$$ $${+0}$$ $${63.85}$$ < $${64.49}$$
docker_cluster_agent_arm64 $${-0}$$ $${196.55}$$ < $${198.49}$$ $${-0.01}$$ $${60.11}$$ < $${61.17}$$
docker_cws_instrumentation_amd64 $${0}$$ $${7.13}$$ < $${7.18}$$ $${-0}$$ $${2.99}$$ < $${3.33}$$
docker_cws_instrumentation_arm64 $${0}$$ $${6.69}$$ < $${6.92}$$ $${+0}$$ $${2.73}$$ < $${3.09}$$
docker_dogstatsd_amd64 $${+0}$$ $${38.8}$$ < $${39.38}$$ $${+0}$$ $${15.02}$$ < $${15.82}$$
docker_dogstatsd_arm64 $${0}$$ $${37.13}$$ < $${37.94}$$ $${+0}$$ $${14.34}$$ < $${14.83}$$
dogstatsd_deb_amd64 $${0}$$ $${30.02}$$ < $${30.61}$$ $${-0}$$ $${7.94}$$ < $${8.79}$$
dogstatsd_deb_arm64 $${0}$$ $${28.18}$$ < $${29.11}$$ $${-0}$$ $${6.82}$$ < $${7.71}$$
dogstatsd_rpm_amd64 $${0}$$ $${30.02}$$ < $${30.61}$$ $${+0}$$ $${7.95}$$ < $${8.8}$$
dogstatsd_suse_amd64 $${0}$$ $${30.02}$$ < $${30.61}$$ $${+0}$$ $${7.95}$$ < $${8.8}$$
iot_agent_deb_amd64 $${0}$$ $${42.97}$$ < $${43.29}$$ $${+0}$$ $${11.25}$$ < $${12.04}$$
iot_agent_deb_arm64 $${0}$$ $${40.09}$$ < $${40.92}$$ $${-0}$$ $${9.62}$$ < $${10.45}$$
iot_agent_deb_armhf $${0}$$ $${40.67}$$ < $${41.03}$$ $${-0}$$ $${9.81}$$ < $${10.62}$$
iot_agent_rpm_amd64 $${0}$$ $${42.97}$$ < $${43.29}$$ $${+0}$$ $${11.27}$$ < $${12.06}$$
iot_agent_suse_amd64 $${0}$$ $${42.97}$$ < $${43.29}$$ $${+0}$$ $${11.27}$$ < $${12.06}$$

@cit-pr-commenter
Copy link

cit-pr-commenter bot commented Nov 20, 2025

Regression Detector

Regression Detector Results

Metrics dashboard
Target profiles
Run ID: 49a84cc4-c106-45da-8921-ec8715c3032b

Baseline: 4e6b4c9
Comparison: 90244eb
Diff

Optimization Goals: ✅ No significant changes detected

Experiments ignored for regressions

Regressions in experiments with settings containing erratic: true are ignored.

perf experiment goal Δ mean % Δ mean % CI trials links
docker_containers_cpu % cpu utilization -4.82 [-7.70, -1.94] 1 Logs

Fine details of change detection per experiment

perf experiment goal Δ mean % Δ mean % CI trials links
quality_gate_logs % cpu utilization +1.56 [+0.09, +3.03] 1 Logs bounds checks dashboard
quality_gate_metrics_logs memory utilization +0.84 [+0.64, +1.05] 1 Logs bounds checks dashboard
ddot_metrics_sum_cumulativetodelta_exporter memory utilization +0.40 [+0.17, +0.63] 1 Logs
tcp_syslog_to_blackhole ingress throughput +0.38 [+0.30, +0.46] 1 Logs
otlp_ingest_logs memory utilization +0.27 [+0.18, +0.37] 1 Logs
quality_gate_idle memory utilization +0.19 [+0.15, +0.23] 1 Logs bounds checks dashboard
otlp_ingest_metrics memory utilization +0.10 [-0.05, +0.25] 1 Logs
file_to_blackhole_100ms_latency egress throughput +0.06 [+0.02, +0.10] 1 Logs
file_tree memory utilization +0.01 [-0.04, +0.06] 1 Logs
uds_dogstatsd_to_api_v3 ingress throughput +0.01 [-0.12, +0.14] 1 Logs
tcp_dd_logs_filter_exclude ingress throughput +0.00 [-0.07, +0.08] 1 Logs
uds_dogstatsd_to_api ingress throughput -0.01 [-0.13, +0.12] 1 Logs
file_to_blackhole_500ms_latency egress throughput -0.01 [-0.38, +0.36] 1 Logs
file_to_blackhole_1000ms_latency egress throughput -0.03 [-0.45, +0.39] 1 Logs
ddot_logs memory utilization -0.03 [-0.11, +0.04] 1 Logs
file_to_blackhole_0ms_latency egress throughput -0.10 [-0.49, +0.29] 1 Logs
ddot_metrics memory utilization -0.10 [-0.31, +0.11] 1 Logs
quality_gate_idle_all_features memory utilization -0.11 [-0.15, -0.07] 1 Logs bounds checks dashboard
ddot_metrics_sum_cumulative memory utilization -0.15 [-0.31, +0.02] 1 Logs
ddot_metrics_sum_delta memory utilization -0.21 [-0.41, -0.01] 1 Logs
docker_containers_memory memory utilization -0.43 [-0.50, -0.35] 1 Logs
uds_dogstatsd_20mb_12k_contexts_20_senders memory utilization -0.50 [-0.56, -0.45] 1 Logs
docker_containers_cpu % cpu utilization -4.82 [-7.70, -1.94] 1 Logs

Bounds Checks: ✅ Passed

perf experiment bounds_check_name replicates_passed links
docker_containers_cpu simple_check_run 10/10
docker_containers_memory memory_usage 10/10
docker_containers_memory simple_check_run 10/10
file_to_blackhole_0ms_latency lost_bytes 10/10
file_to_blackhole_0ms_latency memory_usage 10/10
file_to_blackhole_1000ms_latency lost_bytes 10/10
file_to_blackhole_1000ms_latency memory_usage 10/10
file_to_blackhole_100ms_latency lost_bytes 10/10
file_to_blackhole_100ms_latency memory_usage 10/10
file_to_blackhole_500ms_latency lost_bytes 10/10
file_to_blackhole_500ms_latency memory_usage 10/10
quality_gate_idle intake_connections 10/10 bounds checks dashboard
quality_gate_idle memory_usage 10/10 bounds checks dashboard
quality_gate_idle_all_features intake_connections 10/10 bounds checks dashboard
quality_gate_idle_all_features memory_usage 10/10 bounds checks dashboard
quality_gate_logs intake_connections 10/10 bounds checks dashboard
quality_gate_logs lost_bytes 10/10 bounds checks dashboard
quality_gate_logs memory_usage 10/10 bounds checks dashboard
quality_gate_metrics_logs cpu_usage 10/10 bounds checks dashboard
quality_gate_metrics_logs intake_connections 10/10 bounds checks dashboard
quality_gate_metrics_logs lost_bytes 10/10 bounds checks dashboard
quality_gate_metrics_logs memory_usage 10/10 bounds checks dashboard

Explanation

Confidence level: 90.00%
Effect size tolerance: |Δ mean %| ≥ 5.00%

Performance changes are noted in the perf column of each table:

  • ✅ = significantly better comparison variant performance
  • ❌ = significantly worse comparison variant performance
  • ➖ = no significant change in performance

A regression test is an A/B test of target performance in a repeatable rig, where "performance" is measured as "comparison variant minus baseline variant" for an optimization goal (e.g., ingress throughput). Due to intrinsic variability in measuring that goal, we can only estimate its mean value for each experiment; we report uncertainty in that value as a 90.00% confidence interval denoted "Δ mean % CI".

For each experiment, we decide whether a change in performance is a "regression" -- a change worth investigating further -- if all of the following criteria are true:

  1. Its estimated |Δ mean %| ≥ 5.00%, indicating the change is big enough to merit a closer look.

  2. Its 90.00% confidence interval "Δ mean % CI" does not contain zero, indicating that if our statistical model is accurate, there is at least a 90.00% chance there is a difference in performance between baseline and comparison variants.

  3. Its configuration does not mark it "erratic".

CI Pass/Fail Decision

Passed. All Quality Gates passed.

  • quality_gate_idle, bounds check memory_usage: 10/10 replicas passed. Gate passed.
  • quality_gate_idle, bounds check intake_connections: 10/10 replicas passed. Gate passed.
  • quality_gate_metrics_logs, bounds check intake_connections: 10/10 replicas passed. Gate passed.
  • quality_gate_metrics_logs, bounds check cpu_usage: 10/10 replicas passed. Gate passed.
  • quality_gate_metrics_logs, bounds check memory_usage: 10/10 replicas passed. Gate passed.
  • quality_gate_metrics_logs, bounds check lost_bytes: 10/10 replicas passed. Gate passed.
  • quality_gate_logs, bounds check intake_connections: 10/10 replicas passed. Gate passed.
  • quality_gate_logs, bounds check memory_usage: 10/10 replicas passed. Gate passed.
  • quality_gate_logs, bounds check lost_bytes: 10/10 replicas passed. Gate passed.
  • quality_gate_idle_all_features, bounds check intake_connections: 10/10 replicas passed. Gate passed.
  • quality_gate_idle_all_features, bounds check memory_usage: 10/10 replicas passed. Gate passed.

// container image references from mutable tags to digests.
package imageresolver

func newDatadoghqRegistries(datadogRegistriesList []string) map[string]struct{} {
Copy link
Contributor Author

@erikayasuda erikayasuda Dec 18, 2025

Choose a reason for hiding this comment

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

Note: This is a duplicate of the one that already exists in the image_resolver.go file, but maintaining both until we move all relevant components under the imageresolver package

@erikayasuda erikayasuda changed the title Add imageresolver.Config to initialize ImageResolvers [APMLP-819] Add imageresolver.Config to initialize ImageResolvers Dec 18, 2025
Copy link
Member

@betterengineering betterengineering left a comment

Choose a reason for hiding this comment

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

Looks good! Thanks for refactoring! Feel free to address my comments in this change or as a follow up.

}

imageResolver := NewImageResolver(rcClient, datadogConfig)
imageResolver := NewImageResolver(imageresolver.NewConfig(datadogConfig, rcClient))
Copy link
Member

Choose a reason for hiding this comment

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

Isn't this nice that you only had to touch this here 👀

Comment on lines +38 to +39
MaxInitRetries: 5,
InitRetryDelay: 1 * time.Second,
Copy link
Member

Choose a reason for hiding this comment

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

Would love to see all of these configurable by ddConfig!

type Config struct {
Site string
DDRegistries map[string]struct{}
RCClient RemoteConfigClient
Copy link
Member

Choose a reason for hiding this comment

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

The client ultimately shouldn't be here. The config struct should be purely config. Dependencies should be passed in when you make an image resolver

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah that makes sense. My intent here was to add it in the imageresolver.Config since we know we want to remove it when we pivot to tag-based, so I wanted the changes to be in less places 😅

@github-actions github-actions bot added long review PR is complex, plan time to review it and removed medium review PR review might take time labels Dec 19, 2025
@erikayasuda
Copy link
Contributor Author

/merge

@dd-devflow-routing-codex
Copy link

dd-devflow-routing-codex bot commented Dec 22, 2025

View all feedbacks in Devflow UI.

2025-12-22 21:45:07 UTC ℹ️ Start processing command /merge


2025-12-22 21:45:15 UTC ℹ️ MergeQueue: waiting for PR to be ready

This pull request is not mergeable according to GitHub. Common reasons include pending required checks, missing approvals, or merge conflicts — but it could also be blocked by other repository rules or settings.
It will be added to the queue as soon as checks pass and/or get approvals.
Note: if you pushed new commits since the last approval, you may need additional approval.
You can remove it from the waiting list with /remove command.


2025-12-22 22:06:22 UTC ℹ️ MergeQueue: merge request added to the queue

The expected merge time in main is approximately 2h (p90).


2025-12-22 22:17:00 UTCMergeQueue: The build pipeline contains failing jobs for this merge request

Build pipeline has failing jobs for f91991e:

⚠️ Do NOT retry failed jobs directly (why?).

What to do next?

  • Investigate the failures and when ready, re-add your pull request to the queue!
  • If your PR checks are green, try to rebase/merge. It might be because the CI run is a bit old.
  • Any question, go check the FAQ.
Details

Since those jobs are not marked as being allowed to fail, the pipeline will most likely fail.
Therefore, and to allow other builds to be processed, this merge request has been rejected and the pipeline got canceled.

@erikayasuda
Copy link
Contributor Author

/merge

@dd-devflow-routing-codex
Copy link

dd-devflow-routing-codex bot commented Dec 22, 2025

View all feedbacks in Devflow UI.

2025-12-22 22:17:42 UTC ℹ️ Start processing command /merge


2025-12-22 22:17:48 UTC ℹ️ MergeQueue: pull request added to the queue

The expected merge time in main is approximately 2h (p90).


2025-12-22 22:26:59 UTCMergeQueue: The build pipeline contains failing jobs for this merge request

Build pipeline has failing jobs for c1b8901:

⚠️ Do NOT retry failed jobs directly (why?).

What to do next?

  • Investigate the failures and when ready, re-add your pull request to the queue!
  • If your PR checks are green, try to rebase/merge. It might be because the CI run is a bit old.
  • Any question, go check the FAQ.
Details

Since those jobs are not marked as being allowed to fail, the pipeline will most likely fail.
Therefore, and to allow other builds to be processed, this merge request has been rejected and the pipeline got canceled.

@erikayasuda
Copy link
Contributor Author

/merge

@dd-devflow-routing-codex
Copy link

dd-devflow-routing-codex bot commented Jan 7, 2026

View all feedbacks in Devflow UI.

2026-01-07 22:40:59 UTC ℹ️ Start processing command /merge


2026-01-07 22:41:03 UTC ℹ️ MergeQueue: pull request added to the queue

The expected merge time in main is approximately 1h (p90).


2026-01-07 22:59:58 UTC ℹ️ MergeQueue: This merge request was merged

@dd-mergequeue dd-mergequeue bot merged commit c425686 into main Jan 7, 2026
318 checks passed
@dd-mergequeue dd-mergequeue bot deleted the erikayasuda/imageresolver_config branch January 7, 2026 22:59
@github-actions github-actions bot added this to the 7.76.0 milestone Jan 7, 2026
gh-worker-dd-mergequeue-cf854d bot pushed a commit that referenced this pull request Jan 20, 2026
…ver` package (#45151)

### What does this PR do?
Continuing the refactor of the `ImageResolver` code into the `imageresolver` package for clear delineation of the code. See first part [here](#43308). Namely, the changes are:
- Moving `image_resolver.go` and `image_resolver_test.go` into `imageresolver/`
- Renaming functions and types to avoid stutter like `imageresolver.NewImageResolver(...)`
- Creating an `image.go` file to separate definitions representing images handled by the Resolvers
- Updating references outside of the `imageresolver` package to reflect the above changes

No functional changes are introduced by this PR, only refactor/clean up.

### Motivation
The original `imageresolver` code was hard to read, and the goal here is to make this easier to read and maintain for all repo contributors. This is also to help make future changes easier to implement along with the general refactor initiative for the autoinstrumentation cluster agent code.

### Describe how you validated your changes
Verified existing tests all pass.

### Additional Notes


Co-authored-by: erika.yasuda <erika.yasuda@datadoghq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/no-changelog No changelog entry needed long review PR is complex, plan time to review it qa/done QA done before merge and regressions are covered by tests team/container-platform The Container Platform Team team/injection-platform

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants