Add AbortOnPluginFailure option to abort startup on plugin load failure

This commit is contained in:
Bmagic 2024-11-06 11:58:04 +01:00 committed by GitHub
parent 97caf758ef
commit 552bd8f180
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 14 additions and 2 deletions

View file

@ -238,6 +238,9 @@ func setupServer(staticConfiguration *static.Configuration) (*server.Server, err
}
pluginBuilder, err := createPluginBuilder(staticConfiguration)
if err != nil && staticConfiguration.Experimental != nil && staticConfiguration.Experimental.AbortOnPluginFailure {
return nil, fmt.Errorf("plugin: failed to create plugin builder: %w", err)
}
if err != nil {
pluginLogger.Err(err).Msg("Plugins are disabled because an error has occurred.")
} else if hasPlugins {

View file

@ -228,6 +228,9 @@ WriteTimeout is the maximum duration before timing out writes of the response. I
`--entrypoints.<name>.udp.timeout`:
Timeout defines how long to wait on an idle session before releasing the related resources. (Default: ```3```)
`--experimental.abortonpluginfailure`:
Defines whether all plugins must be loaded successfully for Traefik to start. (Default: ```false```)
`--experimental.fastproxy`:
Enable the FastProxy implementation. (Default: ```false```)

View file

@ -228,6 +228,9 @@ WriteTimeout is the maximum duration before timing out writes of the response. I
`TRAEFIK_ENTRYPOINTS_<NAME>_UDP_TIMEOUT`:
Timeout defines how long to wait on an idle session before releasing the related resources. (Default: ```3```)
`TRAEFIK_EXPERIMENTAL_ABORTONPLUGINFAILURE`:
Defines whether all plugins must be loaded successfully for Traefik to start. (Default: ```false```)
`TRAEFIK_EXPERIMENTAL_FASTPROXY`:
Enable the FastProxy implementation. (Default: ```false```)

View file

@ -488,6 +488,7 @@
[certificatesResolvers.CertificateResolver1.tailscale]
[experimental]
abortOnPluginFailure = true
kubernetesGateway = true
[experimental.plugins]
[experimental.plugins.Descriptor0]

View file

@ -576,6 +576,7 @@ experimental:
mounts:
- foobar
- foobar
abortOnPluginFailure: true
fastProxy:
debug: true
kubernetesGateway: true

View file

@ -4,8 +4,9 @@ import "github.com/traefik/traefik/v3/pkg/plugins"
// Experimental experimental Traefik features.
type Experimental struct {
Plugins map[string]plugins.Descriptor `description:"Plugins configuration." json:"plugins,omitempty" toml:"plugins,omitempty" yaml:"plugins,omitempty" export:"true"`
LocalPlugins map[string]plugins.LocalDescriptor `description:"Local plugins configuration." json:"localPlugins,omitempty" toml:"localPlugins,omitempty" yaml:"localPlugins,omitempty" export:"true"`
Plugins map[string]plugins.Descriptor `description:"Plugins configuration." json:"plugins,omitempty" toml:"plugins,omitempty" yaml:"plugins,omitempty" export:"true"`
LocalPlugins map[string]plugins.LocalDescriptor `description:"Local plugins configuration." json:"localPlugins,omitempty" toml:"localPlugins,omitempty" yaml:"localPlugins,omitempty" export:"true"`
AbortOnPluginFailure bool `description:"Defines whether all plugins must be loaded successfully for Traefik to start." json:"abortOnPluginFailure,omitempty" toml:"abortOnPluginFailure,omitempty" yaml:"abortOnPluginFailure,omitempty" export:"true"`
FastProxy *FastProxyConfig `description:"Enable the FastProxy implementation." json:"fastProxy,omitempty" toml:"fastProxy,omitempty" yaml:"fastProxy,omitempty" label:"allowEmpty" file:"allowEmpty" export:"true"`