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

[Fleet] Make default integration install explicit #121628

Merged
merged 119 commits into from
Feb 1, 2022
Merged
Show file tree
Hide file tree
Changes from 112 commits
Commits
Show all changes
119 commits
Select commit Hold shift + click to select a range
fd1deba
first draft
juliaElastic Dec 20, 2021
666cb42
Merge branch 'main' into feat-remove-default-pkgs
juliaElastic Dec 20, 2021
4312eac
added new text with badge
juliaElastic Dec 20, 2021
5f7ee9a
updated labels
juliaElastic Dec 20, 2021
d80039a
added tabs
juliaElastic Dec 20, 2021
8ccfe99
fix checks
juliaElastic Dec 20, 2021
8249dd4
ignore tests
juliaElastic Dec 20, 2021
5c28e7b
fix i18n
juliaElastic Dec 20, 2021
d187ff9
Merge branch 'main' into feat-remove-default-pkgs
juliaElastic Dec 29, 2021
23de22c
use max instead of sort
juliaElastic Dec 29, 2021
a453c20
Add agent and Fleet server policy
juliaElastic Dec 29, 2021
be86eb5
fix bug with monitoring checkbox
juliaElastic Dec 30, 2021
0eca9f6
fix test
juliaElastic Dec 30, 2021
b0d476f
skip test
juliaElastic Dec 30, 2021
fef2032
fixed validation
juliaElastic Dec 30, 2021
1264ffc
fixed fleet server policy install and missing enrollment keys
juliaElastic Dec 30, 2021
3bafb80
fixed test
juliaElastic Dec 31, 2021
d9611bf
fixed test
juliaElastic Dec 31, 2021
9383a7d
cypress tests
juliaElastic Dec 31, 2021
a0dc73b
Merge branch 'main' into feat-remove-default-pkgs
kibanamachine Dec 31, 2021
9f18b8f
fix test
juliaElastic Dec 31, 2021
2ae5d47
Merge branch 'feat-remove-default-pkgs' of https://github.com/juliaEl…
juliaElastic Dec 31, 2021
8728d1e
added is_default, fixed test
juliaElastic Jan 4, 2022
8833d02
Merge branch 'main' into feat-remove-default-pkgs
kibanamachine Jan 4, 2022
c9fd581
fix cypress
juliaElastic Jan 4, 2022
b4f12b5
cypress fix
juliaElastic Jan 4, 2022
2d7cbdf
added missing link
juliaElastic Jan 5, 2022
6176a4a
removed is_default, default from naming
juliaElastic Jan 5, 2022
01ad43c
fix tests
juliaElastic Jan 5, 2022
7d9fa31
revert osquery change
juliaElastic Jan 5, 2022
854d2ad
changes in cypress fleet server start
juliaElastic Jan 5, 2022
c04eba2
fix fleet enroll and cypress
juliaElastic Jan 6, 2022
92bae14
Merge branch 'main' into feat-remove-default-pkgs
kibanamachine Jan 6, 2022
95faa50
fixed add agent flyout when fleet agent unenrolled
juliaElastic Jan 6, 2022
a742327
fix tests
juliaElastic Jan 6, 2022
6078869
existing hosts no policy selected when more than one
juliaElastic Jan 6, 2022
3ff1f80
updated openapi spec
juliaElastic Jan 6, 2022
1f03ecd
refactor and unit test for increment policy name
juliaElastic Jan 6, 2022
3d34f05
fix checks
juliaElastic Jan 6, 2022
d75d554
fix jest
juliaElastic Jan 10, 2022
5ba4f3a
Merge branch 'main' into feat-remove-default-pkgs
kibanamachine Jan 10, 2022
d25eb2a
fix tests
juliaElastic Jan 10, 2022
eb3ca36
using fleet-server-policy id for first
juliaElastic Jan 10, 2022
cb87b56
fixed refresh after policy created, removed toast
juliaElastic Jan 10, 2022
633693d
fixed smaller review comments
juliaElastic Jan 10, 2022
a7aa263
added missing catch
juliaElastic Jan 10, 2022
5ac31c1
changed to bulk install
juliaElastic Jan 10, 2022
95b7dfb
moved service logic from handler, measuring time in cypress
juliaElastic Jan 10, 2022
fb73010
fcypress comment out fleet server enroll
juliaElastic Jan 11, 2022
89a1d6b
cypress fix
juliaElastic Jan 11, 2022
b2beb39
cypress fix
juliaElastic Jan 11, 2022
c4a81ab
changed toast to callout
juliaElastic Jan 11, 2022
45e6994
changed toast to callout
juliaElastic Jan 11, 2022
52edebc
removed label
juliaElastic Jan 11, 2022
cdcbef9
fix checks, added more tests
juliaElastic Jan 11, 2022
63eff1b
fix test
juliaElastic Jan 11, 2022
ea3e3ba
Merge branch 'main' into feat-remove-default-pkgs
juliaElastic Jan 12, 2022
50bd3a0
fix checks
juliaElastic Jan 12, 2022
8a5aea2
added more cypress asserts
juliaElastic Jan 12, 2022
e90f55f
fix checks
juliaElastic Jan 12, 2022
343e5c2
refactored agent policy create and select
juliaElastic Jan 12, 2022
6cfbab2
update label
juliaElastic Jan 12, 2022
ec66136
fix checks, hide badges for fleet server policy
juliaElastic Jan 13, 2022
2bb3c89
added back is_default flags
juliaElastic Jan 13, 2022
0e5750f
added fleet server specific confirm message to delete policy modal
juliaElastic Jan 13, 2022
02be154
added unit tests for agent_policy_create logic
juliaElastic Jan 13, 2022
c027024
Merge branch 'main' into feat-remove-default-pkgs
juliaElastic Jan 13, 2022
d1c5539
fixed condition to show fleet server instructions
juliaElastic Jan 13, 2022
41a4c4d
fixed tests
juliaElastic Jan 13, 2022
5d318ad
fixed jumping
juliaElastic Jan 13, 2022
fdf9919
fixed bug where add integration stayed invalid when going back to new…
juliaElastic Jan 14, 2022
d08c0fc
fix tests
juliaElastic Jan 14, 2022
39e1edf
Merge branch 'main' into feat-remove-default-pkgs
juliaElastic Jan 14, 2022
f4ed727
fix tests
juliaElastic Jan 14, 2022
e39794a
show invalid if policy not selected
juliaElastic Jan 14, 2022
1b3e5e9
resolved conflict
juliaElastic Jan 14, 2022
d1f67a2
add missing texts
juliaElastic Jan 14, 2022
a0fdb13
fix radio groups when fleet server instructions are rendered twice
juliaElastic Jan 14, 2022
cf2444c
fix test, fixed bug where fleet server policy was not filtered out
juliaElastic Jan 14, 2022
34caedd
fixed add integration from agent policy
juliaElastic Jan 14, 2022
8bae9a5
fixed add integration to agent policy navigation
juliaElastic Jan 14, 2022
5eec441
Merge branch 'main' into feat-remove-default-pkgs
kibanamachine Jan 17, 2022
601d0ec
fixed cypress
juliaElastic Jan 17, 2022
3d9c044
added cypress test for policy add integration
juliaElastic Jan 17, 2022
5e102e9
added cypress test for upgrade integration without policy and upgrade…
juliaElastic Jan 17, 2022
0d23701
added unit test for policy select empty default
juliaElastic Jan 18, 2022
643d4aa
added cypress test for update outputs, settings
juliaElastic Jan 18, 2022
1ca8d91
added cypress test for update agent policy
juliaElastic Jan 18, 2022
cbebb62
added cypress test for update package policy
juliaElastic Jan 18, 2022
0767d35
added cypress test for install package without policy
juliaElastic Jan 18, 2022
12dca7d
fix checks and test
juliaElastic Jan 18, 2022
ee7baa8
removed create link from existing hosts tab
juliaElastic Jan 19, 2022
969fb95
Merge branch 'main' into feat-remove-default-pkgs
kibanamachine Jan 19, 2022
979d374
fixed checks
juliaElastic Jan 19, 2022
b3a3fb1
updated deprecation, throw error and rollback if package policy failed
juliaElastic Jan 19, 2022
f579d32
Merge branch 'main' into feat-remove-default-pkgs
juliaElastic Jan 20, 2022
2faa013
fix formatting
juliaElastic Jan 20, 2022
f676146
fix test
juliaElastic Jan 20, 2022
eccf4b7
documented dependent projects
juliaElastic Jan 20, 2022
1152cd6
Merge branch 'main' into feat-remove-default-pkgs
kibanamachine Jan 24, 2022
5219ea1
cypress speed up
juliaElastic Jan 24, 2022
520aba7
added back integration uninstall
juliaElastic Jan 24, 2022
986f4f8
cypress further speed up
juliaElastic Jan 24, 2022
33fd898
fix checks
juliaElastic Jan 24, 2022
5b6e72d
resolve conflicts with main
juliaElastic Jan 25, 2022
ffc1597
Update x-pack/plugins/fleet/public/components/agent_enrollment_flyout…
juliaElastic Jan 26, 2022
2f9f7e8
review fixes
juliaElastic Jan 26, 2022
e82240c
aria label and onSubmit refactor
juliaElastic Jan 26, 2022
62c5f23
agent policy validation test
juliaElastic Jan 26, 2022
f2c373a
renamed to getFleetServerAgentPolicyId
juliaElastic Jan 27, 2022
fd62227
Merge branch 'main' into feat-remove-default-pkgs
kibanamachine Jan 27, 2022
68bd12a
fixed cypress test
juliaElastic Jan 27, 2022
9d42aec
Merge branch 'main' into feat-remove-default-pkgs
kibanamachine Jan 31, 2022
ac8a0ff
Merge branch 'main' into feat-remove-default-pkgs
kibanamachine Jan 31, 2022
247c279
fixed package policy error message condition
juliaElastic Jan 31, 2022
809d192
Merge branch 'main' into feat-remove-default-pkgs
juliaElastic Feb 1, 2022
ce5de0c
fixed import
juliaElastic Feb 1, 2022
511c236
fixed authz
juliaElastic Feb 1, 2022
a8ed804
fix cypress
juliaElastic Feb 1, 2022
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
12 changes: 12 additions & 0 deletions x-pack/plugins/fleet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,15 @@ $ yarn storybook fleet
```

Write stories by creating `.stories.tsx` files colocated with the components you're working on. Consult the [Storybook docs](https://storybook.js.org/docs/react/get-started/introduction) for more information.

## Dependent applications using Fleet

The projects below are dependent on Fleet, most using Fleet API as well. In case of breaking changes in Fleet functionality/API, the project owners have to be notified to make sure they can plan for the necessary changes on their end to avoid unexpected break in functionality.

* [Elastic Agent](https://github.com/elastic/beats/blob/master/x-pack/elastic-agent): uses Fleet API to enroll agents. [See here](https://github.com/elastic/beats/blob/master/x-pack/elastic-agent/pkg/agent/cmd/container.go)
* [Fleet Server](https://github.com/elastic/fleet-server): uses Fleet API to enroll fleet server [See here](https://github.com/elastic/fleet-server/blob/master/cmd/fleet/router.go)
* [elastic-package](https://github.com/elastic/elastic-package): command line tool, uses Fleet with docker compose and Fleet API [See here](https://github.com/elastic/elastic-package/tree/master/internal/kibana)
* [Azure VM extension](https://github.com/elastic/azure-vm-extension): automation tool for Azure VMs, uses Fleet API to enroll agents [See here](https://github.com/elastic/azure-vm-extension/blob/main/src/handler/windows/scripts/enable.ps1)
* [e2e-testing](https://github.com/elastic/e2e-testing): internal project that runs Fleet and tests Fleet API [See here](https://github.com/elastic/e2e-testing/tree/main/internal/kibana)
* [observability-test-environments](https://github.com/elastic/observability-test-environments): internal project, uses Fleet API [See here](https://github.com/elastic/observability-test-environments/blob/master/ansible/tasks-fleet-config.yml)
* [ECK](https://github.com/elastic/cloud-on-k8s): Elastic Cloud on Kubernetes, orchestrates Elastic Stack applications, including Kibana with Fleet (no direct dependency, has examples that include Fleet config) [See here](https://github.com/elastic/cloud-on-k8s/blob/main/docs/orchestrating-elastic-stack-applications/agent-fleet.asciidoc)
22 changes: 3 additions & 19 deletions x-pack/plugins/fleet/common/constants/epm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,9 @@ export const STANDALONE_RUN_INSTRUCTIONS_WINDOWS = '.\\elastic-agent.exe install

/*
Package rules:
| | unremovablePackages | defaultPackages | autoUpdatePackages |
|---------------|:---------------------:|:---------------:|:------------------:|
| Removable | ❌ | ✔️ | ✔️ |
| Auto-installs | ❌ | ✔️ | ❌ |
| Auto-updates | ❌ | ✔️ | ✔️ |

`endpoint` is a special package. It needs to autoupdate, it needs to _not_ be
removable, but it doesn't install by default. Following the table, it needs to
be in `unremovablePackages` and in `autoUpdatePackages`, but not in
`defaultPackages`.
| | autoUpdatePackages |
|---------------|:------------------:|
| Auto-updates | ✔️ |


We also define "auto upgrade policies" packages below. These are packages that are considered "stack-aligned"
Expand All @@ -42,15 +35,6 @@ in their custom policy editor implementations.

*/

export const unremovablePackages = [
FLEET_SYSTEM_PACKAGE,
FLEET_ELASTIC_AGENT_PACKAGE,
FLEET_SERVER_PACKAGE,
FLEET_ENDPOINT_PACKAGE,
];

export const defaultPackages = unremovablePackages.filter((p) => p !== FLEET_ENDPOINT_PACKAGE);

export const autoUpdatePackages = [
FLEET_ENDPOINT_PACKAGE,
FLEET_APM_PACKAGE,
Expand Down
71 changes: 2 additions & 69 deletions x-pack/plugins/fleet/common/constants/preconfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,8 @@
*/

import { uniqBy } from 'lodash';
import uuidv5 from 'uuid/v5';

import type { PreconfiguredAgentPolicy } from '../types';

import {
defaultPackages,
FLEET_SYSTEM_PACKAGE,
FLEET_SERVER_PACKAGE,
autoUpdatePackages,
monitoringTypes,
autoUpgradePoliciesPackages,
} from './epm';
import { autoUpdatePackages, autoUpgradePoliciesPackages } from './epm';

// UUID v5 values require a namespace. We use UUID v5 for some of our preconfigured ID values.
export const UUID_V5_NAMESPACE = 'dde7c2de-1370-4c19-9975-b473d0e03508';
Expand All @@ -27,63 +17,6 @@ export const PRECONFIGURATION_DELETION_RECORD_SAVED_OBJECT_TYPE =

export const PRECONFIGURATION_LATEST_KEYWORD = 'latest';

type PreconfiguredAgentPolicyWithDefaultInputs = Omit<
PreconfiguredAgentPolicy,
'package_policies'
> & {
package_policies: Array<Omit<PreconfiguredAgentPolicy['package_policies'][0], 'inputs'>>;
};

export const DEFAULT_AGENT_POLICY_ID_SEED = 'default-agent-policy';
export const DEFAULT_SYSTEM_PACKAGE_POLICY_ID = 'default-system-policy';

export const DEFAULT_AGENT_POLICY: PreconfiguredAgentPolicyWithDefaultInputs = {
id: uuidv5(DEFAULT_AGENT_POLICY_ID_SEED, UUID_V5_NAMESPACE),
name: 'Default policy',
namespace: 'default',
description: 'Default agent policy created by Kibana',
package_policies: [
{
id: DEFAULT_SYSTEM_PACKAGE_POLICY_ID,
name: `${FLEET_SYSTEM_PACKAGE}-1`,
package: {
name: FLEET_SYSTEM_PACKAGE,
},
},
],
is_default: true,
is_managed: false,
monitoring_enabled: monitoringTypes,
};

export const DEFAULT_FLEET_SERVER_POLICY_ID = 'default-fleet-server-agent-policy';
export const DEFAULT_FLEET_SERVER_AGENT_POLICY_ID_SEED = 'default-fleet-server';

export const DEFAULT_FLEET_SERVER_AGENT_POLICY: PreconfiguredAgentPolicyWithDefaultInputs = {
id: uuidv5(DEFAULT_FLEET_SERVER_AGENT_POLICY_ID_SEED, UUID_V5_NAMESPACE),
name: 'Default Fleet Server policy',
namespace: 'default',
description: 'Default Fleet Server agent policy created by Kibana',
package_policies: [
{
id: DEFAULT_FLEET_SERVER_POLICY_ID,
name: `${FLEET_SERVER_PACKAGE}-1`,
package: {
name: FLEET_SERVER_PACKAGE,
},
},
],
is_default: false,
is_default_fleet_server: true,
is_managed: false,
monitoring_enabled: monitoringTypes,
};

export const DEFAULT_PACKAGES = defaultPackages.map((name) => ({
name,
version: PRECONFIGURATION_LATEST_KEYWORD,
}));

export const AUTO_UPDATE_PACKAGES = autoUpdatePackages.map((name) => ({
name,
version: PRECONFIGURATION_LATEST_KEYWORD,
Expand All @@ -97,7 +30,7 @@ export const AUTO_UPGRADE_POLICIES_PACKAGES = autoUpgradePoliciesPackages.map((n

// Controls whether the `Keep Policies up to date` setting is exposed to the user
export const KEEP_POLICIES_UP_TO_DATE_PACKAGES = uniqBy(
[...AUTO_UPGRADE_POLICIES_PACKAGES, ...DEFAULT_PACKAGES, ...AUTO_UPDATE_PACKAGES],
[...AUTO_UPGRADE_POLICIES_PACKAGES, ...AUTO_UPDATE_PACKAGES],
({ name }) => name
);

Expand Down
7 changes: 6 additions & 1 deletion x-pack/plugins/fleet/common/openapi/bundled.json
Original file line number Diff line number Diff line change
Expand Up @@ -3002,9 +3002,14 @@
]
},
"is_default": {
"type": "boolean"
"type": "boolean",
"deprecated": true
},
"is_default_fleet_server": {
"type": "boolean",
"deprecated": true
},
"has_fleet_server": {
"type": "boolean"
},
"data_output_id": {
Expand Down
4 changes: 4 additions & 0 deletions x-pack/plugins/fleet/common/openapi/bundled.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1850,8 +1850,12 @@ components:
- type: number
is_default:
type: boolean
deprecated: true
is_default_fleet_server:
type: boolean
deprecated: true
has_fleet_server:
type: boolean
joshdover marked this conversation as resolved.
Show resolved Hide resolved
data_output_id:
type: string
monitoring_output_id:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,12 @@ properties:
- type: number
is_default:
type: boolean
deprecated: true
is_default_fleet_server:
type: boolean
deprecated: true
has_fleet_server:
type: boolean
data_output_id:
type: string
monitoring_output_id:
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/fleet/common/types/models/agent_policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export interface NewAgentPolicy {
description?: string;
is_default?: boolean;
is_default_fleet_server?: boolean; // Optional when creating a policy
has_fleet_server?: boolean;
is_managed?: boolean; // Optional when creating a policy
monitoring_enabled?: MonitoringType;
unenroll_timeout?: number;
Expand Down
Loading