Skip to content

Comments

Add support for DaemonSet to AdvancedDaemonSet migration #158

Open
GautamBytes wants to merge 2 commits intoopenkruise:masterfrom
GautamBytes:migration-final
Open

Add support for DaemonSet to AdvancedDaemonSet migration #158
GautamBytes wants to merge 2 commits intoopenkruise:masterfrom
GautamBytes:migration-final

Conversation

@GautamBytes
Copy link
Contributor

Ⅰ. Describe what this PR does

This PR introduces the functionality to migrate a native Kubernetes DaemonSet to a Kruise AdvancedDaemonSet via the kubectl-kruise migrate command.

The implementation includes:

  1. New Migration Path: The migrate command now accepts DaemonSet as a source (--from) and AdvancedDaemonSet as a destination.
  2. Flag Logic: The --create and --copy flags are intentionally disallowed for this migration type, as the concept of an "empty" DaemonSet is not applicable. The command will return an error if these flags are used.
  3. Migration Logic: The full migration works by performing an orphan deletion of the original DaemonSet first, and then creating the new AdvancedDaemonSet. This prevents duplicate pod creation and allows the new controller to safely adopt the existing pods, ensuring zero downtime.
  4. Updated Docs: The CLI command's help text and examples have been updated to reflect the correct functionality.

Example Usage:

# Migrate pods from an existing DaemonSet to an AdvancedDaemonSet.
kubectl-kruise migrate AdvancedDaemonSet --from DaemonSet -n default --src-name my-ds --dst-name my-ads

Ⅱ. Does this pull request fix one issue?

fixes #129

Ⅲ. Special notes for reviews

This implementation is modeled after the existing Deployment to CloneSet migration to maintain consistency within the project.

The core logic for the migration path relies on DeletePropagationOrphan to ensure a safe handover of pods. The logic is contained within the pkg/migration/daemonset package.

Signed-off-by: GautamBytes <manchandanigautam@gmail.com>
Signed-off-by: GautamBytes <manchandanigautam@gmail.com>
@kruise-bot kruise-bot requested review from FillZpp and hantmac August 20, 2025 08:28
@kruise-bot
Copy link

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

@GautamBytes
Copy link
Contributor Author

@furykerry can you please review this , its corrected as per your comments here . Also , can u guide me how to fix this lint error the error logs shows files which i didn't modify.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add kubectl kruise migrate support for advance daemonset

2 participants