extconfig

package
v0.0.7 Latest Latest
Warning

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

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

Documentation

Overview

Package extconfig defines the schema and loader for the extension configuration file (--extension-config). The file lets out-of-tree callers supply plugin-specific parameters without polluting the core binary's flag set.

Schema (YAML):

providers:
  quota:
    name: bob
    args:
      namespace: bob-namespace
  instanceType:
    name: dave
    args:
      configMapNamespace: alice-namespace
      configMapName: alice-config

plugins:
  - name: carol
    args:
      schedulerURL: http://...

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeArgs

func DecodeArgs[T any](raw map[string]any) (*T, error)

DecodeArgs converts the raw map[string]any from an ExtensionConfig into a concrete *T Args struct. It round-trips through YAML marshal/unmarshal so that the YAML field tags on T are respected.

Returns a zero-value *T when raw is nil (plugin registered with no args).

Types

type ExtensionConfig

type ExtensionConfig struct {
	Providers *ProvidersConfig `json:"providers,omitempty"`
	Plugins   []PluginConfig   `json:"plugins,omitempty"`
}

ExtensionConfig is the top-level structure of the extension config file.

func Load

func Load(path string) (*ExtensionConfig, error)

Load reads a YAML extension config file from path and returns the decoded ExtensionConfig. Returns a zero-value config (no provider, no plugins) when path is empty, so callers can always treat the result as valid.

func (*ExtensionConfig) Plugin

func (c *ExtensionConfig) Plugin(name string) (*PluginConfig, bool)

Plugin looks up a PluginConfig by name. Returns (nil, false) if not found.

type PluginConfig

type PluginConfig struct {
	Name string         `json:"name"`
	Args map[string]any `json:"args,omitempty"`
}

PluginConfig holds the name and raw args for a single lifecycle plugin.

type ProviderConfig

type ProviderConfig struct {
	Name string         `json:"name"`
	Args map[string]any `json:"args,omitempty"`
}

ProviderConfig holds the name and raw args for a provider (quota, instancetype, …).

type ProvidersConfig added in v0.0.5

type ProvidersConfig struct {
	Quota        *ProviderConfig `json:"quota,omitempty"`
	InstanceType *ProviderConfig `json:"instanceType,omitempty"`
}

ProvidersConfig groups all data-source provider configurations.

Jump to

Keyboard shortcuts

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