diff --git a/go.mod b/go.mod index 1f85743..a6e358c 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/AlekSi/pointer v1.2.0 github.com/getkin/kin-openapi v0.133.0 github.com/go-logr/logr v1.4.3 - github.com/hashicorp/golang-lru v1.0.2 + github.com/hashicorp/golang-lru/v2 v2.0.7 github.com/labstack/echo/v4 v4.15.1 github.com/oapi-codegen/echo-middleware v1.0.2 github.com/oapi-codegen/runtime v1.4.0 diff --git a/go.sum b/go.sum index 28480da..a019763 100644 --- a/go.sum +++ b/go.sum @@ -155,8 +155,6 @@ github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY= github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ= github.com/hairyhenderson/go-codeowners v0.7.0 h1:s0W4wF8bdsBEjTWzwzSlsatSthWtTAF2xLgo4a4RwAo= github.com/hairyhenderson/go-codeowners v0.7.0/go.mod h1:wUlNgQ3QjqC4z8DnM5nnCYVq/icpqXJyJOukKx5U8/Q= -github.com/hashicorp/golang-lru v1.0.2 h1:dV3g9Z/unq5DpblPpw+Oqcv4dU/1omnb4Ok8iPY6p1c= -github.com/hashicorp/golang-lru v1.0.2/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k= github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= diff --git a/pkg/service/kubernetes_auth.go b/pkg/service/kubernetes_auth.go index ccf2485..c146333 100644 --- a/pkg/service/kubernetes_auth.go +++ b/pkg/service/kubernetes_auth.go @@ -6,7 +6,7 @@ import ( "strconv" "strings" - lruCache "github.com/hashicorp/golang-lru" + lruCache "github.com/hashicorp/golang-lru/v2" "github.com/labstack/echo/v4" "k8s.io/apimachinery/pkg/util/runtime" "sigs.k8s.io/controller-runtime/pkg/client" @@ -42,8 +42,8 @@ func getCacheSizeOrDefault(def int) int { return parsed } -func createCache() *lruCache.Cache { - cache, err := lruCache.NewWithEvict(getCacheSizeOrDefault(128), nil) +func createCache() *lruCache.Cache[string, client.Client] { + cache, err := lruCache.NewWithEvict[string, client.Client](getCacheSizeOrDefault(128), nil) runtime.Must(err) return cache } @@ -51,7 +51,7 @@ func createCache() *lruCache.Cache { // KubernetesAuth provides middleware to authenticate with Kubernetes JWT tokens type KubernetesAuth struct { CreateClientFunc func(string) (client.Client, error) - cache *lruCache.Cache + cache *lruCache.Cache[string, client.Client] } // DefaultKubernetesAuth uses the JWT bearer token to authenticate