Merge current v2.11 into v3.0

This commit is contained in:
mmatur 2024-02-08 14:15:45 +01:00
commit bc84fdd006
No known key found for this signature in database
GPG key ID: 2FFE42FC256CFF8E
143 changed files with 8736 additions and 6601 deletions

View file

@ -50,6 +50,7 @@ type sharedInformerFactory struct {
lock sync.Mutex
defaultResync time.Duration
customResync map[reflect.Type]time.Duration
transform cache.TransformFunc
informers map[reflect.Type]cache.SharedIndexInformer
// startedInformers is used for tracking which informers have been started.
@ -88,6 +89,14 @@ func WithNamespace(namespace string) SharedInformerOption {
}
}
// WithTransform sets a transform on all informers.
func WithTransform(transform cache.TransformFunc) SharedInformerOption {
return func(factory *sharedInformerFactory) *sharedInformerFactory {
factory.transform = transform
return factory
}
}
// NewSharedInformerFactory constructs a new instance of sharedInformerFactory for all namespaces.
func NewSharedInformerFactory(client versioned.Interface, defaultResync time.Duration) SharedInformerFactory {
return NewSharedInformerFactoryWithOptions(client, defaultResync)
@ -192,6 +201,7 @@ func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFunc internal
}
informer = newFunc(f.client, resyncPeriod)
informer.SetTransform(f.transform)
f.informers[informerType] = informer
return informer

View file

@ -717,7 +717,7 @@ func createForwardAuthMiddleware(k8sClient Client, namespace string, auth *traef
return nil, nil
}
if len(auth.Address) == 0 {
return nil, fmt.Errorf("forward authentication requires an address")
return nil, errors.New("forward authentication requires an address")
}
forwardAuth := &dynamic.ForwardAuth{
@ -812,7 +812,7 @@ func createBasicAuthMiddleware(client Client, namespace string, basicAuth *traef
}
if basicAuth.Secret == "" {
return nil, fmt.Errorf("auth secret must be set")
return nil, errors.New("auth secret must be set")
}
secret, ok, err := client.GetSecret(namespace, basicAuth.Secret)
@ -859,7 +859,7 @@ func createDigestAuthMiddleware(client Client, namespace string, digestAuth *tra
}
if digestAuth.Secret == "" {
return nil, fmt.Errorf("auth secret must be set")
return nil, errors.New("auth secret must be set")
}
secret, ok, err := client.GetSecret(namespace, digestAuth.Secret)

View file

@ -2,7 +2,7 @@ package ingress
import (
"context"
"fmt"
"errors"
"testing"
"time"
@ -39,9 +39,9 @@ func TestTranslateNotFoundError(t *testing.T) {
},
{
desc: "not a kubernetes not found error",
err: fmt.Errorf("bar error"),
err: errors.New("bar error"),
expectedExists: false,
expectedError: fmt.Errorf("bar error"),
expectedError: errors.New("bar error"),
},
}