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

feat: ability to edit kube yaml #5937

Merged
merged 2 commits into from
Feb 26, 2024
Merged

Conversation

cdrage
Copy link
Contributor

@cdrage cdrage commented Feb 9, 2024

feat: ability to edit kube yaml

What does this PR do?

  • Adds the ability to edit kube yaml with two buttons, "revert" and
    "apply"
  • Renames Kube section to "Edit"

Screenshot / video of UI

Screen.Recording.2024-02-09.at.4.46.08.PM.mov

What issues does this PR fix or reference?

Closes #5662

How to test this PR?

  1. Go to Kube tab
  2. Edit a YAML (Deployment only right now)
  3. Click on apply / revert buttons.

Signed-off-by: Charlie Drage charlie@charliedrage.com

@cdrage cdrage requested review from benoitf and a team as code owners February 9, 2024 21:46
@cdrage cdrage requested review from dgolovin and axel7083 and removed request for a team February 9, 2024 21:46
@cdrage cdrage marked this pull request as draft February 9, 2024 21:47
@slemeur
Copy link
Collaborator

slemeur commented Feb 13, 2024

linking to #519

@odockal
Copy link
Contributor

odockal commented Feb 14, 2024

@cdrage Nice feat. It smells like some E2E tests will be needed. Can you please open new epic similar to ie. this (#5484) one?

@cdrage cdrage mentioned this pull request Feb 14, 2024
4 tasks
@cdrage
Copy link
Contributor Author

cdrage commented Feb 14, 2024

@cdrage Nice feat. It smells like some E2E tests will be needed. Can you please open new epic similar to ie. this (#5484) one?

Created! #6001

@cdrage cdrage force-pushed the kubernetes-edit-button branch 6 times, most recently from dfc26d0 to d8cdf62 Compare February 21, 2024 20:44
@cdrage cdrage marked this pull request as ready for review February 21, 2024 20:45
@cdrage
Copy link
Contributor Author

cdrage commented Feb 21, 2024

Notes!

This is a very simple implementation of applying the Kubernetes YAML to the cluster / being able to edit.

However there are NO tests for MonacoEditor. There was already no tests for MonacoEditor, as well as the fact that monaco-editor is dynamically important making it difficult to test see [1] and [2].

There have been tests added however for the Kubernetes client.

I have also opened up #6001 in order to create an e2e test for editing YAML which has been assigned to @odockal

@feloy
Copy link
Contributor

feloy commented Feb 22, 2024

Tested editing recplicas, image of pod, rollingUpdate params, works great!

@cdrage
Copy link
Contributor Author

cdrage commented Feb 22, 2024

@feloy You're right! That'd be beneficial to have some form of explanation of what's going on when pressing apply.

I couldn't find a good way to add this as a description on the same page (no space as the editor fills it entirely), but instead I've added a tooltip.

Screen.Recording.2024-02-22.at.11.00.29.AM.mov

@deboer-tim
Copy link
Collaborator

Tested. This is super cool, and really handy to make quick edits. 🚀

Some nits:

  • I still prefer calling this tab 'Kube' or "YAML'. Yes, it's where you edit, but we could allow editing in other tabs and I'd rather name it based on what it is.
  • Apply should be disabled until you type something, and disabled again if you revert.
  • Likewise, Revert should be disabled until you type, and again after reverting.
  • Our buttons are transparent (to work on any background), which makes it a little awkward b/c the editor text can show up through the button. Could be a follow-up PR, maybe we allow an option to set the bg.

In the future I'd also like an option to hide/remove things like status/managedFields/last-applied-configuration to make it easier to see and edit just the configuration of a resource - probably a good follow-up question for UX call.

### What does this PR do?

* Adds the ability to edit kube yaml with two buttons, "revert" and
  "apply"
* Renames Kube section to "Edit"

### Screenshot / video of UI

<!-- If this PR is changing UI, please include
screenshots or screencasts showing the difference -->

### What issues does this PR fix or reference?

<!-- Include any related issues from Podman Desktop
repository (or from another issue tracker). -->

Closes containers#5662

### How to test this PR?

1. Go to Kube tab
2. Edit a YAML (Deployment only right now)
3. Click on apply / revert buttons.

<!-- Please explain steps to reproduce -->

Signed-off-by: Charlie Drage <charlie@charliedrage.com>
- should be kube not edit for tab
- apply disabled until you type something
- same for revert

Signed-off-by: Charlie Drage <charlie@charliedrage.com>
@cdrage
Copy link
Contributor Author

cdrage commented Feb 22, 2024

In the future I'd also like an option to hide/remove things like status/managedFields/last-applied-configuration to make it easier to see and edit just the configuration of a resource - probably a good follow-up question for UX call.

Ready for another review!

I've implemented the following changes:

  • Buttons are disabled until a change is detected
  • It's Kube not Edit

Issue for managed fields is here: #5936

Issue for transparent background for buttons is here: #6117

Ready for another test / review @feloy @deboer-tim

Copy link
Contributor

@lstocchi lstocchi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@feloy feloy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, very useful feature, thanks

@cdrage
Copy link
Contributor Author

cdrage commented Feb 26, 2024

Merging as it's been now tested multiple times and reviewed by @deboer-tim @feloy and @lstocchi

Thank you for being patient and doing lots of testing on this!

@cdrage cdrage merged commit 4b57796 into containers:main Feb 26, 2024
8 checks passed
@podman-desktop-bot podman-desktop-bot added this to the 1.8.0 milestone Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Editing Kubernetes YAML live on the cluster
7 participants