1
0
mirror of https://github.com/rancher/steve.git synced 2025-05-04 05:56:42 +00:00

Merge pull request from ebauman/v1.24.0

This commit is contained in:
Kinara Shah 2022-06-24 15:44:43 -07:00 committed by GitHub
commit d26d34631a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 429 additions and 108 deletions

23
go.mod
View File

@ -7,33 +7,34 @@ replace (
github.com/knative/pkg => github.com/rancher/pkg v0.0.0-20190514055449-b30ab9de040e
github.com/matryer/moq => github.com/rancher/moq v0.0.0-20190404221404-ee5226d43009
k8s.io/client-go => github.com/rancher/client-go v1.20.0-rancher.1
k8s.io/client-go => github.com/rancher/client-go v1.24.0-rancher1
)
require (
github.com/adrg/xdg v0.3.1
github.com/gorilla/mux v1.7.3
github.com/gorilla/mux v1.8.0
github.com/gorilla/websocket v1.4.2
github.com/imdario/mergo v0.3.8 // indirect
github.com/pborman/uuid v1.2.0
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.11.1
github.com/prometheus/client_golang v1.12.1
github.com/rancher/apiserver v0.0.0-20210922180056-297b6df8d714
github.com/rancher/dynamiclistener v0.2.1-0.20200714201033-9c1939da3af9
github.com/rancher/kubernetes-provider-detector v0.1.2
github.com/rancher/norman v0.0.0-20210423002317-8e6ffc77a819
github.com/rancher/remotedialer v0.2.6-0.20220104192242-f3837f8d649a
github.com/rancher/wrangler v0.8.11-0.20211214201934-f5aa5d9f2e81
github.com/sirupsen/logrus v1.6.0
github.com/sirupsen/logrus v1.8.1
github.com/stretchr/testify v1.7.0
github.com/urfave/cli v1.22.2
github.com/urfave/cli/v2 v2.1.1
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a
k8s.io/api v0.20.0
k8s.io/apiextensions-apiserver v0.20.0
k8s.io/apimachinery v0.20.15
k8s.io/apiserver v0.20.0
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
k8s.io/api v0.24.0
k8s.io/apiextensions-apiserver v0.24.0
k8s.io/apimachinery v0.24.0
k8s.io/apiserver v0.24.0
k8s.io/client-go v12.0.0+incompatible
k8s.io/klog v1.0.0
k8s.io/kube-aggregator v0.20.0
k8s.io/kube-openapi v0.0.0-20211110013926-83f114cd0513
k8s.io/kube-aggregator v0.24.0
k8s.io/kube-openapi v0.0.0-20220328201542-3ee0da9b0b42
)

497
go.sum

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,7 @@
package cli
import (
"k8s.io/client-go/tools/clientcmd"
"os"
"time"
@ -38,7 +39,12 @@ func (w *WebhookConfig) WebhookMiddleware() (auth.Middleware, error) {
config = tempFile
}
return auth.NewWebhookMiddleware(time.Duration(w.CacheTTLSeconds)*time.Second, config)
kubeConfig, err := clientcmd.BuildConfigFromFlags("", config)
if err != nil {
return nil, err
}
return auth.NewWebhookMiddleware(time.Duration(w.CacheTTLSeconds)*time.Second, kubeConfig)
}
func Flags(config *WebhookConfig) []cli.Flag {

View File

@ -2,6 +2,7 @@ package auth
import (
"io/ioutil"
"k8s.io/client-go/rest"
"net/http"
"strings"
"time"
@ -82,8 +83,8 @@ func WebhookConfigForURL(url string) (string, error) {
return tmpFile.Name(), clientcmd.WriteToFile(config, tmpFile.Name())
}
func NewWebhookAuthenticator(cacheTTL time.Duration, kubeConfigFile string) (Authenticator, error) {
wh, err := webhook.New(kubeConfigFile, "v1", nil, WebhookBackoff, nil)
func NewWebhookAuthenticator(cacheTTL time.Duration, kubeConfig *rest.Config) (Authenticator, error) {
wh, err := webhook.New(kubeConfig, "v1", nil, WebhookBackoff)
if err != nil {
return nil, err
}
@ -99,8 +100,8 @@ func NewWebhookAuthenticator(cacheTTL time.Duration, kubeConfigFile string) (Aut
}, nil
}
func NewWebhookMiddleware(cacheTTL time.Duration, kubeConfigFile string) (Middleware, error) {
auth, err := NewWebhookAuthenticator(cacheTTL, kubeConfigFile)
func NewWebhookMiddleware(cacheTTL time.Duration, kubeConfig *rest.Config) (Middleware, error) {
auth, err := NewWebhookAuthenticator(cacheTTL, kubeConfig)
if err != nil {
return nil, err
}