Open totegamma opened 2 weeks ago
Hi @totegamma , The dry run in fact checks the namespace, it is just not notified in output ,If you try to delete a pod which exist in other namespace the error will come out right . Adding namespace like
pod <name> (ns) deleted (server dry run)
may add more clarity. however the developers usually knows that lil detail already.
Hello @Ritikaa96,
Thank you for your reply.
Yes, I know there are no problems with the internal mechanism. I just want to notify the namespace in the output for clarity. Hiding the namespace is a little unkind.
When the applied manifest is too big, it is hard to grasp all resources. This often happens when we use generators such as Helm charts or Kustomize. We can check the manifest with other commands such as grep, but since kubectl already has a dry-run mode, it would be nice to print the namespace for clarity.
/triage accepted /good-first-issue
@mpuckett159: This request has been marked as suitable for new contributors.
Please ensure that the issue body includes answers to the following questions:
For more details on the requirements of such an issue, please see here and ensure that they are met.
If this request no longer meets these requirements, the label can be removed
by commenting with the /remove-good-first-issue
command.
/assign
What would you like to be added:
Prefix namespace to kubectl delete dry-run result.
current:
proposed:
Why is this needed:
The current output is ambiguous, as the resource name should be identifiable as unique.
When working with multiple namespaces like "myapp-prod" and "myapp-dev", and intending to tear down some resources in "myapp-dev", the command might look like this:
From this output, it's unclear whether the manifest targets "myapp-dev" or "myapp-prod". This ambiguity requires additional checks to ensure the correct namespace is being targeted.
Printing the namespace in the dry-run output would enhance clarity and confidence in identifying the targeted resources.
Other considerations This change can be applied for other operations like apply and replace. However, non-delete operations can be validate with the "diff" command. Therefore, I think it is acceptable to add this feature only for the delete operation.
sample implementation would be like this: https://github.com/totegamma/kubernetes/commit/65c18816d3bc8b47810d1230bbf88e8aef219a5e
If this issue accepted, I want to get assigned and make a PR.