Skip to content
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

[Elastic Agent] Fix picking correct policy id for fleet-server #25352

Merged
merged 7 commits into from
Apr 28, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion x-pack/elastic-agent/pkg/agent/cmd/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,10 +292,11 @@ func runContainerCmd(streams *cli.IOStreams, cmd *cobra.Command, cfg setupConfig
return err
}
}
policyID := ""
policyID := cfg.FleetServer.PolicyID
if policy != nil {
policyID = policy.ID
}
logInfo(streams, "Policy selected for enrollment: "+policyID+"\n")
cmdArgs, err := buildEnrollArgs(cfg, token, policyID)
if err != nil {
return err
Expand Down
45 changes: 45 additions & 0 deletions x-pack/elastic-agent/state/fleet-setup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Fleet enrollment of the elastic agent
fleet:
# Enroll the agent if not already enrolled
enroll: true
# Force the fleet setup and agent enrollment, although the agent is already enrolled
force: false
# Allow insecure connection to Kibana (insecure HTTP or un-verified HTTPS)
insecure: true
# Token name to use for fetching token from Kibana
#token_name: ""
# Token policy name to use for fetching token from Kibana
#token_policy_name: ""
# URL of the Fleet Server to enroll into;
#url: "https://${HOSTNAME}:8220"

# Start and run a Fleet Server along side this Elastic Agent
fleet_server:
# Enable to bootstrap Fleet Server
enable: true
# Fleet Server HTTP binding host (overrides the policy)
host: "0.0.0.0"
# expose Fleet Server over HTTP (not recommended; insecure)
#insecure_http: false
# policy ID for Fleet Server to use for itself ("Default Fleet Server policy" when undefined)
# the policy ID needs to be kept in sync with `xpack.fleet.agentPolicies` in the kibana.yml
policy_id: "5a12d34e-0162-4c2b-9f57-841bf90ffb02"
#policy_id: "elastic-agent-on-cloud"
# name of policy for the Fleet Server to use for itself
#policy_name: ""
# Fleet Server HTTP binding port (overrides the policy)
port: 8220

# This prepares the Fleet plugin that exists inside of Kibana. This must either be enabled here or
# done externally before Fleet Server will actually successfully start.
kibana:
fleet:
# enables the Fleet plugin
setup: true
host: http://localhost:5601
username: elastic
password: changeme

retry_sleep_duration: 10s
retry_max_count: 60