-
Notifications
You must be signed in to change notification settings - Fork 40k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added warning msg for kubectl get
#28352
Conversation
a721563
to
ec2a786
Compare
@@ -30,6 +30,11 @@ import ( | |||
|
|||
const ( | |||
kubectlAnnotationPrefix = "kubectl.kubernetes.io/" | |||
Warn = ` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Give this a more meaningful name, e.g. HiddenPodsWarning
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
I would like to review this as well, but will not have time until Monday. |
handlerMap map[reflect.Type]*handlerEntry | ||
options PrintOptions | ||
lastType reflect.Type | ||
hiddenPodsNum int |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to do something similar for replicasets in #27510 and we might need it again for other objects. Can you change the field name to something more generic like hiddenEntryNum
, hiddenObjNum
, hiddenCount
or similar? That way, we can reuse the code and logic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added changes for reuse the same var hiddenObjNum
for all objects and valid printing in case of user getting several resource types at once: kubectl get pods,namespaces (added output example in PR description)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you so much!
Looks better, will review. |
@smarterclayton still planning to review this? |
@@ -30,6 +30,11 @@ import ( | |||
|
|||
const ( | |||
kubectlAnnotationPrefix = "kubectl.kubernetes.io/" | |||
HiddenPodsWarning = ` | |||
WARN: By default only active pods are displayed, to display terminated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This message needs to be more generic, and doesn't need the warning prefix. It really belongs directly inside of the get comment.
This command will hide resources that have completed. For instance, pods that are in the Succeeded or Failed phases. You can see the full results for any resource by providing the `--show-all` flag.
Should be a separate paragraph and in get.go in the help text.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A separate warning can remain here, but I would recommend making it shorter:
Edit: provided a clearer message below for the actual inline output.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
- added warning description regarding terminated objects to `get` long help message - added printing of warning message in case of `get pods` if there are hidden pods Fixes kubernetes#22986
So guys, WDYT is patch ready to be merged? |
LGTM |
GCE e2e build/test passed for commit f20c40e. |
Automatic merge from submit-queue |
As a future note I recommended to someone else with a similar problem that the next change to this code should hoist filtering up as a generic tool that happens before printing. That will make this more resilient to future change |
That would be me for |
@smarterclayton I think you mean this #29115, actually I am planning this. |
get
long help messageget pods
if there are hidden podsFixes #22986 (initiall PR and discussion are here #26417)
Output examples:
# kubectl get pods
# kubectl get pods,namespaces
# kubectl get pods -a
# kubectl get -h
This change is