Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
8 changes: 4 additions & 4 deletions pkg/service/kubernetes_auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -42,16 +42,16 @@ 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
}

// 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
Expand Down