Skip to content

Conversation

@TrafalgarZZZ
Copy link
Member

Ⅰ. Describe what this PR does

  • Implement native sidecar injection mode for Fuse
  • Add FUSE_SIDECAR_INJECTION_MODE environment variable
  • Update webhook to set sidecar injection mode
  • Modify injector to use the new sidecar injection mode
  • Implement default and unprivileged mutators for native sidecar injection

Ⅱ. Does this pull request fix one issue?

fixes #5294

Ⅲ. List the added test cases (unit test/integration test) if any, please explain if no tests are needed.

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

- Implement native sidecar injection mode for Fuse
- Add FUSE_SIDECAR_INJECTION_MODE environment variable
- Update webhook to set sidecar injection mode
- Modify injector to use the new sidecar injection mode
- Implement default and unprivileged mutators for native sidecar injection

Signed-off-by: trafalgarzzz <trafalgarz@outlook.com>
Signed-off-by: trafalgarzzz <trafalgarz@outlook.com>
@codecov
Copy link

codecov bot commented Oct 23, 2025

Codecov Report

❌ Patch coverage is 60.00000% with 24 lines in your changes missing coverage. Please review.
✅ Project coverage is 56.96%. Comparing base (9b73834) to head (641283d).
⚠️ Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
...application/inject/fuse/mutator/mutator_default.go 72.09% 8 Missing and 4 partials ⚠️
pkg/common/types.go 0.00% 9 Missing ⚠️
...cation/inject/fuse/mutator/mutator_unprivileged.go 0.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5295      +/-   ##
==========================================
- Coverage   56.96%   56.96%   -0.01%     
==========================================
  Files         442      442              
  Lines       30476    30529      +53     
==========================================
+ Hits        17361    17390      +29     
- Misses      11504    11523      +19     
- Partials     1611     1616       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Signed-off-by: trafalgarzzz <trafalgarz@outlook.com>
Signed-off-by: trafalgarzzz <trafalgarz@outlook.com>
@TrafalgarZZZ
Copy link
Member Author

/test fluid-e2e

Signed-off-by: trafalgarzzz <trafalgarz@outlook.com>
@TrafalgarZZZ
Copy link
Member Author

/test fluid-e2e

Signed-off-by: trafalgarzzz <trafalgarz@outlook.com>
@TrafalgarZZZ
Copy link
Member Author

/test fluid-e2e

@TrafalgarZZZ
Copy link
Member Author

/retest

1 similar comment
@TrafalgarZZZ
Copy link
Member Author

/retest

- Display an error message if the Kubernetes version is less than 1.28.0-0

Signed-off-by: trafalgarzzz <trafalgarz@outlook.com>
Signed-off-by: trafalgarzzz <trafalgarz@outlook.com>
@cheyang
Copy link
Collaborator

cheyang commented Oct 24, 2025

@TrafalgarZZZ Please fix unit test. Thanks.

@RongGu RongGu requested a review from Copilot October 26, 2025 15:40
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements native sidecar injection mode support for Fuse containers in Fluid, allowing Fuse sidecars to be deployed as Kubernetes native sidecar containers (init containers with restart policy) instead of regular containers.

Key changes:

  • Adds FUSE_SIDECAR_INJECTION_MODE environment variable with support for "default", "legacy", and "native-sidecar" modes
  • Implements native sidecar injection logic that places Fuse containers in initContainers[] with RestartPolicyAlways
  • Updates both default and unprivileged mutators to conditionally use native sidecar injection based on the configured mode

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
sdk/java Removes Java SDK subproject commit reference
pkg/common/types.go Defines SidecarInjectionMode type and GetSidecarInjectionMode() function to read injection mode from environment
pkg/common/env_names.go Declares EnvFuseSidecarInjectionMode constant for the new environment variable
pkg/application/inject/fuse/mutator/mutator_unprivileged.go Updates unprivileged mutator to use native sidecar injection when mode is set
pkg/application/inject/fuse/mutator/mutator_default_test.go Adds test cases for native sidecar injection scenarios
pkg/application/inject/fuse/mutator/mutator_default.go Implements defaultInjectFuseNativeSidecar() and prependFuseNativeSidecar() functions for native sidecar injection
pkg/application/inject/fuse/injector.go Initializes injector with sidecar injection mode and passes it to mutator options
charts/fluid/fluid/values.yaml Adds fuseSidecar.sidecarInjectionMode configuration with documentation
charts/fluid/fluid/templates/webhook/webhook.yaml Sets FUSE_SIDECAR_INJECTION_MODE environment variable in webhook deployment with Kubernetes version validation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- fix unit tests
- fix typos

Signed-off-by: trafalgarzzz <trafalgarz@outlook.com>
@sonarqubecloud
Copy link

@RongGu RongGu requested a review from Copilot October 27, 2025 02:39
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

if helper.Specs.MetaObj.Labels == nil {
helper.Specs.MetaObj.Labels = map[string]string{}
}
helper.Specs.MetaObj.Labels[containerDatasetMappingLabelKey] = fmt.Sprintf("%s_%s", helper.runtimeInfo.GetNamespace(), helper.runtimeInfo.GetName())
Copy link

Copilot AI Oct 27, 2025

Choose a reason for hiding this comment

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

The label value format has changed from using utils.GetDatasetId() (which includes the dataset UID) to a simple namespace_name format. This removes the UID from the label, which could cause issues if datasets with the same name exist in the same namespace but are recreated with different UIDs. Consider keeping the UID in the label value or documenting why it was removed.

Copilot uses AI. Check for mistakes.
if helper.Specs.MetaObj.Labels == nil {
helper.Specs.MetaObj.Labels = map[string]string{}
}
helper.Specs.MetaObj.Labels[containerDatasetMappingLabelKey] = fmt.Sprintf("%s_%s", helper.runtimeInfo.GetNamespace(), helper.runtimeInfo.GetName())
Copy link

Copilot AI Oct 27, 2025

Choose a reason for hiding this comment

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

The label value format has changed from using utils.GetDatasetId() (which includes the dataset UID) to a simple namespace_name format. This removes the UID from the label, which could cause issues if datasets with the same name exist in the same namespace but are recreated with different UIDs. Consider keeping the UID in the label value or documenting why it was removed.

Copilot uses AI. Check for mistakes.
Copy link
Collaborator

@cheyang cheyang left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

@fluid-e2e-bot
Copy link

fluid-e2e-bot bot commented Oct 27, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cheyang

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@fluid-e2e-bot fluid-e2e-bot bot merged commit 73d2cf2 into fluid-cloudnative:master Oct 27, 2025
16 checks passed
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.

[FEATURES] Support injecting native sidecar container for FUSE Sidecar

2 participants