kubectl icon indicating copy to clipboard operation
kubectl copied to clipboard

Improvement for annotation removal output is needed

Open Ritikaa96 opened this issue 2 years ago • 9 comments

What happened: When we add an annotation the output shows: pod/<pod-name> annotated but this is the same output we get after we remove this annotation What you expected to happen: The output should be 'pod/: annotation removed`

How to reproduce it (as minimally and precisely as possible):

  1. Create a pod named my-pod 2 . add annotation to the pod
$ kubectl annotate pod my-pod set-url=http://goo.gl/XXBTWQq
pod/my-pod annotated
  1. Check the annotation using kubectl describe pod my-pod
  2. remove the annotation using
$ kubectl annotate pod my-pod set-url-
pod/my-pod annotated
  1. Check the annotation which will show this is removed .

Anything else we need to know?:

Environment:

  • Kubernetes client and server versions (use kubectl version): -
  • Cloud provider or hardware configuration: any
  • OS (e.g: cat /etc/os-release): any

Ritikaa96 avatar Feb 01 '24 12:02 Ritikaa96

/sig cli /area kubectl

Ritikaa96 avatar Feb 01 '24 12:02 Ritikaa96

I would be happy to contribute the change if this bug is not intentional or redundant.

Ritikaa96 avatar Feb 01 '24 12:02 Ritikaa96

This is a duplicate of the issues referenced in https://github.com/kubernetes/kubernetes/pull/110124. Currently, it requires some refactoring in the code base to achieve this.

ardaguclu avatar Feb 01 '24 12:02 ardaguclu

Hi @ardaguclu thanks for the information, I didn't see that PR. However it seem that this issue will still persist even if thePR is merged.

Ritikaa96 avatar Feb 01 '24 14:02 Ritikaa96

const (
	MsgAnnotationUnchanged = "annotation(s) unchanged" // no change
	MsgAnnotationModified  = "annotation(s) modified"  // support ADD, DEL and ADD && DEL scenarios
)

This shows that both Add and Delete scenarios are still covered with one Message here as well. if this gets changed to two messages i.e, MsgAnnotationAdded MsgAnnotationDeleted that will be great.

Ritikaa96 avatar Feb 01 '24 14:02 Ritikaa96

/triage accepted

mpuckett159 avatar Mar 27 '24 22:03 mpuckett159

/assign

TessaIO avatar Apr 26 '24 09:04 TessaIO