Skip to content

feat: sidecar init stability, drop k8s < 1.29 support#807

Merged
toddbaert merged 8 commits intoopen-feature:mainfrom
Y0sh1dk:fix/sidecar-injection-fix
Apr 23, 2026
Merged

feat: sidecar init stability, drop k8s < 1.29 support#807
toddbaert merged 8 commits intoopen-feature:mainfrom
Y0sh1dk:fix/sidecar-injection-fix

Conversation

@Y0sh1dk
Copy link
Copy Markdown
Contributor

@Y0sh1dk Y0sh1dk commented Mar 9, 2026

  • use native sidecar containers
  • dropping support for severely EOL K8s versions (<1.29)

Fixes: #806

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refactors the flagd container injection logic within the OpenFeature operator to leverage native Kubernetes sidecar containers, addressing a known issue. This change aligns the operator with modern Kubernetes practices for managing auxiliary containers, improving the lifecycle management of flagd instances. It's important to note that this update introduces a breaking change for older Kubernetes versions (pre-v1.29) that do not support built-in sidecar containers.

Highlights

  • Native Kubernetes Sidecar Injection: Updated the flagd container injection mechanism to utilize native Kubernetes sidecar containers, aligning with modern Kubernetes practices for auxiliary container management.
  • Flagd Container Restart Policy: Introduced a RestartPolicy of Always for the injected flagd sidecar container to ensure continuous operation.
  • Injection Logic Refinement: Modified the addFlagdContainer logic to target PodSpec.InitContainers instead of PodSpec.Containers for flagd injection.
  • Breaking Change Notification: Noted that this change is breaking for Kubernetes clusters older than v1.29, as they do not support built-in sidecar containers.
Changelog
  • internal/common/flagdinjector/flagdinjector.go
    • Imported k8s.io/utils/ptr for pointer utilities.
    • Added RestartPolicy: ptr.To(corev1.ContainerRestartPolicyAlways) to the generated flagd container.
    • Modified addFlagdContainer to append and update spec.InitContainers instead of spec.Containers.
  • internal/common/flagdinjector/flagdinjector_test.go
    • Imported corev1 and k8s.io/utils/ptr.
    • Removed several blank lines for cleaner code.
    • Updated calls to generatePod to include a new initContainers parameter, passing nil where appropriate.
    • Modified assertions to check expectedPod.Spec.InitContainers[0] instead of expectedPod.Spec.Containers[1].
    • Updated the generatePod function signature and implementation to accept and utilize an initContainers slice.
    • Adjusted getExpectedPod to define the flagd container within InitContainers instead of Containers, and added the RestartPolicy.
Activity
  • No human activity (comments, reviews, etc.) has been recorded on this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@Y0sh1dk Y0sh1dk changed the title Update Flagd container injection to native Kubernetes sidecar feat: Update Flagd container injection to native Kubernetes sidecar Mar 9, 2026
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the flagd container injection to use native Kubernetes sidecar containers, which is a great improvement for clusters that support this feature (v1.29+). The changes correctly modify the injection logic to place the flagd container into initContainers with restartPolicy: Always. The tests have been updated accordingly to validate the new behavior. The implementation is solid. I've left one minor comment regarding import consistency in a test file.

Comment thread internal/common/flagdinjector/flagdinjector_test.go Outdated
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 9, 2026

Codecov Report

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

Additional details and impacted files
@@             Coverage Diff             @@
##             main     #807       +/-   ##
===========================================
- Coverage   86.51%   68.72%   -17.79%     
===========================================
  Files          19       30       +11     
  Lines        1587     2392      +805     
===========================================
+ Hits         1373     1644      +271     
- Misses        173      695      +522     
- Partials       41       53       +12     
Files with missing lines Coverage Δ
internal/common/flagdinjector/flagdinjector.go 87.71% <100.00%> (ø)

... and 11 files with indirect coverage changes

Flag Coverage Δ
unit-tests 68.72% <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.

@Y0sh1dk Y0sh1dk force-pushed the fix/sidecar-injection-fix branch from ebc2e01 to ff9329a Compare March 9, 2026 06:36
@Y0sh1dk Y0sh1dk force-pushed the fix/sidecar-injection-fix branch from 9e43c3c to aa58166 Compare April 22, 2026 09:54
Y0sh1dk added 3 commits April 22, 2026 19:57
Signed-off-by: Yosiah de Koeyer <dev@yosiahdekoeyer.dev>
Signed-off-by: Yosiah de Koeyer <dev@yosiahdekoeyer.dev>
Signed-off-by: Yosiah de Koeyer <dev@yosiahdekoeyer.dev>
@Y0sh1dk Y0sh1dk force-pushed the fix/sidecar-injection-fix branch from aa58166 to 4790ca6 Compare April 22, 2026 09:58
Y0sh1dk added 2 commits April 22, 2026 20:01
Signed-off-by: Yosiah de Koeyer <dev@yosiahdekoeyer.dev>
…34 and above. See: kubernetes/kubernetes#130989

Signed-off-by: Yosiah de Koeyer <dev@yosiahdekoeyer.dev>
@Y0sh1dk Y0sh1dk marked this pull request as ready for review April 22, 2026 10:29
Comment thread .github/workflows/pr-checks.yml Outdated
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
Comment thread internal/common/flagdinjector/flagdinjector_test.go
Comment thread .github/workflows/pr-checks.yml Outdated
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
@toddbaert toddbaert changed the title feat: Update Flagd container injection to native Kubernetes sidecar feat: sidecar init stability, drop k8s < 1.29 suport Apr 22, 2026
@toddbaert toddbaert self-requested a review April 22, 2026 18:12
@toddbaert
Copy link
Copy Markdown
Member

toddbaert commented Apr 22, 2026

@Y0sh1dk I've only removed k8s 1.28 and older - the rest work fine as mentioned here: #807 (comment)

I will merge tomorrow unless you object. Thanks a lot. I think maybe some of the tests are redundant, but you can decide.

(I also updated the title/description a bit since it will go into the release notes.)

@toddbaert toddbaert changed the title feat: sidecar init stability, drop k8s < 1.29 suport feat: sidecar init stability, drop k8s < 1.29 support Apr 22, 2026
Signed-off-by: Yosiah de Koeyer <dev@yosiahdekoeyer.dev>
@Y0sh1dk
Copy link
Copy Markdown
Contributor Author

Y0sh1dk commented Apr 23, 2026

I will merge tomorrow unless you object. Thanks a lot. I think maybe some of the tests are redundant, but you can decide.

@toddbaert Thanks for the updates, have removed the redundant tests and happy for this to go in.

@toddbaert toddbaert merged commit f57aa85 into open-feature:main Apr 23, 2026
18 of 19 checks passed
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.

Flagd sidecar injection causes evaluation errors on pod creation/termination

2 participants