Skip to content

Conversation

samsonkolge
Copy link
Contributor

Please ensure your pull request adheres to the following guidelines:

  • For first time contributors, read Submitting a pull request
  • All code is covered by unit and/or runtime tests where feasible.
  • All commits contain a well written commit description including a title,
    description and a Fixes: #XXX line if the commit addresses a particular
    GitHub issue.
  • If your commit description contains a Fixes: <commit-id> tag, then
    please add the commit author[s] as reviewer[s] to this issue.
  • All commits are signed off. See the section Developer’s Certificate of Origin
  • Provide a title or release-note blurb suitable for the release notes.
  • Are you a user of Cilium? Please add yourself to the Users doc
  • Thanks for contributing!

Description

This PR fixes issue #36994 where the cilium clustermesh disconnect command doesn't provide any feedback when run without a destination context.

Problem

When running cilium clustermesh disconnect without specifying a destination context via the --destination-context flag, the command silently executes but doesn't display any message or error to the user. This creates a confusing user experience as the user doesn't know what happened.

Current behavior:

cilium clustermesh disconnect -n cilium-system
ℹ️ Configuring Cilium in cluster kind-mgmt to disconnect from cluster

<no further output>

Solution

This PR adds a check at the beginning of the DisconnectWithHelm function to verify if a destination context was provided. If not, it returns a clear error message explaining that a destination context is required.

New behavior:

cilium clustermesh disconnect -n cilium-system

Error: Unable to disconnect clusters: no destination context specified, use --destination-context to specify which cluster to disconnect from

This makes the CLI behavior consistent with the case where an invalid destination context is provided, which already shows an error message.

Testing Information

This PR includes a unit test to verify the error behavior:

  1. TestClusterMeshDisconnectWithoutDestination in cilium-cli/cli/clustermesh_test.go directly tests the DisconnectWithHelm function and verifies that it returns the correct error message when no destination context is provided.

This test ensures that the error message is displayed correctly to users when they attempt to use the clustermesh disconnect command without specifying a destination context.

To run the test

cd cilium-cli
go test -v ./cli -run TestClusterMeshDisconnectWithoutDestination

The test validates our fix by confirming the error message is exactly:
"no destination context specified, use --destination-context to specify which cluster to disconnect from"

Fixes: #36994

Fix cli disconnect error message

@samsonkolge samsonkolge requested review from a team as code owners March 27, 2025 01:10
@maintainer-s-little-helper
Copy link

Commit 8a1d1ab does not match "(?m)^Signed-off-by:".

Please follow instructions provided in https://docs.cilium.io/en/stable/contributing/development/contributing_guide/#developer-s-certificate-of-origin

@maintainer-s-little-helper maintainer-s-little-helper bot added dont-merge/needs-sign-off The author needs to add signoff to their commits before merge. dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. labels Mar 27, 2025
@github-actions github-actions bot added cilium-cli This PR contains changes related with cilium-cli kind/community-contribution This was a contribution made by a community member. labels Mar 27, 2025
@samsonkolge samsonkolge force-pushed the fix-cli-disconnect-error-message branch from 8a1d1ab to 93dcce6 Compare March 27, 2025 01:18
@maintainer-s-little-helper
Copy link

Commit 93dcce6 does not match "(?m)^Signed-off-by:".

Please follow instructions provided in https://docs.cilium.io/en/stable/contributing/development/contributing_guide/#developer-s-certificate-of-origin

@samsonkolge samsonkolge force-pushed the fix-cli-disconnect-error-message branch from 93dcce6 to 716ebf6 Compare March 27, 2025 01:19
@maintainer-s-little-helper
Copy link

Commit 93dcce6 does not match "(?m)^Signed-off-by:".

Please follow instructions provided in https://docs.cilium.io/en/stable/contributing/development/contributing_guide/#developer-s-certificate-of-origin

@samsonkolge samsonkolge force-pushed the fix-cli-disconnect-error-message branch from 716ebf6 to 032b059 Compare March 27, 2025 01:20
@maintainer-s-little-helper
Copy link

Commit 032b059 does not match "(?m)^Signed-off-by:".

Please follow instructions provided in https://docs.cilium.io/en/stable/contributing/development/contributing_guide/#developer-s-certificate-of-origin

@samsonkolge samsonkolge force-pushed the fix-cli-disconnect-error-message branch from 032b059 to f9f0894 Compare March 27, 2025 01:23
@maintainer-s-little-helper maintainer-s-little-helper bot removed the dont-merge/needs-sign-off The author needs to add signoff to their commits before merge. label Mar 27, 2025
@samsonkolge samsonkolge force-pushed the fix-cli-disconnect-error-message branch from f9f0894 to b19cf34 Compare March 27, 2025 01:25
@giorio94 giorio94 added area/clustermesh Relates to multi-cluster routing functionality in Cilium. release-note/misc This PR makes changes that have no direct user impact. labels Mar 27, 2025
@maintainer-s-little-helper maintainer-s-little-helper bot removed the dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. label Mar 27, 2025
Copy link
Member

@giorio94 giorio94 left a comment

Choose a reason for hiding this comment

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

Looks good to me, thanks!

Please fix the issues reported by CI (you need to shorten the commit subject, and change/drop the extra assertion)

@qmonnet qmonnet removed request for a team and qmonnet March 27, 2025 10:13
@samsonkolge samsonkolge force-pushed the fix-cli-disconnect-error-message branch from b19cf34 to 5dfc822 Compare March 27, 2025 11:02
@samsonkolge samsonkolge requested a review from giorio94 March 27, 2025 12:50
@giorio94
Copy link
Member

@samsonkolge Could you please squash the two commits together? I'll re-run CI afterwards.

Add a clear error message when the clustermesh disconnect command
is executed without a destination context, improving user experience
by explaining what is missing.

Fixes: cilium#36994
Signed-off-by: Samson S. Kolge <eglok1980@gmail.com>
@samsonkolge samsonkolge force-pushed the fix-cli-disconnect-error-message branch from 5dfc822 to 0487b72 Compare March 27, 2025 13:34
@samsonkolge
Copy link
Contributor Author

@samsonkolge Could you please squash the two commits together? I'll re-run CI afterwards.

@giorio94 Done.

@qmonnet
Copy link
Member

qmonnet commented Mar 27, 2025

/test

Copy link
Member

@giorio94 giorio94 left a comment

Choose a reason for hiding this comment

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

Thanks!

@maintainer-s-little-helper maintainer-s-little-helper bot added the ready-to-merge This PR has passed all tests and received consensus from code owners to merge. label Mar 27, 2025
@giorio94 giorio94 added this pull request to the merge queue Mar 28, 2025
Merged via the queue into cilium:main with commit ca13bf9 Mar 28, 2025
67 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/clustermesh Relates to multi-cluster routing functionality in Cilium. cilium-cli This PR contains changes related with cilium-cli kind/community-contribution This was a contribution made by a community member. ready-to-merge This PR has passed all tests and received consensus from code owners to merge. release-note/misc This PR makes changes that have no direct user impact.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cilium CLI disconnect confusing message when destination context not set
4 participants