Skip to content

feat(featureflags): env fallback for extra-compatible-node-models - #3769

Open
AdaAibaby wants to merge 1 commit into
e2b-dev:mainfrom
AdaAibaby:feat/extra-compatible-node-models-env-fallback
Open

AdaAibaby wants to merge 1 commit into
e2b-dev:mainfrom
AdaAibaby:feat/extra-compatible-node-models-env-fallback

Conversation

@AdaAibaby

Copy link
Copy Markdown
Contributor

What

Add an EXTRA_COMPATIBLE_NODE_MODELS environment-variable fallback for the extra-compatible-node-models flag, so deployments without LaunchDarkly can configure cross-CPU-model placement.

Refs #3764.

Why

extra-compatible-node-models is declared with a null fallback and no env override:

ExtraCompatibleNodeModelsFlag = NewJSONFlag("extra-compatible-node-models", ldvalue.Null())

Without LAUNCH_DARKLY_API_KEY, NewClient falls back to the ldtestdata offline store, which is only seeded by each flag's construction-time fallback. With the fallback fixed at ldvalue.Null(), GetExtraCompatibleNodeModels always returns nil, so IsCompatibleWithExtra degrades to the hardcoded table and the flag can never carry a value. Self-hosted clusters with a heterogeneous (but compatible) CPU fleet therefore cannot enable the feature at all.

How

Give the flag an env-sourced fallback, consistent with how the same file already bridges the no-LaunchDarkly case for firecracker-versions (DEFAULT_FIRECRACKER_VERSIONS), build-firecracker-version, build-kernel-version, and build-envd-version:

  • New EXTRA_COMPATIBLE_NODE_MODELS env var — a JSON object of build model to node models, e.g. {"106":["173"]}.
  • Parsed at construction into the flag fallback; a malformed value fails NewClient fast via extraCompatibleNodeModelsEnvErr (same discipline as FirecrackerVersionsFallback), rather than being silently dropped.
  • LaunchDarkly, where present, still overrides it — deployments with LaunchDarkly are unaffected.

The one-way, same-architecture-and-family compatibility rule in IsCompatibleWithExtra is unchanged; this only changes where the value can come from, not the rule. Operators remain responsible for choosing safe (older-build → newer-node) pairs, exactly as with LaunchDarkly today.

Test

TestParseExtraCompatibleNodeModels covers empty/whitespace (null, no error), a valid object (parses to the flag value and is read back by GetExtraCompatibleNodeModels), and malformed JSON (errors, stays null).

The extra-compatible-node-models flag is only reachable through LaunchDarkly, so self-hosted deployments (no LaunchDarkly, offline ldtestdata store) cannot configure it and the cross-CPU placement feature it gates is unusable for heterogeneous-CPU fleets.

Add an EXTRA_COMPATIBLE_NODE_MODELS env fallback, mirroring DEFAULT_FIRECRACKER_VERSIONS: a malformed value fails NewClient fast via extraCompatibleNodeModelsEnvErr. LaunchDarkly, where present, still overrides it.

Refs e2b-dev#3764

This branch has not been deployed

No deployments
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.

1 participant