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

Bugfix for savings settings when configMap exists but does not have any data #3280

Merged
merged 1 commit into from
Oct 8, 2018
Merged

Conversation

stefansundin
Copy link
Contributor

Initialize cm.Data if it is nil. This happens if the configMap exists but does not have any data in it, and in this case it was not possible to update the dashboard settings.

For example, the configMap provided here causes the bug: https://github.com/kubernetes/kubernetes/blob/0928bb4c01f6e7ed7c8b990693dd9ea27873def7/cluster/addons/dashboard/dashboard-configmap.yaml

When trying to save, this is the stacktrace that was returned. It does not show up in the UI though, had to find it by using the chrome developer tools.

[restful] recover from panic situation: - assignment to entry in nil map
    /home/travis/.gimme/versions/go1.8.3.linux.amd64/src/runtime/asm_amd64.s:514
    /home/travis/.gimme/versions/go1.8.3.linux.amd64/src/runtime/panic.go:489
    /home/travis/.gimme/versions/go1.8.3.linux.amd64/src/runtime/hashmap.go:487
    /home/travis/build/kubernetes/dashboard/.tmp/backend/src/github.com/kubernetes/dashboard/src/app/backend/settings/manager.go:108
    /home/travis/build/kubernetes/dashboard/.tmp/backend/src/github.com/kubernetes/dashboard/src/app/backend/settings/handler.go:92
    /home/travis/build/kubernetes/dashboard/.tmp/backend/src/github.com/kubernetes/dashboard/src/app/backend/settings/handler.go:43
    /home/travis/build/kubernetes/dashboard/.tmp/backend/src/github.com/kubernetes/dashboard/vendor/github.com/emicklei/go-restful/container.go:244
    /home/travis/build/kubernetes/dashboard/.tmp/backend/src/github.com/kubernetes/dashboard/vendor/github.com/emicklei/go-restful/filter.go:21
    /home/travis/build/kubernetes/dashboard/.tmp/backend/src/github.com/kubernetes/dashboard/src/app/backend/handler/filter.go:46
    /home/travis/build/kubernetes/dashboard/.tmp/backend/src/github.com/kubernetes/dashboard/vendor/github.com/emicklei/go-restful/filter.go:19
    /home/travis/build/kubernetes/dashboard/.tmp/backend/src/github.com/kubernetes/dashboard/src/app/backend/handler/filter.go:121
    /home/travis/build/kubernetes/dashboard/.tmp/backend/src/github.com/kubernetes/dashboard/vendor/github.com/emicklei/go-restful/filter.go:19
    /home/travis/build/kubernetes/dashboard/.tmp/backend/src/github.com/kubernetes/dashboard/src/app/backend/handler/filter.go:94
    /home/travis/build/kubernetes/dashboard/.tmp/backend/src/github.com/kubernetes/dashboard/vendor/github.com/emicklei/go-restful/filter.go:19
    /home/travis/build/kubernetes/dashboard/.tmp/backend/src/github.com/kubernetes/dashboard/src/app/backend/handler/filter.go:58
    /home/travis/build/kubernetes/dashboard/.tmp/backend/src/github.com/kubernetes/dashboard/vendor/github.com/emicklei/go-restful/filter.go:19
    /home/travis/build/kubernetes/dashboard/.tmp/backend/src/github.com/kubernetes/dashboard/vendor/github.com/emicklei/go-restful/container.go:246
    /home/travis/build/kubernetes/dashboard/.tmp/backend/src/github.com/kubernetes/dashboard/vendor/github.com/emicklei/go-restful/container.go:95
    /home/travis/.gimme/versions/go1.8.3.linux.amd64/src/net/http/server.go:1942
    /home/travis/.gimme/versions/go1.8.3.linux.amd64/src/net/http/server.go:2238
    /home/travis/build/kubernetes/dashboard/.tmp/backend/src/github.com/kubernetes/dashboard/vendor/github.com/emicklei/go-restful/container.go:264
    <autogenerated>:32
    /home/travis/.gimme/versions/go1.8.3.linux.amd64/src/net/http/server.go:2238
    /home/travis/.gimme/versions/go1.8.3.linux.amd64/src/net/http/server.go:2568
    /home/travis/.gimme/versions/go1.8.3.linux.amd64/src/net/http/server.go:3088
    <autogenerated>:312
    /home/travis/.gimme/versions/go1.8.3.linux.amd64/src/net/http/h2_bundle.go:4331
    /home/travis/.gimme/versions/go1.8.3.linux.amd64/src/net/http/h2_bundle.go:4611
    /home/travis/.gimme/versions/go1.8.3.linux.amd64/src/runtime/asm_amd64.s:2197

Fixes #3149

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Oct 5, 2018
@k8s-ci-robot k8s-ci-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Oct 5, 2018
@maciaszczykm
Copy link
Member

Thanks! Tests have crashed. You can push commit again with --amend to restart them.

/lgtm

@k8s-ci-robot k8s-ci-robot added lgtm "Looks good to me", indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. and removed lgtm "Looks good to me", indicates that a PR is ready to be merged. labels Oct 5, 2018
@codecov
Copy link

codecov bot commented Oct 5, 2018

Codecov Report

Merging #3280 into master will increase coverage by 0.01%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3280      +/-   ##
==========================================
+ Coverage    54.6%   54.61%   +0.01%     
==========================================
  Files         565      565              
  Lines       12424    12427       +3     
==========================================
+ Hits         6784     6787       +3     
+ Misses       5380     5378       -2     
- Partials      260      262       +2
Impacted Files Coverage Δ
src/app/backend/settings/manager.go 52.63% <0%> (-2.93%) ⬇️
src/app/backend/sync/secret.go 69.49% <0%> (+2.54%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 07fb4d4...5e88065. Read the comment docs.

… but does not have any data in it, and in this case it was not possible to update the dashboard settings.

Signed-off-by: Stefan Sundin <[email protected]>
@stefansundin
Copy link
Contributor Author

@maciaszczykm I rebased and that fixed the travis tests, but I don't know what is going on with codecov.

@maciaszczykm
Copy link
Member

It's ok.

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 5, 2018
@jeefy
Copy link
Member

jeefy commented Oct 7, 2018

/lgtm

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jeefy, maciaszczykm, stefansundin

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

@maciaszczykm maciaszczykm merged commit 15725cd into kubernetes:master Oct 8, 2018
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants