Merge current v2.6 into master
This commit is contained in:
commit
25725e9b2f
45 changed files with 155 additions and 99 deletions
|
@ -186,7 +186,6 @@ func TestGetRoutersByEntryPoints(t *testing.T) {
|
|||
"webs": {
|
||||
"bar": {
|
||||
Router: &dynamic.Router{
|
||||
|
||||
EntryPoints: []string{"webs"},
|
||||
Service: "bar-service@myprovider",
|
||||
Rule: "Host(`foo.bar`)",
|
||||
|
|
|
@ -186,7 +186,6 @@ func TestGetTCPRoutersByEntryPoints(t *testing.T) {
|
|||
"webs": {
|
||||
"bar": {
|
||||
TCPRouter: &dynamic.TCPRouter{
|
||||
|
||||
EntryPoints: []string{"webs"},
|
||||
Service: "bar-service@myprovider",
|
||||
Rule: "HostSNI(`foo.bar`)",
|
||||
|
|
|
@ -144,7 +144,7 @@ func TestPopulateUsedBy(t *testing.T) {
|
|||
},
|
||||
},
|
||||
{
|
||||
desc: "2 different Services each used by a disctinct router.",
|
||||
desc: "2 different Services each used by a distinct router.",
|
||||
conf: &runtime.Configuration{
|
||||
Services: map[string]*runtime.ServiceInfo{
|
||||
"foo-service@myprovider": {
|
||||
|
@ -384,7 +384,7 @@ func TestPopulateUsedBy(t *testing.T) {
|
|||
},
|
||||
},
|
||||
{
|
||||
desc: "2 middlewares from 2 disctinct providers both used by 2 Routers",
|
||||
desc: "2 middlewares from 2 distinct providers both used by 2 Routers",
|
||||
conf: &runtime.Configuration{
|
||||
Services: map[string]*runtime.ServiceInfo{
|
||||
"foo-service@myprovider": {
|
||||
|
@ -593,7 +593,7 @@ func TestPopulateUsedBy(t *testing.T) {
|
|||
},
|
||||
},
|
||||
{
|
||||
desc: "TCP, 2 different Services each used by a disctinct router.",
|
||||
desc: "TCP, 2 different Services each used by a distinct router.",
|
||||
conf: &runtime.Configuration{
|
||||
TCPServices: map[string]*runtime.TCPServiceInfo{
|
||||
"foo-service@myprovider": {
|
||||
|
|
|
@ -169,7 +169,6 @@ func TestGetUDPRoutersByEntryPoints(t *testing.T) {
|
|||
"webs": {
|
||||
"bar": {
|
||||
UDPRouter: &dynamic.UDPRouter{
|
||||
|
||||
EntryPoints: []string{"webs"},
|
||||
Service: "bar-service@myprovider",
|
||||
},
|
||||
|
|
|
@ -44,7 +44,7 @@ type BalancerHandler interface {
|
|||
}
|
||||
|
||||
// BalancerStatusHandler is an http Handler that does load-balancing,
|
||||
// andupdates its parents of its status.
|
||||
// and updates its parents of its status.
|
||||
type BalancerStatusHandler interface {
|
||||
BalancerHandler
|
||||
StatusUpdater
|
||||
|
|
|
@ -131,7 +131,7 @@ func initStandardRegistry(config *types.Prometheus) Registry {
|
|||
Name: configLastReloadFailureName,
|
||||
Help: "Last config reload failure",
|
||||
}, []string{})
|
||||
tlsCertsNotAfterTimesptamp := newGaugeFrom(promState.collectors, stdprometheus.GaugeOpts{
|
||||
tlsCertsNotAfterTimestamp := newGaugeFrom(promState.collectors, stdprometheus.GaugeOpts{
|
||||
Name: tlsCertsNotAfterTimestamp,
|
||||
Help: "Certificate expiration timestamp",
|
||||
}, []string{"cn", "serial", "sans"})
|
||||
|
@ -141,7 +141,7 @@ func initStandardRegistry(config *types.Prometheus) Registry {
|
|||
configReloadsFailures.cv.Describe,
|
||||
lastConfigReloadSuccess.gv.Describe,
|
||||
lastConfigReloadFailure.gv.Describe,
|
||||
tlsCertsNotAfterTimesptamp.gv.Describe,
|
||||
tlsCertsNotAfterTimestamp.gv.Describe,
|
||||
}
|
||||
|
||||
reg := &standardRegistry{
|
||||
|
@ -152,7 +152,7 @@ func initStandardRegistry(config *types.Prometheus) Registry {
|
|||
configReloadsFailureCounter: configReloadsFailures,
|
||||
lastConfigReloadSuccessGauge: lastConfigReloadSuccess,
|
||||
lastConfigReloadFailureGauge: lastConfigReloadFailure,
|
||||
tlsCertsNotAfterTimestampGauge: tlsCertsNotAfterTimesptamp,
|
||||
tlsCertsNotAfterTimestampGauge: tlsCertsNotAfterTimestamp,
|
||||
}
|
||||
|
||||
if config.AddEntryPointsLabels {
|
||||
|
|
|
@ -12,7 +12,7 @@ import (
|
|||
|
||||
func TestRecoverHandler(t *testing.T) {
|
||||
fn := func(w http.ResponseWriter, r *http.Request) {
|
||||
panic("I love panicing!")
|
||||
panic("I love panicking!")
|
||||
}
|
||||
recovery, err := New(context.Background(), http.HandlerFunc(fn))
|
||||
require.NoError(t, err)
|
||||
|
|
|
@ -104,11 +104,11 @@ func TestRetry(t *testing.T) {
|
|||
t.Run(test.desc, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
retryAttemps := 0
|
||||
retryAttempts := 0
|
||||
next := http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
|
||||
retryAttemps++
|
||||
retryAttempts++
|
||||
|
||||
if retryAttemps > test.amountFaultyEndpoints {
|
||||
if retryAttempts > test.amountFaultyEndpoints {
|
||||
// calls WroteHeaders on httptrace.
|
||||
_ = r.Write(io.Discard)
|
||||
|
||||
|
@ -275,11 +275,11 @@ func TestRetryWebsocket(t *testing.T) {
|
|||
t.Run(test.desc, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
retryAttemps := 0
|
||||
retryAttempts := 0
|
||||
next := http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
|
||||
retryAttemps++
|
||||
retryAttempts++
|
||||
|
||||
if retryAttemps > test.amountFaultyEndpoints {
|
||||
if retryAttempts > test.amountFaultyEndpoints {
|
||||
upgrader := websocket.Upgrader{}
|
||||
_, err := upgrader.Upgrade(rw, r, nil)
|
||||
if err != nil {
|
||||
|
|
|
@ -126,7 +126,6 @@ func TestStripPrefix(t *testing.T) {
|
|||
{
|
||||
desc: "earlier prefix matching",
|
||||
config: dynamic.StripPrefix{
|
||||
|
||||
Prefixes: []string{"/stat", "/stat/us"},
|
||||
},
|
||||
path: "/stat/us",
|
||||
|
|
|
@ -10,12 +10,12 @@ import (
|
|||
"github.com/traefik/traefik/v2/pkg/tracing"
|
||||
)
|
||||
|
||||
// Tracable embeds tracing information.
|
||||
type Tracable interface {
|
||||
// Traceable embeds tracing information.
|
||||
type Traceable interface {
|
||||
GetTracingInformation() (name string, spanKind ext.SpanKindEnum)
|
||||
}
|
||||
|
||||
// Wrap adds tracability to an alice.Constructor.
|
||||
// Wrap adds traceability to an alice.Constructor.
|
||||
func Wrap(ctx context.Context, constructor alice.Constructor) alice.Constructor {
|
||||
return func(next http.Handler) (http.Handler, error) {
|
||||
if constructor == nil {
|
||||
|
@ -26,8 +26,8 @@ func Wrap(ctx context.Context, constructor alice.Constructor) alice.Constructor
|
|||
return nil, err
|
||||
}
|
||||
|
||||
if tracableHandler, ok := handler.(Tracable); ok {
|
||||
name, spanKind := tracableHandler.GetTracingInformation()
|
||||
if traceableHandler, ok := handler.(Traceable); ok {
|
||||
name, spanKind := traceableHandler.GetTracingInformation()
|
||||
log.FromContext(ctx).WithField(log.MiddlewareName, name).Debug("Adding tracing to middleware")
|
||||
return NewWrapper(handler, name, spanKind), nil
|
||||
}
|
||||
|
|
|
@ -454,7 +454,7 @@ func (p *Provider) lookupTaskDefinitions(ctx context.Context, client *awsClient,
|
|||
// chunkIDs ECS expects no more than 100 parameters be passed to a API call;
|
||||
// thus, pack each string into an array capped at 100 elements.
|
||||
func (p *Provider) chunkIDs(ids []*string) [][]*string {
|
||||
var chuncked [][]*string
|
||||
var chunked [][]*string
|
||||
for i := 0; i < len(ids); i += 100 {
|
||||
var sliceEnd int
|
||||
if i+100 < len(ids) {
|
||||
|
@ -462,7 +462,7 @@ func (p *Provider) chunkIDs(ids []*string) [][]*string {
|
|||
} else {
|
||||
sliceEnd = len(ids)
|
||||
}
|
||||
chuncked = append(chuncked, ids[i:sliceEnd])
|
||||
chunked = append(chunked, ids[i:sliceEnd])
|
||||
}
|
||||
return chuncked
|
||||
return chunked
|
||||
}
|
||||
|
|
|
@ -31,7 +31,6 @@ const resyncPeriod = 10 * time.Minute
|
|||
// The stores can then be accessed via the Get* functions.
|
||||
type Client interface {
|
||||
WatchAll(namespaces []string, stopCh <-chan struct{}) (<-chan interface{}, error)
|
||||
|
||||
GetIngressRoutes() []*v1alpha1.IngressRoute
|
||||
GetIngressRouteTCPs() []*v1alpha1.IngressRouteTCP
|
||||
GetIngressRouteUDPs() []*v1alpha1.IngressRouteUDP
|
||||
|
@ -42,7 +41,6 @@ type Client interface {
|
|||
GetTLSOptions() []*v1alpha1.TLSOption
|
||||
GetServersTransports() []*v1alpha1.ServersTransport
|
||||
GetTLSStores() []*v1alpha1.TLSStore
|
||||
|
||||
GetService(namespace, name string) (*corev1.Service, bool, error)
|
||||
GetSecret(namespace, name string) (*corev1.Secret, bool, error)
|
||||
GetEndpoints(namespace, name string) (*corev1.Endpoints, bool, error)
|
||||
|
|
|
@ -27,5 +27,5 @@ spec:
|
|||
weight: 4
|
||||
# with unknown namespace
|
||||
- name: whoamitcp
|
||||
namespace: unknwonns
|
||||
namespace: unknowns
|
||||
port: 8080
|
||||
|
|
|
@ -26,5 +26,5 @@ spec:
|
|||
weight: 4
|
||||
# with unknown namespace
|
||||
- name: whoamiudp
|
||||
namespace: unknwonns
|
||||
namespace: unknowns
|
||||
port: 8080
|
||||
|
|
|
@ -50,7 +50,6 @@ func (reh *resourceEventHandler) OnDelete(obj interface{}) {
|
|||
// The stores can then be accessed via the Get* functions.
|
||||
type Client interface {
|
||||
WatchAll(namespaces []string, stopCh <-chan struct{}) (<-chan interface{}, error)
|
||||
|
||||
GetGatewayClasses() ([]*v1alpha2.GatewayClass, error)
|
||||
UpdateGatewayStatus(gateway *v1alpha2.Gateway, gatewayStatus v1alpha2.GatewayStatus) error
|
||||
UpdateGatewayClassStatus(gatewayClass *v1alpha2.GatewayClass, condition metav1.Condition) error
|
||||
|
@ -58,7 +57,6 @@ type Client interface {
|
|||
GetHTTPRoutes(namespaces []string) ([]*v1alpha2.HTTPRoute, error)
|
||||
GetTCPRoutes(namespaces []string) ([]*v1alpha2.TCPRoute, error)
|
||||
GetTLSRoutes(namespaces []string) ([]*v1alpha2.TLSRoute, error)
|
||||
|
||||
GetService(namespace, name string) (*corev1.Service, bool, error)
|
||||
GetSecret(namespace, name string) (*corev1.Secret, bool, error)
|
||||
GetEndpoints(namespace, name string) (*corev1.Endpoints, bool, error)
|
||||
|
|
|
@ -4,7 +4,7 @@ apiVersion: gateway.networking.k8s.io/v1alpha2
|
|||
metadata:
|
||||
name: my-gateway-class
|
||||
spec:
|
||||
controllerName: unkown.io/gateway-controller
|
||||
controllerName: unknown.io/gateway-controller
|
||||
|
||||
---
|
||||
kind: Gateway
|
||||
|
|
|
@ -4,7 +4,7 @@ apiVersion: gateway.networking.k8s.io/v1alpha2
|
|||
metadata:
|
||||
name: my-gateway-class
|
||||
spec:
|
||||
controllerName: unkown.io/gateway-controller
|
||||
controllerName: unknown.io/gateway-controller
|
||||
|
||||
---
|
||||
kind: Gateway
|
||||
|
|
|
@ -15,7 +15,7 @@ apiVersion: gateway.networking.k8s.io/v1alpha2
|
|||
metadata:
|
||||
name: my-gateway-class
|
||||
spec:
|
||||
controllerName: unkown.io/gateway-controller
|
||||
controllerName: unknown.io/gateway-controller
|
||||
|
||||
---
|
||||
kind: Gateway
|
||||
|
|
|
@ -46,7 +46,6 @@ func TestRuntimeConfiguration(t *testing.T) {
|
|||
},
|
||||
"bar": {
|
||||
UDPRouter: &dynamic.UDPRouter{
|
||||
|
||||
EntryPoints: []string{"web"},
|
||||
Service: "foo-service",
|
||||
},
|
||||
|
@ -78,7 +77,6 @@ func TestRuntimeConfiguration(t *testing.T) {
|
|||
},
|
||||
"bar": {
|
||||
UDPRouter: &dynamic.UDPRouter{
|
||||
|
||||
EntryPoints: []string{"web"},
|
||||
Service: "foo-service",
|
||||
},
|
||||
|
|
|
@ -86,7 +86,7 @@ func (b *Balancer) Push(x interface{}) {
|
|||
b.handlers = append(b.handlers, h)
|
||||
}
|
||||
|
||||
// Pop implements heap.Interface for poping an item from the heap.
|
||||
// Pop implements heap.Interface for popping an item from the heap.
|
||||
// It panics if b.Len() < 1.
|
||||
func (b *Balancer) Pop() interface{} {
|
||||
h := b.handlers[len(b.handlers)-1]
|
||||
|
|
|
@ -144,7 +144,7 @@ func TestAppendRespectsImmutability(t *testing.T) {
|
|||
newChain := chain.Append(tagMiddleware(""))
|
||||
|
||||
if &chain.constructors[0] == &newChain.constructors[0] {
|
||||
t.Error("Apppend does not respect immutability")
|
||||
t.Error("Append does not respect immutability")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@ type InfluxDB struct {
|
|||
AddEntryPointsLabels bool `description:"Enable metrics on entry points." json:"addEntryPointsLabels,omitempty" toml:"addEntryPointsLabels,omitempty" yaml:"addEntryPointsLabels,omitempty" export:"true"`
|
||||
AddRoutersLabels bool `description:"Enable metrics on routers." json:"addRoutersLabels,omitempty" toml:"addRoutersLabels,omitempty" yaml:"addRoutersLabels,omitempty" export:"true"`
|
||||
AddServicesLabels bool `description:"Enable metrics on services." json:"addServicesLabels,omitempty" toml:"addServicesLabels,omitempty" yaml:"addServicesLabels,omitempty" export:"true"`
|
||||
AdditionalLabels map[string]string `description:"Additional labels (influxdb tags) on all metrics" json:"additionalLabels,omitempty" toml:"additionalLabels,omitEmpty" yaml:"additionalLabels,omitEmpty" export:"true"`
|
||||
AdditionalLabels map[string]string `description:"Additional labels (influxdb tags) on all metrics" json:"additionalLabels,omitempty" toml:"additionalLabels,omitempty" yaml:"additionalLabels,omitempty" export:"true"`
|
||||
}
|
||||
|
||||
// SetDefaults sets the default values.
|
||||
|
@ -116,7 +116,7 @@ type InfluxDB2 struct {
|
|||
AddEntryPointsLabels bool `description:"Enable metrics on entry points." json:"addEntryPointsLabels,omitempty" toml:"addEntryPointsLabels,omitempty" yaml:"addEntryPointsLabels,omitempty" export:"true"`
|
||||
AddRoutersLabels bool `description:"Enable metrics on routers." json:"addRoutersLabels,omitempty" toml:"addRoutersLabels,omitempty" yaml:"addRoutersLabels,omitempty" export:"true"`
|
||||
AddServicesLabels bool `description:"Enable metrics on services." json:"addServicesLabels,omitempty" toml:"addServicesLabels,omitempty" yaml:"addServicesLabels,omitempty" export:"true"`
|
||||
AdditionalLabels map[string]string `description:"Additional labels (influxdb tags) on all metrics" json:"additionalLabels,omitempty" toml:"additionalLabels,omitEmpty" yaml:"additionalLabels,omitEmpty" export:"true"`
|
||||
AdditionalLabels map[string]string `description:"Additional labels (influxdb tags) on all metrics" json:"additionalLabels,omitempty" toml:"additionalLabels,omitempty" yaml:"additionalLabels,omitempty" export:"true"`
|
||||
}
|
||||
|
||||
// SetDefaults sets the default values.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue