-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extend agent container initialisation logic (#4925)
* feat: implement container initialisation that chowns related paths and raises capabilities * doc: add changelog fragment * fix: update NOTICE.txt * fix: typo in container_init_test.go * feat: add more unit-tests to increase coverage * feat: utilise unix.Exec to re-exec elastic-agent when file capabilities are updated * fix: handle err from utils.HasRoot * fix: refactor skip-file-capabilities flag * fix: add cap_setpcap at elastic-agent binary * feat: make npm install work with elastic-agent user * fix: remove --skip-file-capabilities flag * fix: allow CAP_CHOWN in Ambient set * fix: remove redundant comment from Dockerfile.elastic-agent.tmpl * fix: remove IDE auto-corrections from NOTICE.txt * chore: go mod tidy after merge * feat: refactor to eliminate disrupting effects * fix: correct import order * fix: move logWarning inside container_init_linux.go * fix: update NOTICE.txt * fix: call initContainer before tryContainerLoadPaths for elastic-agent container * fix: revert npm installation changes in agent container image * fix: chown also symlinks * fix: introduce support for inside kubernetes tests * fix: permission for configuration configmap mount to support rootless agent * fix: code format * feat: revisit the runAsUser and runAsGroup in k8s test * fix: go mod tidy * fix: wrap errors in fmt.Errorf * fix: update NOTICE.txt * feat: add comments in container_init_linux.go * fix: adjust artifact_paths to extract all artifacts * fix: permission for configuration configmap mount to support rootless agent at base k8s files * fix: log stderr for k8s inner tests * fix: disable CGO for k8s inner tests * fix: merge conflicts * fix: permission for configuration configmap mount to support rootless agent at base k8s files * fix: improve logging the output of status command when elastic-agent doesn't report healthy * fix: revert back to pre-1.22 golang for loop to make linter happy * fix: don't set runAsGroup inside k8s tests for deployment with root and elastic-agent uid * fix: add DAC_READ_SEARCH capability in k8s tests for deployment with random uid and gid * fix: add comment to elaborate why call initContainer before tryContainerLoadPaths
- Loading branch information
1 parent
96b9388
commit 03b5d31
Showing
21 changed files
with
2,501 additions
and
324 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
32 changes: 32 additions & 0 deletions
32
changelog/fragments/1718273218-container-init-capabilities.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Kind can be one of: | ||
# - breaking-change: a change to previously-documented behavior | ||
# - deprecation: functionality that is being removed in a later release | ||
# - bug-fix: fixes a problem in a previous version | ||
# - enhancement: extends functionality but does not break or fix existing behavior | ||
# - feature: new functionality | ||
# - known-issue: problems that we are aware of in a given version | ||
# - security: impacts on the security of a product or a user’s deployment. | ||
# - upgrade: important information for someone upgrading from a prior version | ||
# - other: does not fit into any of the other categories | ||
kind: feature | ||
|
||
# Change summary; a 80ish characters long description of the change. | ||
summary: extend agent container initialisation to chown paths and raise capabilities for non-root | ||
|
||
# Long description; in case the summary is not enough to describe the change | ||
# this field accommodate a description without length limits. | ||
# NOTE: This field will be rendered only for breaking-change and known-issue kinds at the moment. | ||
#description: | ||
|
||
# Affected component; usually one of "elastic-agent", "fleet-server", "filebeat", "metricbeat", "auditbeat", "all", etc. | ||
component: elastic-agent | ||
|
||
# PR URL; optional; the PR number that added the changeset. | ||
# If not present is automatically filled by the tooling finding the PR where this changelog fragment has been added. | ||
# NOTE: the tooling supports backports, so it's able to fill the original PR number instead of the backport PR number. | ||
# Please provide it if you are adding a fragment for a different PR. | ||
pr: https://github.com/elastic/elastic-agent/pull/4925 | ||
|
||
# Issue URL; optional; the GitHub issue related to this changeset (either closes or is part of). | ||
# If not present is automatically filled by the tooling with the issue linked to the PR number. | ||
#issue: https://github.com/owner/repo/1234 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.