Skip to content

feat(sync): add support for sync hostPath #57

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 4, 2025

Conversation

zxh326
Copy link
Member

@zxh326 zxh326 commented Jul 4, 2025

fix: #56

@zxh326 zxh326 requested a review from Copilot July 4, 2025 02:32
Copy link

@Copilot 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

Adds support for mounting hostPath volumes in sync workloads by propagating an extraVolumes field through the sink parser, API types, CRD schema, deep-copy functions, and pod builder. Also updates sample YAML to document the new option.

  • Propagate ExtraVolumes from SyncSinkExternal to ParsedSyncSink
  • Extend API (sync_types.go) and generated deep-copy logic for HostPath
  • Modify genSyncVolumes to append hostPath volumes and mounts
  • Update CRD schemas and sample manifests to include extraVolumes.hostPath

Reviewed Changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pkg/utils/sync.go Assign external.ExtraVolumes to parsed spec
pkg/builder/sync_pod.go Generate hostPath volumes and mounts in the pod
config/samples/v1_sync.yaml Document hostPath example under extraVolumes
config/crd/bases/juicefs.io_syncs.yaml Add extraVolumes schema, including hostPath
config/crd/bases/juicefs.io_cronsyncs.yaml Same CRD updates for cron-syncs
api/v1/sync_types.go Define new HostPath struct and ExtraVolumes
api/v1/zz_generated.deepcopy.go Generate deep-copy methods for HostPath and slice
Comments suppressed due to low confidence (3)

pkg/builder/sync_pod.go:299

  • [nitpick] Using the loop index for volume names may produce unstable names if order changes; consider a deterministic name derived from the hostPath path (e.g., a hash or sanitized path) to avoid potential collisions.
				Name: fmt.Sprintf("hostpath-%d", i),

pkg/builder/sync_pod.go:261

  • There aren't any unit tests covering hostPath support in genSyncVolumes; consider adding tests to verify both the volume and mount are generated correctly when ExtraVolumes contains a HostPath entry.
	if s.to.ExtraVolumes != nil {

config/crd/bases/juicefs.io_syncs.yaml:552

  • The extraVolumes schema is duplicated in several sections; consider using YAML anchors or a shared definition with $ref to reduce repetition and ease future updates.
                      extraVolumes:

@zxh326 zxh326 requested a review from zwwhdls July 4, 2025 03:12
@zxh326 zxh326 merged commit f06d6d0 into main Jul 4, 2025
@zxh326 zxh326 deleted the support-sync-from-to-hostPath branch July 4, 2025 03:24
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.

sync: support mount host path volumes
2 participants