config

package
v0.6.4 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package config provides management for the registry server config ConfigMap

Index

Constants

View Source
const (
	// SourceTypeGit is the type for registry data stored in Git repositories
	SourceTypeGit = "git"

	// SourceTypeAPI is the type for registry data fetched from API endpoints
	SourceTypeAPI = "api"

	// SourceTypeFile is the type for registry data stored in local files
	SourceTypeFile = "file"

	// RegistryJSONFilePath is the file path where the registry JSON file will be mounted
	RegistryJSONFilePath = "/etc/registry/registry.json"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type APIConfig

type APIConfig struct {
	// Endpoint is the base API URL (without path)
	// The source handler will append the appropriate paths, for instance:
	//   - /v0/servers - List all servers (single response, no pagination)
	//   - /v0/servers/{name} - Get specific server (future)
	//   - /v0/info - Get registry metadata (future)
	// Example: "http://my-registry-api.default.svc.cluster.local/api"
	Endpoint string `yaml:"endpoint"`
}

APIConfig defines API source configuration for ToolHive Registry APIs

type Config

type Config struct {
	// RegistryName is the name/identifier for this registry instance
	// Defaults to "default" if not specified
	RegistryName string            `yaml:"registryName,omitempty"`
	Source       *SourceConfig     `yaml:"source"`
	SyncPolicy   *SyncPolicyConfig `yaml:"syncPolicy,omitempty"`
	Filter       *FilterConfig     `yaml:"filter,omitempty"`
}

Config represents the root configuration structure

func (*Config) ToConfigMapWithContentChecksum

func (c *Config) ToConfigMapWithContentChecksum(mcpRegistry *mcpv1alpha1.MCPRegistry) (*corev1.ConfigMap, error)

ToConfigMapWithContentChecksum converts the Config to a ConfigMap with a content checksum annotation

type ConfigManager

type ConfigManager interface {
	BuildConfig(mcpRegistry *mcpv1alpha1.MCPRegistry) (*Config, error)
	UpsertConfigMap(ctx context.Context,
		mcpRegistry *mcpv1alpha1.MCPRegistry,
		desired *corev1.ConfigMap,
	) error
}

ConfigManager provides methods to build registry server configuration from MCPRegistry resources and its persistence into a ConfigMap

func NewConfigManager

func NewConfigManager(
	k8sClient client.Client,
	scheme *runtime.Scheme,
	checksumManager checksum.RunConfigConfigMapChecksum,
) (ConfigManager, error)

NewConfigManager creates a new instance of ConfigManager with required dependencies

func NewConfigManagerForTesting

func NewConfigManagerForTesting() ConfigManager

NewConfigManagerForTesting creates a ConfigManager for testing purposes only. WARNING: This manager will panic if methods requiring dependencies are called. Only use this for testing BuildConfig or other methods that don't use k8s client.

type FileConfig

type FileConfig struct {
	// Path is the path to the registry.json file on the local filesystem
	// Can be absolute or relative to the working directory
	Path string `yaml:"path"`
}

FileConfig defines local file source configuration

type FilterConfig

type FilterConfig struct {
	Names *NameFilterConfig `yaml:"names,omitempty"`
	Tags  *TagFilterConfig  `yaml:"tags,omitempty"`
}

FilterConfig defines filtering rules for registry entries

type GitConfig

type GitConfig struct {
	// Repository is the Git repository URL (HTTP/HTTPS/SSH)
	Repository string `yaml:"repository"`

	// Branch is the Git branch to use (mutually exclusive with Tag and Commit)
	Branch string `yaml:"branch,omitempty"`

	// Tag is the Git tag to use (mutually exclusive with Branch and Commit)
	Tag string `yaml:"tag,omitempty"`

	// Commit is the Git commit SHA to use (mutually exclusive with Branch and Tag)
	Commit string `yaml:"commit,omitempty"`

	// Path is the path to the registry file within the repository
	Path string `yaml:"path,omitempty"`
}

GitConfig defines Git source settings

type NameFilterConfig

type NameFilterConfig struct {
	Include []string `yaml:"include,omitempty"`
	Exclude []string `yaml:"exclude,omitempty"`
}

NameFilterConfig defines name-based filtering

type SourceConfig

type SourceConfig struct {
	Type   string      `yaml:"type"`
	Format string      `yaml:"format"`
	Git    *GitConfig  `yaml:"git,omitempty"`
	API    *APIConfig  `yaml:"api,omitempty"`
	File   *FileConfig `yaml:"file,omitempty"`
}

SourceConfig defines the data source configuration

type SyncPolicyConfig

type SyncPolicyConfig struct {
	Interval string `yaml:"interval"`
}

SyncPolicyConfig defines synchronization settings

type TagFilterConfig

type TagFilterConfig struct {
	Include []string `yaml:"include,omitempty"`
	Exclude []string `yaml:"exclude,omitempty"`
}

TagFilterConfig defines tag-based filtering

Jump to

Keyboard shortcuts

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