Skip to content

Commit

Permalink
[Fleet] Remove fleetServerEnabled feature flag and use fleet system i…
Browse files Browse the repository at this point in the history
…ndices (#92422)
  • Loading branch information
nchaulet committed Mar 8, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 59c95ee commit de6be00
Showing 83 changed files with 2,228 additions and 1,699 deletions.
119 changes: 43 additions & 76 deletions api_docs/fleet.json
Original file line number Diff line number Diff line change
@@ -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",
@@ -1714,7 +1739,7 @@
"description": [],
"source": {
"path": "x-pack/plugins/fleet/server/services/index.ts",
"lineNumber": 73
"lineNumber": 68
},
"signature": [
"(soClient: Pick<",
@@ -1744,7 +1769,7 @@
"description": [],
"source": {
"path": "x-pack/plugins/fleet/server/services/index.ts",
"lineNumber": 74
"lineNumber": 69
},
"signature": [
"(soClient: Pick<",
@@ -1774,7 +1799,7 @@
"description": [],
"source": {
"path": "x-pack/plugins/fleet/server/services/index.ts",
"lineNumber": 75
"lineNumber": 70
},
"signature": [
"(soClient: Pick<",
@@ -1796,7 +1821,7 @@
"description": [],
"source": {
"path": "x-pack/plugins/fleet/server/services/index.ts",
"lineNumber": 76
"lineNumber": 71
},
"signature": [
"(soClient: Pick<",
@@ -1821,7 +1846,7 @@
],
"source": {
"path": "x-pack/plugins/fleet/server/services/index.ts",
"lineNumber": 72
"lineNumber": 67
},
"initialIsOpen": false
},
@@ -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",
@@ -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",
@@ -1937,7 +1933,7 @@
"description": [],
"source": {
"path": "x-pack/plugins/fleet/server/services/index.ts",
"lineNumber": 55
"lineNumber": 54
}
},
{
@@ -1957,7 +1953,7 @@
"description": [],
"source": {
"path": "x-pack/plugins/fleet/server/services/index.ts",
"lineNumber": 56
"lineNumber": 55
}
}
],
@@ -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",
@@ -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",
@@ -2040,7 +2007,7 @@
"description": [],
"source": {
"path": "x-pack/plugins/fleet/server/services/index.ts",
"lineNumber": 63
"lineNumber": 60
}
},
{
@@ -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
}
},
{
@@ -2074,7 +2041,7 @@
],
"source": {
"path": "x-pack/plugins/fleet/server/services/index.ts",
"lineNumber": 69
"lineNumber": 64
},
"signature": [
"typeof ",
@@ -2471,7 +2438,7 @@
"description": [],
"source": {
"path": "x-pack/plugins/fleet/server/index.ts",
"lineNumber": 75
"lineNumber": 76
},
"signature": [
"any"
@@ -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]][]"
@@ -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; }"
]
}
],
@@ -13693,7 +13660,7 @@
],
"source": {
"path": "x-pack/plugins/fleet/common/types/index.ts",
"lineNumber": 44
"lineNumber": 43
},
"signature": [
"T[keyof T]"
3 changes: 3 additions & 0 deletions api_docs/fleet.mdx
Original file line number Diff line number Diff line change
@@ -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}/>

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
@@ -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 {
@@ -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
@@ -13,7 +13,6 @@ export interface FleetConfigType {
registryUrl?: string;
registryProxyUrl?: string;
agents: {
fleetServerEnabled: boolean;
enabled: boolean;
tlsCheckDisabled: boolean;
pollingRequestTimeout: number;
Original file line number Diff line number Diff line change
@@ -14,7 +14,6 @@ export const createConfigurationMock = (): FleetConfigType => {
registryProxyUrl: '',
agents: {
enabled: true,
fleetServerEnabled: false,
tlsCheckDisabled: true,
pollingRequestTimeout: 1000,
maxConcurrentConnections: 100,
Original file line number Diff line number Diff line change
@@ -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 = [
{
@@ -78,7 +77,6 @@ export const SearchAndFilterBar: React.FunctionComponent<{
showUpgradeable,
onShowUpgradeableChange,
}) => {
const config = useConfig();
// Policies state for filtering
const [isAgentPoliciesFilterOpen, setIsAgentPoliciesFilterOpen] = useState<boolean>(false);

@@ -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}>
Loading

0 comments on commit de6be00

Please sign in to comment.