labels

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 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"

	// 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 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 ParseLabelWithValidation added in v0.1.9

func ParseLabelWithValidation(label string) (string, string, error)

ParseLabelWithValidation parses and validates a label according to Kubernetes 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