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

[Fleet] Remove fleetServerEnabled feature flag and use fleet system indices #92422

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
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
119 changes: 43 additions & 76 deletions api_docs/fleet.json
Original file line number Diff line number Diff line change
Expand Up @@ -1678,7 +1678,32 @@
}
},
"server": {
"classes": [],
"classes": [
{
"id": "def-server.AgentNotFoundError",
"type": "Class",
"tags": [],
"label": "AgentNotFoundError",
"description": [],
"signature": [
{
"pluginId": "fleet",
"scope": "server",
"docId": "kibFleetPluginApi",
"section": "def-server.AgentNotFoundError",
"text": "AgentNotFoundError"
},
" extends ",
"IngestManagerError"
],
"children": [],
"source": {
"path": "x-pack/plugins/fleet/server/errors/index.ts",
"lineNumber": 34
},
"initialIsOpen": false
}
],
"functions": [
{
"id": "def-server.getRegistryUrl",
Expand Down Expand Up @@ -1714,7 +1739,7 @@
"description": [],
"source": {
"path": "x-pack/plugins/fleet/server/services/index.ts",
"lineNumber": 73
"lineNumber": 68
},
"signature": [
"(soClient: Pick<",
Expand Down Expand Up @@ -1744,7 +1769,7 @@
"description": [],
"source": {
"path": "x-pack/plugins/fleet/server/services/index.ts",
"lineNumber": 74
"lineNumber": 69
},
"signature": [
"(soClient: Pick<",
Expand Down Expand Up @@ -1774,7 +1799,7 @@
"description": [],
"source": {
"path": "x-pack/plugins/fleet/server/services/index.ts",
"lineNumber": 75
"lineNumber": 70
},
"signature": [
"(soClient: Pick<",
Expand All @@ -1796,7 +1821,7 @@
"description": [],
"source": {
"path": "x-pack/plugins/fleet/server/services/index.ts",
"lineNumber": 76
"lineNumber": 71
},
"signature": [
"(soClient: Pick<",
Expand All @@ -1821,7 +1846,7 @@
],
"source": {
"path": "x-pack/plugins/fleet/server/services/index.ts",
"lineNumber": 72
"lineNumber": 67
},
"initialIsOpen": false
},
Expand Down Expand Up @@ -1862,15 +1887,7 @@
"type": "Function",
"label": "authenticateAgentWithAccessToken",
"signature": [
"(soClient: Pick<",
{
"pluginId": "core",
"scope": "server",
"docId": "kibCoreSavedObjectsPluginApi",
"section": "def-server.SavedObjectsClient",
"text": "SavedObjectsClient"
},
", \"get\" | \"delete\" | \"create\" | \"find\" | \"update\" | \"bulkCreate\" | \"bulkGet\" | \"bulkUpdate\" | \"errors\" | \"checkConflicts\" | \"resolve\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\">, esClient: ",
"(esClient: ",
{
"pluginId": "core",
"scope": "server",
Expand Down Expand Up @@ -1900,27 +1917,6 @@
"\nAuthenticate an agent with access toekn"
],
"children": [
{
"type": "Object",
"label": "soClient",
"isRequired": true,
"signature": [
"Pick<",
{
"pluginId": "core",
"scope": "server",
"docId": "kibCoreSavedObjectsPluginApi",
"section": "def-server.SavedObjectsClient",
"text": "SavedObjectsClient"
},
", \"get\" | \"delete\" | \"create\" | \"find\" | \"update\" | \"bulkCreate\" | \"bulkGet\" | \"bulkUpdate\" | \"errors\" | \"checkConflicts\" | \"resolve\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\">"
],
"description": [],
"source": {
"path": "x-pack/plugins/fleet/server/services/index.ts",
"lineNumber": 54
}
},
{
"type": "CompoundType",
"label": "esClient",
Expand All @@ -1937,7 +1933,7 @@
"description": [],
"source": {
"path": "x-pack/plugins/fleet/server/services/index.ts",
"lineNumber": 55
"lineNumber": 54
}
},
{
Expand All @@ -1957,7 +1953,7 @@
"description": [],
"source": {
"path": "x-pack/plugins/fleet/server/services/index.ts",
"lineNumber": 56
"lineNumber": 55
}
}
],
Expand All @@ -1973,15 +1969,7 @@
"type": "Function",
"label": "getAgentStatusById",
"signature": [
"(soClient: Pick<",
{
"pluginId": "core",
"scope": "server",
"docId": "kibCoreSavedObjectsPluginApi",
"section": "def-server.SavedObjectsClient",
"text": "SavedObjectsClient"
},
", \"get\" | \"delete\" | \"create\" | \"find\" | \"update\" | \"bulkCreate\" | \"bulkGet\" | \"bulkUpdate\" | \"errors\" | \"checkConflicts\" | \"resolve\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\">, esClient: ",
"(esClient: ",
{
"pluginId": "core",
"scope": "server",
Expand All @@ -2003,27 +1991,6 @@
"\nReturn the status by the Agent's id"
],
"children": [
{
"type": "Object",
"label": "soClient",
"isRequired": true,
"signature": [
"Pick<",
{
"pluginId": "core",
"scope": "server",
"docId": "kibCoreSavedObjectsPluginApi",
"section": "def-server.SavedObjectsClient",
"text": "SavedObjectsClient"
},
", \"get\" | \"delete\" | \"create\" | \"find\" | \"update\" | \"bulkCreate\" | \"bulkGet\" | \"bulkUpdate\" | \"errors\" | \"checkConflicts\" | \"resolve\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\">"
],
"description": [],
"source": {
"path": "x-pack/plugins/fleet/server/services/index.ts",
"lineNumber": 62
}
},
{
"type": "CompoundType",
"label": "esClient",
Expand All @@ -2040,7 +2007,7 @@
"description": [],
"source": {
"path": "x-pack/plugins/fleet/server/services/index.ts",
"lineNumber": 63
"lineNumber": 60
}
},
{
Expand All @@ -2053,15 +2020,15 @@
"description": [],
"source": {
"path": "x-pack/plugins/fleet/server/services/index.ts",
"lineNumber": 64
"lineNumber": 60
}
}
],
"tags": [],
"returnComment": [],
"source": {
"path": "x-pack/plugins/fleet/server/services/index.ts",
"lineNumber": 61
"lineNumber": 60
}
},
{
Expand All @@ -2074,7 +2041,7 @@
],
"source": {
"path": "x-pack/plugins/fleet/server/services/index.ts",
"lineNumber": 69
"lineNumber": 64
},
"signature": [
"typeof ",
Expand Down Expand Up @@ -2471,7 +2438,7 @@
"description": [],
"source": {
"path": "x-pack/plugins/fleet/server/index.ts",
"lineNumber": 75
"lineNumber": 76
},
"signature": [
"any"
Expand Down Expand Up @@ -2933,7 +2900,7 @@
"description": [],
"source": {
"path": "x-pack/plugins/fleet/common/types/index.ts",
"lineNumber": 39
"lineNumber": 38
},
"signature": [
"<T>(o: T) => [keyof T, T[keyof T]][]"
Expand Down Expand Up @@ -5188,7 +5155,7 @@
"lineNumber": 15
},
"signature": [
"{ fleetServerEnabled: boolean; enabled: boolean; tlsCheckDisabled: boolean; pollingRequestTimeout: number; maxConcurrentConnections: number; kibana: { host?: string | string[] | undefined; ca_sha256?: string | undefined; }; elasticsearch: { host?: string | undefined; ca_sha256?: string | undefined; }; agentPolicyRolloutRateLimitIntervalMs: number; agentPolicyRolloutRateLimitRequestPerInterval: number; }"
"{ enabled: boolean; tlsCheckDisabled: boolean; pollingRequestTimeout: number; maxConcurrentConnections: number; kibana: { host?: string | string[] | undefined; ca_sha256?: string | undefined; }; elasticsearch: { host?: string | undefined; ca_sha256?: string | undefined; }; agentPolicyRolloutRateLimitIntervalMs: number; agentPolicyRolloutRateLimitRequestPerInterval: number; }"
]
}
],
Expand Down Expand Up @@ -13693,7 +13660,7 @@
],
"source": {
"path": "x-pack/plugins/fleet/common/types/index.ts",
"lineNumber": 44
"lineNumber": 43
},
"signature": [
"T[keyof T]"
Expand Down
3 changes: 3 additions & 0 deletions api_docs/fleet.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ import fleetObj from './fleet.json';
### Functions
<DocDefinitionList data={fleetObj.server.functions}/>

### Classes
<DocDefinitionList data={fleetObj.server.classes}/>

### Interfaces
<DocDefinitionList data={fleetObj.server.interfaces}/>

Expand Down
14 changes: 7 additions & 7 deletions x-pack/plugins/fleet/common/services/agent_status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import { AGENT_POLLING_THRESHOLD_MS, AGENT_SAVED_OBJECT_TYPE } from '../constants';
import { AGENT_POLLING_THRESHOLD_MS } from '../constants';
import type { Agent, AgentStatus } from '../types';

export function getAgentStatus(agent: Agent, now: number = Date.now()): AgentStatus {
Expand Down Expand Up @@ -42,35 +42,35 @@ export function getAgentStatus(agent: Agent, now: number = Date.now()): AgentSta
}

export function buildKueryForEnrollingAgents() {
return `not (${AGENT_SAVED_OBJECT_TYPE}.last_checkin:*)`;
return 'not (last_checkin:*)';
}

export function buildKueryForUnenrollingAgents() {
return `${AGENT_SAVED_OBJECT_TYPE}.unenrollment_started_at:*`;
return 'unenrollment_started_at:*';
}

export function buildKueryForOnlineAgents() {
return `not (${buildKueryForOfflineAgents()}) AND not (${buildKueryForErrorAgents()}) AND not (${buildKueryForUpdatingAgents()})`;
}

export function buildKueryForErrorAgents() {
return `${AGENT_SAVED_OBJECT_TYPE}.last_checkin_status:error or ${AGENT_SAVED_OBJECT_TYPE}.last_checkin_status:degraded`;
return 'last_checkin_status:error or .last_checkin_status:degraded';
}

export function buildKueryForOfflineAgents() {
return `${AGENT_SAVED_OBJECT_TYPE}.last_checkin < now-${
return `last_checkin < now-${
(4 * AGENT_POLLING_THRESHOLD_MS) / 1000
}s AND not (${buildKueryForErrorAgents()}) AND not ( ${buildKueryForUpdatingAgents()} )`;
}

export function buildKueryForUpgradingAgents() {
return `(${AGENT_SAVED_OBJECT_TYPE}.upgrade_started_at:*) and not (${AGENT_SAVED_OBJECT_TYPE}.upgraded_at:*)`;
return '(upgrade_started_at:*) and not (upgraded_at:*)';
}

export function buildKueryForUpdatingAgents() {
return `(${buildKueryForUpgradingAgents()}) or (${buildKueryForEnrollingAgents()}) or (${buildKueryForUnenrollingAgents()})`;
}

export function buildKueryForInactiveAgents() {
return `${AGENT_SAVED_OBJECT_TYPE}.active:false`;
return `active:false`;
}
1 change: 0 additions & 1 deletion x-pack/plugins/fleet/common/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export interface FleetConfigType {
registryUrl?: string;
registryProxyUrl?: string;
agents: {
fleetServerEnabled: boolean;
enabled: boolean;
tlsCheckDisabled: boolean;
pollingRequestTimeout: number;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export const createConfigurationMock = (): FleetConfigType => {
registryProxyUrl: '',
agents: {
enabled: true,
fleetServerEnabled: false,
tlsCheckDisabled: true,
pollingRequestTimeout: 1000,
maxConcurrentConnections: 100,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ import { FormattedMessage } from '@kbn/i18n/react';

import { AgentPolicy } from '../../../../types';
import { SearchBar } from '../../../../components';
import { AGENTS_INDEX, AGENT_SAVED_OBJECT_TYPE } from '../../../../constants';
import { useConfig } from '../../../../hooks';
import { AGENTS_INDEX } from '../../../../constants';

const statusFilters = [
{
Expand Down Expand Up @@ -78,7 +77,6 @@ export const SearchAndFilterBar: React.FunctionComponent<{
showUpgradeable,
onShowUpgradeableChange,
}) => {
const config = useConfig();
// Policies state for filtering
const [isAgentPoliciesFilterOpen, setIsAgentPoliciesFilterOpen] = useState<boolean>(false);

Expand Down Expand Up @@ -112,13 +110,7 @@ export const SearchAndFilterBar: React.FunctionComponent<{
onSubmitSearch(newSearch);
}
}}
{...(config.agents.fleetServerEnabled
? {
indexPattern: AGENTS_INDEX,
}
: {
fieldPrefix: AGENT_SAVED_OBJECT_TYPE,
})}
indexPattern={AGENTS_INDEX}
/>
</EuiFlexItem>
<EuiFlexItem grow={2}>
Expand Down
Loading