jinnovation / kele.el

🥤 Spritzy Kubernetes cluster management for Emacs
https://jonathanj.in/kele.el/
Apache License 2.0
77 stars 4 forks source link

Resource-specific suffix for `kele-resource`: "list ReplicaSets owned by this Deployment" #145

Open jinnovation opened 1 year ago

jinnovation commented 1 year ago

Given that instances of the kele-resource prefix are scoped to specific resource types, we have an opportunity to introduce resource-specific suffixes that we dynamically inject into the prefix.

Concrete example: when kele-resource is invoked on deployments, inject a suffix for kele-list-ing all the corresponding pods for that deployment.

jinnovation commented 1 year ago

Intermediate step: "list replicasets for this deployment"

jinnovation commented 1 year ago

To do this, we'll need a way to obtain all the resources of a given type owned by a given resource.

We might be able to do this by extending kele--list-resources with a :owned-by parameter that's expected to specify the full group-version-kind-name of the owner to filter for.

jinnovation commented 5 months ago

Honestly, kele-resource prefix could just have all of these suffixes defined on it and then we selectively enable/disable them using the :if slot. Seems easier than trying to dynamically inject suffixes or whatever.

jinnovation commented 5 months ago

This ticket is too broad to be actionable.

Let's replace it with a concrete feature that we can implement.

jinnovation commented 5 months ago

It doesn't look like there's a generic solution for "find all resources owned by this resource" (kubernetes/client-go#1085), so this is probably something we'll have to hard-code some resource-specific behavior for.

The "get/list all ReplicaSets owned by this Deployment" story seems reasonable as starting use case for conditional resource suffixes.

jinnovation commented 4 months ago

See also: https://github.com/kubernetes/kubectl/issues/1292

For inspiration: https://github.com/ahmetb/kubectl-tree