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

Connector needs to have config validators #372

Open
3 of 6 tasks
ryancrawcour opened this issue Mar 29, 2021 · 6 comments · Fixed by #371
Open
3 of 6 tasks

Connector needs to have config validators #372

ryancrawcour opened this issue Mar 29, 2021 · 6 comments · Fixed by #371
Assignees
Labels
feature-request New feature or request in-progress

Comments

@ryancrawcour
Copy link
Contributor

ryancrawcour commented Mar 29, 2021

## Problem Statement
When entering configuration for the connector it would be great if these config values could be validated whilst registering the connector instead of @ runtime when the connector tries to start.

## Proposed Solution
Kafka Connect supports connector config validation. Implement this for the sink connector config properties.
Ensure common, Sink and Source config values all have validators and recommendors as appropriate.

Validations to add -

  • validate database name is valid
  • validation container name is valid
  • validate that the topic(s) are valid

## Additional context
https://www.confluent.io/blog/write-a-kafka-connect-connector-with-configuration-handling/

Next Steps

  • Team consensus to proceed
  • Schedule Design Session
  • Complete Design Review
@ryancrawcour ryancrawcour linked a pull request Mar 29, 2021 that will close this issue
5 tasks
@ryancrawcour ryancrawcour added the feature-request New feature or request label Mar 29, 2021
@ryancrawcour ryancrawcour reopened this Mar 29, 2021
@ryancrawcour ryancrawcour changed the title Sink Connector needs to have config validators Connector needs to have config validators Mar 29, 2021
@ncliang
Copy link
Contributor

ncliang commented Mar 30, 2021

@ryancrawcour I see the following in CosmosClientBuilder::key javadoc

Sets either a master or readonly key used to perform authentication for accessing resource.
Params: key – master or readonly key
Returns: current Builder.

This implies that a readonly key could also be used to create the client. Is there a good way to validate that the client is created with a master key containing required ALL permission to create/write to database/container?

@ryancrawcour
Copy link
Contributor Author

This implies that a readonly key could also be used to create the client. Is there a good way to validate that the client is created with a master key containing required ALL permission to create/write to database/container?

that's a good point. i forget about the read-only key.
not sure the best way to validate that the key being used is a master key, not a read-only key.

@kushagraThapar / @moderakh can you think of a way to validate the key being used has write permission to the container, without actually attempting to write a doc (and then having to delete it).

@mageshn
Copy link

mageshn commented Mar 30, 2021

@ryancrawcour I don't have a lot of knowledge on this but would the permissions API help here? https://docs.microsoft.com/en-us/rest/api/cosmos-db/permissions . This can work only if we can invoke without any additional credentials or permissions.

@moderakh
Copy link
Contributor

@mageshn no permission API purpose is different.

At client side we currently do not have any API to distinguish a write key from a read key without actually attempting to perform a write operation.

I will check with our service side team if there is any workaround.

@ryancrawcour
Copy link
Contributor Author

i have the following listed as validators to add -

validate database name is valid

  • I am thinking of doing a GetDatabase call to check if the db id supplied is valid.

validation container name is valid

  • as above, plan to do a GetContainer (given a valid database) to check is the container id is valid. might have to do multiple here as we support a Topic#Container mapping where it would be possible to supply multiple container names.

@moderakh / @kushagraThapar thoughts on the above 2 operations?

validate that the topic(s) are valid

  • @ncliang what would be the best way to check if the Kafka topic supplied is valid?

any others?

@ryancrawcour
Copy link
Contributor Author

think of a way to validate the key being used has write permission to the container, without actually attempting to write a doc (and then having to delete it).

doesn't look like there is a way to determine write permissions given a key without actually attempting to write a doc.
so we'll just validate that the key given is a valid key, and handle a write failure if that happens.

@ryancrawcour ryancrawcour self-assigned this Jul 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request New feature or request in-progress
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants