Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions contrib/completions/bash/oc

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 0 additions & 7 deletions contrib/completions/zsh/oc

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 4 additions & 6 deletions hack/lib/constants.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions pkg/cmd/server/apis/config/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
18 changes: 9 additions & 9 deletions pkg/cmd/server/apis/config/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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"},
},
{
Expand All @@ -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"},
},
}
Expand Down Expand Up @@ -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"},
},
{
Expand Down
6 changes: 6 additions & 0 deletions pkg/cmd/server/apis/config/validation/master.go
Original file line number Diff line number Diff line change
Expand Up @@ -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."))
}
Expand Down
4 changes: 4 additions & 0 deletions pkg/cmd/server/kubernetes/master/master_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
Expand Down
31 changes: 15 additions & 16 deletions pkg/cmd/server/kubernetes/master/master_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
}
}
1 change: 0 additions & 1 deletion pkg/cmd/server/kubernetes/node/options/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/server/start/start_kube_controller_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
2 changes: 1 addition & 1 deletion pkg/cmd/server/start/start_kube_scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
2 changes: 1 addition & 1 deletion pkg/cmd/server/start/start_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
1 change: 0 additions & 1 deletion pkg/oc/admin/migrate/migrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 0 additions & 1 deletion pkg/oc/cli/cmd/create/route.go
Original file line number Diff line number Diff line change
Expand Up @@ -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\"")

Expand Down