Skip to content

Commit dbcf8a3

Browse files
committed
removed unprivileged agent count, updated callout
1 parent 2b2fe93 commit dbcf8a3

10 files changed

Lines changed: 78 additions & 127 deletions

File tree

x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/multi_page_layout/components/page_steps/install_agent/install_agent_managed.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ export const InstallElasticAgentManagedPageStep: React.FC<InstallAgentPageProps>
8383
fleetServerHost,
8484
onCopy: () => setCommandCopied(true),
8585
rootIntegrations: getRootIntegrations(agentPolicy?.package_policies ?? []),
86-
unprivilegedAgentsCount: agentPolicy?.unprivileged_agents ?? 0,
8786
}),
8887
];
8988

x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/multi_page_layout/components/page_steps/install_agent/install_agent_standalone.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ export const InstallElasticAgentStandalonePageStep: React.FC<InstallAgentPagePro
114114
fullCopyButton: true,
115115
onCopy: () => setCommandCopied(true),
116116
rootIntegrations: getRootIntegrations(agentPolicy?.package_policies ?? []),
117-
unprivilegedAgentsCount: agentPolicy?.unprivileged_agents ?? 0,
118117
}),
119118
];
120119

x-pack/plugins/fleet/public/components/agent_enrollment_flyout/steps/compute_steps.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,6 @@ export const StandaloneSteps: React.FunctionComponent<InstructionProps> = ({
170170
isK8s,
171171
cloudSecurityIntegration,
172172
rootIntegrations: getRootIntegrations(selectedPolicy?.package_policies ?? []),
173-
unprivilegedAgentsCount: selectedPolicy?.unprivileged_agents ?? 0,
174173
})
175174
);
176175

@@ -313,7 +312,6 @@ export const ManagedSteps: React.FunctionComponent<InstructionProps> = ({
313312
fleetServerHost,
314313
enrollToken,
315314
rootIntegrations: getRootIntegrations(selectedPolicy?.package_policies ?? []),
316-
unprivilegedAgentsCount: selectedPolicy?.unprivileged_agents ?? 0,
317315
})
318316
);
319317
}

x-pack/plugins/fleet/public/components/agent_enrollment_flyout/steps/install_managed_agent_step.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ export const InstallManagedAgentStep = ({
3030
fullCopyButton,
3131
onCopy,
3232
rootIntegrations,
33-
unprivilegedAgentsCount,
3433
}: {
3534
selectedApiKeyId?: string;
3635
apiKeyData?: GetOneEnrollmentAPIKeyResponse | null;
@@ -43,7 +42,6 @@ export const InstallManagedAgentStep = ({
4342
fullCopyButton?: boolean;
4443
onCopy?: () => void;
4544
rootIntegrations?: Array<{ name: string; title: string }>;
46-
unprivilegedAgentsCount?: number;
4745
}): EuiContainedStepProps => {
4846
const nonCompleteStatus = selectedApiKeyId ? undefined : 'disabled';
4947
const status = isComplete ? 'complete' : nonCompleteStatus;
@@ -63,7 +61,6 @@ export const InstallManagedAgentStep = ({
6361
fullCopyButton={fullCopyButton}
6462
fleetServerHost={fleetServerHost}
6563
rootIntegrations={rootIntegrations}
66-
unprivilegedAgentsCount={unprivilegedAgentsCount}
6764
/>
6865
) : (
6966
<React.Fragment />

x-pack/plugins/fleet/public/components/agent_enrollment_flyout/steps/install_standalone_agent_step.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ export const InstallStandaloneAgentStep = ({
2424
fullCopyButton,
2525
onCopy,
2626
rootIntegrations,
27-
unprivilegedAgentsCount,
2827
}: {
2928
installCommand: CommandsByPlatform;
3029
isK8s?: K8sMode;
@@ -33,7 +32,6 @@ export const InstallStandaloneAgentStep = ({
3332
fullCopyButton?: boolean;
3433
onCopy?: () => void;
3534
rootIntegrations?: Array<{ name: string; title: string }>;
36-
unprivilegedAgentsCount?: number;
3735
}): EuiContainedStepProps => {
3836
return {
3937
title: i18n.translate('xpack.fleet.agentEnrollment.stepEnrollAndRunAgentTitle', {
@@ -48,7 +46,6 @@ export const InstallStandaloneAgentStep = ({
4846
fullCopyButton={fullCopyButton}
4947
isManaged={false}
5048
rootIntegrations={rootIntegrations}
51-
unprivilegedAgentsCount={unprivilegedAgentsCount}
5249
/>
5350
),
5451
status: isComplete ? 'complete' : undefined,

x-pack/plugins/fleet/public/components/enrollment_instructions/install_section.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { InstallationMessage } from '../agent_enrollment_flyout/installation_mes
1414
import type { K8sMode, CloudSecurityIntegration } from '../agent_enrollment_flyout/types';
1515
import { PlatformSelector } from '../platform_selector';
1616

17-
import { UnprivilegedCallout } from './unprivileged_callout';
17+
import { RootPrivilegesCallout } from './root_privileges_callout';
1818

1919
interface Props {
2020
installCommand: CommandsByPlatform;
@@ -26,7 +26,6 @@ interface Props {
2626
isManaged?: boolean;
2727
onCopy?: () => void;
2828
rootIntegrations?: Array<{ name: string; title: string }>;
29-
unprivilegedAgentsCount?: number;
3029
}
3130

3231
export const InstallSection: React.FunctionComponent<Props> = ({
@@ -39,15 +38,11 @@ export const InstallSection: React.FunctionComponent<Props> = ({
3938
isManaged = true,
4039
onCopy,
4140
rootIntegrations,
42-
unprivilegedAgentsCount,
4341
}) => {
4442
return (
4543
<>
4644
<InstallationMessage isK8s={isK8s} isManaged={isManaged} />
47-
<UnprivilegedCallout
48-
rootIntegrations={rootIntegrations}
49-
unprivilegedAgentsCount={unprivilegedAgentsCount}
50-
/>
45+
<RootPrivilegesCallout rootIntegrations={rootIntegrations} />
5146
<PlatformSelector
5247
fullCopyButton={fullCopyButton}
5348
onCopy={onCopy}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License
4+
* 2.0; you may not use this file except in compliance with the Elastic License
5+
* 2.0.
6+
*/
7+
8+
import React from 'react';
9+
10+
import { cleanup, waitFor } from '@testing-library/react';
11+
12+
import { createFleetTestRendererMock } from '../../mock';
13+
14+
import { RootPrivilegesCallout } from './root_privileges_callout';
15+
16+
describe('RootPrivilegesCallout', () => {
17+
function render(rootIntegrations?: Array<{ name: string; title: string }>) {
18+
cleanup();
19+
const renderer = createFleetTestRendererMock();
20+
const results = renderer.render(<RootPrivilegesCallout rootIntegrations={rootIntegrations} />);
21+
22+
return results;
23+
}
24+
25+
it('should render callout requiring root privileges', async () => {
26+
const renderResult = render([{ name: 'auditd_manager', title: 'Auditd Manager' }], 0);
27+
28+
await waitFor(() => {
29+
expect(renderResult.getByText('Root privileges required')).toBeInTheDocument();
30+
expect(renderResult.getByTestId('rootPrivilegesCallout').textContent).toContain(
31+
'This agent policy contains the following integrations that require Elastic Agents to have root privileges. To ensure that all data required by the integrations can be collected, enroll the agents using an account with root privileges.'
32+
);
33+
expect(renderResult.getByText('Auditd Manager')).toBeInTheDocument();
34+
});
35+
});
36+
});
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License
4+
* 2.0; you may not use this file except in compliance with the Elastic License
5+
* 2.0.
6+
*/
7+
8+
import React from 'react';
9+
import { EuiCallOut, EuiSpacer } from '@elastic/eui';
10+
import { i18n } from '@kbn/i18n';
11+
import { FormattedMessage } from '@kbn/i18n-react';
12+
13+
export const RootPrivilegesCallout: React.FC<{
14+
rootIntegrations?: Array<{ name: string; title: string }>;
15+
}> = ({ rootIntegrations = [] }) => {
16+
return rootIntegrations.length > 0 ? (
17+
<>
18+
<EuiCallOut
19+
color="warning"
20+
iconType="warning"
21+
title={i18n.translate('xpack.fleet.agentEnrollmentCallout.rootPrivilegesTitle', {
22+
defaultMessage: 'Root privileges required',
23+
})}
24+
data-test-subj="rootPrivilegesCallout"
25+
>
26+
<FormattedMessage
27+
id="xpack.fleet.agentEnrollmentCallout.rootPrivilegesMessage"
28+
defaultMessage="This agent policy contains the following integrations that require Elastic Agents to have root privileges.
29+
To ensure that all data required by the integrations can be collected, enroll the agents using an account with root privileges."
30+
/>
31+
<ul>
32+
{rootIntegrations.map((item) => (
33+
<li key={item.name}>{item.title}</li>
34+
))}
35+
</ul>
36+
</EuiCallOut>
37+
<EuiSpacer size="m" />
38+
</>
39+
) : null;
40+
};

x-pack/plugins/fleet/public/components/enrollment_instructions/unprivileged_callout.test.tsx

Lines changed: 0 additions & 60 deletions
This file was deleted.

x-pack/plugins/fleet/public/components/enrollment_instructions/unprivileged_callout.tsx

Lines changed: 0 additions & 50 deletions
This file was deleted.

0 commit comments

Comments
 (0)