Skip to content

Commit

Permalink
[Fleet] remove enabled feature flags (elastic#206448)
Browse files Browse the repository at this point in the history
## Summary

Closes elastic#190844

Removed feature flags enabled by default, deleted conditionals where not
needed.
  • Loading branch information
juliaElastic authored and viduni94 committed Jan 23, 2025
1 parent e0a4045 commit 1775ddb
Show file tree
Hide file tree
Showing 59 changed files with 683 additions and 1,289 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,8 @@
export type ExperimentalFeatures = typeof allowedExperimentalValues;

const _allowedExperimentalValues = {
createPackagePolicyMultiPageLayout: true,
packageVerification: true,
diagnosticFileUploadEnabled: true,
displayAgentMetrics: true,
showIntegrationsSubcategories: true,
agentFqdnMode: true,
showExperimentalShipperOptions: false,
agentTamperProtectionEnabled: true,
secretsStorage: true,
kafkaOutput: true,
outputSecretsStorage: true,
remoteESOutput: true,
enableStrictKQLValidation: true,
subfeaturePrivileges: true,
advancedPolicySettings: true,
useSpaceAwareness: false,
enableReusableIntegrationPolicies: true,
asyncDeployPolicies: true,
enableExportCSV: true,
};

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ Fleet is in the process to become space aware. This means that different Fleet o

## How to enable the feature

The feature is behind a feature flag `useSpaceAwareness`. If you are testing space awareness you could also be interested in testing `subfeaturePrivileges` at the same time which enables granular privileges to different parts of Fleet.
The feature is behind a feature flag `useSpaceAwareness`.

In your `kibana.yml` config

```yaml
xpack.fleet.enableExperimental: ['useSpaceAwareness', 'subfeaturePrivileges']
xpack.fleet.enableExperimental: ['useSpaceAwareness']
```
After the feature flag is enabled you will have to do another step to opt-in for the feature, that call will migrate the current space agnostic saved objects to new space aware saved objects.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ import { EnrollmentTokenListPage } from './sections/agents/enrollment_token_list
import { UninstallTokenListPage } from './sections/agents/uninstall_token_list_page';
import { SettingsApp } from './sections/settings';
import { DebugPage } from './sections/debug';
import { ExperimentalFeaturesService } from './services';
import { ErrorLayout, PermissionsError } from './layouts';

const FEEDBACK_URL = 'https://ela.st/fleet-feedback';
Expand Down Expand Up @@ -307,8 +306,6 @@ export const AppRoutes = memo(
const flyoutContext = useFlyoutContext();
const fleetStatus = useFleetStatus();

const { agentTamperProtectionEnabled } = ExperimentalFeaturesService.get();

const authz = useAuthz();

return (
Expand Down Expand Up @@ -364,21 +361,19 @@ export const AppRoutes = memo(
</AppLayout>
)}
</Route>
{agentTamperProtectionEnabled && (
<Route path={FLEET_ROUTING_PATHS.uninstall_tokens}>
{authz.fleet.allAgents ? (
<AppLayout setHeaderActionMenu={setHeaderActionMenu}>
<UninstallTokenListPage />
</AppLayout>
) : (
<AppLayout setHeaderActionMenu={setHeaderActionMenu}>
<ErrorLayout isAddIntegrationsPath={false}>
<PermissionsError error="MISSING_PRIVILEGES" requiredFleetRole="Agents All" />
</ErrorLayout>
</AppLayout>
)}
</Route>
)}
<Route path={FLEET_ROUTING_PATHS.uninstall_tokens}>
{authz.fleet.allAgents ? (
<AppLayout setHeaderActionMenu={setHeaderActionMenu}>
<UninstallTokenListPage />
</AppLayout>
) : (
<AppLayout setHeaderActionMenu={setHeaderActionMenu}>
<ErrorLayout isAddIntegrationsPath={false}>
<PermissionsError error="MISSING_PRIVILEGES" requiredFleetRole="Agents All" />
</ErrorLayout>
</AppLayout>
)}
</Route>
<Route path={FLEET_ROUTING_PATHS.data_streams}>
<AppLayout setHeaderActionMenu={setHeaderActionMenu}>
<DataStreamApp />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ import type { Section } from '../../sections';
import { useLink, useConfig, useAuthz, useStartServices } from '../../hooks';
import { WithHeaderLayout } from '../../../../layouts';

import { ExperimentalFeaturesService } from '../../services';

import { DefaultPageTitle } from './default_page_title';

interface Props {
Expand All @@ -32,8 +30,6 @@ export const DefaultLayout: React.FunctionComponent<Props> = ({
const { getHref } = useLink();
const { agents } = useConfig();
const authz = useAuthz();
const { agentTamperProtectionEnabled, subfeaturePrivileges } = ExperimentalFeaturesService.get();

const { docLinks } = useStartServices();
const granularPrivilegesCallout = useDismissableTour('GRANULAR_PRIVILEGES');

Expand Down Expand Up @@ -83,7 +79,7 @@ export const DefaultLayout: React.FunctionComponent<Props> = ({
isSelected: section === 'uninstall_tokens',
href: getHref('uninstall_tokens'),
'data-test-subj': 'fleet-uninstall-tokens-tab',
isHidden: !authz.fleet.allAgents || !agentTamperProtectionEnabled, // needed only for agentTamperProtectionEnabled feature flag
isHidden: !authz.fleet.allAgents,
},
{
name: (
Expand Down Expand Up @@ -115,7 +111,7 @@ export const DefaultLayout: React.FunctionComponent<Props> = ({

return (
<>
{!subfeaturePrivileges || !authz.fleet.all || granularPrivilegesCallout.isHidden ? null : (
{!authz.fleet.all || granularPrivilegesCallout.isHidden ? null : (
<EuiCallOut
size="s"
iconType="cheer"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
} from '../../../components';
import { FLEET_SERVER_PACKAGE } from '../../../constants';

import { policyHasFleetServer, ExperimentalFeaturesService } from '../../../services';
import { policyHasFleetServer } from '../../../services';

import { AgentUpgradeAgentModal } from '../../agents/components';

Expand Down Expand Up @@ -50,8 +50,6 @@ export const AgentPolicyActionMenu = memo<{
useState<boolean>(false);
const [isUpgradeAgentsModalOpen, setIsUpgradeAgentsModalOpen] = useState<boolean>(false);

const { agentTamperProtectionEnabled } = ExperimentalFeaturesService.get();

const isFleetServerPolicy = useMemo(
() =>
agentPolicy.package_policies?.some(
Expand Down Expand Up @@ -228,7 +226,6 @@ export const AgentPolicyActionMenu = memo<{

if (
authz.fleet.allAgents &&
agentTamperProtectionEnabled &&
!agentPolicy?.is_managed &&
!agentPolicy?.supports_agentless
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ import { UninstallCommandFlyout } from '../../../../../../components';

import type { ValidationResults } from '../agent_policy_validation';

import { ExperimentalFeaturesService } from '../../../../services';
import { useAgentPolicyFormContext } from '../agent_policy_form';
import { policyHasEndpointSecurity as hasElasticDefend } from '../../../../../../../common/services';

Expand Down Expand Up @@ -121,7 +120,6 @@ export const AgentPolicyAdvancedOptionsContent: React.FunctionComponent<Props> =
// agent monitoring checkbox group can appear multiple times in the DOM, ids have to be unique to work correctly
const monitoringCheckboxIdSuffix = Date.now();

const { agentTamperProtectionEnabled } = ExperimentalFeaturesService.get();
const licenseService = useLicense();
const [isUninstallCommandFlyoutOpen, setIsUninstallCommandFlyoutOpen] = useState(false);
const policyHasElasticDefend = useMemo(() => hasElasticDefend(agentPolicy), [agentPolicy]);
Expand Down Expand Up @@ -227,12 +225,7 @@ export const AgentPolicyAdvancedOptionsContent: React.FunctionComponent<Props> =
);

const AgentTamperProtectionSection = useMemo(() => {
if (
agentTamperProtectionEnabled &&
licenseService.isPlatinum() &&
!agentPolicy.is_managed &&
!agentPolicy.supports_agentless
) {
if (licenseService.isPlatinum() && !agentPolicy.is_managed && !agentPolicy.supports_agentless) {
if (AgentTamperProtectionWrapper) {
return (
<Suspense fallback={null}>
Expand All @@ -245,7 +238,6 @@ export const AgentPolicyAdvancedOptionsContent: React.FunctionComponent<Props> =
return AgentTamperProtectionSectionContent;
}
}, [
agentTamperProtectionEnabled,
licenseService,
agentPolicy.is_managed,
AgentTamperProtectionWrapper,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ import { useAuthz } from '../../../../../hooks';

import { ConfiguredSettings } from '../../../components/form_settings';

import { ExperimentalFeaturesService } from '../../../../../services';

import { AgentPolicyAdvancedOptionsContent } from './agent_policy_advanced_fields';
import { AgentPolicyGeneralFields } from './agent_policy_general_fields';
import { AgentPolicyFormSystemMonitoringCheckbox } from './agent_policy_system_monitoring_field';
Expand Down Expand Up @@ -74,8 +72,6 @@ export const AgentPolicyForm: React.FunctionComponent<Props> = ({
const authz = useAuthz();
const isDisabled = !authz.fleet.allAgentPolicies;

const { advancedPolicySettings } = ExperimentalFeaturesService.get();

const generalSettingsWrapper = (children: JSX.Element[]) => (
<EuiDescribedFormGroup
fullWidth
Expand Down Expand Up @@ -152,37 +148,6 @@ export const AgentPolicyForm: React.FunctionComponent<Props> = ({
updateAgentPolicy={updateAgentPolicy}
validation={validation}
/>

{advancedPolicySettings ? (
<>
<EuiSpacer size="xl" />

<EuiTitle>
<h3>
<FormattedMessage
id="xpack.fleet.agentPolicyForm.advancedSettingsTitle"
defaultMessage="Advanced settings"
/>
</h3>
</EuiTitle>
<EuiSpacer size="m" />
<ConfiguredSettings
configuredSettings={AGENT_POLICY_ADVANCED_SETTINGS}
disabled={isDisabled}
/>
</>
) : null}
</StyledEuiAccordion>
</>
) : (
<>
<AgentPolicyAdvancedOptionsContent
agentPolicy={agentPolicy}
updateAgentPolicy={updateAgentPolicy}
validation={validation}
disabled={isDisabled}
/>
{advancedPolicySettings ? (
<>
<EuiSpacer size="xl" />

Expand All @@ -197,10 +162,36 @@ export const AgentPolicyForm: React.FunctionComponent<Props> = ({
<EuiSpacer size="m" />
<ConfiguredSettings
configuredSettings={AGENT_POLICY_ADVANCED_SETTINGS}
disabled={isDisabled || !!agentPolicy?.supports_agentless}
disabled={isDisabled}
/>
</>
) : null}
</StyledEuiAccordion>
</>
) : (
<>
<AgentPolicyAdvancedOptionsContent
agentPolicy={agentPolicy}
updateAgentPolicy={updateAgentPolicy}
validation={validation}
disabled={isDisabled}
/>
<>
<EuiSpacer size="xl" />

<EuiTitle>
<h3>
<FormattedMessage
id="xpack.fleet.agentPolicyForm.advancedSettingsTitle"
defaultMessage="Advanced settings"
/>
</h3>
</EuiTitle>
<EuiSpacer size="m" />
<ConfiguredSettings
configuredSettings={AGENT_POLICY_ADVANCED_SETTINGS}
disabled={isDisabled || !!agentPolicy?.supports_agentless}
/>
</>
<EuiSpacer size="xl" />
</>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ function renderActions({ agent, agentPolicy }: { agent: Agent; agentPolicy?: Age

describe('AgentDetailsActionMenu', () => {
beforeEach(() => {
mockedExperimentalFeaturesService.get.mockReturnValue({
diagnosticFileUploadEnabled: true,
} as any);
mockedExperimentalFeaturesService.get.mockReturnValue({} as any);
mockedUseAuthz.mockReturnValue({
fleet: {
readAgents: true,
Expand All @@ -72,17 +70,6 @@ describe('AgentDetailsActionMenu', () => {
return utils.queryByTestId('requestAgentDiagnosticsBtn');
}

it('should not render action if feature is disabled', async () => {
mockedExperimentalFeaturesService.get.mockReturnValue({
diagnosticFileUploadEnabled: false,
} as any);
const res = renderAndGetDiagnosticsButton({
agent: {} as Agent,
agentPolicy: {} as AgentPolicy,
});
expect(res).toBe(null);
});

it('should render an active action button if agent version >= 8.7', async () => {
const res = renderAndGetDiagnosticsButton({
agent: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import {
import { useAgentRefresh } from '../hooks';
import { isAgentUpgradeable, policyHasFleetServer } from '../../../../services';
import { AgentRequestDiagnosticsModal } from '../../components/agent_request_diagnostics_modal';
import { ExperimentalFeaturesService } from '../../../../services';

import { AgentDetailsJsonFlyout } from './agent_details_json_flyout';

Expand Down Expand Up @@ -53,7 +52,6 @@ export const AgentDetailsActionMenu: React.FunctionComponent<{
);

const hasFleetServer = agentPolicy && policyHasFleetServer(agentPolicy);
const { diagnosticFileUploadEnabled } = ExperimentalFeaturesService.get();

const onClose = useMemo(() => {
if (onCancelReassign) {
Expand Down Expand Up @@ -126,7 +124,7 @@ export const AgentDetailsActionMenu: React.FunctionComponent<{
defaultMessage="View agent JSON"
/>
</EuiContextMenuItem>,
...(authz.fleet.readAgents && diagnosticFileUploadEnabled
...(authz.fleet.readAgents
? [
<EuiContextMenuItem
icon="download"
Expand Down
Loading

0 comments on commit 1775ddb

Please sign in to comment.