Skip to content

Entity settings

What is entitySettings?

entitySettings allow you to add new menu entries inside the cluster settings page. You can access this page by right-clicking on your cluster and selecting Settings.

openClusterSettings

You will see the new component here

openClusterSettings

How to use it

Interface

This is the entitySettings interface

entitySettings: EntitySettingRegistration[] = [];

EntitySettingRegistration is defined as follows

interface EntitySettingRegistration {
  apiVersions: string[];
  kind: string;
  title: string;
  components: EntitySettingComponents;
  source?: string;
  id?: string;
  priority?: number;
  group?: string;
}

Hands on

To add a new setting menu entry in cluster settings just add this code of block to your renderer/index.tsx file

entitySettings = [
  {
    apiVersions: ["entity.k8slens.dev/v1alpha1"],
    kind: "KubernetesCluster",
    title: "My settings",
    components: {
      View: () => <div>HELLO!</div>,
    },
    id: "my-custom-cluster-settings",
    group: "Settings",
  },
];

After compiling and installing the plugin, remember to close Freelens from the tray icon and reopen it, or you won’t see the new menu entries