Skip to content

feldera-types: resolve env vars in connector config#5836

Merged
abhizer merged 3 commits intomainfrom
issue5799
Apr 9, 2026
Merged

feldera-types: resolve env vars in connector config#5836
abhizer merged 3 commits intomainfrom
issue5799

Conversation

@abhizer
Copy link
Copy Markdown
Contributor

@abhizer abhizer commented Mar 16, 2026

Describe Manual Test Plan

Manually tested by creating a pipeline with env vars in connector config and setting env vars via the pipeline config.

Checklist

  • Unit tests added/updated
  • Integration tests added/updated
  • Documentation updated
  • Changelog updated

Fixes: #5799

Follows the same scheme as the kubernetes secret resolver.
To resolve an env var successfully, the string must start with: `${env:`
and end with `}`.

The env var name then has to start from a valid alphabet, or underscore.
The name then may contain numbers.

Example: `"table": "${env:TABLE_NAME}"`

Signed-off-by: Abhinav Gyawali <22275402+abhizer@users.noreply.github.com>
@abhizer abhizer requested a review from snkas March 16, 2026 14:31
@abhizer abhizer changed the title Issue5799 feldera-types: resolve env vars in connector config Mar 16, 2026
@gz
Copy link
Copy Markdown
Contributor

gz commented Mar 16, 2026

what's stopping us from having a canonical default as @jpadilla suggests #5799 that gets used in case it's set?

Ok(value) => Ok(value),
Err(env::VarError::NotPresent) | Err(env::VarError::NotUnicode(_)) => {
Err(SecretRefResolutionError::EnvVarNotSet {
env_ref: secret_ref,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

When env::var returns VarError::NotUnicode, the variable is set — it just contains non-UTF-8 bytes. Mapping it to EnvVarNotSet produces a misleading error: the user will check env | grep VAR, see it set, and wonder why Feldera says otherwise.

Consider a separate error variant, or at minimum tweak the message to "is not set or contains non-UTF-8 bytes".

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The separate error variant is preferred.

@abhizer abhizer requested a review from gz April 7, 2026 17:46
Copy link
Copy Markdown
Contributor

@gz gz left a comment

Choose a reason for hiding this comment

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

what happens to checkpointed state with env variables

- It is not possible to specify a secret value type other than string
- It is not possible to specify a secret as a substring, for example
`abc${secret:kubernetes:a/b}def` does not work
- It is not possible to specify a reference value type other than string
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

create follow up issue for these?

Copy link
Copy Markdown
Contributor

@snkas snkas left a comment

Choose a reason for hiding this comment

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

The implementation itself works, though I'm still in-between whether this adds functionality to Feldera that is out of scope.

The connector configuration was made part of the SQL to have it be self-contained (rather than the very prior version, where the connector was a separate API entity). Adding extra ways to parameterize it, either out-of-band or via the runtime configuration, is effectively going against that design decision.

The user controls the pipeline, and is able to create them in whatever "templating" framework that is useful to them. So if a value should be changed in the connector configuration, then that change can be applied.

Example analogies to this design are Kubernetes vs. Helm, or CSS vs. SCSS.

I think the actual issue this is trying to fix is to avoid recompilation when the connector changes. We could solve that differently, for example changing the way connectors are provided by having them be a separate field and removing it from SQL (or supplementary to it).

```
can be identified to be secret or environment variable references (this excludes keys), for example
(secret named `a` at data key `b` has value `value`):
```
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Indent was already correct?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah, this was just autoformatting by the IDE.

@snkas
Copy link
Copy Markdown
Contributor

snkas commented Apr 8, 2026

The mechanism that this is being added to is called secret references, and has claimed string that start with ${secret: and end with }. This is not backward compatible in that string that start with ${env: and end with } are now no longer plain strings. There is already the ability to add another provider via ${secret:env:...}, this could be used instead? This is orthogonal to my prior comment of whether we should be providing templating.

Signed-off-by: Abhinav Gyawali <22275402+abhizer@users.noreply.github.com>

[ci] apply automatic fixes

Signed-off-by: feldera-bot <feldera-bot@feldera.com>

apply suggestions from code review

Signed-off-by: Abhinav Gyawali <22275402+abhizer@users.noreply.github.com>
@snkas
Copy link
Copy Markdown
Contributor

snkas commented Apr 8, 2026

Also note that ${env:..} is a more common usage, as such it can conflict with an actual connector-relevant value. For example, Kafka Connect uses it as well.

Signed-off-by: feldera-bot <feldera-bot@feldera.com>
@abhizer abhizer added this pull request to the merge queue Apr 8, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 8, 2026
@abhizer abhizer added this pull request to the merge queue Apr 8, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 8, 2026
@abhizer abhizer added this pull request to the merge queue Apr 8, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 9, 2026
@abhizer abhizer added this pull request to the merge queue Apr 9, 2026
Merged via the queue into main with commit 6af3f1b Apr 9, 2026
1 check passed
@abhizer abhizer deleted the issue5799 branch April 9, 2026 04:46
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.

5 participants