From bf9d9aac316d5591112da20e7914f479850e5b43 Mon Sep 17 00:00:00 2001 From: Joe Portner <5295965+jportner@users.noreply.github.com> Date: Thu, 6 Jan 2022 10:51:51 -0500 Subject: [PATCH 01/12] skip flaky suite (#99879) --- x-pack/test/functional/apps/spaces/enter_space.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/x-pack/test/functional/apps/spaces/enter_space.ts b/x-pack/test/functional/apps/spaces/enter_space.ts index 6a93da999ee2e..bac4c5a031107 100644 --- a/x-pack/test/functional/apps/spaces/enter_space.ts +++ b/x-pack/test/functional/apps/spaces/enter_space.ts @@ -14,7 +14,8 @@ export default function enterSpaceFunctonalTests({ const esArchiver = getService('esArchiver'); const PageObjects = getPageObjects(['security', 'spaceSelector']); - describe('Enter Space', function () { + // FLAKY: https://github.com/elastic/kibana/issues/99879 + describe.skip('Enter Space', function () { // FLAKY: https://github.com/elastic/kibana/issues/100570 // These tests fail very intermittently in Firefox. Skip Firefox testing until resolved. // this.tags('includeFirefox'); From 33b4188edcdda8e9636e397d3832a98bc7dcbae3 Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Thu, 6 Jan 2022 12:46:07 -0500 Subject: [PATCH 02/12] skip failing test suite (#100236) --- .../security_solution_endpoint/apps/endpoint/policy_details.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/x-pack/test/security_solution_endpoint/apps/endpoint/policy_details.ts b/x-pack/test/security_solution_endpoint/apps/endpoint/policy_details.ts index 690874f104660..d7ee9ede406a7 100644 --- a/x-pack/test/security_solution_endpoint/apps/endpoint/policy_details.ts +++ b/x-pack/test/security_solution_endpoint/apps/endpoint/policy_details.ts @@ -235,7 +235,8 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { ); }; - describe('When on the Endpoint Policy Details Page', function () { + // Failing: See https://github.com/elastic/kibana/issues/100236 + describe.skip('When on the Endpoint Policy Details Page', function () { let indexedData: IndexedHostsAndAlertsResponse; before(async () => { From 7b6c53eeef6b864577bdd8066532657fac3e0429 Mon Sep 17 00:00:00 2001 From: Tim Sullivan Date: Thu, 6 Jan 2022 17:24:33 -0700 Subject: [PATCH 03/12] [7.16] [Reporting] Fix TypeError in CSV export (#121697) (#122449) * [Reporting] Fix TypeError in CSV export (#121697) * [Reporting] Fix TypeError in CSV export * functional test for sparse data csv export * make the test functional * silly * fix async * fix tests * Update x-pack/test/functional/apps/discover/reporting.ts Co-authored-by: Michael Dokolin * fix * revert empty array map in test Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Michael Dokolin (cherry picked from commit 5070b9fd0372e4c55e4a9d8300c4a2f48f9c7214) # Conflicts: # x-pack/test/functional/fixtures/kbn_archiver/reporting/logs.json * revert added tests --- .../csv_searchsource/generate_csv/generate_csv.ts | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/x-pack/plugins/reporting/server/export_types/csv_searchsource/generate_csv/generate_csv.ts b/x-pack/plugins/reporting/server/export_types/csv_searchsource/generate_csv/generate_csv.ts index 48e43c865ec7f..a2eef2bba98c8 100644 --- a/x-pack/plugins/reporting/server/export_types/csv_searchsource/generate_csv/generate_csv.ts +++ b/x-pack/plugins/reporting/server/export_types/csv_searchsource/generate_csv/generate_csv.ts @@ -65,7 +65,6 @@ function isPlainStringArray( export class CsvGenerator { private _columns?: string[]; - private _formatters?: Record; private csvContainsFormulas = false; private maxSizeReached = false; private csvRowCount = 0; @@ -122,10 +121,6 @@ export class CsvGenerator { * Load field formats for each field in the list */ private getFormatters(table: Datatable) { - if (this._formatters) { - return this._formatters; - } - // initialize field formats const formatters: Record = {}; table.columns.forEach((c) => { @@ -133,8 +128,7 @@ export class CsvGenerator { formatters[c.id] = fieldFormat; }); - this._formatters = formatters; - return this._formatters; + return formatters; } private escapeValues(settings: CsvExportSettings) { From 7e10d9439a6d2eea53470b17a48fe784aae33676 Mon Sep 17 00:00:00 2001 From: Julia Bardi <90178898+juliaElastic@users.noreply.github.com> Date: Mon, 10 Jan 2022 11:59:48 +0100 Subject: [PATCH 04/12] [Fleet] added fleet setup before installing integration (#121379) (#122509) * added fleet setup before installing integration * added fleet setup error toast message * added try catch --- .../detail/settings/install_button.tsx | 40 +++++++++++++++++-- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/settings/install_button.tsx b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/settings/install_button.tsx index f2813058afe5a..079d1fe4525f8 100644 --- a/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/settings/install_button.tsx +++ b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/settings/install_button.tsx @@ -15,8 +15,12 @@ import { useCapabilities, useGetPackageInstallStatus, useInstallPackage, + useStartServices, } from '../../../../../hooks'; +import { sendPostFleetSetup } from '../../../../../../../hooks/use_request/setup'; +import { toMountPoint } from '../../../../../../../../../../../src/plugins/kibana_react/public'; + import { ConfirmPackageInstall } from './confirm_package_install'; type InstallationButtonProps = Pick & { @@ -35,17 +39,45 @@ export function InstallButton(props: InstallationButtonProps) { const getPackageInstallStatus = useGetPackageInstallStatus(); const { status: installationStatus } = getPackageInstallStatus(name); - const isInstalling = installationStatus === InstallStatus.installing; + const [isFleetSetupInProgress, setFleetSetupInProgress] = useState(false); + + const isInstalling = installationStatus === InstallStatus.installing || isFleetSetupInProgress; const [isInstallModalVisible, setIsInstallModalVisible] = useState(false); const toggleInstallModal = useCallback(() => { setIsInstallModalVisible(!isInstallModalVisible); }, [isInstallModalVisible]); - const handleClickInstall = useCallback(() => { - installPackage({ name, version, title }); + const { notifications } = useStartServices(); + + const handleClickInstall = useCallback(async () => { + setFleetSetupInProgress(true); toggleInstallModal(); - }, [installPackage, name, title, toggleInstallModal, version]); + try { + const res = await sendPostFleetSetup({ forceRecreate: false }); + if (res.error) { + throw res.error; + } + } catch (e) { + notifications.toasts.addWarning({ + title: toMountPoint( + + ), + text: toMountPoint( + + ), + iconType: 'alert', + }); + } + setFleetSetupInProgress(false); + installPackage({ name, version, title }); + }, [installPackage, name, title, toggleInstallModal, version, notifications.toasts]); const installModal = ( Date: Mon, 10 Jan 2022 13:52:23 -0500 Subject: [PATCH 05/12] skip failing test suite (#116059) --- .../test_suites/saved_objects_management/hidden_types.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/plugin_functional/test_suites/saved_objects_management/hidden_types.ts b/test/plugin_functional/test_suites/saved_objects_management/hidden_types.ts index 8e7adb504ebee..439ece04e615f 100644 --- a/test/plugin_functional/test_suites/saved_objects_management/hidden_types.ts +++ b/test/plugin_functional/test_suites/saved_objects_management/hidden_types.ts @@ -21,7 +21,8 @@ export default function ({ getService, getPageObjects }: PluginFunctionalProvide const esArchiver = getService('esArchiver'); const testSubjects = getService('testSubjects'); - describe('saved objects management with hidden types', () => { + // Failing: See https://github.com/elastic/kibana/issues/116059 + describe.skip('saved objects management with hidden types', () => { before(async () => { await esArchiver.load( 'test/functional/fixtures/es_archiver/saved_objects_management/hidden_types' From c2f0226d3347962e826e54a873b791fc4536835b Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Mon, 10 Jan 2022 17:55:20 -0500 Subject: [PATCH 06/12] Update ftr (#122481) (#122604) Co-authored-by: Renovate Bot Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> (cherry picked from commit 6bf738fcf0d6444e77c24cd6f1e2a5478155f86c) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- package.json | 4 ++-- yarn.lock | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index e84d32ba5b4ae..7ba36d2ee30ed 100644 --- a/package.json +++ b/package.json @@ -668,7 +668,7 @@ "callsites": "^3.1.0", "chai": "3.5.0", "chance": "1.0.18", - "chromedriver": "^96.0.0", + "chromedriver": "^97.0.0", "clean-webpack-plugin": "^3.0.0", "cmd-shim": "^2.1.0", "compression-webpack-plugin": "^4.0.0", @@ -795,7 +795,7 @@ "rxjs-marbles": "^5.0.6", "sass-loader": "^10.2.0", "sass-resources-loader": "^2.0.1", - "selenium-webdriver": "^4.1.0", + "selenium-webdriver": "^4.1.1", "serve-static": "1.14.1", "shelljs": "^0.8.4", "simple-git": "1.116.0", diff --git a/yarn.lock b/yarn.lock index 87107f42776a7..3b99fc6f05bb3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9581,10 +9581,10 @@ chrome-trace-event@^1.0.2: dependencies: tslib "^1.9.0" -chromedriver@^96.0.0: - version "96.0.0" - resolved "https://registry.yarnpkg.com/chromedriver/-/chromedriver-96.0.0.tgz#c8473498e4c94950fa168187b112019cce9e5c6c" - integrity sha512-4g6Hn5RHGsbaBmOrJbDlz/hdVPOc22eRsbvoAAMqkZxR2NJCcddHzCw2FAQeW8lX/C7xWVz3nyDsKX3fE9lIIw== +chromedriver@^97.0.0: + version "97.0.0" + resolved "https://registry.yarnpkg.com/chromedriver/-/chromedriver-97.0.0.tgz#7005b1a15a6456558d0fc4d5b72c98c12d1b033d" + integrity sha512-SZ9MW+/6/Ypz20CNdRKocsmRM2AJ/YwHaWpA1Np2QVPFUbhjhus6vBtqFD+l8M5qrktLWPQSjTwIsDckNfXIRg== dependencies: "@testim/chrome-version" "^1.0.7" axios "^0.21.2" @@ -25199,10 +25199,10 @@ select-hose@^2.0.0: resolved "https://registry.yarnpkg.com/select-hose/-/select-hose-2.0.0.tgz#625d8658f865af43ec962bfc376a37359a4994ca" integrity sha1-Yl2GWPhlr0Psliv8N2o3NZpJlMo= -selenium-webdriver@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/selenium-webdriver/-/selenium-webdriver-4.1.0.tgz#d11e5d43674e2718265a30684bcbf6ec734fd3bd" - integrity sha512-kUDH4N8WruYprTzvug4Pl73Th+WKb5YiLz8z/anOpHyUNUdM3UzrdTOxmSNaf9AczzBeY+qXihzku8D1lMaKOg== +selenium-webdriver@^4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/selenium-webdriver/-/selenium-webdriver-4.1.1.tgz#da083177d811f36614950e809e2982570f67d02e" + integrity sha512-Fr9e9LC6zvD6/j7NO8M1M/NVxFX67abHcxDJoP5w2KN/Xb1SyYLjMVPGgD14U2TOiKe4XKHf42OmFw9g2JgCBQ== dependencies: jszip "^3.6.0" tmp "^0.2.1" From aea9e66c14a3c91139866d1b8eec8c7bcfd6cd95 Mon Sep 17 00:00:00 2001 From: Kyle Pollich Date: Tue, 11 Jan 2022 16:04:42 -0500 Subject: [PATCH 07/12] [7.16] [Fleet] Fix navigation to policy for policies created inline (#122470) (#122692) * [Fleet] Fix navigation to policy for policies created inline (#122470) * Fix navigation to policy for policies created inline * Fix inline agent policy creation check * Add clarifying comment per review Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> (cherry picked from commit f9c6259b4772f8a4d59cae17e6fc8cd2f79c8423) # Conflicts: # x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/index.tsx * Fix errors after conflicts --- .../create_package_policy_page/index.tsx | 32 ++++++++++++++++--- .../step_select_agent_policy.tsx | 3 ++ 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/index.tsx index f870713e72271..447a5e704f044 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/index.tsx @@ -145,6 +145,8 @@ export const CreatePackagePolicyPage: React.FunctionComponent = () => { inputs: [], }); + const [wasNewAgentPolicyCreated, setWasNewAgentPolicyCreated] = useState(false); + // Validation state const [validationResults, setValidationResults] = useState(); const [hasAgentPolicyError, setHasAgentPolicyError] = useState(false); @@ -274,6 +276,10 @@ export const CreatePackagePolicyPage: React.FunctionComponent = () => { }, [packagePolicy, agentCount]); const doOnSaveNavigation = useRef(true); + const handleInlineAgentPolicyCreate = useCallback(() => { + setWasNewAgentPolicyCreated(true); + }, []); + // Detect if user left page useEffect(() => { return () => { @@ -293,12 +299,16 @@ export const CreatePackagePolicyPage: React.FunctionComponent = () => { return; } + const packagePolicyPath = getPath('policy_details', { policyId: packagePolicy.policy_id }); + if (routeState?.onSaveNavigateTo && policy) { const [appId, options] = routeState.onSaveNavigateTo; if (options?.path) { const pathWithQueryString = appendOnSaveQueryParamsToPath({ - path: options.path, + // In cases where we created a new agent policy inline, we need to override the initial `path` + // value and navigate to the newly-created agent policy instead + path: wasNewAgentPolicyCreated ? packagePolicyPath : options.path, policy, mappingOptions: routeState.onSaveQueryParams, paramsToApply, @@ -308,10 +318,17 @@ export const CreatePackagePolicyPage: React.FunctionComponent = () => { handleNavigateTo(routeState.onSaveNavigateTo); } } else { - history.push(getPath('policy_details', { policyId: agentPolicy!.id })); + history.push(packagePolicyPath); } }, - [agentPolicy, getPath, handleNavigateTo, history, routeState] + [ + packagePolicy.policy_id, + getPath, + handleNavigateTo, + history, + routeState, + wasNewAgentPolicyCreated, + ] ); const onSubmit = useCallback(async () => { @@ -398,9 +415,16 @@ export const CreatePackagePolicyPage: React.FunctionComponent = () => { agentPolicy={agentPolicy} updateAgentPolicy={updateAgentPolicy} setHasAgentPolicyError={setHasAgentPolicyError} + onNewAgentPolicyCreate={handleInlineAgentPolicyCreate} /> ), - [packageInfo, queryParamsPolicyId, agentPolicy, updateAgentPolicy] + [ + packageInfo, + queryParamsPolicyId, + agentPolicy, + updateAgentPolicy, + handleInlineAgentPolicyCreate, + ] ); const extensionView = useUIExtension(packagePolicy.package?.name ?? '', 'package-policy-create'); diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/step_select_agent_policy.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/step_select_agent_policy.tsx index 72bd829dcf61a..096111fe93c8d 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/step_select_agent_policy.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/step_select_agent_policy.tsx @@ -45,12 +45,14 @@ export const StepSelectAgentPolicy: React.FunctionComponent<{ agentPolicy: AgentPolicy | undefined; updateAgentPolicy: (agentPolicy: AgentPolicy | undefined) => void; setHasAgentPolicyError: (hasError: boolean) => void; + onNewAgentPolicyCreate: () => void; }> = ({ packageInfo, agentPolicy, updateAgentPolicy, defaultAgentPolicyId, setHasAgentPolicyError, + onNewAgentPolicyCreate, }) => { const { isReady: isFleetReady } = useFleetStatus(); @@ -203,6 +205,7 @@ export const StepSelectAgentPolicy: React.FunctionComponent<{ onClose={(newAgentPolicy?: AgentPolicy) => { setIsCreateAgentPolicyFlyoutOpen(false); if (newAgentPolicy) { + onNewAgentPolicyCreate(); refreshAgentPolicies(); setSelectedPolicyId(newAgentPolicy.id); } From c96f7eb0a2f71563d11f97ce13e5f2ade1edebf3 Mon Sep 17 00:00:00 2001 From: Spencer Date: Tue, 11 Jan 2022 18:00:06 -0700 Subject: [PATCH 08/12] [ftr] document flaky test runner (#122721) (#122733) (cherry picked from commit cf989792c319ea705906384be36b34b388d3599c) # Conflicts: # docs/developer/contributing/development-functional-tests.asciidoc --- .../contributing/development-functional-tests.asciidoc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/developer/contributing/development-functional-tests.asciidoc b/docs/developer/contributing/development-functional-tests.asciidoc index 5dc6f2dee5a44..f1455b511e1df 100644 --- a/docs/developer/contributing/development-functional-tests.asciidoc +++ b/docs/developer/contributing/development-functional-tests.asciidoc @@ -515,3 +515,12 @@ macOS users on a machine with a discrete graphics card may see significant speed * Open "Advanced GPU Settings..." * Uncheck the "Prefer integrated to discrete GPU" option * Restart iTerm + +[discrete] +== Flaky Test Runner + +If your functional tests are flaky then the Operations team might skip them and ask that you make them less flaky before enabling them once again. This process usually involves looking at the failures which are logged on the relevant Github issue and finding incorrect assumptions or conditions which need to be awaited at some point in the test. To determine if your changes make the test fail less often you can run your tests in the Flaky Test Runner. This tool runs up to 500 executions of a specific ciGroup. To start a build of the Flaky Test Runner create a PR with your changes and then visit https://ci-stats.kibana.dev/trigger_flaky_test_runner, select your PR, choose the CI Group that your tests are in, and trigger the build. + +This will take you to Buildkite where your build will run and tell you if it failed in any execution. + +A flaky test may only fail once in 1000 runs, so keep this in mind and make sure you use enough executions to really prove that a test isn't flaky anymore. From 54c01024b68198ca15f6066c7daeabea31e4a874 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Istv=C3=A1n=20Zolt=C3=A1n=20Szab=C3=B3?= Date: Wed, 12 Jan 2022 12:15:31 +0100 Subject: [PATCH 09/12] [DOCS] Changes an attribute to resolve correctly (#122667) (#122748) Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- docs/user/dashboard/make-dashboards-interactive.asciidoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/user/dashboard/make-dashboards-interactive.asciidoc b/docs/user/dashboard/make-dashboards-interactive.asciidoc index 54a723f63e253..2c6fff7157b92 100644 --- a/docs/user/dashboard/make-dashboards-interactive.asciidoc +++ b/docs/user/dashboard/make-dashboards-interactive.asciidoc @@ -48,7 +48,7 @@ To create *Controls* panels: . Select the control panel type from the dropdown, then click *Add*. -. Enter the *Control Label*, then select the *{Data-Source}* and *Field*. +. Enter the *Control Label*, then select the *{data-source-caps}* and *Field*. . If you are adding a *Range slider*, enter the *Step Size* and *Decimal Places*. From edada3d43b1d9e8dbf1088747ac9d4b94740b612 Mon Sep 17 00:00:00 2001 From: Kaarina Tungseth Date: Wed, 12 Jan 2022 10:01:49 -0600 Subject: [PATCH 10/12] =?UTF-8?q?[DOC]=20Clarify=20rolling=20upgrades=20of?= =?UTF-8?q?=20Kibana=20are=20not=20supported=20and=20report=E2=80=A6=20(#1?= =?UTF-8?q?17644)=20(#122792)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [DOC] Clarify rolling upgrades of Kibana are not supported and reporting settings I would like to clarify: - rolling upgrades are not supported and highlight all Kibana instances must be stopped prior an upgrade - cookie statement might be misleading - https://www.elastic.co/guide/en/kibana/current/reporting-settings-kb.html#reporting-kibana-server-settings reporting settings are missing Please rephrase/reorganize the statements. A link to the reporting documentation would be useful. * Update docs/user/production-considerations/production.asciidoc Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com> * Update docs/user/production-considerations/production.asciidoc Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com> * Update docs/user/production-considerations/production.asciidoc * Update docs/user/production-considerations/production.asciidoc * Update docs/user/production-considerations/production.asciidoc * Update docs/user/production-considerations/production.asciidoc * Update docs/user/production-considerations/production.asciidoc * Update docs/user/production-considerations/production.asciidoc * Update docs/user/production-considerations/production.asciidoc Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Kaarina Tungseth (cherry picked from commit f7a970dbc2e24af15fcb994e098e5c0fc6a31bcf) Co-authored-by: Luca Belluccini --- .../production.asciidoc | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/docs/user/production-considerations/production.asciidoc b/docs/user/production-considerations/production.asciidoc index 43e08f42f12a4..d4dafbab8b6a4 100644 --- a/docs/user/production-considerations/production.asciidoc +++ b/docs/user/production-considerations/production.asciidoc @@ -16,6 +16,11 @@ separate from your {es} data or master nodes. To distribute {kib} traffic across the nodes in your {es} cluster, you can configure {kib} to use a list of {es} hosts. +[WARNING] +==== +{kib} does not support rolling upgrades, and deploying mixed versions of {kib} can result in data loss or upgrade failures. Please shut down all instances of {kib} before performing an upgrade, and ensure all running {kib} instances have matching versions. +==== + [float] [[load-balancing-kibana]] === Load balancing across multiple {kib} instances @@ -59,13 +64,18 @@ bin/kibana -c config/instance2.yml === Accessing multiple load-balanced {kib} clusters To access multiple load-balanced {kib} clusters from the same browser, -set `xpack.security.cookieName` in the configuration. +explicitly set `xpack.security.cookieName` to the same value in the {kib} configuration +of each {kib} instance. + +Each {kib} cluster must have a different value of `xpack.security.cookieName`. + This avoids conflicts between cookies from the different {kib} instances. -In each cluster, {kib} instances should have the same `cookieName` -value. This will achieve seamless high availability and keep the session +This will achieve seamless high availability and keep the session active in case of failure from the currently used instance. + + [float] [[high-availability]] === High availability across multiple {es} nodes From 1384e066c6cdcde07ada3c29a59c15772d800e42 Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Wed, 12 Jan 2022 11:37:54 -0500 Subject: [PATCH 11/12] fixed bug with policy upgrade and updated vars (#122767) (#122785) (cherry picked from commit 42839e104e0dcefa602cc5cb260ed3744f042d57) Co-authored-by: Julia Bardi <90178898+juliaElastic@users.noreply.github.com> --- .../edit_package_policy_page/index.tsx | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/index.tsx index b60643f5e7017..1942159515d0c 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/index.tsx @@ -187,7 +187,24 @@ export const EditPackagePolicyForm = memo<{ ...restOfPackagePolicy, inputs: baseInputs.map((input: any) => { // Remove `compiled_input` from all input info, we assign this after saving - const { streams, compiled_input: compiledInput, ...restOfInput } = input; + const { streams, compiled_input: compiledInput, vars, ...restOfInput } = input; + let basePolicyInputVars: any = + isUpgrade && + basePolicy.inputs.find( + (i) => i.type === input.type && i.policy_template === input.policy_template + )?.vars; + let newVars = vars; + if (basePolicyInputVars && vars) { + // merging vars from dry run with updated ones + basePolicyInputVars = Object.keys(vars).reduce( + (acc, curr) => ({ ...acc, [curr]: basePolicyInputVars[curr] }), + {} + ); + newVars = { + ...vars, + ...basePolicyInputVars, + }; + } return { ...restOfInput, streams: streams.map((stream: any) => { @@ -195,6 +212,7 @@ export const EditPackagePolicyForm = memo<{ const { compiled_stream, ...restOfStream } = stream; return restOfStream; }), + vars: newVars, }; }), package: basePackage, From ab8543ae6764d197f3cf3f6656444add1aae7dc0 Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Wed, 12 Jan 2022 12:40:35 -0500 Subject: [PATCH 12/12] [Fleet] Fix upgrade notice displaying in error (#122675) (#122803) * Fix upgrade notice displaying in error * Move upgrade detection to a util method (cherry picked from commit 07b64b16ee3de75bd8c5f988238cfe57220cdb97) Co-authored-by: Kyle Pollich --- .../edit_package_policy_page/index.tsx | 39 +++++++++++++++---- .../utils/has_upgrade_available.ts | 25 ++++++++++++ .../edit_package_policy_page/utils/index.ts | 8 ++++ .../upgrade_package_policy_page/index.tsx | 2 +- .../sections/epm/screens/policy/index.tsx | 2 +- 5 files changed, 66 insertions(+), 10 deletions(-) create mode 100644 x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/utils/has_upgrade_available.ts create mode 100644 x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/utils/index.ts diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/index.tsx index 1942159515d0c..8e5260ea84b33 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/index.tsx @@ -65,6 +65,8 @@ import type { import type { PackagePolicyEditExtensionComponentProps } from '../../../types'; import { pkgKeyFromPackageInfo, storedPackagePoliciesToAgentInputs } from '../../../services'; +import { hasUpgradeAvailable } from './utils'; + export const EditPackagePolicyPage = memo(() => { const { params: { packagePolicyId }, @@ -84,16 +86,16 @@ export const EditPackagePolicyPage = memo(() => { // the edit form in an "upgrade" state regardless of whether the user intended to // "edit" their policy or "upgrade" it. This ensures the new policy generated will be // set to use the latest version of the package, not its current version. - isUpgrade={extensionView?.useLatestPackageVersion} + forceUpgrade={extensionView?.useLatestPackageVersion} /> ); }); export const EditPackagePolicyForm = memo<{ packagePolicyId: string; - isUpgrade?: boolean; + forceUpgrade?: boolean; from?: EditPackagePolicyFrom; -}>(({ packagePolicyId, isUpgrade = false, from = 'edit' }) => { +}>(({ packagePolicyId, forceUpgrade = false, from = 'edit' }) => { const { application, notifications } = useStartServices(); const { agents: { enabled: isFleetEnabled }, @@ -119,6 +121,14 @@ export const EditPackagePolicyForm = memo<{ useState(); const [dryRunData, setDryRunData] = useState(); + const [isUpgrade, setIsUpgrade] = useState(false); + + useEffect(() => { + if (forceUpgrade) { + setIsUpgrade(true); + } + }, [forceUpgrade]); + const policyId = agentPolicy?.id ?? ''; // Retrieve agent policy, package, and package policy info @@ -146,11 +156,24 @@ export const EditPackagePolicyForm = memo<{ setAgentPolicy(agentPolicyData.item); } - const { data: upgradePackagePolicyDryRunData } = await sendUpgradePackagePolicyDryRun([ - packagePolicyId, - ]); + const { data: upgradePackagePolicyDryRunData, error: upgradePackagePolicyDryRunError } = + await sendUpgradePackagePolicyDryRun([packagePolicyId]); + + if (upgradePackagePolicyDryRunError) { + throw upgradePackagePolicyDryRunError; + } + + const hasUpgrade = upgradePackagePolicyDryRunData + ? hasUpgradeAvailable(upgradePackagePolicyDryRunData) + : false; + + // If the dry run data doesn't indicate a difference in version numbers, flip the form back + // to its non-upgrade state, even if we were initially set to the upgrade view + if (!hasUpgrade) { + setIsUpgrade(false); + } - if (upgradePackagePolicyDryRunData) { + if (upgradePackagePolicyDryRunData && hasUpgrade) { setDryRunData(upgradePackagePolicyDryRunData); } @@ -442,7 +465,7 @@ export const EditPackagePolicyForm = memo<{ const [selectedTab, setSelectedTab] = useState(0); const layoutProps = { - from: extensionView?.useLatestPackageVersion ? 'upgrade-from-extension' : from, + from: extensionView?.useLatestPackageVersion && isUpgrade ? 'upgrade-from-extension' : from, cancelUrl, agentPolicy, packageInfo, diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/utils/has_upgrade_available.ts b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/utils/has_upgrade_available.ts new file mode 100644 index 0000000000000..d042eddb09334 --- /dev/null +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/utils/has_upgrade_available.ts @@ -0,0 +1,25 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import semverGt from 'semver/functions/gt'; + +import type { UpgradePackagePolicyDryRunResponse } from '../../../../types'; + +/** + * Given a dry run response, determines if a greater version exists in the "proposed" + * version of the first package policy in the response. + */ +export function hasUpgradeAvailable(dryRunData: UpgradePackagePolicyDryRunResponse) { + return ( + dryRunData && + dryRunData[0].diff && + semverGt( + dryRunData[0].diff[1].package?.version ?? '', + dryRunData[0].diff[0].package?.version ?? '' + ) + ); +} diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/utils/index.ts b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/utils/index.ts new file mode 100644 index 0000000000000..e8206e9dbbf97 --- /dev/null +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/utils/index.ts @@ -0,0 +1,8 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export * from './has_upgrade_available'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/upgrade_package_policy_page/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/upgrade_package_policy_page/index.tsx index 18cf7847cd29b..853caeb0cc826 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/upgrade_package_policy_page/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/upgrade_package_policy_page/index.tsx @@ -30,5 +30,5 @@ export const UpgradePackagePolicyPage = memo(() => { from = 'upgrade-from-integrations-policy-list'; } - return ; + return ; }); diff --git a/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/policy/index.tsx b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/policy/index.tsx index ed8ad166cde9b..e78a2954a86d6 100644 --- a/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/policy/index.tsx +++ b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/policy/index.tsx @@ -28,7 +28,7 @@ export const Policy = memo(() => { ); });