Skip to content
This repository has been archived by the owner on Sep 17, 2024. It is now read-only.

chore: use preconfigured policy for fleet-server's default policy #2111

Merged
merged 3 commits into from
Feb 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
13 changes: 13 additions & 0 deletions cli/config/compose/profiles/fleet/default/kibana.config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,16 @@ xpack.fleet.agents.fleet_server.hosts: ["http://fleet-server:8220"]

xpack.encryptedSavedObjects.encryptionKey: "12345678901234567890123456789012"
xpack.fleet.agents.tlsCheckDisabled: true

xpack.fleet.packages:
- name: fleet_server
version: latest
xpack.fleet.agentPolicies:
- name: Fleet Server policy
id: fleet-server-policy
description: Fleet server policy
namespace: default
package_policies:
- name: Fleet Server
package:
name: fleet_server
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ xpack.fleet.outputs:
type: "elasticsearch"
id: "output-123"
hosts: ["http://elasticsearch:9200"]
xpack.fleet.packages:
- name: fleet_server
version: latest
xpack.fleet.agentPolicies:
- name: Test preconfigured policy
id: "test-preconfigured"
Expand All @@ -32,3 +35,11 @@ xpack.fleet.agentPolicies:
- package:
name: system
name: sytem-1
- name: Fleet Server policy
id: fleet-server-policy
description: Fleet server policy
namespace: default
package_policies:
- name: Fleet Server
package:
name: fleet_server
11 changes: 6 additions & 5 deletions e2e/_suites/fleet/fleet.go
Original file line number Diff line number Diff line change
Expand Up @@ -651,12 +651,13 @@ func bootstrapFleet(ctx context.Context, env map[string]string) error {
}).Fatal("Fleet could not be recreated")
}

fleetServicePolicy, err := kibanaClient.GetDefaultPolicy(ctx, true)
if err != nil {
log.WithFields(log.Fields{
"error": err,
}).Fatal("Could not get Fleet Server's default policy")
// these values comes from the kibana.config.yml file at Fleet's profile dir
fleetServicePolicy := kibana.Policy{
ID: "fleet-server-policy",
Name: "Fleet Server Policy",
Description: "Fleet Server policy",
}

log.WithFields(log.Fields{
"id": fleetServicePolicy.ID,
"name": fleetServicePolicy.Name,
Expand Down
1 change: 1 addition & 0 deletions internal/kibana/policies.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ type Policy struct {
}

// GetDefaultPolicy gets the default policy or optionally the default fleet policy
// deprecated: will be removed in upcoming releases
func (c *Client) GetDefaultPolicy(ctx context.Context, fleetServer bool) (Policy, error) {
span, _ := apm.StartSpanOptions(ctx, "Getting default policy", "fleet.package-policies.get-default", apm.SpanOptions{
Parent: apm.SpanFromContext(ctx).TraceContext(),
Expand Down