netobserv

package
v0.0.65 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultPluginNamespace = "netobserv"
	DefaultPluginService   = "netobserv-plugin"
	DefaultPluginPort      = 9001

	// DefaultPluginHTTPTimeout bounds waits for the console plugin HTTP API (Loki/Prometheus work behind it).
	DefaultPluginHTTPTimeout = 120 * time.Second
)

Defaults match netobserv-operator (PluginName, DefaultOperatorNamespace, advanced.port).

View Source
const DefaultPluginServiceCAPath = "/var/run/secrets/kubernetes.io/serviceaccount/service-ca.crt"

DefaultPluginServiceCAPath is the OpenShift-projected service-serving CA bundle.

Variables

This section is empty.

Functions

func ArgumentsToValues

func ArgumentsToValues(arguments map[string]any) url.Values

ArgumentsToValues converts prepared MCP tool arguments into URL query values.

func BuildPluginURL

func BuildPluginURL(namespace, service string, port int, isOpenShift bool) string

BuildPluginURL builds a URL for the console plugin backend Service.

func DefaultPluginURL

func DefaultPluginURL(isOpenShift bool) string

DefaultPluginURL returns the in-cluster Service URL using HTTPS on OpenShift and HTTP otherwise.

func PrepareQueryArguments

func PrepareQueryArguments(arguments map[string]any) map[string]any

PrepareQueryArguments converts MCP tool arguments into console-plugin query parameters. The plugin reads startTime/endTime (Unix seconds) and ignores timeRange.

Types

type Config

type Config struct {
	// Url overrides the plugin base URL. When empty, built from namespace, service, and port.
	Url                  string `toml:"url,omitempty"`
	Namespace            string `toml:"namespace,omitempty"`
	Service              string `toml:"service,omitempty"`
	Port                 int    `toml:"port,omitempty"`
	Insecure             bool   `toml:"insecure,omitempty"`
	CertificateAuthority string `toml:"certificate_authority,omitempty"`
}

Config holds NetObserv console plugin backend configuration.

func (*Config) ResolvedURL

func (c *Config) ResolvedURL(isOpenShift bool) string

ResolvedURL returns the plugin base URL, applying operator-aligned defaults when url is unset.

func (*Config) Validate

func (c *Config) Validate() error

type GetResponse

type GetResponse struct {
	Body      string
	Truncated bool
}

GetResponse is the result of a plugin HTTP GET call.

type NetObserv

type NetObserv struct {
	// contains filtered or unexported fields
}

NetObserv is an HTTP client for the NetObserv console plugin backend API.

func NewNetObserv

func NewNetObserv(configProvider api.BaseConfig, k8s api.KubernetesClient) *NetObserv

NewNetObserv creates a client using toolset config, cluster detection, and the Kubernetes REST config.

func (*NetObserv) ExecuteGet

func (n *NetObserv) ExecuteGet(ctx context.Context, endpoint string, arguments map[string]any) (string, error)

ExecuteGet performs a GET request against the plugin API with query parameters derived from arguments.

func (*NetObserv) ExecuteGetAccept

func (n *NetObserv) ExecuteGetAccept(ctx context.Context, endpoint string, arguments map[string]any, accept string, maxBodySize int64) (GetResponse, error)

ExecuteGetAccept performs a GET with a custom Accept header and truncates the body at maxBodySize.

Jump to

Keyboard shortcuts

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