Skip to content

Reduce operator image chmod layers#3087

Merged
tbavelier merged 2 commits into
mainfrom
tbavelier/reduce-operator-image-size
Jun 4, 2026
Merged

Reduce operator image chmod layers#3087
tbavelier merged 2 commits into
mainfrom
tbavelier/reduce-operator-image-size

Conversation

@tbavelier

@tbavelier tbavelier commented Jun 4, 2026

Copy link
Copy Markdown
Member

What

Use COPY --chmod in the operator image runtime stage instead of copying files and changing permissions in separate RUN chmod layers.

Why

The separate chmod commands rewrote large files into new layers, duplicating /helpers, /yaml-mapper, /readsecret.sh, and license files in the final image.

Validation

  • make docker-build-ci IMG=tbdatadog/operator:main-chmod-test GOARCH=arm64
  • dive --ci tbdatadog/operator:main-chmod-test

Result:

╰─❯ docker images tbdatadog/operator
                                                                                                                                                      i Info →   U  In Use
IMAGE                                ID             DISK USAGE   CONTENT SIZE   EXTRA
tbdatadog/operator:main              40dacd9fcc78        221MB         52.3MB
tbdatadog/operator:main-chmod-test   63cb8e21465a        170MB         39.5MB
  • dive efficiency improved from 0.7699 to 1.0:
╰─❯ CI=true dive tbdatadog/operator:main
  Using default CI config
Image Source: docker://tbdatadog/operator:main
Extracting image from docker-engine... (this can take a while for large images)
Analyzing image...
  efficiency: 76.9862 %
  wastedBytes: 76596908 bytes (77 MB)
  userWastedPercent: 54.0052 %
Inefficient Files:
Count  Wasted Space  File Path
    2         52 MB  /yaml-mapper
    2         24 MB  /helpers
    2         27 kB  /licenses/LICENSE-3rdparty.csv
    2         23 kB  /licenses/LICENSE
    2         560 B  /readsecret.sh
Results:
  FAIL: highestUserWastedPercent: too many bytes wasted, relative to the user bytes added (%-user-wasted-bytes=0.5400516648659988 > threshold=0.1)
  SKIP: highestWastedBytes: rule disabled
  FAIL: lowestEfficiency: image efficiency is too low (efficiency=0.769861641423005 < threshold=0.9)
Result:FAIL [Total:3] [Passed:0] [Failed:2] [Warn:0] [Skipped:1]

╭─ ~/dd/datadog-operator tbavelier/re…r-image-size                                                                                                         3.12  16:13:36
╰─❯ CI=true dive tbdatadog/operator:main-chmod-test
  Using default CI config
Image Source: docker://tbdatadog/operator:main-chmod-test
Extracting image from docker-engine... (this can take a while for large images)
Analyzing image...
  efficiency: 100.0000 %
  wastedBytes: 0 bytes (0 B)
  userWastedPercent: 0.0000 %
Inefficient Files:
Count  Wasted Space  File Path
None
Results:
  PASS: highestUserWastedPercent
  SKIP: highestWastedBytes: rule disabled
  PASS: lowestEfficiency
Result:PASS [Total:3] [Passed:2] [Failed:0] [Warn:0] [Skipped:1]

@tbavelier tbavelier added this to the v1.28.0 milestone Jun 4, 2026
@tbavelier
tbavelier marked this pull request as ready for review June 4, 2026 14:12
@tbavelier
tbavelier requested a review from a team June 4, 2026 14:12
@codecov-commenter

codecov-commenter commented Jun 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 43.64%. Comparing base (e62a2b2) to head (b76c5fd).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #3087   +/-   ##
=======================================
  Coverage   43.64%   43.64%           
=======================================
  Files         350      350           
  Lines       30075    30075           
=======================================
  Hits        13125    13125           
  Misses      16079    16079           
  Partials      871      871           
Flag Coverage Δ
unittests 43.64% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e62a2b2...b76c5fd. Read the comment docs.

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

@datadog-prod-us1-3

datadog-prod-us1-3 Bot commented Jun 4, 2026

Copy link
Copy Markdown

Pipelines  Code Coverage

Fix all issues with BitsAI

⚠️ Warnings

🚦 1 Pipeline job failed

DataDog/datadog-operator | e2e: [1.25]   View in Datadog   GitLab

See error Failed to acquire the dpkg frontend lock due to another process holding it while installing the amazon-ecr-credential-helper.

ℹ️ Info

🎯 Code Coverage (details)
Patch Coverage: 100.00%
Overall Coverage: 43.96% (+0.00%)

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: b76c5fd | Docs | Datadog PR Page | Give us feedback!

@tbavelier
tbavelier merged commit 0ec9665 into main Jun 4, 2026
43 of 44 checks passed
@tbavelier
tbavelier deleted the tbavelier/reduce-operator-image-size branch June 4, 2026 15:43
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.

3 participants