Skip to content

feat: expose flagd sync-server keepalive settings on FeatureFlagSource - #852

Merged
toddbaert merged 4 commits into
open-feature:mainfrom
jabenedicic:851-feat-flagd-sync-keepalive
Jul 31, 2026
Merged

toddbaert merged 4 commits into
open-feature:mainfrom
jabenedicic:851-feat-flagd-sync-keepalive

Conversation

@jabenedicic

Copy link
Copy Markdown
Contributor

What

Adds two opt-in fields to FeatureFlagSource that surface flagd's new sync-server gRPC keepalive-enforcement settings, so keepalive tolerance for operator-managed flagd (injected sidecar and standalone Flagd) can be tuned from the CRD instead of per-container env/args.

Closes #851.

Field Env var emitted Type flagd flag
keepAliveMinTime FLAGD_KEEP_ALIVE_MIN_TIME duration --keep-alive-min-time
keepAlivePermitWithoutStream FLAGD_KEEP_ALIVE_PERMIT_WITHOUT_STREAM bool --keep-alive-permit-without-stream

The corresponding flagd flags are proposed in open-feature/flagd#1999 (issue #1998). That change and this one are best considered together, but can land in either order — see below.

Design notes

  • Opt-in, no default. Both fields are optional pointers with no +kubebuilder:default. The env var is emitted only when the field is set; unset means flagd uses its own default, so there is no behaviour change for existing FeatureFlagSources.
  • Env vars, not CLI args. Surfaced through FeatureFlagSourceSpec.ToEnvVars() rather than container args. A flagd that predates these flags silently ignores unknown FLAGD_* env vars (whereas an unknown CLI flag would hard-error). So these fields are inert against the current flagd and this change has no issues if merged before the flagd change — it is safe to land in either order.
  • No flagd image bump here. The default flagd tag is unchanged; the fields become functional once the operator's flagd image is bumped to a release with the flags. That bump is intentionally a separate change.
  • Both the injected sidecar and the standalone Flagd (which references a FeatureFlagSource) pick this up through the shared injection path.

Test plan

  • make unit-test — new tests for Merge() (override/nil) and ToEnvVars() (set / unset / mixed / explicit false).
  • Regenerated CRDs, deepcopy, and CRD docs (make generate manifests generate-crdocs); reference doc updated.
  • Verified that stock flagd (the currently-pinned image) starts cleanly with FLAGD_KEEP_ALIVE_MIN_TIME / FLAGD_KEEP_ALIVE_PERMIT_WITHOUT_STREAM set — the unknown env vars are ignored, no crash, output identical to baseline.

@coderabbitai

coderabbitai Bot commented Jul 14, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f65ca2fb-4257-4e35-8b9e-0ea28bcc562d

📥 Commits

Reviewing files that changed from the base of the PR and between 7052be2 and b6dc790.

📒 Files selected for processing (7)
  • api/core/v1beta1/common/common.go
  • api/core/v1beta1/featureflagsource_types.go
  • api/core/v1beta1/featureflagsource_types_test.go
  • api/core/v1beta1/zz_generated.deepcopy.go
  • config/crd/bases/core.openfeature.dev_featureflagsources.yaml
  • docs/crds.md
  • docs/feature_flag_source.md
🚧 Files skipped from review as they are similar to previous changes (3)
  • docs/feature_flag_source.md
  • docs/crds.md
  • config/crd/bases/core.openfeature.dev_featureflagsources.yaml

📝 Walkthrough

Walkthrough

FeatureFlagSourceSpec now supports optional flagd keepalive settings. Values are merged, deep-copied, converted to environment variables, represented in the CRD schema, tested, and documented.

Changes

FeatureFlag keepalive configuration

Layer / File(s) Summary
Keepalive contract and schema
api/core/v1beta1/common/common.go, api/core/v1beta1/featureflagsource_types.go, config/crd/bases/...
Adds keepalive environment variable constants and optional FeatureFlagSourceSpec fields to the CRD schema.
Merge, environment propagation, and object copying
api/core/v1beta1/featureflagsource_types.go, api/core/v1beta1/zz_generated.deepcopy.go, api/core/v1beta1/featureflagsource_types_test.go
Merges and deep-copies keepalive values, emits configured environment variables, and tests unset, true, false, and partial configurations.
Configuration documentation
docs/crds.md, docs/feature_flag_source.md
Documents the optional keepalive fields and their flagd-default behavior.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

sequenceDiagram
  participant FeatureFlagSourceSpec
  participant ToEnvVars
  participant flagdSidecar
  FeatureFlagSourceSpec->>ToEnvVars: configured keepalive fields
  ToEnvVars->>flagdSidecar: FLAGD_KEEP_ALIVE_* environment variables
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: exposing flagd keepalive settings on FeatureFlagSource.
Description check ✅ Passed The description is directly related to the keepalive FeatureFlagSource changes and their intended behavior.
Linked Issues check ✅ Passed The PR adds the requested optional keepalive fields, emits env vars only when set, and avoids a flagd image bump.
Out of Scope Changes check ✅ Passed The tests, CRD generation, deepcopy updates, and docs all support the requested FeatureFlagSource keepalive feature.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Jul 14, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.63%. Comparing base (499661e) to head (b6dc790).
⚠️ Report is 106 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main     #852       +/-   ##
===========================================
- Coverage   86.51%   69.63%   -16.89%     
===========================================
  Files          19       31       +12     
  Lines        1587     2022      +435     
===========================================
+ Hits         1373     1408       +35     
- Misses        173      561      +388     
- Partials       41       53       +12     
Files with missing lines Coverage Δ
api/core/v1beta1/common/common.go 83.67% <ø> (ø)
api/core/v1beta1/featureflagsource_types.go 90.43% <100.00%> (ø)

... and 24 files with indirect coverage changes

Flag Coverage Δ
unit-tests 69.63% <100.00%> (∅)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Signed-off-by: Jason Benedicic <48251655+jabenedicic@users.noreply.github.com>
Signed-off-by: Jason Benedicic <48251655+jabenedicic@users.noreply.github.com>
Signed-off-by: Jason Benedicic <48251655+jabenedicic@users.noreply.github.com>
Signed-off-by: Jason Benedicic <48251655+jabenedicic@users.noreply.github.com>
@toddbaert
toddbaert force-pushed the 851-feat-flagd-sync-keepalive branch from 7052be2 to b6dc790 Compare July 30, 2026 17:22
@toddbaert
toddbaert merged commit 14a3864 into open-feature:main Jul 31, 2026
15 of 16 checks passed
This was referenced Jul 31, 2026
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.

Expose flagd sync-server gRPC keepalive settings on FeatureFlagSource

2 participants