labels

package
v0.3.9 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package labels provides utilities for managing container labels used by the toolhive application.

Index

Constants

View Source
const (
	// LabelPrefix is the prefix for all ToolHive labels
	LabelPrefix = "toolhive"

	// LabelToolHive is the label that indicates a container is managed by ToolHive
	LabelToolHive = "toolhive"

	// LabelName is the label that contains the container name
	LabelName = "toolhive-name"

	// LabelBaseName is the label that contains the base container name (without timestamp)
	LabelBaseName = "toolhive-basename"

	// LabelTransport is the label that contains the transport mode
	LabelTransport = "toolhive-transport"

	// LabelPort is the label that contains the port
	LabelPort = "toolhive-port"

	// LabelToolType is the label that indicates the type of tool
	LabelToolType = "toolhive-tool-type"

	// LabelNetworkIsolation indicates that the network isolation functionality is enabled.
	LabelNetworkIsolation = "toolhive-network-isolation"

	// LabelGroup is the label that contains the group name
	LabelGroup = "toolhive-group"

	// LabelAuxiliary is the label that indicates this is an auxiliary workload (like inspector)
	LabelAuxiliary = "toolhive-auxiliary"

	// LabelToolHiveValue is the value for the LabelToolHive label
	LabelToolHiveValue = "true"
)

Variables

This section is empty.

Functions

func AddNetworkIsolationLabel added in v0.1.4

func AddNetworkIsolationLabel(labels map[string]string, networkIsolation bool)

AddNetworkIsolationLabel adds the network isolation label to a container

func AddNetworkLabels added in v0.0.48

func AddNetworkLabels(labels map[string]string, networkName string)

AddNetworkLabels adds network-related labels to a network

func AddStandardLabels

func AddStandardLabels(labels map[string]string, containerName, containerBaseName, transportType string, port int)

AddStandardLabels adds standard labels to a container

func FormatToolHiveFilter

func FormatToolHiveFilter() string

FormatToolHiveFilter formats a filter for ToolHive containers

func GetContainerBaseName

func GetContainerBaseName(labels map[string]string) string

GetContainerBaseName gets the base container name from labels

func GetContainerName

func GetContainerName(labels map[string]string) string

GetContainerName gets the container name from labels

func GetGroup added in v0.2.1

func GetGroup(labels map[string]string) string

GetGroup gets the group name from labels

func GetPort

func GetPort(labels map[string]string) (int, error)

GetPort gets the port from labels

func GetToolType

func GetToolType(labels map[string]string) string

GetToolType gets the tool type from labels

func GetTransportType

func GetTransportType(labels map[string]string) string

GetTransportType gets the transport type from labels

func HasNetworkIsolation added in v0.1.4

func HasNetworkIsolation(labels map[string]string) bool

HasNetworkIsolation checks if a container has network isolation enabled.

func IsAuxiliaryWorkload added in v0.3.6

func IsAuxiliaryWorkload(labels map[string]string) bool

IsAuxiliaryWorkload checks if a workload is an auxiliary workload (like inspector) Auxiliary workloads don't follow standard workload management patterns and don't use proxy processes

func IsStandardToolHiveLabel added in v0.1.9

func IsStandardToolHiveLabel(key string) bool

IsStandardToolHiveLabel checks if a label key is a standard ToolHive label that should not be passed through from user input or displayed to users

func IsToolHiveContainer

func IsToolHiveContainer(labels map[string]string) bool

IsToolHiveContainer checks if a container is managed by ToolHive

func ParseLabel added in v0.1.9

func ParseLabel(label string) (string, string, error)

ParseLabel parses a label string in the format "key=value" and validates it according to Kubernetes label naming conventions

func SetGroup added in v0.2.1

func SetGroup(labels map[string]string, groupName string)

SetGroup sets the group name in labels

Types

This section is empty.

Jump to

Keyboard shortcuts

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