File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change 16
16
- name : Set up Go 1.x
17
17
uses : actions/setup-go@v2
18
18
with :
19
- go-version : ^ 1.16
19
+ go-version : 1.16.6
20
20
id : go
21
21
22
22
- run : go get github.com/golangci/golangci-lint/cmd/golangci-lint
Original file line number Diff line number Diff line change @@ -6,12 +6,25 @@ import (
6
6
"sigs.k8s.io/apiserver-runtime/internal/sample-apiserver/pkg/cmd/server"
7
7
)
8
8
9
+ var enableAuthorization bool
10
+
9
11
// DisableAuthorization disables delegated authentication and authorization
10
12
func (a * Server ) DisableAuthorization () * Server {
11
13
server .ServerOptionsFns = append (server .ServerOptionsFns , func (o * ServerOptions ) * ServerOptions {
12
- o .RecommendedOptions .Authorization = nil
14
+ if ! enableAuthorization {
15
+ o .RecommendedOptions .Authorization = nil
16
+ }
13
17
return o
14
18
})
19
+ server .FlagsFns = append (server .FlagsFns , func (fs * pflag.FlagSet ) * pflag.FlagSet {
20
+ fs .BoolVar (& enableAuthorization , "enable-authorization" , false ,
21
+ "Enabling authorization will check if the incoming authenticated requests " +
22
+ "have sufficient permission for the requesting target. Deploying the apiserver " +
23
+ "inside a kubernetes cluster will delegate the authorization to the hosting " +
24
+ "kube-apiserver, otherwise specify `--authorization-kubeconfig` to explicitly " +
25
+ "set a kube-apiserver to talk to." )
26
+ return fs
27
+ })
15
28
return a
16
29
}
17
30
You can’t perform that action at this time.
0 commit comments