Skip to content

Commit f7fe3b5

Browse files
Merge pull request #19200 from liggitt/prebase
Pre-rebase fixes
2 parents f539586 + ddedeb5 commit f7fe3b5

File tree

14 files changed

+44
-53
lines changed

14 files changed

+44
-53
lines changed

contrib/completions/bash/oc

Lines changed: 0 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

contrib/completions/zsh/oc

Lines changed: 0 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

hack/lib/constants.sh

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -230,20 +230,18 @@ function os::util::list_test_packages_under() {
230230

231231
if [[ -n "${TEST_KUBE-}" ]]; then
232232
# we need to find all of the kubernetes test suites, excluding those we directly whitelisted before, the end-to-end suite, and
233-
# the go2idl tests which we currently do not support
234-
# etcd3 isn't supported yet and that test flakes upstream
235233
# cmd wasn't done before using glide and constantly flakes
236-
find -L vendor/k8s.io/{apimachinery,apiserver,client-go,kube-aggregator,kubernetes} -not \( \
234+
# the forked etcd packages are used only by the gce etcd containers
235+
find -L vendor/k8s.io/{api,apimachinery,apiserver,client-go,kube-aggregator,kubernetes} -not \( \
237236
\( \
238237
-path "${kubernetes_path}/staging" \
239238
-o -path "${kubernetes_path}/cmd" \
240239
-o -path "${kubernetes_path}/test" \
241-
-o -path "${kubernetes_path}/cmd/libs/go2idl/client-gen/testoutput/testgroup/unversioned" \
242-
-o -path "${kubernetes_path}/pkg/storage/etcd3" \
243-
-o -path "${kubernetes_path}/third_party/golang/go/build" \
240+
-o -path "${kubernetes_path}/third_party/forked/etcd*" \
244241
\) -prune \
245242
\) -name '*_test.go' | cut -f 2- -d / | xargs -n1 dirname | sort -u | xargs -n1 printf "${OS_GO_PACKAGE}/vendor/%s\n"
246243
else
244+
echo "${OS_GO_PACKAGE}/vendor/k8s.io/api/..."
247245
echo "${OS_GO_PACKAGE}/vendor/k8s.io/kubernetes/pkg/api/..."
248246
echo "${OS_GO_PACKAGE}/vendor/k8s.io/kubernetes/pkg/apis/..."
249247
fi

pkg/cmd/server/apis/config/helpers.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -472,10 +472,11 @@ func GetKubeAPIServerFlagAPIEnablement(flagValue []string) map[schema.GroupVersi
472472
versions := map[schema.GroupVersion]bool{}
473473
for _, val := range flagValue {
474474
// skip bad flags
475-
if !strings.HasPrefix(val, "apis/") {
475+
if strings.HasPrefix(val, "api/") {
476476
continue
477477
}
478-
tokens := strings.Split(val[len("apis/"):], "=")
478+
val = strings.TrimPrefix(val, "apis/")
479+
tokens := strings.Split(val, "=")
479480
if len(tokens) != 2 {
480481
continue
481482
}

pkg/cmd/server/apis/config/helpers_test.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ func TestGetKubeAPIServerFlagAPIEnablement(t *testing.T) {
1515
}{
1616
{
1717
name: "skip bad",
18-
flagValue: []string{"api/legacy=true", "apis/foobar/is/bad=true", "apis/foo/v1=true=true", "apis/good/v1=false"},
18+
flagValue: []string{"api/legacy=true", "foobar/is/bad=true", "foo/v1=true=true", "good/v1=false"},
1919
expected: map[schema.GroupVersion]bool{
2020
{Group: "good", Version: "v1"}: false,
2121
},
2222
},
2323
{
2424
name: "good",
25-
flagValue: []string{"apis/good/v2=true", "apis/good/v1=false"},
25+
flagValue: []string{"good/v2=true", "good/v1=false"},
2626
expected: map[schema.GroupVersion]bool{
2727
{Group: "good", Version: "v1"}: false,
2828
{Group: "good", Version: "v2"}: true,
@@ -51,20 +51,20 @@ func TestGetEnabledAPIVersionsForGroup(t *testing.T) {
5151
{
5252
name: "enable unknown from flag",
5353
apiGroup: "good",
54-
flagValue: []string{"apis/good/v2=true", "apis/good/v1=false"},
54+
flagValue: []string{"good/v2=true", "good/v1=false"},
5555
expected: []string{"v2"},
5656
},
5757
{
5858
name: "enable from flag, disabled by disable",
5959
apiGroup: "good",
6060
disabledAPIGroupVersions: map[string][]string{"good": {"v2"}},
61-
flagValue: []string{"apis/good/v2=true", "apis/good/v1=false"},
61+
flagValue: []string{"good/v2=true", "good/v1=false"},
6262
expected: []string{},
6363
},
6464
{
6565
name: "enable by default, disable by flag",
6666
apiGroup: "batch",
67-
flagValue: []string{"apis/batch/v1=false"},
67+
flagValue: []string{"batch/v1=false"},
6868
expected: []string{"v1beta1", "v2alpha1"},
6969
},
7070
{
@@ -75,7 +75,7 @@ func TestGetEnabledAPIVersionsForGroup(t *testing.T) {
7575
{
7676
name: "enable settings",
7777
apiGroup: "settings.k8s.io",
78-
flagValue: []string{"apis/settings.k8s.io/v1alpha1=true"},
78+
flagValue: []string{"settings.k8s.io/v1alpha1=true"},
7979
expected: []string{"v1alpha1"},
8080
},
8181
}
@@ -108,20 +108,20 @@ func TestGetDisabledAPIVersionsForGroup(t *testing.T) {
108108
{
109109
name: "enable unknown from flag",
110110
apiGroup: "good",
111-
flagValue: []string{"apis/good/v2=true", "apis/good/v1=false"},
111+
flagValue: []string{"good/v2=true", "good/v1=false"},
112112
expected: []string{"v1"},
113113
},
114114
{
115115
name: "enable from flag, disabled by disable",
116116
apiGroup: "good",
117117
disabledAPIGroupVersions: map[string][]string{"good": {"v2"}},
118-
flagValue: []string{"apis/good/v2=true", "apis/good/v1=false"},
118+
flagValue: []string{"good/v2=true", "good/v1=false"},
119119
expected: []string{"v1", "v2"},
120120
},
121121
{
122122
name: "enable by default, disable by flag",
123123
apiGroup: "batch",
124-
flagValue: []string{"apis/batch/v1=false"},
124+
flagValue: []string{"batch/v1=false"},
125125
expected: []string{"v1"},
126126
},
127127
{

pkg/cmd/server/apis/config/validation/master.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,12 @@ func ValidateAPIServerExtendedArguments(config configapi.ExtendedArguments, fldP
639639

640640
validationResults.AddErrors(ValidateExtendedArguments(config, apiserveroptions.NewServerRunOptions().AddFlags, fldPath)...)
641641

642+
for i, key := range config["runtime-config"] {
643+
if strings.HasPrefix(key, "apis/") {
644+
validationResults.AddWarnings(field.Invalid(fldPath.Key("runtime-config").Index(i), key, "remove the apis/ prefix"))
645+
}
646+
}
647+
642648
if len(config["admission-control"]) > 0 {
643649
validationResults.AddWarnings(field.Invalid(fldPath.Key("admission-control"), config["admission-control"], "specified admission ordering is being phased out. Convert to DefaultAdmissionConfig in admissionConfig.pluginConfig."))
644650
}

pkg/cmd/server/kubernetes/master/master_config.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,10 @@ func BuildKubeAPIserverOptions(masterConfig configapi.MasterConfig) (*kapiserver
176176
for k, v := range masterConfig.KubernetesMasterConfig.APIServerArguments {
177177
args[k] = v
178178
}
179+
// fixup 'apis/' prefixed args
180+
for i, key := range args["runtime-config"] {
181+
args["runtime-config"][i] = strings.TrimPrefix(key, "apis/")
182+
}
179183
if masterConfig.AuditConfig.Enabled {
180184
if existing, ok := args["feature-gates"]; ok {
181185
args["feature-gates"] = []string{existing[0] + ",AdvancedAuditing=true"}

pkg/cmd/server/kubernetes/master/master_test.go

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,18 @@ package master
22

33
import (
44
"testing"
5-
"time"
65

7-
"github.com/coreos/etcd/client"
6+
"github.com/coreos/etcd/clientv3"
87
"golang.org/x/net/context"
98
"k8s.io/apiserver/pkg/registry/generic"
109
"k8s.io/apiserver/pkg/storage/etcd/etcdtest"
1110
etcdtesting "k8s.io/apiserver/pkg/storage/etcd/testing"
12-
"k8s.io/apiserver/pkg/storage/storagebackend"
1311
"k8s.io/kubernetes/pkg/api/testapi"
1412
)
1513

1614
func TestNewMasterLeasesHasCorrectTTL(t *testing.T) {
17-
server := etcdtesting.NewUnsecuredEtcdTestClientServer(t)
18-
etcdStorage := &storagebackend.Config{
19-
Type: "etcd2",
20-
Prefix: etcdtest.PathPrefix(),
21-
ServerList: server.Client.Endpoints(),
22-
DeserializationCacheSize: etcdtest.DeserializationCacheSize,
23-
Codec: testapi.Groups[""].StorageCodec(),
24-
}
15+
server, etcdStorage := etcdtesting.NewUnsecuredEtcd3TestClientServer(t)
16+
etcdStorage.Codec = testapi.Groups[""].StorageCodec()
2517

2618
restOptions := generic.RESTOptions{StorageConfig: etcdStorage, Decorator: generic.UndecoratedStorage, DeleteCollectionWorkers: 1}
2719
storageInterface, _ := restOptions.Decorator(restOptions.StorageConfig, nil, "masterleases", nil, nil, nil, nil)
@@ -32,14 +24,21 @@ func TestNewMasterLeasesHasCorrectTTL(t *testing.T) {
3224
t.Fatalf("error updating lease: %v", err)
3325
}
3426

35-
etcdClient := server.Client
36-
keys := client.NewKeysAPI(etcdClient)
37-
resp, err := keys.Get(context.Background(), etcdtest.PathPrefix()+"/masterleases/1.2.3.4", nil)
27+
etcdClient := server.V3Client
28+
resp, err := etcdClient.Get(context.Background(), etcdtest.PathPrefix()+"/masterleases/1.2.3.4")
3829
if err != nil {
3930
t.Fatalf("error getting key: %v", err)
4031
}
41-
ttl := resp.Node.TTLDuration()
42-
if ttl > 15*time.Second || ttl < 10*time.Second {
32+
leaseID := resp.Kvs[0].Lease
33+
if leaseID == 0 {
34+
t.Fatalf("no lease found")
35+
}
36+
ttlResponse, err := etcdClient.Lease.TimeToLive(context.Background(), clientv3.LeaseID(leaseID))
37+
if err != nil {
38+
t.Fatalf("error getting lease: %v", err)
39+
}
40+
ttl := ttlResponse.GrantedTTL
41+
if ttl > 15 || ttl < 10 {
4342
t.Errorf("ttl %v should be ~ 15s", ttl)
4443
}
4544
}

pkg/cmd/server/kubernetes/node/options/options.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ func ComputeKubeletFlags(startingArgs map[string][]string, options configapi.Nod
4949

5050
setIfUnset(args, "address", kubeAddressStr)
5151
setIfUnset(args, "port", kubePortStr)
52-
setIfUnset(args, "require-kubeconfig", "true")
5352
setIfUnset(args, "kubeconfig", options.MasterKubeConfig)
5453
setIfUnset(args, "pod-manifest-path", path)
5554
setIfUnset(args, "root-dir", options.VolumeDirectory)

pkg/cmd/server/start/start_kube_controller_manager.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,6 @@ func runEmbeddedKubeControllerManager(kubeconfigFile, saPrivateKeyFile, saRootCA
8787
glog.Fatal(err)
8888
}
8989
glog.Infof("`kube-controller-manager %v`", args)
90-
cmd.Run(nil, nil)
90+
cmd.Run(cmd, nil)
9191
panic(fmt.Sprintf("`kube-controller-manager %v` exited", args))
9292
}

0 commit comments

Comments
 (0)