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

Show topologySpreadConstraints in Describe command #109563

Merged

Conversation

ardaguclu
Copy link
Member

What type of PR is this?

/kind feature
/kind bug

What this PR does / why we need it:

Currently describe command does not show topologySpreadConstraints
field(although get command returns). This PR adds support for showing topologySpreadConstraints in
describe command.For simplicity, if this field is not set, it will not show
(unlike to other core fields whose are shown as <none> even if they are null).

For kubectl describe pod/testpod, result will be like;

Topology Spread Constraints:  topology.kubernetes.io/zone1:ScheduleAnyway when max skew 3 is exceeded
                              topology.kubernetes.io/zone2:DoNotSchedule when max skew 1 is exceeded for selector foo=bar

For kubectl describe deployment/testdeployment, result will be like;

Pod Template:
  Labels:  app=nginx
  Containers:
   nginx:
    Image:                      nginx:1.14.2
    Port:                       80/TCP
    Host Port:                  0/TCP
    Environment:                <none>
    Mounts:                     <none>
  Volumes:                      <none>
  Topology Spread Constraints:  topology.kubernetes.io/zone1:ScheduleAnyway when max skew 3 is exceeded
                                topology.kubernetes.io/zone2:DoNotSchedule when max skew 1 is exceeded for selector foo=bar

Which issue(s) this PR fixes:

Fixes #

Does this PR introduce a user-facing change?

topologySpreadConstraints will be shown in describe command for pods, deployments, daemonsets, etc.

Currently describe command does not show `topologySpreadConstraints`
field. This PR adds support for showing topologySpreadConstraints in
describe command.For simplicity, if this field is not set, it will not show
(unlike to other core fields whose are shown as `<none>` even if they are null).
@k8s-ci-robot
Copy link
Contributor

Please note that we're already in Test Freeze for the release-1.24 branch. This means every merged PR has to be cherry-picked into the release branch to be part of the upcoming v1.24.0 release.

@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. kind/bug Categorizes issue or PR as related to a bug. 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. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Apr 20, 2022
@k8s-ci-robot k8s-ci-robot added 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 Apr 20, 2022
@ardaguclu
Copy link
Member Author

/cc @soltysh @brianpursley

@@ -2110,6 +2137,7 @@ func DescribePodTemplate(template *corev1.PodTemplateSpec, w PrefixWriter) {
}
describeContainers("Containers", template.Spec.Containers, nil, nil, w, " ")
describeVolumes(template.Spec.Volumes, w, " ")
describeTopologySpreadConstraints(template.Spec.TopologySpreadConstraints, w, " ")
Copy link
Member

Choose a reason for hiding this comment

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

Strange we don't show all the information for a pod template. I wonder what the criteria is for deciding what should be shown for a pod template. For example, we don't show tolerations.

I think it is fine to add this here. I wonder if we should (as a separate PR) add the other spec fields, where they make sense.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it is fine to add this here. I wonder if we should (as a separate PR) add the other spec fields, where they make sense.

I have the same question in my mind. As far as I understand, since describe is nicer way to showing resources, there is no promise that describe shows everything get shows.

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ardaguclu, brianpursley

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 Apr 28, 2022
@brianpursley
Copy link
Member

/triage accepted
/priority important-soon
/lgtm

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Apr 29, 2022
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 29, 2022
@k8s-ci-robot k8s-ci-robot merged commit b1e130f into kubernetes:master May 4, 2022
@k8s-ci-robot k8s-ci-robot added this to the v1.25 milestone May 4, 2022
@ardaguclu ardaguclu deleted the describe-topologyspreadconstraints branch May 4, 2022 09:26
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/bug Categorizes issue or PR as related to a bug. 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. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. 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/M Denotes a PR that changes 30-99 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants