Add generated file
This PR adds generated files under pkg/client and vendor folder.
This commit is contained in:
33
vendor/k8s.io/kubernetes/pkg/kubeapiserver/authorizer/modes/BUILD
generated
vendored
Normal file
33
vendor/k8s.io/kubernetes/pkg/kubeapiserver/authorizer/modes/BUILD
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
load(
|
||||
"@io_bazel_rules_go//go:def.bzl",
|
||||
"go_library",
|
||||
"go_test",
|
||||
)
|
||||
|
||||
go_test(
|
||||
name = "go_default_test",
|
||||
srcs = ["modes_test.go"],
|
||||
embed = [":go_default_library"],
|
||||
)
|
||||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
srcs = ["modes.go"],
|
||||
importpath = "k8s.io/kubernetes/pkg/kubeapiserver/authorizer/modes",
|
||||
deps = ["//vendor/k8s.io/apimachinery/pkg/util/sets:go_default_library"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "package-srcs",
|
||||
srcs = glob(["**"]),
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:private"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "all-srcs",
|
||||
srcs = [":package-srcs"],
|
||||
tags = ["automanaged"],
|
||||
)
|
35
vendor/k8s.io/kubernetes/pkg/kubeapiserver/authorizer/modes/modes.go
generated
vendored
Normal file
35
vendor/k8s.io/kubernetes/pkg/kubeapiserver/authorizer/modes/modes.go
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
Copyright 2017 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package modes
|
||||
|
||||
import "k8s.io/apimachinery/pkg/util/sets"
|
||||
|
||||
const (
|
||||
ModeAlwaysAllow string = "AlwaysAllow"
|
||||
ModeAlwaysDeny string = "AlwaysDeny"
|
||||
ModeABAC string = "ABAC"
|
||||
ModeWebhook string = "Webhook"
|
||||
ModeRBAC string = "RBAC"
|
||||
ModeNode string = "Node"
|
||||
)
|
||||
|
||||
var AuthorizationModeChoices = []string{ModeAlwaysAllow, ModeAlwaysDeny, ModeABAC, ModeWebhook, ModeRBAC, ModeNode}
|
||||
|
||||
// IsValidAuthorizationMode returns true if the given authorization mode is a valid one for the apiserver
|
||||
func IsValidAuthorizationMode(authzMode string) bool {
|
||||
return sets.NewString(AuthorizationModeChoices...).Has(authzMode)
|
||||
}
|
45
vendor/k8s.io/kubernetes/pkg/kubeapiserver/authorizer/modes/modes_test.go
generated
vendored
Normal file
45
vendor/k8s.io/kubernetes/pkg/kubeapiserver/authorizer/modes/modes_test.go
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
Copyright 2017 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package modes
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestIsValidAuthorizationMode(t *testing.T) {
|
||||
var tests = []struct {
|
||||
authzMode string
|
||||
expected bool
|
||||
}{
|
||||
{"", false},
|
||||
{"rBAC", false}, // not supported
|
||||
{"falsy value", false}, // not supported
|
||||
{"RBAC", true}, // supported
|
||||
{"ABAC", true}, // supported
|
||||
{"Webhook", true}, // supported
|
||||
{"AlwaysAllow", true}, // supported
|
||||
{"AlwaysDeny", true}, // supported
|
||||
}
|
||||
for _, rt := range tests {
|
||||
actual := IsValidAuthorizationMode(rt.authzMode)
|
||||
if actual != rt.expected {
|
||||
t.Errorf(
|
||||
"failed ValidAuthorizationMode:\n\texpected: %t\n\t actual: %t",
|
||||
rt.expected,
|
||||
actual,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user