Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
45a664e
Add allowlist of output types for agentless
jen-huang Jan 9, 2025
2def436
Restrict list of outputs in policy editor when in agentless mode
jen-huang Jan 9, 2025
48e4613
Enable data output selection for agentless policies, restrict to `ela…
jen-huang Jan 10, 2025
fcb2687
Merge remote-tracking branch 'upstream/main' into feat/agentless-outputs
jen-huang Jan 13, 2025
8da6fef
Merge remote-tracking branch 'upstream/main' into feat/agentless-outputs
jen-huang Jan 16, 2025
bac1430
Check output type on update package policy API
jen-huang Jan 16, 2025
935ad0f
Prevent non-local ES outputs from being waterfalled to agentless poli…
jen-huang Jan 21, 2025
a032823
Merge remote-tracking branch 'upstream/main' into feat/agentless-outputs
jen-huang Jan 21, 2025
817c04b
Minimize changes to allowed output type helpers, add tests
jen-huang Jan 21, 2025
4c619a5
Add UI test
jen-huang Jan 21, 2025
2a91dfb
Add tests for output service
jen-huang Jan 21, 2025
87f4ffc
Merge remote-tracking branch 'upstream/main' into feat/agentless-outputs
jen-huang Jan 21, 2025
37dfbe8
Add API integration tests
jen-huang Jan 21, 2025
66b48ca
Fix navigation from create integration page
jen-huang Jan 21, 2025
4715640
Block creating agentless integration if default output is non-local ES
jen-huang Jan 21, 2025
b7c1f58
Merge remote-tracking branch 'upstream/main' into feat/agentless-outputs
jen-huang Jan 22, 2025
c40f636
Fix util test
jen-huang Jan 22, 2025
739e053
Fix api tests
jen-huang Jan 22, 2025
5de6feb
Add logging to troubleshoot test
jen-huang Jan 22, 2025
223d55b
[CI] Auto-commit changed files from 'node scripts/capture_oas_snapsho…
kibanamachine Jan 22, 2025
08550a1
[CI] Auto-commit changed files from 'make api-docs'
kibanamachine Jan 22, 2025
e64a6d0
Adjust debugging, try setting up fleet server before
jen-huang Jan 23, 2025
0affeb3
Merge branch 'feat/agentless-outputs' of github.com:jen-huang/kibana …
jen-huang Jan 23, 2025
02d8e58
PR feedback, make reset output ID more specific
jen-huang Jan 23, 2025
feb3ca5
Fix switching between agent-based/agentless and new hosts/existing hosts
jen-huang Jan 23, 2025
1122242
Add more debugging for api test
jen-huang Jan 23, 2025
494e676
Merge remote-tracking branch 'upstream/main' into feat/agentless-outputs
jen-huang Jan 23, 2025
8e8d4d9
Fix bug and test
jen-huang Jan 23, 2025
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,270 changes: 2,190 additions & 1,080 deletions oas_docs/bundle.json

Large diffs are not rendered by default.

3,270 changes: 2,190 additions & 1,080 deletions oas_docs/bundle.serverless.json

Large diffs are not rendered by default.

2,118 changes: 1,368 additions & 750 deletions oas_docs/output/kibana.serverless.yaml

Large diffs are not rendered by default.

2,118 changes: 1,368 additions & 750 deletions oas_docs/output/kibana.yaml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,16 @@

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

import { outputType } from './output';

export const AGENTLESS_AGENT_POLICY_INACTIVITY_TIMEOUT = 3600;
export const AGENTLESS_AGENT_POLICY_MONITORING: MonitoringType = ['logs', 'metrics'];
export const AGENTLESS_GLOBAL_TAG_NAME_ORGANIZATION = 'organization';
export const AGENTLESS_GLOBAL_TAG_NAME_DIVISION = 'division';
export const AGENTLESS_GLOBAL_TAG_NAME_TEAM = 'team';

// Allowed output types for agentless integrations
export const AGENTLESS_ALLOWED_OUTPUT_TYPES = [outputType.Elasticsearch];

// Input types to disable for agentless integrations
export const AGENTLESS_DISABLED_INPUTS = ['tcp', 'udp', 'filestream', 'http_endpoint', 'winlog'];
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export {
mapPackageReleaseToIntegrationCardRelease,
} from './package_prerelease';

export { getAllowedOutputTypeForPolicy } from './output_helpers';
export { getAllowedOutputTypesForAgentPolicy } from './output_helpers';
export { agentStatusesToSummary } from './agent_statuses_to_summary';

export {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,29 @@
import { load } from 'js-yaml';

import {
getAllowedOutputTypeForPolicy,
getAllowedOutputTypesForAgentPolicy,
outputYmlIncludesReservedPerformanceKey,
} from './output_helpers';

describe('getAllowedOutputTypeForPolicy', () => {
describe('getAllowedOutputTypesForAgentPolicy', () => {
it('should return all available output type for an agent policy without APM and Fleet Server', () => {
const res = getAllowedOutputTypeForPolicy({
const res = getAllowedOutputTypesForAgentPolicy({
package_policies: [
{
package: { name: 'nginx' },
},
],
} as any);

expect(res).toHaveLength(4);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: could be nice to test it contains all the expected

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

expect(res).toContain('elasticsearch');
expect(res).toContain('logstash');
expect(res).toContain('kafka');
expect(res).toContain('remote_elasticsearch');
});

it('should return only elasticsearch for an agent policy with APM', () => {
const res = getAllowedOutputTypeForPolicy({
const res = getAllowedOutputTypesForAgentPolicy({
package_policies: [
{
package: { name: 'apm' },
Expand All @@ -39,7 +42,7 @@ describe('getAllowedOutputTypeForPolicy', () => {
});

it('should return only elasticsearch for an agent policy with Fleet Server', () => {
const res = getAllowedOutputTypeForPolicy({
const res = getAllowedOutputTypesForAgentPolicy({
package_policies: [
{
package: { name: 'fleet_server' },
Expand All @@ -49,6 +52,32 @@ describe('getAllowedOutputTypeForPolicy', () => {

expect(res).toEqual(['elasticsearch']);
});

it('should return only elasticsearch for an agentless agent policy', () => {
const res = getAllowedOutputTypesForAgentPolicy({ supports_agentless: true } as any);

expect(res).toEqual(['elasticsearch']);
});
});

describe('getAllowedOutputTypesForPackagePolicy', () => {
it('should return all available output type for a package policy without agentless support', () => {
const res = getAllowedOutputTypesForAgentPolicy({
package_policies: [
{
package: { name: 'nginx' },
},
],
} as any);

expect(res).toHaveLength(4);
});

it('should return only elasticsearch for a package policy with agentless support', () => {
const res = getAllowedOutputTypesForAgentPolicy({ supports_agentless: true } as any);

expect(res).toEqual(['elasticsearch']);
});
});

describe('outputYmlIncludesReservedPerformanceKey', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ import { isObject } from 'lodash';

import { getFlattenedObject } from '@kbn/std';

import type { AgentPolicy, OutputType, ValueOf } from '../types';
import type { AgentPolicy, PackagePolicy, OutputType, ValueOf } from '../types';
import {
FLEET_APM_PACKAGE,
FLEET_SERVER_PACKAGE,
FLEET_SYNTHETICS_PACKAGE,
outputType,
OUTPUT_TYPES_WITH_PRESET_SUPPORT,
RESERVED_CONFIG_YML_KEYS,
AGENTLESS_ALLOWED_OUTPUT_TYPES,
} from '../constants';

const sameClusterRestrictedPackages = [
Expand All @@ -29,7 +30,7 @@ const sameClusterRestrictedPackages = [
* Return allowed output type for a given agent policy,
* Fleet Server and APM cannot use anything else than same cluster ES
*/
export function getAllowedOutputTypeForPolicy(agentPolicy: AgentPolicy): string[] {
export function getAllowedOutputTypesForAgentPolicy(agentPolicy: Partial<AgentPolicy>): string[] {
const isRestrictedToSameClusterES =
agentPolicy.package_policies &&
agentPolicy.package_policies.some(
Expand All @@ -40,14 +41,33 @@ export function getAllowedOutputTypeForPolicy(agentPolicy: AgentPolicy): string[
return [outputType.Elasticsearch];
}

if (agentPolicy.supports_agentless) {
return AGENTLESS_ALLOWED_OUTPUT_TYPES;
}

return Object.values(outputType);
}

export function getAllowedOutputTypesForIntegration(packageName: string): string[] {
const isRestrictedToSameClusterES = sameClusterRestrictedPackages.includes(packageName);
/**
* Return allowed output type for a given package policy
*/
export function getAllowedOutputTypesForPackagePolicy(
packagePolicy: Pick<PackagePolicy, 'supports_agentless'>
): string[] {
if (packagePolicy.supports_agentless) {
return AGENTLESS_ALLOWED_OUTPUT_TYPES;
}

if (isRestrictedToSameClusterES) {
return [outputType.Elasticsearch];
return Object.values(outputType);
}

export function getAllowedOutputTypesForIntegration(packageName?: string): string[] {
if (packageName) {
const isRestrictedToSameClusterES = sameClusterRestrictedPackages.includes(packageName);

if (isRestrictedToSameClusterES) {
return [outputType.Elasticsearch];
}
}

return Object.values(outputType);
Expand Down
Loading