Skip to content
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

Include Conditions in kubectl describe namespace #106219

Merged
merged 1 commit into from Nov 16, 2021

Conversation

dlipovetsky
Copy link
Contributor

What type of PR is this?

/kind feature

What this PR does / why we need it:

Currently, kubectl describe namespace does not include Conditions.
This change adds Conditions to the output. Example output:

Name:         example
Labels:       <none>
Annotations:  <none>
Status:	      Terminating
Conditions:
  Type                             Status  LastTransitionTime               Reason          Message
  ----                             ------  ------------------               ------          -------
  NamespaceDeletionContentFailure  True    Wed, 15 Jan 2014 00:00:00 +0000  example reason  example message

No resource quota.

No LimitRange resource.

Which issue(s) this PR fixes:

Fixes #106218

Special notes for your reviewer:

Does this PR introduce a user-facing change?

kubectl describe namespace now shows Conditions

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/feature Categorizes issue or PR as related to a new feature. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Nov 8, 2021
@k8s-ci-robot
Copy link
Contributor

@dlipovetsky: This issue is currently awaiting triage.

If a SIG or subproject determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added needs-priority Indicates a PR lacks a `priority/foo` label and requires one. area/kubectl sig/cli Categorizes an issue or PR as relevant to SIG CLI. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Nov 8, 2021
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Nov 8, 2021
@dlipovetsky
Copy link
Contributor Author

[sig-node] RuntimeClass
/home/prow/go/src/k8s.io/kubernetes/_output/local/go/src/k8s.io/kubernetes/test/e2e/common/node/framework.go:23
  should reject a Pod requesting a deleted RuntimeClass [NodeFeature:RuntimeHandler] [It]
  /home/prow/go/src/k8s.io/kubernetes/_output/local/go/src/k8s.io/kubernetes/test/e2e/common/node/runtimeclass.go:88

Failed for both tests, but appears unrelated to the PR.

/test pull-kubernetes-e2e-kind
/test pull-kubernetes-e2e-gce-ubuntu-containerd

@eddiezane
Copy link
Member

/assign

@lauchokyip
Copy link
Member

/cc

if len(namespace.Status.Conditions) > 0 {
w.Write(LEVEL_0, "Conditions:\n")
w.Write(LEVEL_1, "Type\tStatus\tLastTransitionTime\tReason\tMessage\n")
w.Write(LEVEL_1, "----\t------\t------------------\t------\t-------\n")
Copy link
Member

Choose a reason for hiding this comment

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

What about a quite long message or reason?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Please, when leaving a review comment, explain what your concern is, and, if possible, give an example.

There are many functions in this package that use this same formatting. The writer interprets the tabs as separators, not as literal tabs. Here's what the output looks like with a long reasons and message:

Name:         example
        Labels:       <none>
        Annotations:  <none>
        Status:       Terminating
        Conditions:
          Type                             Status  LastTransitionTime               Reason                                                                                                                                                                                                             Message
          ----                             ------  ------------------               ------                                                                                                                                                                                                             -------
          NamespaceDeletionContentFailure  True    Wed, 15 Jan 2014 00:00:00 +0000  eexample reason example reason example reason example reason example reason example reason example reason example reason example reason example reason example reason example reason xample reason example reason  example message example message example message example message example message example message example message example message example message example message example message example message example message

        No resource quota.

        No LimitRange resource.

Copy link
Member

@kerthcet kerthcet Nov 15, 2021

Choose a reason for hiding this comment

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

thanks for your advices @dlipovetsky , the code looks good to me.

If a namespace deletion is blocked, finding the reason why can require
reading the Conditions on the namespace.

Currently, `kubectl describe namespace` does not include Conditions.
This change adds Conditions to the output. Example output:

```
Name:         example
Labels:       <none>
Annotations:  <none>
Status:	      Terminating
Conditions:
  Type                             Status  LastTransitionTime               Reason          Message
  ----                             ------  ------------------               ------          -------
  NamespaceDeletionContentFailure  True    Wed, 15 Jan 2014 00:00:00 +0000  example reason  example message

No resource quota.

No LimitRange resource.
```
Copy link
Member

@eddiezane eddiezane left a comment

Choose a reason for hiding this comment

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

Thanks!

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 16, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dlipovetsky, eddiezane

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 16, 2021
@dlipovetsky
Copy link
Contributor Author

=== Failed
=== FAIL: pkg/kubelet TestUpdatePodWithTerminatedPod (0.00s)
pod_workers_test.go:326: podWorker state should not be marked terminated for a running pod

Failure is unrelated.

/test pull-kubernetes-unit

@k8s-ci-robot k8s-ci-robot merged commit 824ad80 into kubernetes:master Nov 16, 2021
@k8s-ci-robot k8s-ci-robot added this to the v1.23 milestone Nov 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/kubectl cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/cli Categorizes an issue or PR as relevant to SIG CLI. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

kubectl describe namespace should show Conditions
5 participants