Skip to content

Resolve env-var placeholders in Flink config.yaml#369

Open
velo wants to merge 2 commits into
mainfrom
feat/iceberg-auto-maintenance
Open

Resolve env-var placeholders in Flink config.yaml#369
velo wants to merge 2 commits into
mainfrom
feat/iceberg-auto-maintenance

Conversation

@velo

@velo velo commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

Summary

BaseRunner.initConfiguration() now runs the loaded config.yaml values through the existing EnvVarResolver (the same ${VAR} mechanism already applied to the SQL script and compiled plan). This lets secrets be injected into Flink config via env vars instead of landing in the plaintext config.yaml ConfigMap.

Motivating use: Iceberg auto-maintenance wires a JDBC lock store whose credentials must not sit in a ConfigMap. cloud-compilation emits flink-maintenance.lock.jdbc.user: ${ICEBERG_LOCK_USER} / ...password: ${ICEBERG_LOCK_PASSWORD} placeholders; the flink pod mounts them from the iceberg-maintainance-locktable secret, and this change resolves them at runtime.

Configuration.toMap() returns a copy, so mutating conf while iterating is safe. Values without ${...} are untouched.

Test

CliRunnerTest.initConfiguration_shouldResolveEnvVarPlaceholdersInConfig — asserts a ${VAR} config value resolves from env and literals pass through. Full CliRunnerTest green (14/14, under Java 17).

Related

  • Pairs with cloud-compilation PR (branch feat/iceberg-auto-maintenance) which emits the config.
  • Wayfinder ticket: DataSQRL/cloud-compilation-wayfinder#13

🤖 Generated with Claude Code

Signed-off-by: Marvin Froeder <marvin@datasqrl.com>
@velo
velo marked this pull request as ready for review July 21, 2026 16:52

@ferenc-csaky ferenc-csaky left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Added 2 comments, but the core logic looks good.

Comment on lines +106 to +112
/**
* Resolves {@code ${VAR}} placeholders in Flink configuration values from the environment, the
* same mechanism already applied to the SQL script and compiled plan. Lets secrets (e.g. the
* Iceberg maintenance lock JDBC credentials) be injected via env vars instead of landing in the
* plaintext config.yaml ConfigMap. {@link Configuration#toMap()} returns a copy, so mutating
* {@code conf} while iterating it is safe.
*/

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Delete this, it's just noise, the method is trivial.

* plaintext config.yaml ConfigMap. {@link Configuration#toMap()} returns a copy, so mutating
* {@code conf} while iterating it is safe.
*/
private void resolveEnvVars(Configuration conf) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'd prefer creating a new instance instead of mutating the given one. Configuration has a copy ctor.

Signed-off-by: Marvin Froeder <marvin@datasqrl.com>
@ferenc-csaky
ferenc-csaky enabled auto-merge (squash) July 21, 2026 20:10
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