Skip to content

Conversation

@xliuqq
Copy link
Collaborator

@xliuqq xliuqq commented May 5, 2025

Ⅰ. Describe what this PR does

support inplace update for juicefs runtime workers pods .

Ⅱ. Does this pull request fix one issue?

fixes #XXXX

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

Ⅳ. Describe how to verify it

manual test

Ⅴ. Special notes for reviews

@fluid-e2e-bot
Copy link

fluid-e2e-bot bot commented May 5, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign yangyuliufeng for approval by writing /assign @yangyuliufeng in a comment. For more information see:The Kubernetes Code Review Process.

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

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

@cheyang cheyang changed the title support inplace update for juicefs runtime workers support inplace update for runtime workers May 6, 2025
@cheyang cheyang requested review from Syspretor and TrafalgarZZZ May 6, 2025 02:23
@sonarqubecloud
Copy link

@codecov
Copy link

codecov bot commented Aug 30, 2025

Codecov Report

❌ Patch coverage is 8.16327% with 180 lines in your changes missing coverage. Please review.
✅ Project coverage is 55.46%. Comparing base (a42f1d8) to head (024a25b).
⚠️ Report is 81 commits behind head on master.

Files with missing lines Patch % Lines
pkg/webhook/handler/mutating/mutating_handler.go 2.80% 99 Missing and 5 partials ⚠️
pkg/utils/dataset/lifecycle/node.go 0.00% 51 Missing ⚠️
pkg/utils/kubeclient/persistent_podstate.go 0.00% 18 Missing ⚠️
pkg/ddc/base/runtime.go 37.50% 5 Missing ⚠️
pkg/ddc/base/label.go 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4864      +/-   ##
==========================================
- Coverage   55.77%   55.46%   -0.31%     
==========================================
  Files         413      414       +1     
  Lines       28087    28261     +174     
==========================================
+ Hits        15666    15676      +10     
- Misses      11006    11167     +161     
- Partials     1415     1418       +3     

☔ 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.

xliuqq added 2 commits August 30, 2025 22:00
Signed-off-by: xliuqq <[email protected]>

webhook cache the specific configmap and only inplace update worker pod has annotation

Signed-off-by: xliuqq <[email protected]>

fix test

Signed-off-by: xliuqq <[email protected]>

use crd instead of cm

Signed-off-by: xliuqq <[email protected]>

run make gen-openapi

Signed-off-by: xliuqq <[email protected]>

fix e2e test error

Signed-off-by: xliuqq <[email protected]>
Signed-off-by: xliuqq <[email protected]>
@sonarqubecloud
Copy link

@RongGu RongGu requested a review from Copilot November 6, 2025 05:54
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 in-place update support for JuiceFS runtime worker pods to maintain pod-to-node affinity during updates. The feature introduces three update strategies: ReCreate (default), InPlace, and InPlaceIfPossible.

Key changes:

  • Adds a new PersistentPodState CRD to track the mapping between worker pod names and their assigned nodes
  • Implements webhook mutation logic to inject node affinity/preference based on the update strategy
  • Updates the JuiceFS runtime spec to include an UpdateStrategy field

Reviewed Changes

Copilot reviewed 29 out of 29 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
api/v1alpha1/persistentpodstate_types.go Defines new PersistentPodState CRD to store pod-to-node mappings
api/v1alpha1/juicefsruntime_types.go Adds UpdateStrategy field to JuiceFSRuntimeSpec
pkg/webhook/handler/mutating/mutating_handler.go Implements MutateRuntimeWorkerPod to inject node affinity based on update strategy
pkg/utils/dataset/lifecycle/node.go Syncs worker pod states to PersistentPodState during reconciliation
pkg/ddc/juicefs/transform.go Sets runtime pod type labels and annotations for worker pods requiring in-place updates
charts/juicefs/templates/worker/persistent_podstate.yaml Template for creating PersistentPodState resource
charts/fluid/fluid/templates/webhook/webhookconfiguration.yaml Adds webhook configuration for mutating worker pods
Multiple RBAC files Grants permissions to access persistentpodstates resources

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

return admission.Errored(http.StatusInternalServerError, err)
// mutating runtime worker pod
if common.CheckExpectValue(pod.Labels, common.RuntimePodType, common.RuntimeWorkerPod) {
// mutating app pod, check whether should inject
Copy link

Copilot AI Nov 6, 2025

Choose a reason for hiding this comment

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

The comment on line 93 is incorrect. It says 'mutating app pod' but this code block is actually for mutating runtime worker pods. The comment should say 'mutating runtime worker pod, check whether should inject' to match the actual context.

Suggested change
// mutating app pod, check whether should inject
// mutating runtime worker pod, check whether should inject

Copilot uses AI. Check for mistakes.
// states are not sync yet.
podState, ok := persistentPodState.Status.PodStates[pod.Name]
if !ok {
return
Copy link

Copilot AI Nov 6, 2025

Choose a reason for hiding this comment

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

Missing explicit nil return. Line 185 returns without a value when podState is not found, but the function signature requires returning an error. While Go allows bare return for named return values (defaulting to the zero value), it's inconsistent with other return statements in this function (lines 153, 160, 169, 179, 205, 224, 227) which explicitly return nil. This should be return nil for consistency and clarity.

Suggested change
return
return nil

Copilot uses AI. Check for mistakes.
},
}
utils.InjectNodeSelectorTerms(terms, pod)
return
Copy link

Copilot AI Nov 6, 2025

Choose a reason for hiding this comment

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

Missing explicit nil return. Line 205 returns without a value after injecting node selector terms, but the function signature requires returning an error. This should be return nil for consistency with other return statements in the function.

Suggested change
return
return nil

Copilot uses AI. Check for mistakes.
},
}
utils.InjectPreferredSchedulingTerms(terms, pod)
return
Copy link

Copilot AI Nov 6, 2025

Choose a reason for hiding this comment

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

Missing explicit nil return. Line 224 returns without a value after injecting preferred scheduling terms, but the function signature requires returning an error. This should be return nil for consistency with other return statements in the function.

Suggested change
return
return nil

Copilot uses AI. Check for mistakes.

if !reflect.DeepEqual(persistentPodState.Status, updatedPodState.Status) {
updatedPodState.Status.LastUpdateTime = &metav1.Time{Time: time.Now()}
rootLog.Info("update podpersistentstate status", "status", updatedPodState.Status)
Copy link

Copilot AI Nov 6, 2025

Choose a reason for hiding this comment

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

The log message contains 'podpersistentstate' which should be separated as 'pod persistent state' or 'PersistentPodState' for clarity and consistency with the resource name.

Suggested change
rootLog.Info("update podpersistentstate status", "status", updatedPodState.Status)
rootLog.Info("update PersistentPodState status", "status", updatedPodState.Status)

Copilot uses AI. Check for mistakes.
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