datadog-agent
datadog-agent copied to clipboard
Set the run_dir /opt/datadog-agent/run group writable
What does this PR do?
Set the run_dir /opt/datadog-agent/run group writable
Motivation
When I run the datadog-agent container as user dd-agent (UID:100), I found errors like this due to permission issue on /opt/datadog-agent/run:
2024-02-08 20:24:35.130,2024-02-08 20:24:35 UTC | CORE | ERROR | (pkg/util/installinfo/install_info.go:134 in logVersionHistoryToFile) | Cannot write json file: /opt/datadog-agent/run/version-history.json open /opt/datadog-agent/run/version-history.json: permission denied,datadog-ecs/datadog-agent/bd1ce4ab59a04cfe88154bcd500df82b,123456789012:my-cluster-datadog
2024-02-08 20:24:34.346,2024-02-08 20:24:34 UTC | CORE | ERROR | (cmd/agent/subcommands/run/command.go:432 in startAgent) | Failed to initialize config management service: open /opt/datadog-agent/run/remote-config.db: permission denied,datadog-ecs/datadog-agent/bd1ce4ab59a04cfe88154bcd500df82b,123456789012:my-cluster-datadog
2024-02-08 20:24:00.311,2024-02-08 20:24:00 UTC | CORE | ERROR | (pkg/util/installinfo/install_info.go:134 in logVersionHistoryToFile) | Cannot write json file: /opt/datadog-agent/run/version-history.json open /opt/datadog-agent/run/version-history.json: permission denied,datadog-ecs/datadog-agent/393ec259321e489d901e44e544918bfb,123456789012:my-cluster-datadog
2024-02-08 20:23:59.906,2024-02-08 20:23:59 UTC | CORE | ERROR | (cmd/agent/subcommands/run/command.go:432 in startAgent) | Failed to initialize config management service: open /opt/datadog-agent/run/remote-config.db: permission denied,datadog-ecs/datadog-agent/393ec259321e489d901e44e544918bfb,123456789012:my-cluster-datadog
2024-02-08 20:23:38.318,2024-02-08 20:23:38 UTC | CORE | ERROR | (pkg/util/installinfo/install_info.go:134 in logVersionHistoryToFile) | Cannot write json file: /opt/datadog-agent/run/version-history.json open /opt/datadog-agent/run/version-history.json: permission denied,datadog-ecs/datadog-agent/2729bed525a743c2b74b6dba8446d0f9,123456789012:my-cluster-datadog
Setting it to group writable in the Dockerfile.
Describe how to test/QA your changes
Build a new docker image and configure to run it as regular user dd-agent (UID:100).
Reviewer's Checklist
- [ ] If known, an appropriate milestone has been selected; otherwise the
Triagemilestone is set. - [ ] Use the
major_changelabel if your change either has a major impact on the code base, is impacting multiple teams or is changing important well-established internals of the Agent. This label will be use during QA to make sure each team pay extra attention to the changed behavior. For any customer facing change use a releasenote. - [ ] A release note has been added or the
changelog/no-changeloglabel has been applied. - [ ] Changed code has automated tests for its functionality.
- [ ] Adequate QA/testing plan information is provided. Except if the
qa/skip-qalabel, with required eitherqa/doneorqa/no-code-changelabels, are applied. - [ ] At least one
team/..label has been applied, indicating the team(s) that should QA this change. - [ ] If applicable, docs team has been notified or an issue has been opened on the documentation repo.
- [ ] If applicable, the
need-change/operatorandneed-change/helmlabels have been applied. - [ ] If applicable, the
k8s/<min-version>label, indicating the lowest Kubernetes version compatible with this feature. - [ ] If applicable, the config template has been updated.
Can I get another review?
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 45.41%. Comparing base (
680baa2) to head (d2730d5).
:exclamation: Current head d2730d5 differs from pull request most recent head 6e61679
Please upload reports for the commit 6e61679 to get more accurate results.
Additional details and impacted files
@@ Coverage Diff @@
## main #22720 +/- ##
==========================================
+ Coverage 36.93% 45.41% +8.47%
==========================================
Files 3069 2108 -961
Lines 342046 251334 -90712
==========================================
- Hits 126338 114141 -12197
+ Misses 205876 128011 -77865
+ Partials 9832 9182 -650
| Flag | Coverage Δ | |
|---|---|---|
| centos_x86_64 | ? |
|
| ubuntu_x86_64 | 45.41% <ø> (+8.48%) |
:arrow_up: |
Flags with carried forward coverage won't be shown. Click here to find out more.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.