Document broken behaviour with KUBE_API_VERSIONS

This commit is contained in:
Dr. Stefan Schimanski 2016-12-13 09:22:48 +01:00
parent 543417dbf0
commit e57ef4327f

View File

@ -25,6 +25,7 @@ import (
"net" "net"
"net/http" "net/http"
"net/url" "net/url"
"os"
"strconv" "strconv"
"strings" "strings"
"time" "time"
@ -246,7 +247,15 @@ func Run(s *options.ServerRunOptions) error {
} }
client, err := internalclientset.NewForConfig(selfClientConfig) client, err := internalclientset.NewForConfig(selfClientConfig)
if err != nil { if err != nil {
return fmt.Errorf("failed to create clientset: %v", err) kubeAPIVersions := os.Getenv("KUBE_API_VERSIONS")
if len(kubeAPIVersions) == 0 {
return fmt.Errorf("failed to create clientset: %v", err)
}
// KUBE_API_VERSIONS is used in test-update-storage-objects.sh, disabling a number of API
// groups. This leads to a nil client above and undefined behaviour further down.
// TODO: get rid of KUBE_API_VERSIONS or define sane behaviour if set
glog.Errorf("Failed to create clientset with KUBE_API_VERSIONS=%q. KUBE_API_VERSIONS is only for testing. Things will break.", kubeAPIVersions)
} }
sharedInformers := informers.NewSharedInformerFactory(nil, client, 10*time.Minute) sharedInformers := informers.NewSharedInformerFactory(nil, client, 10*time.Minute)