Skip to content

fix: watch Job resources in dataload and datamigrate controllers#5675

Open
jakharmonika364 wants to merge 1 commit intofluid-cloudnative:masterfrom
jakharmonika364:fix-dataload-status-sync
Open

fix: watch Job resources in dataload and datamigrate controllers#5675
jakharmonika364 wants to merge 1 commit intofluid-cloudnative:masterfrom
jakharmonika364:fix-dataload-status-sync

Conversation

@jakharmonika364
Copy link
Contributor

Ⅰ. Describe what this PR does

This PR fixes a bug where DataLoad and DataMigrate status gets stuck at "Executing" even after the job completes successfully.

The controllers were only watching CronJob resources, but when policy: Once is used (which is the default), the helm charts create regular Job resources instead. Since the controllers weren't watching Jobs, they never received completion events and couldn't update the status.

Now both controllers watch Job and CronJob resources to handle all policy types.


Ⅱ. Does this pull request fix one issue?

fixes #4287


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

No new tests added. The change is straightforward - just adding the missing Job watcher to the controller setup. The existing reconciliation logic already handles Job status correctly, it just wasn't being triggered.


Ⅳ. Describe how to verify it

  1. Create a DataLoad with policy: Once (default)
  2. Wait for the loader job to complete
  3. Check DataLoad status - it should transition to "Complete" instead of staying stuck at "Executing"

You can also verify by checking the controller logs - it should now reconcile when Jobs change state.


Ⅴ. Special notes for reviews

This is a minimal fix - only 4 lines added total (2 per controller). The same issue affects both DataLoad and DataMigrate controllers, so I fixed both in this PR. Let me know if you'd prefer separate PRs for each controller.

@fluid-e2e-bot
Copy link

fluid-e2e-bot bot commented Mar 2, 2026

[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 cheyang for approval by writing /assign @cheyang 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.

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
Copy link

fluid-e2e-bot bot commented Mar 2, 2026

Hi @jakharmonika364. Thanks for your PR.

I'm waiting for a fluid-cloudnative member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@gemini-code-assist
Copy link
Contributor

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 addresses a critical bug affecting DataLoad and DataMigrate resources. Previously, when policy: Once was used, the controllers failed to track the completion of the underlying Job resources, leading to an incorrect "Executing" status. By extending the controllers to watch Job resources, this change ensures that the status accurately reflects the job's lifecycle, improving the reliability of these operations.

Highlights

  • Bug Fix: Resolved an issue where DataLoad and DataMigrate resources remained in an "Executing" state even after completion, due to controllers not watching Job resources.
  • Controller Enhancements: Updated both DataLoad and DataMigrate controllers to watch batchv1.Job resources in addition to CronJob resources, ensuring proper status updates for policy: Once configurations.
Changelog
  • pkg/controllers/v1alpha1/dataload/dataload_controller.go
    • Added Owns(&batchv1.Job{}) to the SetupWithManager function for both batch/v1 and batch/v1beta1 CronJob compatibility paths.
  • pkg/controllers/v1alpha1/datamigrate/datamigrate_controller.go
    • Added Owns(&batchv1.Job{}) to the SetupWithManager function for both batch/v1 and batch/v1beta1 CronJob compatibility paths.
Activity
  • Identified and fixed a bug where DataLoad and DataMigrate resources were stuck in 'Executing' status.
  • Implemented a minimal fix by adding batchv1.Job watchers to the DataLoad and DataMigrate controllers.
  • Verified the fix by creating a DataLoad with policy: Once and confirming status transition to 'Complete'.
  • No new tests were added as the existing reconciliation logic already handles Job status correctly once triggered.
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.

Signed-off-by: Monika Jakhar <jakharmonika364@gmail.com>
@jakharmonika364 jakharmonika364 force-pushed the fix-dataload-status-sync branch from 0f82652 to 011336a Compare March 2, 2026 15:57
@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 2, 2026

Copy link
Contributor

@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 fixes a bug where DataLoad and DataMigrate resources would get stuck in the 'Executing' state by adding a watch for Job resources in both controllers. The change correctly addresses the issue for operations with a policy of Once. My review includes suggestions to refactor the controller setup logic in both modified files. This would reduce code duplication and improve long-term maintainability.

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.

[BUG] dataload status is not correct

1 participant