inspektorgadget

package
v0.0.12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 3, 2025 License: MIT Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotDeployed = fmt.Errorf("inspektor gadget is not deployed, please deploy it first using: 'inspektor_gadget_observability' tool (action: deploy)")

Functions

func InspektorGadgetHandler

func InspektorGadgetHandler(mgr GadgetManager, cfg *config.ConfigData) tools.ResourceHandler

InspektorGadgetHandler returns a handler to manage gadgets

func RegisterInspektorGadgetTool

func RegisterInspektorGadgetTool() mcp.Tool

RegisterInspektorGadgetTool registers the inspektor-gadget tool to manage gadgets

Types

type Gadget

type Gadget struct {
	// Name for the gadget, LLM focused to help with use-case discovery
	Name string
	// Image is the Gadget image to be used
	Image string
	// Description provides a LLM focused description of the gadget
	Description string
	// Params are the LLM focused parameters that can be used to filter the gadget results
	Params map[string]interface{}
	// ParamsFunc is a function that prepares gadgetParams based on the filterParams
	ParamsFunc func(filterParams map[string]interface{}, gadgetParams map[string]string)
}

Gadget defines the structure of a gadget with its parameters and filter options

type GadgetInstance

type GadgetInstance struct {
	ID           string            `json:"id"`
	GadgetName   string            `json:"gadgetName"`
	GadgetImage  string            `json:"gadgetImage"`
	FilterParams map[string]string `json:"filterParams,omitempty"`
	Namespaces   []string          `json:"namespaces,omitempty"`
	CreatedBy    string            `json:"createdBy,omitempty"`
	StartedAt    string            `json:"startedAt,omitempty"`
}

GadgetInstance represents a running gadget instance

type GadgetManager

type GadgetManager interface {
	// RunGadget runs a gadget with the given parameters for a specified duration
	RunGadget(ctx context.Context, image string, params map[string]string, duration time.Duration) (string, error)
	// StartGadget starts a gadget with the given parameters
	StartGadget(ctx context.Context, image string, params map[string]string, tags []string) (string, error)
	// StopGadget stops a running gadget by its ID
	StopGadget(ctx context.Context, id string) error
	// GetResults retrieves results for a gadget by its ID
	GetResults(ctx context.Context, id string) (string, error)
	// ListGadgets lists all running gadgets
	ListGadgets(ctx context.Context) ([]*GadgetInstance, error)
	// IsDeployed checks if the Inspektor Gadget is deployed in the environment
	IsDeployed(ctx context.Context) (bool, string, error)
	// GetVersion retrieves the version of Inspektor Gadget installed in the cluster
	GetVersion() (string, error)
}

GadgetManager defines the interface for managing Inspektor Gadget gadgets

func NewGadgetManager

func NewGadgetManager() GadgetManager

NewGadgetManager creates a new instance of GadgetManager

type HelmClient added in v0.0.6

type HelmClient interface {
	InstallChart(chartUrl, releaseName, namespace string) (string, error)
	UninstallChart(releaseName, namespace string) (string, error)
	CheckRelease(releaseName, namespace string) error
	UpgradeChart(chartUrl, releaseName, namespace string) (string, error)
}

HelmClient defines the minimal interface used by the Inspektor Gadget handlers

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL