-
Notifications
You must be signed in to change notification settings - Fork 4.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support additional kube-scheduler config parameters via config file #8407
Changes from all commits
a9f3db6
13047db
7a01739
447b46d
b994559
ac9c368
117353c
069e74a
99c57b6
f5c8e46
1298d54
03af6b8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* | ||
Copyright 2020 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 model | ||
|
||
import ( | ||
"bytes" | ||
"testing" | ||
|
||
"k8s.io/apimachinery/pkg/api/resource" | ||
"k8s.io/kops/pkg/apis/kops" | ||
"k8s.io/kops/pkg/configbuilder" | ||
) | ||
|
||
func TestParseDefault(t *testing.T) { | ||
expect := []byte( | ||
`apiVersion: kubescheduler.config.k8s.io/v1alpha1 | ||
kind: KubeSchedulerConfiguration | ||
clientConnection: | ||
kubeconfig: /var/lib/kube-scheduler/kubeconfig | ||
`) | ||
|
||
s := &kops.KubeSchedulerConfig{} | ||
|
||
yaml, err := configbuilder.BuildConfigYaml(s, NewSchedulerConfig()) | ||
if err != nil { | ||
t.Errorf("unexpected error: %s", err) | ||
} | ||
|
||
if !bytes.Equal(yaml, expect) { | ||
t.Errorf("unexpected result: \n%s, expected: \n%s", yaml, expect) | ||
} | ||
} | ||
|
||
func TestParse(t *testing.T) { | ||
expect := []byte( | ||
`apiVersion: kubescheduler.config.k8s.io/v1alpha1 | ||
kind: KubeSchedulerConfiguration | ||
clientConnection: | ||
burst: 100 | ||
kubeconfig: /var/lib/kube-scheduler/kubeconfig | ||
qps: 3.1 | ||
`) | ||
qps, _ := resource.ParseQuantity("3.1") | ||
|
||
s := &kops.KubeSchedulerConfig{Qps: &qps, Burst: 100} | ||
|
||
yaml, err := configbuilder.BuildConfigYaml(s, NewSchedulerConfig()) | ||
if err != nil { | ||
t.Errorf("unexpected error: %s", err) | ||
} | ||
|
||
if !bytes.Equal(yaml, expect) { | ||
t.Errorf("unexpected result: \n%s, expected: \n%s", yaml, expect) | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") | ||
|
||
go_library( | ||
name = "go_default_library", | ||
srcs = ["buildconfigfile.go"], | ||
importpath = "k8s.io/kops/pkg/configbuilder", | ||
visibility = ["//visibility:public"], | ||
deps = [ | ||
"//pkg/apis/kops:go_default_library", | ||
"//util/pkg/reflectutils:go_default_library", | ||
"//vendor/gopkg.in/yaml.v2:go_default_library", | ||
"//vendor/k8s.io/apimachinery/pkg/api/resource:go_default_library", | ||
"//vendor/k8s.io/klog:go_default_library", | ||
], | ||
) | ||
|
||
go_test( | ||
name = "go_default_test", | ||
srcs = ["buildconfigfile_test.go"], | ||
embed = [":go_default_library"], | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for a followup PR: