• Kubernetes Submit Queue's avatar
    Merge pull request #58351 from php-coder/update_swagger_spec_show_log · a490ac5c
    Kubernetes Submit Queue authored
    Automatic merge from submit-queue (batch tested with PRs 58008, 58351). 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>.
    
    update-swagger-spec.sh: when API server fails to start, show the last lines of logs
    
    **What this PR does / why we need it**:
    When API server fails to start there is no easy way to know why. You have to read the script where you will find that there is a log file that could have some useful info. This PR simplifies debugging:
    1) it includes the path to the log file in the error message
    2) it also shows the last 10 lines from this log
    
    Before this change:
    ```
    +++ [0116 19:33:49] Starting kube-apiserver
    !!! [0116 19:34:19] Timed out waiting for apiserver:  to answer at 127.0.0.1:8050/healthz; tried 30 waiting 1 between each
    !!! Error in ./hack/update-swagger-spec.sh:42
      Error in ./hack/update-swagger-spec.sh:42. 'return 1' exited with status 1
    Call stack:
      1: ./hack/update-swagger-spec.sh:42 main(...)
    Exiting with status 1
    +++ [0116 19:34:19] Clean up complete
    ```
    
    After this change:
    ```
    +++ [0116 19:42:41] Starting kube-apiserver
    !!! [0116 19:42:51] Timed out waiting for apiserver:  to answer at 127.0.0.1:8050/healthz; tried 30 waiting 1 between each
    !!! [0116 19:42:51] Here are the last 10 lines from kube-apiserver (/tmp/swagger-api-server.log)
    !!! [0116 19:42:51] === BEGIN OF LOG ===
    I0116 19:42:41.689355   30809 server.go:122] Version: v1.10.0-alpha.1.877+a02cb7c1f7d0d6-dirty
    I0116 19:42:41.942601   30809 serving.go:295] Generated self-signed cert (/tmp/update-swagger-spec.2Udp/certs/apiserver.crt, /tmp/update-swagger-spec.2Udp/certs/apiserver.key)
    I0116 19:42:41.942611   30809 server.go:647] external host was not specified, using 10.10.10.10
    W0116 19:42:41.942618   30809 authentication.go:378] AnonymousAuth is not allowed with the AllowAll authorizer.  Resetting AnonymousAuth to false. You should use a different authorizer
    error in initializing storage factory: group version podsecuritypolicy.admission.k8s.io/v1beta1 that has not been registered
    !!! [0116 19:42:51] === END OF LOG ===
    +++ [0116 19:42:51] Clean up complete
    ```
    
    **Release note**:
    ```release-note
    NONE
    ```
    
    PTAL @cblecker @sttts 
    CC @simo5
    a490ac5c
Name
Last commit
Last update
.github Loading commit data...
Godeps Loading commit data...
api Loading commit data...
build Loading commit data...
cluster Loading commit data...
cmd Loading commit data...
docs Loading commit data...
examples Loading commit data...
hack 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...
translations Loading commit data...
vendor Loading commit data...
.bazelrc Loading commit data...
.generated_files Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
.kazelcfg.json Loading commit data...
BUILD.bazel Loading commit data...
CHANGELOG-1.10.md Loading commit data...
CHANGELOG-1.2.md Loading commit data...
CHANGELOG-1.3.md Loading commit data...
CHANGELOG-1.4.md Loading commit data...
CHANGELOG-1.5.md Loading commit data...
CHANGELOG-1.6.md Loading commit data...
CHANGELOG-1.7.md Loading commit data...
CHANGELOG-1.8.md Loading commit data...
CHANGELOG-1.9.md Loading commit data...
CHANGELOG.md Loading commit data...
CONTRIBUTING.md Loading commit data...
LICENSE Loading commit data...
Makefile Loading commit data...
Makefile.generated_files Loading commit data...
OWNERS Loading commit data...
OWNERS_ALIASES Loading commit data...
README.md Loading commit data...
SUPPORT.md Loading commit data...
WORKSPACE Loading commit data...
code-of-conduct.md Loading commit data...
labels.yaml Loading commit data...