Skip to content

Conversation

@SharanRP
Copy link

When joining a ClusterSet fails, the cleanup logic was failing to delete the ClusterSet resource because the apiVersion and kind fields were empty in the unstructured object used for rollback.

This happened because the Kubernetes controller-runtime client clears TypeMeta fields after Create() calls. The code was incorrectly using clusterSet.APIVersion and clusterSet.Kind after creation, which were now empty strings.

The fix uses hardcoded apiVersion and kind values when building the unstructured object for rollback. This follows the same pattern already used elsewhere in the codebase (e.g., join.go for Secret resources).

Added unit tests to verify the fix:

  • TestCreateClusterSetRollbackIntegration: Validates apiVersion and kind are correctly set after CreateClusterSet
  • TestRollback: Tests various rollback scenarios including the failure case when kind is missing

Fixes #7639

When joining a ClusterSet fails, the cleanup logic was failing to delete
the ClusterSet resource because the apiVersion and kind fields were
empty in the unstructured object used for rollback.

This happened because the Kubernetes controller-runtime client clears
TypeMeta fields after Create() calls. The fix uses hardcoded apiVersion
and kind values when building the unstructured object for rollback.

Fixes antrea-io#7639

Signed-off-by: SharanRP <[email protected]>
@SharanRP SharanRP force-pushed the fix/antctl-mc-join-cleanup-7639 branch from efc2b5e to 04ccef2 Compare December 25, 2025 13:35
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.

antctl mc join fails to cleanup correctly in case of error

1 participant