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: add customizable workload GVRs #3031

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

lacroixthomas
Copy link

Enhancement: #3012

The goal of this PR is to bring a customizable Workload view, which will allow users to use CRDs and to define how they want to be shown on the view.

@lacroixthomas lacroixthomas force-pushed the features/customizable-workload-resources branch from 10722f8 to 4be2681 Compare December 14, 2024 18:44
Copy link
Owner

@derailed derailed left a comment

Choose a reason for hiding this comment

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

@lacroixthomas Thank you for this PR!
I like this concept! The original idea behind k9s workloads was for users to get a sense of their workloads and workload associated state of affairs in a simple view. Thus we care about resources that reports some kind of status. Hence secrets, configmaps are not of interest here.
In my mind, this feature would be best to allow user to enhance this view by adding more resources that can report status to the initial default list of resources vs having to specify a new list of resources. This is a bit more tricky since different context/clusters may have a different set of resources. For example clusterA has Argo CRDs but clusterB doesn't. Thus it might be best to a) treat workload_configs at the cluster level and b) manage the configuration as a separate (optional!) file outside of k9s main config.
Managing workload configurations as separate artifacts would also allow us to have external contributions (like skins, plugns, ...) so folks can grab vetted workload configs artifacts to enhance their workload views.
Another aspect of interest here is how does one come up with the right configuration aka status|ready|valid. It would be great if we can watch these artifacts on disk to ensure the configuration and reported status are indeed correct as this is the main intent behind the workload feature aka `show me the current status of my workloads and associated artifacts'
Would this make better sense?

@derailed derailed added enhancement New feature or request needs-tlc Pr needs additional updates labels Dec 15, 2024
@lacroixthomas
Copy link
Author

lacroixthomas commented Dec 16, 2024

@derailed You're welcome !

Following what you told me, we could have:

A folder containing the different workload default artifacts / or we can keep them hardcoded:

$XDG_CONFIG_HOME/k9s/workloads/deployments.yaml
$XDG_CONFIG_HOME/k9s/workloads/replicaset.yaml
...

This list will be used as default for the workload view

And having a $XDG_DATA_HOME/k9s/workloads folder with all the custom artifacts from the user:

$XDG_DATA_HOME/k9s/workloads/argo.yaml
$XDG_DATA_HOME/k9s/workloads/externalsecrets.yaml
...

The user would be able to add these custom artifacts to their config file per cluster as:
$XDG_DATA_HOME/k9s/clusters/cluster-1/context-1/workload.yaml

# List of workload artifacts to append to the default list
workloads:
	- argo
	- externalsecrets

We could also add it on the k9s main config in case we want to have this custom workload config by default for all clusters the users have ?

To be able to validate the workload artifacts that they added, we can maybe have a shortcut on the workload view as customArtifact view or something, to be able to list their custom artifacts and to see if they are valid. Maybe adding an edit shortcut ? Pressing describe to show the content and enter to see what it would show within the workload view ?

Would that make sense following your feedback ?

@lacroixthomas
Copy link
Author

I'm working on a second design, will ping you once it's ready

We'll have a config at the cluster level only, by default it will uses all the hardcoded gvrs (as before) and it will append the custom one on top of it.

There will be a specific view workloadGVRs (will find a better name), from this view we'll be able to list the different custom config from $XDG_DATA_HOME/k9s/workloads, we'll be able to edit them, to create them (a popup to ask the name of the file and will create a template with default values for them, or commented ones), they'll also be able to delete them.
The idea from this view is to create a custom GVR, to have a CRUD on it and to be able to simulate how it would looks like in the Workload view (by pressing enter), there would also be 2 options, to add it or to delete it from the current context config (a column will be present to show if it's set in the context or not)

I'll try to finish a first iteration soon, I'll send you screenshots or videos to show you

@lacroixthomas lacroixthomas force-pushed the features/customizable-workload-resources branch from e52274c to 1963092 Compare December 23, 2024 23:40
feat: Add config and add some documentation

feat: Refactor getValidity

feat: Refactor getValidity

feat: refactor the get replicas complexity

feat: trigger pipeline

feat: refactor workload list

feat: delete log

feat: unblock unit tests (will come back to it)

feat: fix unit tests and add k9s.json new schema

feat: add comment on the dao/workload

feat: remove todo

feat: add header on new file

feat: add new view with crud for custom gvr and rollback config
@lacroixthomas lacroixthomas force-pushed the features/customizable-workload-resources branch from 1963092 to 5e6e701 Compare December 23, 2024 23:41
@lacroixthomas lacroixthomas marked this pull request as draft December 23, 2024 23:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request needs-tlc Pr needs additional updates
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants