-
Notifications
You must be signed in to change notification settings - Fork 148
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
Fix elastic-agent cloud image run issues #1630
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# 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: bug-fix | ||
|
||
# Change summary; a 80ish characters long description of the change. | ||
summary: fix runtime path setup when run in container mode | ||
|
||
# Long description; in case the summary is not enough to describe the change | ||
# this field accommodate a description without length limits. | ||
#description: | ||
|
||
# Affected component; a word indicating the component this changeset affects. | ||
component: cmd/container.go | ||
|
||
# PR number; 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: 1630 | ||
|
||
# Issue number; 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: 1234 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,9 +40,9 @@ import ( | |
const ( | ||
requestRetrySleepEnv = "KIBANA_REQUEST_RETRY_SLEEP" | ||
maxRequestRetriesEnv = "KIBANA_REQUEST_RETRY_COUNT" | ||
defaultRequestRetrySleep = "1s" // sleep 1 sec between retries for HTTP requests | ||
defaultMaxRequestRetries = "30" // maximum number of retries for HTTP requests | ||
defaultStateDirectory = "/usr/share/elastic-agent/state" // directory that will hold the state data | ||
defaultRequestRetrySleep = "1s" // sleep 1 sec between retries for HTTP requests | ||
defaultMaxRequestRetries = "30" // maximum number of retries for HTTP requests | ||
defaultStateDirectory = "/usr/share/elastic-agent" // directory that will hold the state data | ||
) | ||
|
||
var ( | ||
|
@@ -766,13 +766,12 @@ func setPaths(statePath, configPath, logsPath string, writePaths bool) error { | |
if statePath == "" { | ||
statePath = defaultStateDirectory | ||
} | ||
topPath := filepath.Join(statePath, "data") | ||
configPath = envWithDefault(configPath, "CONFIG_PATH") | ||
if configPath == "" { | ||
configPath = statePath | ||
} | ||
// ensure that the directory and sub-directory data exists | ||
if err := os.MkdirAll(topPath, 0755); err != nil { | ||
if err := os.MkdirAll(statePath, 0755); err != nil { | ||
return fmt.Errorf("preparing STATE_PATH(%s) failed: %w", statePath, err) | ||
} | ||
// ensure that the elastic-agent.yml exists in the state directory or if given in the config directory | ||
|
@@ -789,10 +788,9 @@ func setPaths(statePath, configPath, logsPath string, writePaths bool) error { | |
} | ||
originalInstall := paths.Install() | ||
originalTop := paths.Top() | ||
paths.SetTop(topPath) | ||
paths.SetTop(statePath) | ||
paths.SetConfig(configPath) | ||
// when custom top path is provided the home directory is not versioned | ||
paths.SetVersionHome(false) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm curious to know what this does (I expect we need Michal or Blake to answer this). It's a bit hard to tell from the code. As far as I can tell in the container I built, the home path is versioned by default. I get There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yah, this just adds the |
||
|
||
// install path stays on container default mount (otherwise a bind mounted directory could have noexec set) | ||
paths.SetInstall(originalInstall) | ||
// set LOGS_PATH is given | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is here probably to share state across runs. have mounted volume.
this PR fixes the problem but i don't believe it's proper fix and will introduce another set of issues.
i believe proper fix would be to fix not just
data/downloads
but alsodata/components
will prepare PR on monday and test it as well