Skip to content

Commit

Permalink
[Fleet] Add toggle for experimental synthetic _source support in Fl…
Browse files Browse the repository at this point in the history
…eet data streams (#140132)

* First pass at synthetic source support in Fleet

* Fix some type failures + clean up naming

* Fix more types

* Avoid needless PUTs to component templates when opt-in is unchanged

* Honor experimental data stream settings during dry-run/upgrade workflow

* Remove docs link for now

* Fix various bugs in logic/lookups + add tests

Co-authored-by: Kibana Machine <[email protected]>
  • Loading branch information
kpollich and kibanamachine authored Sep 12, 2022
1 parent fd424e6 commit cc5ff75
Show file tree
Hide file tree
Showing 13 changed files with 681 additions and 150 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
DeletePackagePoliciesResponse,
PackagePolicyInput,
} from '@kbn/fleet-plugin/common';
import { DeepReadonly } from 'utility-types';
import { createCspRuleSearchFilterByPackagePolicy } from '../../common/utils/helpers';
import {
CLOUDBEAT_VANILLA,
Expand Down Expand Up @@ -85,7 +86,7 @@ export const onPackagePolicyPostCreateCallback = async (
* Callback to handle deletion of PackagePolicies in Fleet
*/
export const removeCspRulesInstancesCallback = async (
deletedPackagePolicy: DeletePackagePoliciesResponse[number],
deletedPackagePolicy: DeepReadonly<DeletePackagePoliciesResponse[number]>,
soClient: ISavedObjectsRepository,
logger: Logger
): Promise<void> => {
Expand Down
13 changes: 13 additions & 0 deletions x-pack/plugins/fleet/common/types/models/epm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,14 @@ export type PackageInfo =
| Installable<Merge<RegistryPackage, EpmPackageAdditions>>
| Installable<Merge<ArchivePackage, EpmPackageAdditions>>;

// TODO - Expand this with other experimental indexing types
export type ExperimentalIndexingFeature = 'synthetic_source';

export interface ExperimentalDataStreamFeature {
data_stream: string;
features: Record<ExperimentalIndexingFeature, boolean>;
}

export interface Installation extends SavedObjectAttributes {
installed_kibana: KibanaAssetReference[];
installed_es: EsAssetReference[];
Expand All @@ -433,6 +441,11 @@ export interface Installation extends SavedObjectAttributes {
install_format_schema_version?: string;
verification_status: PackageVerificationStatus;
verification_key_id?: string | null;
// TypeScript doesn't like using the `ExperimentalDataStreamFeature` type defined above here
experimental_data_stream_features?: Array<{
data_stream: string;
features: Record<ExperimentalIndexingFeature, boolean>;
}>;
}

export interface PackageUsageStats {
Expand Down
3 changes: 3 additions & 0 deletions x-pack/plugins/fleet/common/types/models/package_policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@
* 2.0.
*/

import type { ExperimentalDataStreamFeature } from './epm';

export interface PackagePolicyPackage {
name: string;
title: string;
version: string;
experimental_data_stream_features?: ExperimentalDataStreamFeature[];
}

export interface PackagePolicyConfigRecordEntry {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ export const PackagePolicyInputPanel: React.FunctionComponent<{
packagePolicy: NewPackagePolicy;
packageInputStreams: Array<RegistryStream & { data_stream: { dataset: string; type: string } }>;
packagePolicyInput: NewPackagePolicyInput;
updatePackagePolicy: (updatedPackagePolicy: Partial<NewPackagePolicy>) => void;
updatePackagePolicyInput: (updatedInput: Partial<NewPackagePolicyInput>) => void;
inputValidationResults: PackagePolicyInputValidationResults;
forceShowErrors?: boolean;
Expand All @@ -85,6 +86,7 @@ export const PackagePolicyInputPanel: React.FunctionComponent<{
packageInputStreams,
packagePolicyInput,
packagePolicy,
updatePackagePolicy,
updatePackagePolicyInput,
inputValidationResults,
forceShowErrors,
Expand Down Expand Up @@ -236,6 +238,7 @@ export const PackagePolicyInputPanel: React.FunctionComponent<{
packagePolicy={packagePolicy}
packageInputStream={packageInputStream}
packagePolicyInputStream={packagePolicyInputStream!}
updatePackagePolicy={updatePackagePolicy}
updatePackagePolicyInputStream={(
updatedStream: Partial<PackagePolicyInputStream>
) => {
Expand Down
Loading

0 comments on commit cc5ff75

Please sign in to comment.