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

Migrations for scoped connectors #11305

Merged
merged 9 commits into from
Mar 23, 2022
Merged

Conversation

git-phu
Copy link
Contributor

@git-phu git-phu commented Mar 22, 2022

What

Part of #9652
Tech Spec

Migrations and model changes to support scoped connector definitions.
Also includes some misc. changes that will be used in upcoming PRs.

Changes

  • Two booleans for the actor definitions table
    • public: If true this definition can be used by all workspaces with no further permissions required. Otherwise, a workspace needs to have a grant for this definition in order to be able to use it.
    • custom: if true this definition should only be configured for the workspace it was created in and should not be grantable to other namespaces
  • New table actor_definition_workspace_grants
    • each record represents a grant to use a given actor definition for a given workspace

Recommended reading order

Easiest to view by commit

User Impact

No user visible impact. Upcoming PRs will depend on these changes.

Comment on lines +784 to +791
private Condition includeTombstones(final Field<Boolean> tombstoneField, final boolean includeTombstones) {
if (includeTombstones) {
return DSL.trueCondition();
} else {
return tombstoneField.eq(false);
}
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this one doesn't fit in this PR thematically but I wanted to use this convenience method in multiple upcoming PRs

description: true if this connector definition is available to all workspaces
type: boolean
default: false
custom:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

from @michel-tricot in https://github.com/airbytehq/airbyte/pull/11339/files#r832831845

What is the definition of custom vs public? I would be careful before adding that kind of specific flags on the data model. They risk proliferating.
Are they mutually exclusive? then it should be a enum and if we foresee that it is only these two states then just one boolean
Can it be true on both? false on both? what is the expected behavior in these cases?

Copy link
Contributor

Choose a reason for hiding this comment

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

Here's my take on what the possible combinations mean:

Connector Definition

public custom Valid? Meaning
true true no  
true false yes Part of Airbyte’s catalog, available by default
false true yes User-uploaded custom connector
false false yes Part of Airbyte’s catalog, opt-in via workspace grant

Originally, the plan was just to introduce the public boolean on its own. But, we want to support an endpoint that returns all public: false connector definitions that are eligible for opt-in grants. The use case here is an 'early access' connector that is in the Airbyte Catalog, but not available by default.

We need to clearly differentiate these private, opt-in connectors from user-uploaded custom connectors so that an instance admin doesn't accidentally grant a custom connector to a different customer. The data model doesn't currently support this differentiation, so we decided that adding a 'custom' boolean in addition to the 'public' boolean made sense.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup. It also seems possible that public: true && custom: true could map to something valid in the future (for example third-party supported and maintained connectors that are approved by Airbyte as available to everyone).

I do agree though that we should be wary of flag proliferation and the current states can be conveniently captured in a single enum as well.

fyi the original discussion about whether to use an enum for this is here

Copy link
Contributor

@pmossman pmossman Mar 23, 2022

Choose a reason for hiding this comment

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

@cgardens fyi in case you want to weigh in, since you were part of the original discussion about boolean vs enum tradeoffs.

I think the original resistance to an enum came from the fact that we'd be duplicating information that we can already glean from the source_type enum, which already has a 'custom' value.

However, this source_type enum wouldn't be appropriate for describing destination definitions, and existing use-cases of source_type: custom would IMO be better served by querying for a new custom: true boolean.

In general, I think conflating custom with public visibility at the database level by trying to define an enum that describes both feels a bit inflexible to me. I think there are independent use-cases of each, so defining two booleans feels like the cleanest approach for supporting current needs while remaining flexible to the future.

Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed with @pmossman 's comment. The original source_type enum (originated for billing purposes) was misleading. e.g. we had: api, file, db, custom in a single enum. One of these things is not like the others. Custom is a different concept from other enums and concepts we've discussed and having it be clearly separate makes that clear. Private / public are also totally disjoint concepts from the custom idea. Parker's table lays it out well (and we should probably integrate it into how we document the project).

Copy link
Contributor

@pmossman pmossman left a comment

Choose a reason for hiding this comment

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

Looks great! Just left one very small comment.

Edit: just saw the comment from michel, will add a response

…ed-connectors-migrations

# Conflicts:
#	airbyte-config/persistence/src/main/java/io/airbyte/config/persistence/ConfigRepository.java
@git-phu git-phu temporarily deployed to more-secrets March 23, 2022 18:53 Inactive
@git-phu git-phu temporarily deployed to more-secrets March 23, 2022 18:53 Inactive
@git-phu git-phu temporarily deployed to more-secrets March 23, 2022 19:00 Inactive
@git-phu git-phu temporarily deployed to more-secrets March 23, 2022 19:00 Inactive
@git-phu git-phu merged commit e050177 into master Mar 23, 2022
@git-phu git-phu deleted the peter/scoped-connectors-migrations branch March 23, 2022 21:02
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.

4 participants