Dashboard: edit a Secret should base64 decode the values then encode them on save

Created on 20 Jan 2018  路  13Comments  路  Source: kubernetes/dashboard

It would be really handy to be able to edit a Secret in the dashboard. Currently editing works, but it shows the base64 encoded values of the data map which means you have to mess around decoding/encoding base64 outside of the editor. It would be so much easier to just be able to edit them in the textarea directly ;)

good first issue help wanted kindocumentation lifecyclfrozen

All 13 comments

Do we want to fix this?

I am asking because there is an explicit call of windows.atob in the secrets page.

refer: https://github.com/kubernetes/dashboard/search?utf8=%E2%9C%93&q=formatDataValue&type=

Correct me if I am wrong here.

I agree with jstrachan and this is a good to have feature.

This would be a useful feature. I'd like to work on it.

@kasisnu You are welcome to work on it.

Hi @floreks @jstrachan

I was looking at this, i'm new to this but willing to contribute :)

Was curious what will be the best way to tackle this ?

SInce the edit component is generic for all kind of resources, i guess having an extra logic for secret here is not ideal : https://github.com/kubernetes/dashboard/blob/28f4c132308f3c83450e17a82760ef9cb2e930c8/src/app/frontend/common/dialogs/editresource/dialog.ts#L46

Another way could be to add an http interceptor on get/secret ?

I guess modifying the backend is no go ?

WDYT ?

I think the stringData field of SecretSpec would be useful for this feature. I'll have a try

I think the stringData field of SecretSpec would be useful for this feature. I'll have a try

@feloy Can you have a look at my PR for this issue and related issue #4255 ?

https://github.com/kubernetes/dashboard/pull/4290/files#diff-0ca22423fa7ae7f454e3081a82eafb18R124

image

If we can perhaps finalize on what's to be done, I can modify my existing PR to reflect the required changes.

I like that the Edit Secret modal shows everything as base64 encoded, since that matches the YAML file, and we probably want to still be able to copy and paste.

What I am working on instead is a quick edit. This would be next to the eye icon of the secret page, that will allow you to open a modal for one entry in the secret and save. This could be direct text unencoded, and should provide a good user experience.

image

I'm going to throw in some inspirations for this issue.

Openshift Console (functions exactly like Kubernetes Dashboard) allows creating and editing Kubernetes secrets as if a key-value collection:


image


image


image


image


image

I put together this dialog for Quick Edit, just working on wiring it up to save.

image

This is complete and the pull request is ready:

Added quick edit icon to Secrets page with dialog to decode and update a data value #5039

I re-implemented it as requested, with an inline edit.

Implemented inline editing for data entries on Secrets page. #5040

image

https://github.com/kubernetes/dashboard/pull/5040 covers that perfectly. You can edit the decoded value in the card and you can also edit the original value in the edit dialog.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Eddman picture Eddman  路  4Comments

pavankjadda picture pavankjadda  路  3Comments

donspaulding picture donspaulding  路  5Comments

maciaszczykm picture maciaszczykm  路  3Comments

andrei-dascalu picture andrei-dascalu  路  3Comments