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

initial support for local connectors #1195

Merged
merged 5 commits into from
Sep 26, 2023
Merged

Conversation

jgraettinger
Copy link
Member

@jgraettinger jgraettinger commented Sep 21, 2023

This PR adds initial support for local connectors for captures, derivations, and materializations. Local connectors are a lot like images, but instead are a command line that can be run on the local machine, optionally with an environment. They're intended for development use-cases only -- including full Tilt local stacks -- but are disabled in production settings.

flowctl is re-worked accordingly:

  • The generate command is expanded to also generate configuration stubs for endpoint and resource configs of captures & materializations.
  • The raw discover and raw capture commands are updated to use the runtime crate to drive connectors, which handles details of image vs local vs other connector flavors.

sops unsealing is also supported for local connectors. I'm thinking we should use this, paired with a CI KMS key, to facilitate easier connector development with configured SaaS API credentials and representative account fixtures, subject to a developer or CI workflow having permission to the applicable CI KMS.

This PR pairs with estuary/connectors#970 and is required to run connectors of the latter.

Workflow steps:

(How does one use this feature, and how has it changed)

Documentation links affected:

(list any documentation links that you created, or existing ones that you've identified as needing updates, along with a brief description)

Notes for reviewers:

(anything that might help someone review this PR)


This change is Reviewable

Local connectors are parsed correctly and that's about it.

This commit does not add any support for actually running local
connectors (that's coming).

Also handle derivation images within the `agent`, which had been
omitted.
We'd like them to be available in local contexts, like `flowctl` and
also local stacks, while being disabled in production deployments.
Add DebugJson newtype for wrapping serde::Serialize types with a debug
formatter that outputs styled, colorized JSON if stderr is a terminal.
Support for local connectors largely mirrors image connectors.
We unseal and unnest its endpoint configuration, then start the
configured program and drive it using its configured protocol.

Also relax unsealing (sops decryption) to pass through non-object
documents, which can happen if the config wasn't resolved (for example,
because it's being generated).
Also expand the perview of `flowctl generate` to also generate endpoint
config and resource config stubs for captures and materializations where
the indicate files are missing.

This is a replacement for the two-step "discover" workflow we've
previously had, where the first stage would write a config and the
second would actually do discover. That doesn't work with local
connectors (because we need a proper capture spec in order to know what
connector to discover from).
Copy link
Member

@williamhbaker williamhbaker left a comment

Choose a reason for hiding this comment

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

LGTM. I tested this out with the python demo connectors and it seemed to work well on my dev machine.

@@ -27,6 +27,7 @@ import (
type FlowConsumerConfig struct {
runconsumer.BaseConfig
Flow struct {
AllowLocal bool `long:"allow-local" description:"Allow local connectors. True for local stacks, and false otherwise."`
Copy link
Member

Choose a reason for hiding this comment

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

Are we setting this to true for local stacks somewhere? I would think we could add the configuration to the Tiltfile

Copy link
Member Author

Choose a reason for hiding this comment

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

Right, I haven't yet. I was mainly focused on making sure that they'd be disallowed everywhere unless specifically opted in, and I opted in within flowctl but not Tiltfile.

@jgraettinger jgraettinger merged commit 1785555 into master Sep 26, 2023
5 checks passed
@jgraettinger jgraettinger deleted the johnny/local-connectors branch September 26, 2023 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants