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

[GCS]-Parse configurations from Kibana UI #493

Merged

Conversation

jignesh-crest
Copy link
Collaborator

@jignesh-crest jignesh-crest commented Feb 16, 2023

Closes #466

This PR addresses the following changes:

  • Parse the private-key present in the configurations passed from UI.
  • Moves the configuration validation to a separate method.

Checklists

Pre-Review Checklist

  • Covered the changes with automated tests
  • Tested the changes locally by running make test and make ftest NAME=google_cloud_storage
  • Added a label for each target release version (example: v7.13.2, v7.14.0, v8.0.0)
  • Considered corresponding documentation changes
  • Contributed any configuration settings changes to the configuration reference

parse configs from ui by formating the private-key
@jignesh-crest jignesh-crest changed the title parse configs from ui by formating the private-key [GCS]-Parse configurations from Kibana UI Feb 16, 2023
@praveen-elastic
Copy link
Collaborator

buildkite test this

@jignesh-crest jignesh-crest marked this pull request as ready for review February 16, 2023 11:33
Copy link
Contributor

@timgrein timgrein left a comment

Choose a reason for hiding this comment

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

Some comments around test specific code in connector implementations and a suggestion for narrowing an exception type.

connectors/sources/google_cloud_storage.py Outdated Show resolved Hide resolved
connectors/sources/google_cloud_storage.py Outdated Show resolved Hide resolved
connectors/sources/google_cloud_storage.py Show resolved Hide resolved
connectors/sources/google_cloud_storage.py Outdated Show resolved Hide resolved
@timgrein timgrein requested a review from a team February 16, 2023 13:38
@jignesh-crest
Copy link
Collaborator Author

Hey, I've rebased the branch on the latest main. on a side note, This PR needs to be backported to 8.7 as these changes will be required to make the Google Cloud Connector work with Kibana UI. But I'm not able to add or remove any labels, so can someone do that, would be a great help.

cc: @timgrein @tarekziade

Copy link
Member

@artem-shelkovnikov artem-shelkovnikov left a comment

Choose a reason for hiding this comment

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

I'm not sure about approach taken here.

Ideally, when connector is initialised, it already has to have all fields initialised and ready to work. In this PR, however, values are initialised later with special private method - doesn't seem like a good pattern to me.

I want to discuss it with @tarekziade - ideally you validate config in initialiser and raise errors there, and framework will show errors in UI correctly.

@jignesh-crest
Copy link
Collaborator Author

@artem-shelkovnikov I've been validating the configurations at the time of initialization only, I've moved it to ping keeping this comment in mind.

@artem-shelkovnikov
Copy link
Member

I understand, however it feels like this validation should happen in the initialiser OR we should actually introduce a method in the framework validate_configuration that each connector has to implement. Both of these changes require framework change that we need to discuss with @tarekziade.

Problem that I see with current approach is that connector becomes more fragile. If it happens so that we don't call ping before calling get_docs, then connector will break - configuration is populated only in ping, not in get_docs

Copy link
Member

@wangch079 wangch079 left a comment

Choose a reason for hiding this comment

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

I agree with @artem-shelkovnikov that _validate_configurations() and _initialize_configurations() shouldn't happens in ping(). Any particular reason to move them out of __init__?

It also requires to be called in sequence, e.g. it will fail if you call _initialize_configurations() without calling _validate_configurations().

connectors/source.py Outdated Show resolved Hide resolved
connectors/sources/google_cloud_storage.py Outdated Show resolved Hide resolved
@jignesh-crest jignesh-crest marked this pull request as draft March 1, 2023 09:40
@jignesh-crest jignesh-crest marked this pull request as ready for review March 2, 2023 04:48
@moxarth-elastic
Copy link
Collaborator

buildkite test this

connectors/sources/google_cloud_storage.py Show resolved Hide resolved
connectors/sources/google_cloud_storage.py Outdated Show resolved Hide resolved
connectors/sources/google_cloud_storage.py Outdated Show resolved Hide resolved
Co-authored-by: Chenhui Wang <54903978+wangch079@users.noreply.github.com>
@moxarth-elastic
Copy link
Collaborator

buildkite test this

@moxarth-elastic
Copy link
Collaborator

buildkite test this

@moxarth-elastic
Copy link
Collaborator

buildkite test this

1 similar comment
@moxarth-elastic
Copy link
Collaborator

buildkite test this

timgrein
timgrein previously approved these changes Mar 20, 2023
Copy link
Contributor

@timgrein timgrein left a comment

Choose a reason for hiding this comment

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

LGTM

@jignesh-crest
Copy link
Collaborator Author

@artem-shelkovnikov, @wangch079, Can we get this merge if it looks good to you?

@moxarth-elastic
Copy link
Collaborator

buildkite test this

@praveen-elastic
Copy link
Collaborator

buildkite test this

@artem-shelkovnikov artem-shelkovnikov merged commit 2144c0f into elastic:main Mar 21, 2023
@github-actions
Copy link

💔 Failed to create backport PR(s)

Status Branch Result
8.8 The branch "8.8" is invalid or doesn't exist

To backport manually run:
backport --pr 493 --autoMerge --autoMergeMethod squash

@artem-shelkovnikov
Copy link
Member

💚 All backports created successfully

Status Branch Result
8.7

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

artem-shelkovnikov added a commit that referenced this pull request Mar 21, 2023
(cherry picked from commit 2144c0f)

Co-authored-by: jignesh-crest <95845553+jignesh-crest@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[GCS] - connector fails when configurations passed through UI
6 participants