Skip to content

Commit

Permalink
Merge pull request #189 from ibihim/proxy_drop_unused_args
Browse files Browse the repository at this point in the history
pkg/proxy: rm unused args
  • Loading branch information
s-urbaniak committed Aug 18, 2022
2 parents 1c7f88b + bd487b5 commit fc1ca4f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 15 deletions.
6 changes: 1 addition & 5 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,11 +230,7 @@ For more information, please go to https://github.com/brancz/kube-rbac-proxy/iss
sarAuthorizer,
)

auth, err := proxy.New(kubeClient, cfg.auth, authorizer, authenticator)

if err != nil {
klog.Fatalf("Failed to create rbac-proxy: %v", err)
}
auth := proxy.New(cfg.auth, authorizer, authenticator)

upstreamTransport, err := initTransport(cfg.upstreamCAFile)
if err != nil {
Expand Down
5 changes: 2 additions & 3 deletions pkg/proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import (
"k8s.io/apiserver/pkg/authentication/authenticator"
"k8s.io/apiserver/pkg/authentication/user"
"k8s.io/apiserver/pkg/authorization/authorizer"
clientset "k8s.io/client-go/kubernetes"
"k8s.io/klog/v2"
)

Expand All @@ -55,8 +54,8 @@ func new(authenticator authenticator.Request, authorizer authorizer.Authorizer,
}

// New creates an authenticator, an authorizer, and a matching authorizer attributes getter compatible with the kube-rbac-proxy
func New(client clientset.Interface, config Config, authorizer authorizer.Authorizer, authenticator authenticator.Request) (*kubeRBACProxy, error) {
return new(authenticator, authorizer, config), nil
func New(config Config, authorizer authorizer.Authorizer, authenticator authenticator.Request) *kubeRBACProxy {
return new(authenticator, authorizer, config)
}

// Handle authenticates the client and authorizes the request.
Expand Down
8 changes: 1 addition & 7 deletions pkg/proxy/proxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,9 @@ import (
"k8s.io/apiserver/pkg/authentication/request/bearertoken"
"k8s.io/apiserver/pkg/authentication/user"
"k8s.io/apiserver/pkg/authorization/authorizer"
testclient "k8s.io/client-go/kubernetes/fake"
)

func TestProxyWithOIDCSupport(t *testing.T) {
kc := testclient.NewSimpleClientset()
cfg := Config{
Authentication: &authn.AuthnConfig{
OIDC: &authn.OIDCConfig{},
Expand All @@ -57,11 +55,7 @@ func TestProxyWithOIDCSupport(t *testing.T) {
t.Run(v.description, func(t *testing.T) {

w := httptest.NewRecorder()
proxy, err := New(kc, cfg, v.authorizer, authenticator)

if err != nil {
t.Fatalf("Failed to instantiate test proxy. Details : %s", err.Error())
}
proxy := New(cfg, v.authorizer, authenticator)
proxy.Handle(w, v.req)

resp := w.Result()
Expand Down

0 comments on commit fc1ca4f

Please sign in to comment.