diff --git a/contrib/completions/bash/oc b/contrib/completions/bash/oc index e97386cf7260..8a3fcab3351e 100644 --- a/contrib/completions/bash/oc +++ b/contrib/completions/bash/oc @@ -4576,8 +4576,6 @@ _oc_adm_migrate_image-references() flags+=("--vmodule=") must_have_one_flag=() - must_have_one_flag+=("--filename=") - must_have_one_flag+=("-f") must_have_one_noun=() noun_aliases=() } @@ -4661,8 +4659,6 @@ _oc_adm_migrate_legacy-hpa() flags+=("--vmodule=") must_have_one_flag=() - must_have_one_flag+=("--filename=") - must_have_one_flag+=("-f") must_have_one_noun=() noun_aliases=() } @@ -4746,8 +4742,6 @@ _oc_adm_migrate_storage() flags+=("--vmodule=") must_have_one_flag=() - must_have_one_flag+=("--filename=") - must_have_one_flag+=("-f") must_have_one_noun=() noun_aliases=() } @@ -11368,7 +11362,6 @@ _oc_create_route_reencrypt() flags+=("--vmodule=") must_have_one_flag=() - must_have_one_flag+=("--dest-ca-cert=") must_have_one_flag+=("--service=") must_have_one_noun=() noun_aliases=() diff --git a/contrib/completions/zsh/oc b/contrib/completions/zsh/oc index 6a6d3547ca8c..a052cee5e386 100644 --- a/contrib/completions/zsh/oc +++ b/contrib/completions/zsh/oc @@ -4718,8 +4718,6 @@ _oc_adm_migrate_image-references() flags+=("--vmodule=") must_have_one_flag=() - must_have_one_flag+=("--filename=") - must_have_one_flag+=("-f") must_have_one_noun=() noun_aliases=() } @@ -4803,8 +4801,6 @@ _oc_adm_migrate_legacy-hpa() flags+=("--vmodule=") must_have_one_flag=() - must_have_one_flag+=("--filename=") - must_have_one_flag+=("-f") must_have_one_noun=() noun_aliases=() } @@ -4888,8 +4884,6 @@ _oc_adm_migrate_storage() flags+=("--vmodule=") must_have_one_flag=() - must_have_one_flag+=("--filename=") - must_have_one_flag+=("-f") must_have_one_noun=() noun_aliases=() } @@ -11510,7 +11504,6 @@ _oc_create_route_reencrypt() flags+=("--vmodule=") must_have_one_flag=() - must_have_one_flag+=("--dest-ca-cert=") must_have_one_flag+=("--service=") must_have_one_noun=() noun_aliases=() diff --git a/hack/lib/constants.sh b/hack/lib/constants.sh index 5597b7adcb7e..9538cd7302aa 100755 --- a/hack/lib/constants.sh +++ b/hack/lib/constants.sh @@ -230,20 +230,18 @@ function os::util::list_test_packages_under() { if [[ -n "${TEST_KUBE-}" ]]; then # we need to find all of the kubernetes test suites, excluding those we directly whitelisted before, the end-to-end suite, and - # the go2idl tests which we currently do not support - # etcd3 isn't supported yet and that test flakes upstream # cmd wasn't done before using glide and constantly flakes - find -L vendor/k8s.io/{apimachinery,apiserver,client-go,kube-aggregator,kubernetes} -not \( \ + # the forked etcd packages are used only by the gce etcd containers + find -L vendor/k8s.io/{api,apimachinery,apiserver,client-go,kube-aggregator,kubernetes} -not \( \ \( \ -path "${kubernetes_path}/staging" \ -o -path "${kubernetes_path}/cmd" \ -o -path "${kubernetes_path}/test" \ - -o -path "${kubernetes_path}/cmd/libs/go2idl/client-gen/testoutput/testgroup/unversioned" \ - -o -path "${kubernetes_path}/pkg/storage/etcd3" \ - -o -path "${kubernetes_path}/third_party/golang/go/build" \ + -o -path "${kubernetes_path}/third_party/forked/etcd*" \ \) -prune \ \) -name '*_test.go' | cut -f 2- -d / | xargs -n1 dirname | sort -u | xargs -n1 printf "${OS_GO_PACKAGE}/vendor/%s\n" else + echo "${OS_GO_PACKAGE}/vendor/k8s.io/api/..." echo "${OS_GO_PACKAGE}/vendor/k8s.io/kubernetes/pkg/api/..." echo "${OS_GO_PACKAGE}/vendor/k8s.io/kubernetes/pkg/apis/..." fi diff --git a/pkg/cmd/server/apis/config/helpers.go b/pkg/cmd/server/apis/config/helpers.go index 8465efb4b8af..fb2dc5b03f23 100644 --- a/pkg/cmd/server/apis/config/helpers.go +++ b/pkg/cmd/server/apis/config/helpers.go @@ -475,10 +475,11 @@ func GetKubeAPIServerFlagAPIEnablement(flagValue []string) map[schema.GroupVersi versions := map[schema.GroupVersion]bool{} for _, val := range flagValue { // skip bad flags - if !strings.HasPrefix(val, "apis/") { + if strings.HasPrefix(val, "api/") { continue } - tokens := strings.Split(val[len("apis/"):], "=") + val = strings.TrimPrefix(val, "apis/") + tokens := strings.Split(val, "=") if len(tokens) != 2 { continue } diff --git a/pkg/cmd/server/apis/config/helpers_test.go b/pkg/cmd/server/apis/config/helpers_test.go index 75e0554c1c53..837f69fd651c 100644 --- a/pkg/cmd/server/apis/config/helpers_test.go +++ b/pkg/cmd/server/apis/config/helpers_test.go @@ -15,14 +15,14 @@ func TestGetKubeAPIServerFlagAPIEnablement(t *testing.T) { }{ { name: "skip bad", - flagValue: []string{"api/legacy=true", "apis/foobar/is/bad=true", "apis/foo/v1=true=true", "apis/good/v1=false"}, + flagValue: []string{"api/legacy=true", "foobar/is/bad=true", "foo/v1=true=true", "good/v1=false"}, expected: map[schema.GroupVersion]bool{ {Group: "good", Version: "v1"}: false, }, }, { name: "good", - flagValue: []string{"apis/good/v2=true", "apis/good/v1=false"}, + flagValue: []string{"good/v2=true", "good/v1=false"}, expected: map[schema.GroupVersion]bool{ {Group: "good", Version: "v1"}: false, {Group: "good", Version: "v2"}: true, @@ -51,20 +51,20 @@ func TestGetEnabledAPIVersionsForGroup(t *testing.T) { { name: "enable unknown from flag", apiGroup: "good", - flagValue: []string{"apis/good/v2=true", "apis/good/v1=false"}, + flagValue: []string{"good/v2=true", "good/v1=false"}, expected: []string{"v2"}, }, { name: "enable from flag, disabled by disable", apiGroup: "good", disabledAPIGroupVersions: map[string][]string{"good": {"v2"}}, - flagValue: []string{"apis/good/v2=true", "apis/good/v1=false"}, + flagValue: []string{"good/v2=true", "good/v1=false"}, expected: []string{}, }, { name: "enable by default, disable by flag", apiGroup: "batch", - flagValue: []string{"apis/batch/v1=false"}, + flagValue: []string{"batch/v1=false"}, expected: []string{"v1beta1", "v2alpha1"}, }, { @@ -75,7 +75,7 @@ func TestGetEnabledAPIVersionsForGroup(t *testing.T) { { name: "enable settings", apiGroup: "settings.k8s.io", - flagValue: []string{"apis/settings.k8s.io/v1alpha1=true"}, + flagValue: []string{"settings.k8s.io/v1alpha1=true"}, expected: []string{"v1alpha1"}, }, } @@ -108,20 +108,20 @@ func TestGetDisabledAPIVersionsForGroup(t *testing.T) { { name: "enable unknown from flag", apiGroup: "good", - flagValue: []string{"apis/good/v2=true", "apis/good/v1=false"}, + flagValue: []string{"good/v2=true", "good/v1=false"}, expected: []string{"v1"}, }, { name: "enable from flag, disabled by disable", apiGroup: "good", disabledAPIGroupVersions: map[string][]string{"good": {"v2"}}, - flagValue: []string{"apis/good/v2=true", "apis/good/v1=false"}, + flagValue: []string{"good/v2=true", "good/v1=false"}, expected: []string{"v1", "v2"}, }, { name: "enable by default, disable by flag", apiGroup: "batch", - flagValue: []string{"apis/batch/v1=false"}, + flagValue: []string{"batch/v1=false"}, expected: []string{"v1"}, }, { diff --git a/pkg/cmd/server/apis/config/validation/master.go b/pkg/cmd/server/apis/config/validation/master.go index eaa50195c6f7..5fd09c62facb 100644 --- a/pkg/cmd/server/apis/config/validation/master.go +++ b/pkg/cmd/server/apis/config/validation/master.go @@ -652,6 +652,12 @@ func ValidateAPIServerExtendedArguments(config configapi.ExtendedArguments, fldP validationResults.AddErrors(ValidateExtendedArguments(config, apiserveroptions.NewServerRunOptions().AddFlags, fldPath)...) + for i, key := range config["runtime-config"] { + if strings.HasPrefix(key, "apis/") { + validationResults.AddWarnings(field.Invalid(fldPath.Key("runtime-config").Index(i), key, "remove the apis/ prefix")) + } + } + if len(config["admission-control"]) > 0 { validationResults.AddWarnings(field.Invalid(fldPath.Key("admission-control"), config["admission-control"], "specified admission ordering is being phased out. Convert to DefaultAdmissionConfig in admissionConfig.pluginConfig.")) } diff --git a/pkg/cmd/server/kubernetes/master/master_config.go b/pkg/cmd/server/kubernetes/master/master_config.go index 7991efaa33ee..c551f5e3628b 100644 --- a/pkg/cmd/server/kubernetes/master/master_config.go +++ b/pkg/cmd/server/kubernetes/master/master_config.go @@ -176,6 +176,10 @@ func BuildKubeAPIserverOptions(masterConfig configapi.MasterConfig) (*kapiserver for k, v := range masterConfig.KubernetesMasterConfig.APIServerArguments { args[k] = v } + // fixup 'apis/' prefixed args + for i, key := range args["runtime-config"] { + args["runtime-config"][i] = strings.TrimPrefix(key, "apis/") + } if masterConfig.AuditConfig.Enabled { if existing, ok := args["feature-gates"]; ok { args["feature-gates"] = []string{existing[0] + ",AdvancedAuditing=true"} diff --git a/pkg/cmd/server/kubernetes/master/master_test.go b/pkg/cmd/server/kubernetes/master/master_test.go index 17eeda5c94f6..2e4a5e98a0cf 100644 --- a/pkg/cmd/server/kubernetes/master/master_test.go +++ b/pkg/cmd/server/kubernetes/master/master_test.go @@ -2,26 +2,18 @@ package master import ( "testing" - "time" - "github.com/coreos/etcd/client" + "github.com/coreos/etcd/clientv3" "golang.org/x/net/context" "k8s.io/apiserver/pkg/registry/generic" "k8s.io/apiserver/pkg/storage/etcd/etcdtest" etcdtesting "k8s.io/apiserver/pkg/storage/etcd/testing" - "k8s.io/apiserver/pkg/storage/storagebackend" "k8s.io/kubernetes/pkg/api/testapi" ) func TestNewMasterLeasesHasCorrectTTL(t *testing.T) { - server := etcdtesting.NewUnsecuredEtcdTestClientServer(t) - etcdStorage := &storagebackend.Config{ - Type: "etcd2", - Prefix: etcdtest.PathPrefix(), - ServerList: server.Client.Endpoints(), - DeserializationCacheSize: etcdtest.DeserializationCacheSize, - Codec: testapi.Groups[""].StorageCodec(), - } + server, etcdStorage := etcdtesting.NewUnsecuredEtcd3TestClientServer(t) + etcdStorage.Codec = testapi.Groups[""].StorageCodec() restOptions := generic.RESTOptions{StorageConfig: etcdStorage, Decorator: generic.UndecoratedStorage, DeleteCollectionWorkers: 1} storageInterface, _ := restOptions.Decorator(restOptions.StorageConfig, nil, "masterleases", nil, nil, nil, nil) @@ -32,14 +24,21 @@ func TestNewMasterLeasesHasCorrectTTL(t *testing.T) { t.Fatalf("error updating lease: %v", err) } - etcdClient := server.Client - keys := client.NewKeysAPI(etcdClient) - resp, err := keys.Get(context.Background(), etcdtest.PathPrefix()+"/masterleases/1.2.3.4", nil) + etcdClient := server.V3Client + resp, err := etcdClient.Get(context.Background(), etcdtest.PathPrefix()+"/masterleases/1.2.3.4") if err != nil { t.Fatalf("error getting key: %v", err) } - ttl := resp.Node.TTLDuration() - if ttl > 15*time.Second || ttl < 10*time.Second { + leaseID := resp.Kvs[0].Lease + if leaseID == 0 { + t.Fatalf("no lease found") + } + ttlResponse, err := etcdClient.Lease.TimeToLive(context.Background(), clientv3.LeaseID(leaseID)) + if err != nil { + t.Fatalf("error getting lease: %v", err) + } + ttl := ttlResponse.GrantedTTL + if ttl > 15 || ttl < 10 { t.Errorf("ttl %v should be ~ 15s", ttl) } } diff --git a/pkg/cmd/server/kubernetes/node/options/options.go b/pkg/cmd/server/kubernetes/node/options/options.go index e371f7be1ecc..619e343c4327 100644 --- a/pkg/cmd/server/kubernetes/node/options/options.go +++ b/pkg/cmd/server/kubernetes/node/options/options.go @@ -49,7 +49,6 @@ func ComputeKubeletFlags(startingArgs map[string][]string, options configapi.Nod setIfUnset(args, "address", kubeAddressStr) setIfUnset(args, "port", kubePortStr) - setIfUnset(args, "require-kubeconfig", "true") setIfUnset(args, "kubeconfig", options.MasterKubeConfig) setIfUnset(args, "pod-manifest-path", path) setIfUnset(args, "root-dir", options.VolumeDirectory) diff --git a/pkg/cmd/server/start/start_kube_controller_manager.go b/pkg/cmd/server/start/start_kube_controller_manager.go index fd7a9039c832..84033f5c3bcf 100644 --- a/pkg/cmd/server/start/start_kube_controller_manager.go +++ b/pkg/cmd/server/start/start_kube_controller_manager.go @@ -87,6 +87,6 @@ func runEmbeddedKubeControllerManager(kubeconfigFile, saPrivateKeyFile, saRootCA glog.Fatal(err) } glog.Infof("`kube-controller-manager %v`", args) - cmd.Run(nil, nil) + cmd.Run(cmd, nil) panic(fmt.Sprintf("`kube-controller-manager %v` exited", args)) } diff --git a/pkg/cmd/server/start/start_kube_scheduler.go b/pkg/cmd/server/start/start_kube_scheduler.go index 4f7fd874cf5c..a340baac00e8 100644 --- a/pkg/cmd/server/start/start_kube_scheduler.go +++ b/pkg/cmd/server/start/start_kube_scheduler.go @@ -60,7 +60,7 @@ func runEmbeddedScheduler(kubeconfigFile, schedulerConfigFile string, qps float3 glog.Fatal(err) } glog.Infof("`kube-scheduler %v`", args) - cmd.Run(nil, nil) + cmd.Run(cmd, nil) glog.Fatalf("`kube-scheduler %v` exited", args) time.Sleep(10 * time.Second) } diff --git a/pkg/cmd/server/start/start_node.go b/pkg/cmd/server/start/start_node.go index 763ffff2bfd9..a78b72f8385f 100644 --- a/pkg/cmd/server/start/start_node.go +++ b/pkg/cmd/server/start/start_node.go @@ -534,6 +534,6 @@ func runKubeletInProcess(kubeletArgs []string) error { return err } glog.Infof("kubelet %v", kubeletArgs) - cmd.Run(nil, nil) + cmd.Run(cmd, kubeletArgs) return nil } diff --git a/pkg/oc/admin/migrate/migrator.go b/pkg/oc/admin/migrate/migrator.go index 0f6ad0317acf..82cd9be78cb6 100644 --- a/pkg/oc/admin/migrate/migrator.go +++ b/pkg/oc/admin/migrate/migrator.go @@ -95,7 +95,6 @@ func (o *ResourceOptions) Bind(c *cobra.Command) { usage := "Filename, directory, or URL to docker-compose.yml file to use" kubectl.AddJsonFilenameFlag(c, &o.Filenames, usage) - c.MarkFlagRequired("filename") } func (o *ResourceOptions) Complete(f *clientcmd.Factory, c *cobra.Command) error { diff --git a/pkg/oc/cli/cmd/create/route.go b/pkg/oc/cli/cmd/create/route.go index c4bf12d465b5..cfde0584b282 100644 --- a/pkg/oc/cli/cmd/create/route.go +++ b/pkg/oc/cli/cmd/create/route.go @@ -331,7 +331,6 @@ func NewCmdCreateReencryptRoute(fullName string, f *clientcmd.Factory, out io.Wr cmd.Flags().String("ca-cert", "", "Path to a CA certificate file.") cmd.MarkFlagFilename("ca-cert") cmd.Flags().String("dest-ca-cert", "", "Path to a CA certificate file, used for securing the connection from the router to the destination.") - cmd.MarkFlagRequired("dest-ca-cert") cmd.MarkFlagFilename("dest-ca-cert") cmd.Flags().String("wildcard-policy", "", "Sets the WildcardPolicy for the hostname, the default is \"None\". valid values are \"None\" and \"Subdomain\"")