Open janhartje opened 1 year ago
I am having the exact same problem, it is so counterintuitive to try to find your secrets for the pod in global secrets.
K8s lens as a client provides this service, and it is much easier to use. When you select a pod, it shows all the environment variables used in that pod, and you can reveal them yourselves.
I would like to implement this but I am new to Go and I have already looked through the code base trying to wrap my head around it for a day at least now but I still don't know where to start exactly.
My idea is to add a key binding in the pod description view which would then dissect the lines of the output which seem to be generated here to generate and inject the describe view of the respective configmap/secret. Ideally even working with the objects themselves and creating the view a bit cleaner potentially to just get the keys and values. So I'd have to get the pod object from the describe view, not sure how that is possible.
I also had a look at internal/view/secret.decodeCmd
which basically generates a plain YAML from scratch which is similar to what I want. I'd obviously want to reuse the decoding logic.
I just don't understand the general structure of this repo and didn't find any documentation (remember I am new to Go).
Can any maintainer of this repo maybe lead me into the right direction and provide some guidance?
For example, I think inside internal/view/details.go
the Describe
view is defined. There, inside bindKeys()
I'd like to add the new keybinding for the new toggle. But how do I know the resource type inside that view? I'd obviously only want to enable the keybinding conditionally for pod resources.
Problem
It's hard to find out wich environment variables are set for a pod if you're using secret and configmap
Solution Idea
It would be nice to have a Toggle when you are in the pod description to resolve environment variables wich are set by a configmap or secret.
After you activate the toggle the following expressions are resolved to the real value