podman-desktop icon indicating copy to clipboard operation
podman-desktop copied to clipboard

move kubernetes related UI to a Kubernetes extension

Open benoitf opened this issue 11 months ago • 1 comments

Epic domain

Now, the kubernetes part is mostly managed by two parts, the viewing of objects like Pods, Deployments, CronJobs, etc... and the "Kube Apply"

It's pretty well scoped, so I would like to move out all related files to a separate extension. So disabling the extension would disable all kubernetes related features of monitoring a Kubernetes cluster. Very easy to turn on/turn off

There might be some API enhancements to make it more integrated but it will result in a codebase be better scoped with clear expectations from the different part.

It will also reduce the "core" part to the basics and have an easier way of adding new features through the extension scope. The extension itself could have extension endpoints that other extensions could easily reuse to make faster enhancements

Additional context

It could be a default extension so almost nothing would change from a fresh install but it would be easy to turn on/off the feature. Some settings might need to be tweaked or have a "one-time" converter to updated properties being scoped to the extension.

benoitf avatar Feb 12 '25 18:02 benoitf

Current state before extracting as an extension:

1. Kubernetes-related methods offered in by extension-api:

1a. kubernetes namespace

  • get/set/watch kubeconfig file path
  • create Kubernetes resources
  • register generators of Kubernetes manifests from containers/pods/compose
  export namespace kubernetes {
    // Path to the configuration file
    export function getKubeconfig(): Uri;
    export const onDidUpdateKubeconfig: Event<KubeconfigUpdateEvent>;
    export function setKubeconfig(kubeconfig: Uri): Promise<void>;

    /**
     * Create one or several Kubernetes resources on the Kubernetes contenxt.
     *
     * @param context the Kubernetes context to use
     * @param manifests the manifests to create as JSON objects
     */
    export function createResources(context: string, manifests: unknown[]): Promise<void>;

    /**
     * Add a KubernetesGenerator to KubernetesGeneratorRegistry
     * @param provider the custom provider to add
     */
    export function registerKubernetesGenerator(provider: KubernetesGeneratorProvider): Disposable;
  }

1b. provider namespace

  export namespace provider {
    export const onDidUpdateKubernetesConnection: Event<UpdateKubernetesConnectionEvent>;
    [...]
  }
  export interface Provider {
    setKubernetesProviderConnectionFactory(
      containerProviderConnectionFactory: KubernetesProviderConnectionFactory,
      connectionAuditor?: Auditor,
    ): Disposable;
    registerKubernetesProviderConnection(connection: KubernetesProviderConnection): Disposable;
    [...]
  }

2. Internal

Entrypoint of all Kubernetes machinery is KubernetesClient (packages/main/src/plugin/kubernetes/kubernetes-client.ts)

This module starts Kubernetes in legacy or experimental mode depending on user config.

  • start monitoring of Kubernetes contexts (check health, permissions, resources, etc), and send events with current state
  • handle calls
    • from extension API (see above)
    • internal (create/update/delete resources, manage Kubeconfig file, port-forwarding, etc)

feloy avatar Jun 19 '25 08:06 feloy

Two weeks ago we had a meeting with @feloy and @benoitf discussing the scope and complexity. To keep the parity between the core implementation and the newly formed extension it would be great to pause addition of new features to the current Kubernetes implementation. We should keep an eye on the new commits, maybe this tracker could help.

There are currently 3 sub-tasks, they seem to be quite complex - @feloy would it make sense to further break it down into smaller pieces for tracking purposes?

The work can be started right away, I already see one ticket In Progress.

cc: @jeffmaury

jiridostal avatar Jul 08 '25 11:07 jiridostal

@jiridostal does it make sense to create the issues on the extension's repo (https://github.com/podman-desktop/extension-kubernetes-dashboard), or in the podman desktop's one?

feloy avatar Jul 08 '25 12:07 feloy

I believe the extension repo works better for the purpose.

jiridostal avatar Jul 08 '25 13:07 jiridostal

I have created this epic and sub-tasks on extension's repo for the first sub-issue: https://github.com/podman-desktop/extension-kubernetes-dashboard/issues/51

feloy avatar Jul 08 '25 14:07 feloy

hello, I'm wondering if we would need a Kubernetes extension pack (that brings altogether all the related extensions)

benoitf avatar Nov 14 '25 10:11 benoitf