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

[APM] Fleet support for merging input.config values with other nested properties in the policy input #101690

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ export function getPackagePolicyWithAgentConfigurations(
{
...firstInput,
config: {
...firstInput.config,
[APM_SERVER]: {
value: {
...apmServerValue,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import type { PackagePolicy, FullAgentPolicyInput, FullAgentPolicyInputStream } from '../types';
import { DEFAULT_OUTPUT } from '../constants';
import { merge } from 'lodash';

export const storedPackagePoliciesToAgentInputs = (
packagePolicies: PackagePolicy[]
Expand All @@ -31,10 +32,6 @@ export const storedPackagePoliciesToAgentInputs = (
namespace: packagePolicy.namespace || 'default',
},
use_output: DEFAULT_OUTPUT.name,
...Object.entries(input.config || {}).reduce((acc, [key, { value }]) => {
acc[key] = value;
return acc;
}, {} as { [k: string]: any }),
...(input.compiled_input || {}),
...(input.streams.length
? {
Expand All @@ -56,6 +53,14 @@ export const storedPackagePoliciesToAgentInputs = (
: {}),
};

merge(
Copy link
Contributor

Choose a reason for hiding this comment

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

could you add a comment explaining this logic?

fullInput,
Object.entries(input.config || {}).reduce(
(acc, [key, { value }]) => ({ ...acc, [key]: value }),
{}
)
);

if (packagePolicy.package) {
fullInput.meta = {
package: {
Expand Down