Ejemplo n.º 1
0
func MustParse(gitversion string) semver.Version {
	v, err := Parse(gitversion)
	if err != nil {
		glog.Fatalf("failed to parse semver from gitversion %q: %v", gitversion, err)
	}
	return v
}
Ejemplo n.º 2
0
func GetHostname(hostnameOverride string) string {
	hostname := hostnameOverride
	if string(hostname) == "" {
		nodename, err := exec.Command("uname", "-n").Output()
		if err != nil {
			glog.Fatalf("Couldn't determine hostname: %v", err)
		}
		hostname = string(nodename)
	}
	return strings.ToLower(strings.TrimSpace(hostname))
}
Ejemplo n.º 3
0
func init() {
	// Env var KUBE_API_VERSIONS is a comma separated list of API versions that
	// should be registered in the scheme.
	kubeAPIVersions := os.Getenv("KUBE_API_VERSIONS")
	if len(kubeAPIVersions) != 0 {
		for _, version := range strings.Split(kubeAPIVersions, ",") {
			gv, err := unversioned.ParseGroupVersion(version)
			if err != nil {
				glog.Fatalf("invalid api version: %s in KUBE_API_VERSIONS: %s.",
					version, os.Getenv("KUBE_API_VERSIONS"))
			}
			envRequestedVersions[gv] = struct{}{}
		}
	}
}