• Kubernetes Submit Queue's avatar
    Merge pull request #46079 from xiangpengzhao/print-allocated-oir · 33482dd4
    Kubernetes Submit Queue authored
    Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.
    
    Display extended resources in node allocated resources
    
    **What this PR does / why we need it**:
    Displays ~~opaque integer~~ [extended] resources in node allocated resources of command `kubectl describe node`. This will give users more info about node ~~OIR~~ [extended resources] consumption.
    
    **Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #
    This is a partially fix of #44271.
    
    **Special notes for your reviewer**:
    This PR
    - only displays allocated ~~OIR~~ [extended resources] details of node, it doesn't display ~~OIR~~ [extended resources] requests/limits for each pod because it's hard to organize format. I tried to print ~~OIR~~ [extended resources] requests/limits of pods, but some strings have been eaten when a line is too long (the output has been separated into two lines by terminal). I think it's because a `\t` blank can't be show in two lines.
    - ~~uses `OIR-foo` instead of `pod.alpha.kubernetes.io/opaque-int-resource-foo` for short.~~
    - doesn't display the percentage of ~~OIR~~ [extended resources] usage because I think the percentage is not so meaningful.
    - displays each ~~OIR~~ [extended resources] in single rows to be clear.
    
    UPDATE:
    Example with default namespace resource:
    ```
    Non-terminated Pods:         (1 in total)
      Namespace                  Name                     CPU Requests  CPU Limits  Memory Requests  Memory Limits
      ---------                  ----                     ------------  ----------  ---------------  -------------
      default                    rc-nginx-single-krp84    1 (33%)       1 (33%)     512Mi (6%)       512Mi (6%)
    Allocated resources:
      (Total limits may be over 100 percent, i.e., overcommitted.)
    Resource                 Requests    Limits
      --------               --------    ------
      cpu                    1 (33%)     1 (33%)
      memory                 512Mi (6%)  512Mi (6%)
      kubernetes.io/widgets  111         0
    ```
    
    /cc @ConnorDoyle @soltysh 
    
    ref #44181
    
    **Release note**:
    
    ```release-note
    Display requests/limits of extended resources in node allocated resources.
    ```
    33482dd4
Name
Last commit
Last update
..
api Loading commit data...
apis Loading commit data...
auth Loading commit data...
capabilities Loading commit data...
client Loading commit data...
cloudprovider Loading commit data...
controller Loading commit data...
credentialprovider Loading commit data...
features Loading commit data...
fieldpath Loading commit data...
generated Loading commit data...
kubeapiserver Loading commit data...
kubectl Loading commit data...
kubelet Loading commit data...
kubemark Loading commit data...
master Loading commit data...
printers Loading commit data...
probe Loading commit data...
proxy Loading commit data...
quota Loading commit data...
registry Loading commit data...
routes Loading commit data...
scheduler Loading commit data...
security Loading commit data...
securitycontext Loading commit data...
serviceaccount Loading commit data...
ssh Loading commit data...
util Loading commit data...
version Loading commit data...
volume Loading commit data...
watch/json Loading commit data...
windows/service Loading commit data...
.import-restrictions Loading commit data...
BUILD Loading commit data...
OWNERS Loading commit data...