Moves pilot outside the experimental section.

This commit is contained in:
Ludovic Fernandez 2020-09-15 12:08:03 +02:00 committed by GitHub
parent 4592626bbb
commit 3e60863e2d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 11 additions and 12 deletions

View file

@ -14,7 +14,7 @@ func initPlugins(staticCfg *static.Configuration) (*plugins.Client, map[string]p
opts := plugins.ClientOptions{ opts := plugins.ClientOptions{
Output: outputDir, Output: outputDir,
Token: staticCfg.Experimental.Pilot.Token, Token: staticCfg.Pilot.Token,
} }
client, err := plugins.NewClient(opts) client, err := plugins.NewClient(opts)
@ -31,9 +31,7 @@ func initPlugins(staticCfg *static.Configuration) (*plugins.Client, map[string]p
} }
func isPilotEnabled(staticCfg *static.Configuration) bool { func isPilotEnabled(staticCfg *static.Configuration) bool {
return staticCfg.Experimental != nil && return staticCfg.Pilot != nil && staticCfg.Pilot.Token != ""
staticCfg.Experimental.Pilot != nil &&
staticCfg.Experimental.Pilot.Token != ""
} }
func hasPlugins(staticCfg *static.Configuration) bool { func hasPlugins(staticCfg *static.Configuration) bool {

View file

@ -202,7 +202,7 @@ func setupServer(staticConfiguration *static.Configuration) (*server.Server, err
if isPilotEnabled(staticConfiguration) { if isPilotEnabled(staticConfiguration) {
pilotRegistry := metrics.RegisterPilot() pilotRegistry := metrics.RegisterPilot()
aviator = pilot.New(staticConfiguration.Experimental.Pilot.Token, pilotRegistry, routinesPool) aviator = pilot.New(staticConfiguration.Pilot.Token, pilotRegistry, routinesPool)
routinesPool.GoCtx(func(ctx context.Context) { routinesPool.GoCtx(func(ctx context.Context) {
aviator.Tick(ctx) aviator.Tick(ctx)
}) })

View file

@ -4,13 +4,6 @@ import "github.com/containous/traefik/v2/pkg/plugins"
// Experimental experimental Traefik features. // Experimental experimental Traefik features.
type Experimental struct { type Experimental struct {
Pilot *Pilot `description:"Traefik Pilot configuration." json:"pilot,omitempty" toml:"pilot,omitempty" yaml:"pilot,omitempty"`
Plugins map[string]plugins.Descriptor `description:"Plugins configuration." json:"plugins,omitempty" toml:"plugins,omitempty" yaml:"plugins,omitempty"` Plugins map[string]plugins.Descriptor `description:"Plugins configuration." json:"plugins,omitempty" toml:"plugins,omitempty" yaml:"plugins,omitempty"`
DevPlugin *plugins.DevPlugin `description:"Dev plugin configuration." json:"devPlugin,omitempty" toml:"devPlugin,omitempty" yaml:"devPlugin,omitempty"` DevPlugin *plugins.DevPlugin `description:"Dev plugin configuration." json:"devPlugin,omitempty" toml:"devPlugin,omitempty" yaml:"devPlugin,omitempty"`
} }
// Pilot Configuration related to Traefik Pilot.
type Pilot struct {
Token string `description:"Traefik Pilot token." json:"token,omitempty" toml:"token,omitempty" yaml:"token,omitempty"`
}

View file

@ -0,0 +1,6 @@
package static
// Pilot Configuration related to Traefik Pilot.
type Pilot struct {
Token string `description:"Traefik Pilot token." json:"token,omitempty" toml:"token,omitempty" yaml:"token,omitempty"`
}

View file

@ -72,6 +72,8 @@ type Configuration struct {
CertificatesResolvers map[string]CertificateResolver `description:"Certificates resolvers configuration." json:"certificatesResolvers,omitempty" toml:"certificatesResolvers,omitempty" yaml:"certificatesResolvers,omitempty" export:"true"` CertificatesResolvers map[string]CertificateResolver `description:"Certificates resolvers configuration." json:"certificatesResolvers,omitempty" toml:"certificatesResolvers,omitempty" yaml:"certificatesResolvers,omitempty" export:"true"`
Pilot *Pilot `description:"Traefik Pilot configuration." json:"pilot,omitempty" toml:"pilot,omitempty" yaml:"pilot,omitempty"`
Experimental *Experimental `description:"experimental features." json:"experimental,omitempty" toml:"experimental,omitempty" yaml:"experimental,omitempty"` Experimental *Experimental `description:"experimental features." json:"experimental,omitempty" toml:"experimental,omitempty" yaml:"experimental,omitempty"`
} }