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

[ftr] implement support for accessing ES through CCS #126547

Merged
merged 10 commits into from
Mar 7, 2022

Conversation

spalger
Copy link
Contributor

@spalger spalger commented Mar 1, 2022

Closes #124865

In order to support testing CCS compatibility we have decided to extend the FTR config schema to support esTestCluster.ccs which, when enabled, changes the way that we start ES to start two single-node clusters:

1. ftr-remote

This cluster is started first, it listens to HTTP requests at esTestCluster.ccs.remoteClusterUrl, and transport requests on a port determined at runtime using the get-port module. The remoteEs and remoteEsArchiver services are setup to communicate directly with this node for loading data into and managing the remote cluster. Roles on this cluster can be setup with the esTestCluster.remoteRoles config.

2. ftr-local

This cluster is initialized second, it is the cluster that Kibana and all the default services will talk to, including es and esArchiver. This cluster also has a single remote cluster configured at startup, ftr-remote which can be used to query the ftr-remote cluster.


In the test/functional_ccs/config.ts file we setup the ccs_remote_search role on the remote cluster, and then also set this as a default role for all users created on via the testUser service. When calling testUser.setRoles() people will need to define this role if they want that user to have CCS permissions on the remote cluster. We could change the logic to be out-out, but I'd prefer to make it explicit when we call setRoles() that the list of roles provided will be the roles that user has.

Additionally, in order to support cloud testing this config supports defining the entire esTestCluster.ccs.remoteClusterUrl via the REMOTE_CLUSTER_URL environment variable, which could point to a completely different machine.

@spalger spalger force-pushed the implement/ftr-ccs-support branch 9 times, most recently from 94d23e8 to a02cfb2 Compare March 1, 2022 22:04
@spalger spalger added release_note:skip Skip the PR/issue when compiling release notes Team:Operations Team label for Operations Team Team:QA Team label for QA Team v7.17.2 v8.0.2 v8.1.1 v8.2.0 auto-backport Deprecated: Automatically backport this PR after it's merged labels Mar 2, 2022
@spalger spalger marked this pull request as ready for review March 2, 2022 20:08
@spalger spalger requested a review from a team as a code owner March 2, 2022 20:08
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-operations (Team:Operations)

@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-qa (Team:QA)

@spalger spalger requested review from LeeDr and cuff-links March 2, 2022 20:08
@spalger
Copy link
Contributor Author

spalger commented Mar 3, 2022

@elasticmachine merge upstream

@liza-mae
Copy link
Contributor

liza-mae commented Mar 4, 2022

Yes set like this:

_pass1=<password>
_pass2=<password>
export TEST_ES_URL=https://elastic:${_pass1}@<endpoint>
export TEST_KIBANA_URL=https://elastic:${_pass1}@<endpoint>
export REMOTE_CLUSTER_URL=https://elastic:${_pass2}@<endpoint>

The curl command for those URLs comes back successful.

curl $TEST_ES_URL
{
  "name" : "instance-0000000001",
  "cluster_name" : "2695877d320c4bcdbfbc81223be4401d",
  "cluster_uuid" : "blV5szVNTqSrGuDHDVbv6Q",
  "version" : {
    "number" : "8.1.0",
    "build_flavor" : "default",
    "build_type" : "docker",
    "build_hash" : "3700f7679f7d95e36da0b43762189bab189bc53a",
    "build_date" : "2022-03-03T14:20:00.690422633Z",
    "build_snapshot" : false,
    "lucene_version" : "9.0.0",
    "minimum_wire_compatibility_version" : "7.17.0",
    "minimum_index_compatibility_version" : "7.0.0"
  },
  "tagline" : "You Know, for Search"
}
curl $REMOTE_CLUSTER_URL
{
  "name" : "instance-0000000001",
  "cluster_name" : "a8c8efc71c6d4229831104be818f246b",
  "cluster_uuid" : "ezfFY-PZSEyECZWfX0xtSw",
  "version" : {
    "number" : "7.17.0",
    "build_flavor" : "default",
    "build_type" : "docker",
    "build_hash" : "bee86328705acaa9a6daede7140defd4d9ec56bd",
    "build_date" : "2022-01-28T08:36:04.875279988Z",
    "build_snapshot" : false,
    "lucene_version" : "8.11.1",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}

@liza-mae
Copy link
Contributor

liza-mae commented Mar 4, 2022

@spalger your fix worked for the superuser security issue. Thanks!

I only ran the data_view_css.ts test but it failed, it appears to be a problem with privileges for the test_user role, so I reverted back to superuser elastic and the test passed.

Copy link
Contributor

@liza-mae liza-mae left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, tested FTR changes against cloud CCS setup.

@LeeDr
Copy link
Contributor

LeeDr commented Mar 4, 2022

@spalger can you explain how I would (in a test) get the test_user created with the correct roles on the remote cluster? The existing functional_ccs tests copied to x-pack and inheriting x-pack/test/functional/config.js won't pass for me locally unless it also created test_user on the remote cluster.

I'm not sure we can use the existing test_user service if it's hitting the Kibana api. We need to use the remote Elasticsearch cluster to create the user.

@spalger
Copy link
Contributor Author

spalger commented Mar 4, 2022

@LeeDr My understanding of https://www.elastic.co/guide/en/elasticsearch/reference/current/remote-clusters-privileges.html#remote-clusters-privileges-ccs was that we just needed to have a known role name in sync between the remote cluster and the local user, so the testUser would still be created on the local cluster but it would need to get a role name that is in place on the remote cluster and gives it the read_cross_cluster permission. In the test/function_ccs config I setup the security.remoteEsRoles config to create the ccs_remote_search role on the remote cluster, users created with the testUsers service should just need the ccs_remote_search role to be able to search on the remote cluster too... My reading of the docs might be incorrect though, do we really need to create user accounts on all clusters?

Copy link
Contributor

@LeeDr LeeDr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - Spencer is correct that we don't need the test_user on the remote cluster. Only the role including view_index_metadata. Works great!

@spalger spalger enabled auto-merge (squash) March 7, 2022 21:02
@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
@kbn/test 208 210 +2
Unknown metric groups

API count

id before after diff
@kbn/test 244 248 +4

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@spalger spalger merged commit 0821c31 into elastic:main Mar 7, 2022
@spalger spalger deleted the implement/ftr-ccs-support branch March 7, 2022 22:27
@kibanamachine
Copy link
Contributor

💔 All backports failed

Status Branch Result
8.1 Backport failed because of merge conflicts

You might need to backport the following PRs to 8.1:
- Added CCS test for data view functionality. (#124586)
7.17 Backport failed because of merge conflicts

You might need to backport the following PRs to 7.17:
- [kbn/es] add support for --ready-timeout (#126217)
- Added CCS test for data view functionality. (#124586)
8.0 Backport failed because of merge conflicts

You might need to backport the following PRs to 8.0:
- Added CCS test for data view functionality. (#124586)

Manual backport

To create the backport manually run:

node scripts/backport --pr 126547

Questions ?

Please refer to the Backport tool documentation

jloleysens added a commit to jloleysens/kibana that referenced this pull request Mar 8, 2022
…ed-unexpectedly-error

* 'main' of github.com:elastic/kibana: (46 commits)
  Fix copy and pasted renderer user_name test (elastic#126663)
  [Gauge] Vis editors gauge legacy percent mode. (elastic#126318)
  Remove all cases related code from timelines (elastic#127003)
  Hide Enterprise search panel when no nodes are present (elastic#127100)
  [Lens] Fixed flakiness on runtime fields' appearance on the list (elastic#126945)
  [Security Solution][Lists] - Add missing privileges callout to exception lists page (elastic#126874)
  [Security Solution][Lists] - Updates exception flyout edit error messages (elastic#126875)
  [Security Solution][Rules] - Remove rule selection for read only users (elastic#126827)
  Fix session cleanup test (elastic#126966)
  [ftr] implement support for accessing ES through CCS (elastic#126547)
  [type-summarizer] always use normalized paths, fix windows compat (elastic#127055)
  Revert "[ci] Configure hourly pipeline for a small spot instance trial (elastic#126824)"
  Revert "[CI] Expand spot instance trial a bit (elastic#126928)"
  [Alerting] Adding functional tests for alerting and actions telemetry (elastic#126528)
  [Telemetry] Check permissions when requesting telemetry (elastic#126238)
  Don't submit empty seed_urls or sitemap_urls when making a partial crawl request (elastic#126972)
  Remove License Requirement for Enterprise Search App Search Meta Engines (elastic#127046)
  [ML] Adding data recognizer module config cache (elastic#126338)
  skip flaky suite (elastic#126027)
  [Reporting] Improve error logging for rescheduled jobs (elastic#126737)
  ...

# Conflicts:
#	x-pack/plugins/reporting/server/core.ts
#	x-pack/plugins/reporting/server/lib/tasks/execute_report.ts
jloleysens added a commit to jloleysens/kibana that referenced this pull request Mar 8, 2022
…re-browser-errors

* 'main' of github.com:elastic/kibana: (46 commits)
  Fix copy and pasted renderer user_name test (elastic#126663)
  [Gauge] Vis editors gauge legacy percent mode. (elastic#126318)
  Remove all cases related code from timelines (elastic#127003)
  Hide Enterprise search panel when no nodes are present (elastic#127100)
  [Lens] Fixed flakiness on runtime fields' appearance on the list (elastic#126945)
  [Security Solution][Lists] - Add missing privileges callout to exception lists page (elastic#126874)
  [Security Solution][Lists] - Updates exception flyout edit error messages (elastic#126875)
  [Security Solution][Rules] - Remove rule selection for read only users (elastic#126827)
  Fix session cleanup test (elastic#126966)
  [ftr] implement support for accessing ES through CCS (elastic#126547)
  [type-summarizer] always use normalized paths, fix windows compat (elastic#127055)
  Revert "[ci] Configure hourly pipeline for a small spot instance trial (elastic#126824)"
  Revert "[CI] Expand spot instance trial a bit (elastic#126928)"
  [Alerting] Adding functional tests for alerting and actions telemetry (elastic#126528)
  [Telemetry] Check permissions when requesting telemetry (elastic#126238)
  Don't submit empty seed_urls or sitemap_urls when making a partial crawl request (elastic#126972)
  Remove License Requirement for Enterprise Search App Search Meta Engines (elastic#127046)
  [ML] Adding data recognizer module config cache (elastic#126338)
  skip flaky suite (elastic#126027)
  [Reporting] Improve error logging for rescheduled jobs (elastic#126737)
  ...

# Conflicts:
#	x-pack/plugins/reporting/server/lib/tasks/execute_report.ts
@spalger spalger removed the v8.0.2 label Mar 8, 2022
lucasfcosta pushed a commit to lucasfcosta/kibana that referenced this pull request Mar 8, 2022
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
@kibanamachine kibanamachine added the backport missing Added to PRs automatically when the are determined to be missing a backport. label Mar 9, 2022
@kibanamachine
Copy link
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create backports run node scripts/backport --pr 126547 or prevent reminders by adding the backport:skip label.

@spalger
Copy link
Contributor Author

spalger commented Mar 10, 2022

Backport blocked by #124586, going to skip it for now. If you get the backports done and would like me to backport this please let me know @cuff-links

@spalger spalger added backport:skip This commit does not require backporting and removed v8.1.1 v7.17.2 labels Mar 10, 2022
@kibanamachine kibanamachine removed the backport missing Added to PRs automatically when the are determined to be missing a backport. label Mar 10, 2022
@cuff-links
Copy link
Contributor

Will do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Deprecated: Automatically backport this PR after it's merged backport:skip This commit does not require backporting release_note:skip Skip the PR/issue when compiling release notes Team:Operations Team label for Operations Team Team:QA Team label for QA Team v8.2.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for starting a CCS node with the FTR
8 participants