Documentation
¶
Overview ¶
Package provider defines Vale snapshot/config provider interfaces and helpers.
Index ¶
- Constants
- func AppendSortedRoutes(cfg *config.Config, routes *mapping.Map[string, config.Route])
- func AppendSortedServices(cfg *config.Config, services *mapping.Map[string, *config.Service])
- func ApplyLogger(target any, logger *slog.Logger)
- func ConfigEndpoint(rawURL string, weight int) config.Endpoint
- func ConfigProviderName(provider ConfigProvider, fallback string) string
- func NewEntrypointConfig(name, address string) *config.Config
- func NewOnceCloser(closeFn func()) io.Closer
- func SortedStrings(values *collectionlist.List[string]) *collectionlist.List[string]
- func SplitCSV(value string) *collectionlist.List[string]
- func StripTraefikProviderNamespace(name string) string
- type ConfigBuilder
- func (b *ConfigBuilder) Admin(address string) *ConfigBuilder
- func (b *ConfigBuilder) Build() *config.Config
- func (b *ConfigBuilder) BuildValidated() (*config.Config, error)
- func (b *ConfigBuilder) Entrypoint(name, address string, options ...EntrypointOption) *ConfigBuilder
- func (b *ConfigBuilder) Errors() *collectionlist.List[error]
- func (b *ConfigBuilder) Health(interval, timeout string) *ConfigBuilder
- func (b *ConfigBuilder) Middleware(middleware config.Middleware) *ConfigBuilder
- func (b *ConfigBuilder) MiddlewareNamed(name string, options ...MiddlewareOption) *ConfigBuilder
- func (b *ConfigBuilder) Observability(accessLog, metrics bool) *ConfigBuilder
- func (b *ConfigBuilder) Route(route config.Route) *ConfigBuilder
- func (b *ConfigBuilder) RouteTo(name, entrypoint, service string, options ...RouteOption) *ConfigBuilder
- func (b *ConfigBuilder) Security(security config.Security) *ConfigBuilder
- func (b *ConfigBuilder) Service(name, endpointURL string) *ConfigBuilder
- func (b *ConfigBuilder) ServiceWithEndpoints(name string, endpoints ...config.Endpoint) *ConfigBuilder
- func (b *ConfigBuilder) ServiceWithStrategy(name, strategy string, endpoints ...config.Endpoint) *ConfigBuilder
- type ConfigProvider
- type ConfigProviderFactory
- type ConfigProviderRegistry
- func (r *ConfigProviderRegistry) Clone() *ConfigProviderRegistry
- func (r *ConfigProviderRegistry) Create(ctx context.Context, spec ProviderSpec) (ConfigProvider, error)
- func (r *ConfigProviderRegistry) Factory(providerType string) (ConfigProviderFactory, bool)
- func (r *ConfigProviderRegistry) Names() *collectionlist.List[string]
- func (r *ConfigProviderRegistry) Register(providerType string, factory ConfigProviderFactory) error
- type ConfigSourceChangedEvent
- type ConfigSourceFailedEvent
- type ConfigSourceLoadedEvent
- type EntrypointOption
- type Event
- type EventBus
- type LoggerAware
- type MiddlewareOption
- func MiddlewareAddPrefix(pathPrefix string) MiddlewareOption
- func MiddlewareBasicAuth(realm string, users map[string]string) MiddlewareOption
- func MiddlewareChain(names ...string) MiddlewareOption
- func MiddlewareCompress(minBytes int) MiddlewareOption
- func MiddlewareIPAllowList(trustForwardHeader bool, sourceRange ...string) MiddlewareOption
- func MiddlewareMaxBodyBytes(maxBodyBytes int64) MiddlewareOption
- func MiddlewareRedirectRegex(pattern, replacement string, permanent bool) MiddlewareOption
- func MiddlewareRedirectScheme(scheme, port string, permanent bool) MiddlewareOption
- func MiddlewareReplacePath(path string) MiddlewareOption
- func MiddlewareReplacePathRegex(pattern, replacement string) MiddlewareOption
- func MiddlewareRequestHeader(key, value string) MiddlewareOption
- func MiddlewareResponseHeader(key, value string) MiddlewareOption
- func MiddlewareStripPrefix(pathPrefix string) MiddlewareOption
- func MiddlewareStripPrefixes(pathPrefixes ...string) MiddlewareOption
- func MiddlewareType(middlewareType string) MiddlewareOption
- type MultiCloser
- type Named
- type NopCloser
- type ProviderSpec
- type RouteOption
- type SnapshotProvider
- type SnapshotProviderFactory
- type SnapshotProviderRegistry
- func (r *SnapshotProviderRegistry) Clone() *SnapshotProviderRegistry
- func (r *SnapshotProviderRegistry) Create(ctx context.Context, spec ProviderSpec) (SnapshotProvider, error)
- func (r *SnapshotProviderRegistry) Factory(providerType string) (SnapshotProviderFactory, bool)
- func (r *SnapshotProviderRegistry) Names() *collectionlist.List[string]
- func (r *SnapshotProviderRegistry) Register(providerType string, factory SnapshotProviderFactory) error
- type SnapshotRecompiledEvent
- type SnapshotUnchangedEvent
- type TraefikLabels
- type TraefikRouter
- type TraefikService
- type WatchHub
- type WatchSetupFailedEvent
Constants ¶
const ( EventNameConfigSourceLoaded = "provider.config_source.loaded" EventNameConfigSourceFailed = "provider.config_source.failed" EventNameSnapshotRecompiled = "provider.snapshot.recompiled" EventNameSnapshotUnchanged = "provider.snapshot.unchanged" EventNameWatchSetupFailed = "provider.watch.setup_failed" EventNameConfigSourceChanged = "provider.config_source.changed" )
Variables ¶
This section is empty.
Functions ¶
func AppendSortedRoutes ¶
func AppendSortedServices ¶
func ApplyLogger ¶
ApplyLogger injects logger when target supports LoggerAware.
func ConfigProviderName ¶
func ConfigProviderName(provider ConfigProvider, fallback string) string
func NewEntrypointConfig ¶
func NewOnceCloser ¶
NewOnceCloser wraps a close function so it runs at most once.
func SortedStrings ¶
func SortedStrings(values *collectionlist.List[string]) *collectionlist.List[string]
SortedStrings returns a sorted copy of values.
func StripTraefikProviderNamespace ¶
StripTraefikProviderNamespace strips a Traefik provider suffix such as "auth@docker".
Types ¶
type ConfigBuilder ¶
type ConfigBuilder struct {
// contains filtered or unexported fields
}
func NewConfigBuilder ¶
func NewConfigBuilder() *ConfigBuilder
func (*ConfigBuilder) Admin ¶
func (b *ConfigBuilder) Admin(address string) *ConfigBuilder
func (*ConfigBuilder) Build ¶
func (b *ConfigBuilder) Build() *config.Config
func (*ConfigBuilder) BuildValidated ¶
func (b *ConfigBuilder) BuildValidated() (*config.Config, error)
func (*ConfigBuilder) Entrypoint ¶
func (b *ConfigBuilder) Entrypoint(name, address string, options ...EntrypointOption) *ConfigBuilder
func (*ConfigBuilder) Errors ¶
func (b *ConfigBuilder) Errors() *collectionlist.List[error]
func (*ConfigBuilder) Health ¶
func (b *ConfigBuilder) Health(interval, timeout string) *ConfigBuilder
func (*ConfigBuilder) Middleware ¶
func (b *ConfigBuilder) Middleware(middleware config.Middleware) *ConfigBuilder
func (*ConfigBuilder) MiddlewareNamed ¶
func (b *ConfigBuilder) MiddlewareNamed(name string, options ...MiddlewareOption) *ConfigBuilder
func (*ConfigBuilder) Observability ¶
func (b *ConfigBuilder) Observability(accessLog, metrics bool) *ConfigBuilder
func (*ConfigBuilder) Route ¶
func (b *ConfigBuilder) Route(route config.Route) *ConfigBuilder
func (*ConfigBuilder) RouteTo ¶
func (b *ConfigBuilder) RouteTo(name, entrypoint, service string, options ...RouteOption) *ConfigBuilder
func (*ConfigBuilder) Security ¶
func (b *ConfigBuilder) Security(security config.Security) *ConfigBuilder
func (*ConfigBuilder) Service ¶
func (b *ConfigBuilder) Service(name, endpointURL string) *ConfigBuilder
func (*ConfigBuilder) ServiceWithEndpoints ¶
func (b *ConfigBuilder) ServiceWithEndpoints(name string, endpoints ...config.Endpoint) *ConfigBuilder
func (*ConfigBuilder) ServiceWithStrategy ¶
func (b *ConfigBuilder) ServiceWithStrategy(name, strategy string, endpoints ...config.Endpoint) *ConfigBuilder
type ConfigProvider ¶
type ConfigProviderFactory ¶
type ConfigProviderFactory func(context.Context, ProviderSpec) (ConfigProvider, error)
type ConfigProviderRegistry ¶
type ConfigProviderRegistry struct {
// contains filtered or unexported fields
}
func NewConfigProviderRegistry ¶
func NewConfigProviderRegistry() *ConfigProviderRegistry
func (*ConfigProviderRegistry) Clone ¶
func (r *ConfigProviderRegistry) Clone() *ConfigProviderRegistry
func (*ConfigProviderRegistry) Create ¶
func (r *ConfigProviderRegistry) Create(ctx context.Context, spec ProviderSpec) (ConfigProvider, error)
func (*ConfigProviderRegistry) Factory ¶
func (r *ConfigProviderRegistry) Factory(providerType string) (ConfigProviderFactory, bool)
func (*ConfigProviderRegistry) Names ¶
func (r *ConfigProviderRegistry) Names() *collectionlist.List[string]
func (*ConfigProviderRegistry) Register ¶
func (r *ConfigProviderRegistry) Register(providerType string, factory ConfigProviderFactory) error
type ConfigSourceChangedEvent ¶
type ConfigSourceChangedEvent struct {
Source string
}
func (ConfigSourceChangedEvent) Name ¶
func (e ConfigSourceChangedEvent) Name() string
type ConfigSourceFailedEvent ¶
func (ConfigSourceFailedEvent) Name ¶
func (e ConfigSourceFailedEvent) Name() string
type ConfigSourceLoadedEvent ¶
func (ConfigSourceLoadedEvent) Name ¶
func (e ConfigSourceLoadedEvent) Name() string
type EntrypointOption ¶
type EntrypointOption func(*config.Entrypoint)
func EntrypointACME ¶
func EntrypointACME(email, cacheDir string, domains ...string) EntrypointOption
func EntrypointTLS ¶
func EntrypointTLS(certFile, keyFile string) EntrypointOption
type EventBus ¶
type EventBus = eventx.BusRuntime
type LoggerAware ¶
LoggerAware marks components that can receive the gateway-level logger.
type MiddlewareOption ¶
type MiddlewareOption func(*config.Middleware)
func MiddlewareAddPrefix ¶
func MiddlewareAddPrefix(pathPrefix string) MiddlewareOption
func MiddlewareBasicAuth ¶ added in v0.1.1
func MiddlewareBasicAuth(realm string, users map[string]string) MiddlewareOption
func MiddlewareChain ¶
func MiddlewareChain(names ...string) MiddlewareOption
func MiddlewareCompress ¶ added in v0.1.1
func MiddlewareCompress(minBytes int) MiddlewareOption
func MiddlewareIPAllowList ¶ added in v0.1.1
func MiddlewareIPAllowList(trustForwardHeader bool, sourceRange ...string) MiddlewareOption
func MiddlewareMaxBodyBytes ¶
func MiddlewareMaxBodyBytes(maxBodyBytes int64) MiddlewareOption
func MiddlewareRedirectRegex ¶
func MiddlewareRedirectRegex(pattern, replacement string, permanent bool) MiddlewareOption
func MiddlewareRedirectScheme ¶
func MiddlewareRedirectScheme(scheme, port string, permanent bool) MiddlewareOption
func MiddlewareReplacePath ¶
func MiddlewareReplacePath(path string) MiddlewareOption
func MiddlewareReplacePathRegex ¶
func MiddlewareReplacePathRegex(pattern, replacement string) MiddlewareOption
func MiddlewareRequestHeader ¶
func MiddlewareRequestHeader(key, value string) MiddlewareOption
func MiddlewareResponseHeader ¶
func MiddlewareResponseHeader(key, value string) MiddlewareOption
func MiddlewareStripPrefix ¶
func MiddlewareStripPrefix(pathPrefix string) MiddlewareOption
func MiddlewareStripPrefixes ¶
func MiddlewareStripPrefixes(pathPrefixes ...string) MiddlewareOption
func MiddlewareType ¶
func MiddlewareType(middlewareType string) MiddlewareOption
type MultiCloser ¶
type MultiCloser struct {
// contains filtered or unexported fields
}
MultiCloser closes a group of resources and returns the first close error.
func NewMultiCloser ¶
func NewMultiCloser(closers *collectionlist.List[io.Closer]) MultiCloser
func NewMultiCloserFrom ¶
func NewMultiCloserFrom(closers ...io.Closer) MultiCloser
func (MultiCloser) Close ¶
func (m MultiCloser) Close() error
type ProviderSpec ¶
func NewProviderSpec ¶
func NewProviderSpec(providerType string) ProviderSpec
func (ProviderSpec) WithName ¶
func (s ProviderSpec) WithName(name string) ProviderSpec
func (ProviderSpec) WithSetting ¶
func (s ProviderSpec) WithSetting(key, value string) ProviderSpec
type RouteOption ¶
func RouteHeader ¶
func RouteHeader(key, value string) RouteOption
func RouteHost ¶
func RouteHost(host string) RouteOption
func RouteMethod ¶
func RouteMethod(method string) RouteOption
func RouteMiddlewares ¶
func RouteMiddlewares(names ...string) RouteOption
func RoutePathPrefix ¶
func RoutePathPrefix(pathPrefix string) RouteOption
type SnapshotProvider ¶
type SnapshotProvider interface {
Load(context.Context) (*runtime.CompiledSnapshot, error)
Watch(context.Context, func(*runtime.CompiledSnapshot), func(error)) (io.Closer, error)
}
func Fallback ¶
func Fallback(providers ...SnapshotProvider) SnapshotProvider
func FallbackList ¶
func FallbackList(providers *collectionlist.List[SnapshotProvider]) SnapshotProvider
type SnapshotProviderFactory ¶
type SnapshotProviderFactory func(context.Context, ProviderSpec) (SnapshotProvider, error)
type SnapshotProviderRegistry ¶
type SnapshotProviderRegistry struct {
// contains filtered or unexported fields
}
func NewSnapshotProviderRegistry ¶
func NewSnapshotProviderRegistry() *SnapshotProviderRegistry
func (*SnapshotProviderRegistry) Clone ¶
func (r *SnapshotProviderRegistry) Clone() *SnapshotProviderRegistry
func (*SnapshotProviderRegistry) Create ¶
func (r *SnapshotProviderRegistry) Create(ctx context.Context, spec ProviderSpec) (SnapshotProvider, error)
func (*SnapshotProviderRegistry) Factory ¶
func (r *SnapshotProviderRegistry) Factory(providerType string) (SnapshotProviderFactory, bool)
func (*SnapshotProviderRegistry) Names ¶
func (r *SnapshotProviderRegistry) Names() *collectionlist.List[string]
func (*SnapshotProviderRegistry) Register ¶
func (r *SnapshotProviderRegistry) Register(providerType string, factory SnapshotProviderFactory) error
type SnapshotRecompiledEvent ¶
type SnapshotRecompiledEvent struct {
SourceCount int
RouteCount int
ServiceCount int
Fingerprint string
}
func (SnapshotRecompiledEvent) Name ¶
func (e SnapshotRecompiledEvent) Name() string
type SnapshotUnchangedEvent ¶
func (SnapshotUnchangedEvent) Name ¶
func (e SnapshotUnchangedEvent) Name() string
type TraefikLabels ¶
type TraefikLabels struct {
Enabled mo.Option[bool]
Routers *mapping.Map[string, TraefikRouter]
Services *mapping.Map[string, TraefikService]
Middlewares *mapping.Map[string, config.Middleware]
}
TraefikLabels is the normalized subset of Traefik HTTP dynamic labels Vale can project.
func NewTraefikLabels ¶
func NewTraefikLabels() TraefikLabels
NewTraefikLabels returns an empty Traefik label projection.
func ParseTraefikLabels ¶
func ParseTraefikLabels(labels *mapping.Map[string, string]) TraefikLabels
ParseTraefikLabels parses Traefik-compatible HTTP labels.
func (TraefikLabels) HasHTTPConfig ¶
func (labels TraefikLabels) HasHTTPConfig() bool
HasHTTPConfig reports whether the labels define Traefik HTTP routing resources.
type TraefikRouter ¶
type TraefikRouter struct {
Name string
Rule string
Entrypoints *collectionlist.List[string]
Middlewares *collectionlist.List[string]
Service string
Host string
PathPrefix string
Method string
Headers *mapping.Map[string, string]
}
TraefikRouter contains router labels projected into Vale's HTTP route model.
type TraefikService ¶
TraefikService contains load balancer labels projected into Vale services.
type WatchHub ¶ added in v0.1.1
type WatchHub struct {
// contains filtered or unexported fields
}
func NewWatchHub ¶ added in v0.1.1
func NewWatchHub() *WatchHub
type WatchSetupFailedEvent ¶
func (WatchSetupFailedEvent) Name ¶
func (e WatchSetupFailedEvent) Name() string
Source Files
¶
- aggregate.go
- closer.go
- config_builder.go
- config_builder_entrypoint.go
- config_builder_middleware.go
- config_builder_route.go
- config_builder_service.go
- config_builder_settings.go
- events.go
- logger.go
- provider.go
- registry.go
- sort.go
- strings.go
- traefik_label_parse.go
- traefik_labels.go
- traefik_policy_labels.go
- watch_hub.go
Directories
¶
| Path | Synopsis |
|---|---|
|
docker
module
|
|
|
file
module
|
|
|
fileconfig
module
|
|
|
k8s
module
|
|
|
Package memoryconfig provides an in-memory mutable config provider.
|
Package memoryconfig provides an in-memory mutable config provider. |
|
Package merged merges multiple config providers into one runtime provider.
|
Package merged merges multiple config providers into one runtime provider. |
|
Package static provides an immutable runtime snapshot provider.
|
Package static provides an immutable runtime snapshot provider. |
|
Package staticconfig provides an immutable declarative config provider.
|
Package staticconfig provides an immutable declarative config provider. |