Skip to content

Commit

Permalink
Put behind feature flag
Browse files Browse the repository at this point in the history
  • Loading branch information
jillguyonnet committed Jul 23, 2024
1 parent 82d8158 commit ff98d7a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion x-pack/plugins/fleet/server/services/agents/namespace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,16 @@

import { DEFAULT_NAMESPACE_STRING } from '@kbn/core-saved-objects-utils-server';

import { appContextService } from '../app_context';

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

export function isAgentInNamespace(agent: Agent, namespace?: string) {
const useSpaceAwareness = appContextService.getExperimentalFeatures()?.useSpaceAwareness;
if (!useSpaceAwareness) {
return true;
}

return (
(namespace && agent.namespaces?.includes(namespace)) ||
(!namespace &&
Expand All @@ -20,7 +27,8 @@ export function isAgentInNamespace(agent: Agent, namespace?: string) {
}

export function agentsKueryNamespaceFilter(namespace?: string) {
if (!namespace) {
const useSpaceAwareness = appContextService.getExperimentalFeatures()?.useSpaceAwareness;
if (!useSpaceAwareness || !namespace) {
return;
}
return namespace === DEFAULT_NAMESPACE_STRING
Expand Down

0 comments on commit ff98d7a

Please sign in to comment.