-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
airbyte-config: Implement RemoteDefinitionsProvider #16018
airbyte-config: Implement RemoteDefinitionsProvider #16018
Conversation
8360d40
to
b0e2572
Compare
* This config persistence pulls the connector configurations from a remotely hosted catalog. It is | ||
* read-only. | ||
*/ | ||
final public class RemoteConnectorCatalogPersistence implements ConfigPersistence { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It this the right interface for us to be using? I think we used this back in a time on when we had a lot less clarity on what our goals are--it was partially a trick to get platform upgrades to work. Now we have a much more focused version on "catalog persistence". Using this very broad interface means we lose a lot of clarity. As we are refactoring this, it would be a good moment to revisit what this iface should be.
cc @evantahler
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cgardens, I don't get if you suggest I use a different already existing interface or if we need to create a new, more focused one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The second option.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 on the second option.
In terms of interface, I think what's being abstracted here is the source_definitions
and destination_definitions
.
Probably an ActorDefinitionsProvider
with a listDefinitions
method could work.
The current behavior could be wrapped in a SeedResource
implementation while your new one would be a RemoteResource
.
Injecting this into the the existing implementations would help us avoid adding a new layer of ConfigPersistence and a step forward into breaking this giant into more focused pieces.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had initially suggested implementing a new ConfigPersistence
class since that's what we were using for the YamlSeedConfigPersistence
, which is doing a similar thing, and would be easy to slot in as a replacement when loading in the definitions for cloud. But I definitely agree that the typing guarantees and how generic ConfigPersistence is isn't ideal... If we want to move away from it anyway, this being an ActorDefinitionsProvider
like jimmy proposed sounds great to me.
* This config persistence pulls the connector configurations from a remotely hosted catalog. It is | ||
* read-only. | ||
*/ | ||
final public class RemoteConnectorCatalogPersistence implements ConfigPersistence { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I find the name a bit confusing, in the platform code, connectors are mostly called Source/Destination/Actor. At this point, I would try to not introduce a new one. RemoteActorDefinitions
might be more in line with the current naming.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nevermind... I discovered parts of the platform with "connectors". still hoping we can unify this a bit.
* This config persistence pulls the connector configurations from a remotely hosted catalog. It is | ||
* read-only. | ||
*/ | ||
final public class RemoteConnectorCatalogPersistence implements ConfigPersistence { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 on the second option.
In terms of interface, I think what's being abstracted here is the source_definitions
and destination_definitions
.
Probably an ActorDefinitionsProvider
with a listDefinitions
method could work.
The current behavior could be wrapped in a SeedResource
implementation while your new one would be a RemoteResource
.
Injecting this into the the existing implementations would help us avoid adding a new layer of ConfigPersistence and a step forward into breaking this giant into more focused pieces.
return configsWithMissingField; | ||
} | ||
|
||
private static JsonNode addMissingTombstoneField(final JsonNode definitionJson) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This and the ones below look like something that should be shared with the current implementation.
final JsonNode currPublic = definitionJson.get("public"); | ||
if (currPublic == null || currPublic.isNull()) { | ||
// definitions loaded from the cloud connector catalog are by definition public | ||
((ObjectNode) definitionJson).set("public", BooleanNode.TRUE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think there's anything to change on this end, but just a note that the remote catalog will now have public
set to true
since the schema is enforced more strictly in https://github.com/airbytehq/airbyte-cloud/pull/2485/commits/86e9dc72a5b7afd821a9f8b3eaa10986e370817f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, so if this is enforced upstream I'll remove the addition of public
and custom
fields.
@@ -0,0 +1,225 @@ | |||
/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any particular reason you chose to add this as part of OSS and not directly in Cloud? (mainly just curious, with the proposed changes to the interface it might make more sense to keep this in OSS)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because I think nothing logically tights it to the Cloud repo and that this could allow OSS users to declare their remote catalog.
…ence' of github.com:airbytehq/airbyte into augustin/config/implement-remote-catalog-config-persistence
@gosusnp / @cgardens I made an (incomplete) attempt at refactoring the code in the direction I think you suggest. This is my first Java contribution, so bare with me, please 😄
|
@alafanechere , nice! I agree with the direction. I would say first, let's start with an Specifically for the iface:
I don't think this is a good method to have in the interface. This Maybe just? Not sure if there are other public methods you need in the interface?
If it is important that the single method be able to return both source and destination definitions, we can also just build a wrapper class to handle that.
|
@alafanechere , pretty much agree with @cgardens's comments. About In terms of wrapping up the refactoring, it's something that we (workflow team) would typically take on. You're more than welcome to contribute if you want to take a stab at it. |
@gosusnp I made the suggested changes following our call:
I'll write tests for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good! I added a few comments.
One thing to keep in mind, if you want to remove YamlSeedConfigPersistence
. It is used in cloud, so if you remove it, you'll break cloud. A two step process here might be easier. You can replace the usage of YamlSeedConfigPersistence
in this PR but you should update cloud before being able to remove it.
airbyte-config/init/src/main/java/io/airbyte/config/init/PatchingHelpers.java
Outdated
Show resolved
Hide resolved
airbyte-config/init/src/main/java/io/airbyte/config/init/RemoteDefinitionsProvider.java
Outdated
Show resolved
Hide resolved
airbyte-config/init/src/main/java/io/airbyte/config/init/RemoteDefinitionsProvider.java
Outdated
Show resolved
Hide resolved
airbyte-config/init/src/main/java/io/airbyte/config/init/RemoteDefinitionsProvider.java
Outdated
Show resolved
Hide resolved
airbyte-config/init/src/main/java/io/airbyte/config/init/RemoteDefinitionsProvider.java
Outdated
Show resolved
Hide resolved
airbyte-config/init/src/main/java/io/airbyte/config/init/RemoteDefinitionsProvider.java
Outdated
Show resolved
Hide resolved
airbyte-config/init/src/main/java/io/airbyte/config/init/LocalDefinitionsProvider.java
Outdated
Show resolved
Hide resolved
airbyte-config/init/src/main/java/io/airbyte/config/init/RemoteDefinitionsProvider.java
Outdated
Show resolved
Hide resolved
…onfig-persistence
…ence' of github.com:airbytehq/airbyte into augustin/config/implement-remote-catalog-config-persistence
I'll definitely do the following before removing
|
What
https://github.com/airbytehq/airbyte-cloud/issues/2402
Epic: https://github.com/airbytehq/airbyte-cloud/issues/2399
To decouple cloud deployments from connector catalog updates we need Airbyte's bootloader to fetch connector configuration (a.k.a definitions) from a remote source. (A JSON file ATM)
How (updated after iterations)
DefinitionsProvider
interfaceRemoteDefinitionsProvider
class which retrieves a remote catalog and exposes the definitions with its interfaceLocalDefinitionsProvider
class whose internal logic of parsing YAML seed file is similar toYamlSeedConfigPersistence
DefinitionsProviderToConfigPersistence
) that can be used in the bootloader to avoid immediately refactoring the bootloader to use the newDefinitionsProvider
interface.REMOTE_CONNECTOR_CATALOG_URL
) (not used at the moment)Recommended reading order
DefinitionsProvider.java
RemoteDefinitionsProvider.java
LocalDefinitionsProvider.java
DefinitionProviderToConfigPersistenceAdapterTest.java
EnvConfigs.java
Configs.java
🚨 User Impact 🚨
No impact: new classes are not used yet.