mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 03:11:40 +00:00
apiextensions: make integration test server flags available to test code
This commit is contained in:
parent
74e62b9a77
commit
0cafec6608
@ -31,7 +31,7 @@ import (
|
||||
)
|
||||
|
||||
// StartDefaultServer starts a test server.
|
||||
func StartDefaultServer(t servertesting.Logger) (func(), *rest.Config, *options.CustomResourceDefinitionsServerOptions, error) {
|
||||
func StartDefaultServer(t servertesting.Logger, flags ...string) (func(), *rest.Config, *options.CustomResourceDefinitionsServerOptions, error) {
|
||||
// create kubeconfig which will not actually be used. But authz/authn needs it to startup.
|
||||
fakeKubeConfig, err := ioutil.TempFile("", "kubeconfig")
|
||||
fakeKubeConfig.WriteString(`
|
||||
@ -55,15 +55,16 @@ users:
|
||||
`)
|
||||
fakeKubeConfig.Close()
|
||||
|
||||
s, err := servertesting.StartTestServer(t, nil, []string{
|
||||
s, err := servertesting.StartTestServer(t, nil, append([]string{
|
||||
"--etcd-prefix", uuid.New(),
|
||||
"--etcd-servers", strings.Join(IntegrationEtcdServers(), ","),
|
||||
"--authentication-skip-lookup",
|
||||
"--authentication-kubeconfig", fakeKubeConfig.Name(),
|
||||
"--authorization-kubeconfig", fakeKubeConfig.Name(),
|
||||
"--kubeconfig", fakeKubeConfig.Name(),
|
||||
"--disable-admission-plugins", "NamespaceLifecycle,MutatingAdmissionWebhook,ValidatingAdmissionWebhook",
|
||||
}, nil)
|
||||
"--disable-admission-plugins", "NamespaceLifecycle,MutatingAdmissionWebhook,ValidatingAdmissionWebhook"},
|
||||
flags...,
|
||||
), nil)
|
||||
if err != nil {
|
||||
os.Remove(fakeKubeConfig.Name())
|
||||
return nil, nil, nil, err
|
||||
@ -78,8 +79,8 @@ users:
|
||||
}
|
||||
|
||||
// StartDefaultServerWithClients starts a test server and returns clients for it.
|
||||
func StartDefaultServerWithClients(t servertesting.Logger) (func(), clientset.Interface, dynamic.Interface, error) {
|
||||
tearDown, config, _, err := StartDefaultServer(t)
|
||||
func StartDefaultServerWithClients(t servertesting.Logger, extraFlags ...string) (func(), clientset.Interface, dynamic.Interface, error) {
|
||||
tearDown, config, _, err := StartDefaultServer(t, extraFlags...)
|
||||
if err != nil {
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user