4 Extending Kubed

Kubed has built-in support for many common types of Kubernetes resources. “Support” for a resource type in Kubed just means providing common commands for working with resources of that type, such as a command for showing the interactive list of these resources, like kubed-list-pods for Kubernetes pods. In Kubed, the macro kubed-define-resource is used to define these common commands and add support for more resource types:

Macro: kubed-define-resource resource &optional properties &rest [ keyword argument ]… commands

Define commands for resource.

Say you want to add support for your Kubernetes service accounts. With kubed-define-resource, all you need to do is to add the following line to your Emacs initialization file:

(kubed-define-resource serviceaccount)

This line defines the following commands for you:

See the documentation string of kubed-define-resource (C-h f) for details about the optional arguments of this macro: the properties argument which lets you specify what Kubed should show in the resource list buffer and the commands argument which lets you associate additional commands with your resource type.