• Kubernetes Submit Queue's avatar
    Merge pull request #32885 from janetkuo/kubectl-rollingupdate-garbage-collector-error · af0b973f
    Kubernetes Submit Queue authored
    Automatic merge from submit-queue
    
    Improve error message when kubectl rolling-update fail due to version skew
    
    <!--  Thanks for sending a pull request!  Here are some tips for you:
    1. If this is your first time, read our contributor guidelines https://github.com/kubernetes/kubernetes/blob/master/CONTRIBUTING.md and developer guide https://github.com/kubernetes/kubernetes/blob/master/docs/devel/development.md
    2. If you want *faster* PR reviews, read how: https://github.com/kubernetes/kubernetes/blob/master/docs/devel/faster_reviews.md
    3. Follow the instructions for writing a release note: https://github.com/kubernetes/kubernetes/blob/master/docs/devel/pull-requests.md#release-notes
    -->
    
    **What this PR does / why we need it**: follow up #32751, we should print the real error message first, the workaround later 
    
    **Before:**
    ```console
    $ kubectl rolling-update nginx --image=redis 
    Created nginx-6ee4372891ec51a97dfbf83ed0846886
    Scaling up nginx-6ee4372891ec51a97dfbf83ed0846886 from 0 to 1, scaling down nginx from 1 to 0 (keep 1 pods available, don't exceed 2 pods)
    Scaling nginx-6ee4372891ec51a97dfbf83ed0846886 up to 1
    Scaling nginx down to 0
    Update succeeded. Deleting old controller: nginx
    Renaming nginx-6ee4372891ec51a97dfbf83ed0846886 to nginx
    Error from server: Note: if you are using "kubectl rolling-update" and your kubectl version is older than v1.4.0, your rolling-update has probably failed, though the pods are correctly updated. Please see https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG.md#kubectl-rolling-update for a workaround. : object is being deleted: replicationcontrollers "nginx" already exists
    ```
    
    **After:** (see the error message)
    ```console
    $ kubectl rolling-update nginx --image=redis
    Created nginx-12b5782bcdff627fca46537e9e1045f8
    Scaling up nginx-12b5782bcdff627fca46537e9e1045f8 from 0 to 1, scaling down nginx from 1 to 0 (keep 1 pods available, don't exceed 2 pods)
    Scaling nginx-12b5782bcdff627fca46537e9e1045f8 up to 1
    Scaling nginx down to 0
    Update succeeded. Deleting old controller: nginx
    Renaming nginx-12b5782bcdff627fca46537e9e1045f8 to nginx
    Error from server: object is being deleted: replicationcontrollers "nginx" already exists: if you're using "kubectl rolling-update" with kubectl version older than v1.4.0, your rolling update has failed, though the pods are correctly updated. Please see https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG.md#kubectl-rolling-update for a workaround
    ```
    
    **Which issue this PR fixes** *(optional, in `fixes #<issue number>(, #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #
    
    **Special notes for your reviewer**:
    
    **Release note**:
    <!--  Steps to write your release note:
    1. Use the release-note-* labels to set the release note state (if you have access) 
    2. Enter your extended release note in the below block; leaving it blank means using the PR title as the release note. If no release note is required, just write `NONE`. 
    -->
    ```release-note
    NONE
    ```
    
    Print the real error message first, the workaround later
    
    @lavalamp @gmarek
    af0b973f
Name
Last commit
Last update
.github Loading commit data...
Godeps Loading commit data...
api/swagger-spec Loading commit data...
build Loading commit data...
cluster Loading commit data...
cmd Loading commit data...
contrib Loading commit data...
docs Loading commit data...
examples Loading commit data...
federation Loading commit data...
hack Loading commit data...
hooks Loading commit data...
logo Loading commit data...
pkg Loading commit data...
plugin Loading commit data...
staging Loading commit data...
test Loading commit data...
third_party Loading commit data...
vendor Loading commit data...
www Loading commit data...
.generated_docs Loading commit data...
.gitignore Loading commit data...
CHANGELOG.md Loading commit data...
CONTRIB.md Loading commit data...
CONTRIBUTING.md Loading commit data...
DESIGN.md Loading commit data...
LICENSE Loading commit data...
Makefile Loading commit data...
Makefile.generated_files Loading commit data...
OWNERS Loading commit data...
README.md Loading commit data...
Vagrantfile Loading commit data...
code-of-conduct.md Loading commit data...
labels.yaml Loading commit data...