Skip to content

Commit

Permalink
[Fleet] Use multiple saved object type for agent and package policies…
Browse files Browse the repository at this point in the history
… with opt-in migration (#189387)
  • Loading branch information
nchaulet authored Aug 14, 2024
1 parent 2077468 commit 708fcd2
Show file tree
Hide file tree
Showing 96 changed files with 2,243 additions and 655 deletions.
60 changes: 59 additions & 1 deletion packages/kbn-check-mappings-update-cli/current_fields.json
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,36 @@
"token",
"valid_until"
],
"fleet-agent-policies": [
"advanced_settings",
"agent_features",
"agent_features.enabled",
"agent_features.name",
"data_output_id",
"description",
"download_source_id",
"fleet_server_host_id",
"global_data_tags",
"inactivity_timeout",
"is_default",
"is_default_fleet_server",
"is_managed",
"is_preconfigured",
"is_protected",
"keep_monitoring_alive",
"monitoring_enabled",
"monitoring_output_id",
"name",
"namespace",
"overrides",
"revision",
"schema_version",
"status",
"supports_agentless",
"unenroll_timeout",
"updated_at",
"updated_by"
],
"fleet-fleet-server-host": [
"host_urls",
"is_default",
Expand All @@ -469,6 +499,32 @@
"proxy_id"
],
"fleet-message-signing-keys": [],
"fleet-package-policies": [
"created_at",
"created_by",
"description",
"elasticsearch",
"enabled",
"inputs",
"is_managed",
"name",
"namespace",
"output_id",
"overrides",
"package",
"package.name",
"package.requires_root",
"package.title",
"package.version",
"policy_id",
"policy_ids",
"revision",
"secret_references",
"secret_references.id",
"updated_at",
"updated_by",
"vars"
],
"fleet-preconfiguration-deletion-record": [
"id"
],
Expand Down Expand Up @@ -651,7 +707,9 @@
"has_seen_add_data_notice",
"output_secret_storage_requirements_met",
"prerelease_integrations_enabled",
"secret_storage_requirements_met"
"secret_storage_requirements_met",
"use_space_awareness_migration_started_at",
"use_space_awareness_migration_status"
],
"inventory-view": [],
"kql-telemetry": [],
Expand Down
182 changes: 182 additions & 0 deletions packages/kbn-check-mappings-update-cli/current_mappings.json
Original file line number Diff line number Diff line change
Expand Up @@ -1553,6 +1553,99 @@
}
}
},
"fleet-agent-policies": {
"properties": {
"advanced_settings": {
"index": false,
"type": "flattened"
},
"agent_features": {
"properties": {
"enabled": {
"type": "boolean"
},
"name": {
"type": "keyword"
}
}
},
"data_output_id": {
"type": "keyword"
},
"description": {
"type": "text"
},
"download_source_id": {
"type": "keyword"
},
"fleet_server_host_id": {
"type": "keyword"
},
"global_data_tags": {
"index": false,
"type": "flattened"
},
"inactivity_timeout": {
"type": "integer"
},
"is_default": {
"type": "boolean"
},
"is_default_fleet_server": {
"type": "boolean"
},
"is_managed": {
"type": "boolean"
},
"is_preconfigured": {
"type": "keyword"
},
"is_protected": {
"type": "boolean"
},
"keep_monitoring_alive": {
"type": "boolean"
},
"monitoring_enabled": {
"index": false,
"type": "keyword"
},
"monitoring_output_id": {
"type": "keyword"
},
"name": {
"type": "keyword"
},
"namespace": {
"type": "keyword"
},
"overrides": {
"index": false,
"type": "flattened"
},
"revision": {
"type": "integer"
},
"schema_version": {
"type": "version"
},
"status": {
"type": "keyword"
},
"supports_agentless": {
"type": "boolean"
},
"unenroll_timeout": {
"type": "integer"
},
"updated_at": {
"type": "date"
},
"updated_by": {
"type": "keyword"
}
}
},
"fleet-fleet-server-host": {
"properties": {
"host_urls": {
Expand Down Expand Up @@ -1581,6 +1674,87 @@
"dynamic": false,
"properties": {}
},
"fleet-package-policies": {
"properties": {
"created_at": {
"type": "date"
},
"created_by": {
"type": "keyword"
},
"description": {
"type": "text"
},
"elasticsearch": {
"dynamic": false,
"properties": {}
},
"enabled": {
"type": "boolean"
},
"inputs": {
"dynamic": false,
"properties": {}
},
"is_managed": {
"type": "boolean"
},
"name": {
"type": "keyword"
},
"namespace": {
"type": "keyword"
},
"output_id": {
"type": "keyword"
},
"overrides": {
"index": false,
"type": "flattened"
},
"package": {
"properties": {
"name": {
"type": "keyword"
},
"requires_root": {
"type": "boolean"
},
"title": {
"type": "keyword"
},
"version": {
"type": "keyword"
}
}
},
"policy_id": {
"type": "keyword"
},
"policy_ids": {
"type": "keyword"
},
"revision": {
"type": "integer"
},
"secret_references": {
"properties": {
"id": {
"type": "keyword"
}
}
},
"updated_at": {
"type": "date"
},
"updated_by": {
"type": "keyword"
},
"vars": {
"type": "flattened"
}
}
},
"fleet-preconfiguration-deletion-record": {
"properties": {
"id": {
Expand Down Expand Up @@ -2168,6 +2342,14 @@
},
"secret_storage_requirements_met": {
"type": "boolean"
},
"use_space_awareness_migration_started_at": {
"index": false,
"type": "date"
},
"use_space_awareness_migration_status": {
"index": false,
"type": "keyword"
}
}
},
Expand Down
3 changes: 3 additions & 0 deletions packages/kbn-test/src/kbn_client/kbn_client_saved_objects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,13 @@ const STANDARD_LIST_TYPES = [
'infrastructure-monitoring-log-view',
'apm-indices',
// Fleet saved object types
'ingest_manager_settings',
'ingest-outputs',
'ingest-download-sources',
'ingest-agent-policies',
'fleet-agent-policies',
'ingest-package-policies',
'fleet-package-policies',
'epm-packages',
'epm-packages-assets',
'fleet-preconfiguration-deletion-record',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,10 @@ describe('checking migration metadata changes on all registered SO types', () =>
"file": "6b65ae5899b60ebe08656fd163ea532e557d3c98",
"file-upload-usage-collection-telemetry": "06e0a8c04f991e744e09d03ab2bd7f86b2088200",
"fileShare": "5be52de1747d249a221b5241af2838264e19aaa1",
"fleet-agent-policies": "f57d3b70e4175a19a18f18ee72a379ceec82e1fc",
"fleet-fleet-server-host": "69be15f6b6f2a2875ad3c7050ddea7a87f505417",
"fleet-message-signing-keys": "93421f43fed2526b59092a4e3c65d64bc2266c0f",
"fleet-package-policies": "2f4d524adb49a5281d3af0b66bb3003ba0ff2e44",
"fleet-preconfiguration-deletion-record": "c52ea1e13c919afe8a5e8e3adbb7080980ecc08e",
"fleet-proxy": "6cb688f0d2dd856400c1dbc998b28704ff70363d",
"fleet-setup-lock": "0dc784792c79b5af5a6e6b5dcac06b0dbaa90bde",
Expand All @@ -120,7 +122,7 @@ describe('checking migration metadata changes on all registered SO types', () =>
"ingest-download-sources": "279a68147e62e4d8858c09ad1cf03bd5551ce58d",
"ingest-outputs": "daafff49255ab700e07491376fe89f04fc998b91",
"ingest-package-policies": "53a94064674835fdb35e5186233bcd7052eabd22",
"ingest_manager_settings": "91445219e7115ff0c45d1dabd5d614a80b421797",
"ingest_manager_settings": "e794576a05d19dd5306a1e23cbb82c09bffabd65",
"inventory-view": "b8683c8e352a286b4aca1ab21003115a4800af83",
"kql-telemetry": "93c1d16c1a0dfca9c8842062cf5ef8f62ae401ad",
"legacy-url-alias": "9b8cca3fbb2da46fd12823d3cd38fdf1c9f24bc8",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ const previouslyRegisteredTypes = [
'file-upload-usage-collection-telemetry',
'fleet-agent-actions',
'fleet-agent-events',
'fleet-agent-policies',
'fleet-package-policies',
'fleet-agents',
'fleet-enrollment-api-keys',
'fleet-fleet-server-host',
Expand Down
4 changes: 3 additions & 1 deletion x-pack/plugins/fleet/common/constants/agent_policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
* 2.0.
*/

export const AGENT_POLICY_SAVED_OBJECT_TYPE = 'ingest-agent-policies';
export const LEGACY_AGENT_POLICY_SAVED_OBJECT_TYPE = 'ingest-agent-policies';
export const AGENT_POLICY_SAVED_OBJECT_TYPE = 'fleet-agent-policies';

export const AGENT_POLICY_INDEX = '.fleet-policies';
export const agentPolicyStatuses = {
Active: 'active',
Expand Down
4 changes: 3 additions & 1 deletion x-pack/plugins/fleet/common/constants/package_policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
* 2.0.
*/

export const PACKAGE_POLICY_SAVED_OBJECT_TYPE = 'ingest-package-policies';
export const LEGACY_PACKAGE_POLICY_SAVED_OBJECT_TYPE = 'ingest-package-policies';

export const PACKAGE_POLICY_SAVED_OBJECT_TYPE = 'fleet-package-policies';

export const PACKAGE_POLICY_DEFAULT_INDEX_PRIVILEGES = ['auto_configure', 'create_doc'];

Expand Down
3 changes: 2 additions & 1 deletion x-pack/plugins/fleet/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ export {
FLEET_ENDPOINT_PACKAGE,
// Saved object type
AGENT_POLICY_SAVED_OBJECT_TYPE,
LEGACY_AGENT_POLICY_SAVED_OBJECT_TYPE,
PACKAGES_SAVED_OBJECT_TYPE,
PACKAGE_POLICY_SAVED_OBJECT_TYPE,
LEGACY_PACKAGE_POLICY_SAVED_OBJECT_TYPE as PACKAGE_POLICY_SAVED_OBJECT_TYPE,
OUTPUT_SAVED_OBJECT_TYPE,
PRECONFIGURATION_DELETION_RECORD_SAVED_OBJECT_TYPE,
ASSETS_SAVED_OBJECT_TYPE,
Expand Down
3 changes: 3 additions & 0 deletions x-pack/plugins/fleet/common/types/models/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ export interface BaseSettings {

export interface Settings extends BaseSettings {
id: string;
version?: string;
preconfigured_fields?: Array<'fleet_server_hosts'>;
secret_storage_requirements_met?: boolean;
output_secret_storage_requirements_met?: boolean;
use_space_awareness_migration_status?: 'pending' | 'success' | 'error';
use_space_awareness_migration_started_at?: string | null;
}
1 change: 1 addition & 0 deletions x-pack/plugins/fleet/common/types/rest_spec/fleet_setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@ export interface GetFleetStatusResponse {
>;
missing_optional_features: Array<'encrypted_saved_object_encryption_key_required'>;
package_verification_key_id?: string;
is_space_awareness_enabled?: boolean;
is_secrets_storage_enabled?: boolean;
}
Loading

0 comments on commit 708fcd2

Please sign in to comment.