From 197059b65df85619118da64e5db916b0f6555bb4 Mon Sep 17 00:00:00 2001 From: Jeff Lowdermilk Date: Tue, 10 Feb 2015 10:25:07 -0800 Subject: [PATCH] Remove kubecfg, cleanup a few stray references. --- build/common.sh | 3 +- cluster/kubecfg.sh | 109 ----- cmd/kubecfg/kubecfg.go | 529 --------------------- contrib/completions/bash/kubecfg | 199 -------- docs/getting-started-guides/aws/kubectl.md | 4 +- docs/getting-started-guides/vagrant.md | 2 +- hack/lib/golang.sh | 1 - pkg/kubecfg/doc.go | 20 - pkg/kubecfg/kubecfg.go | 329 ------------- pkg/kubecfg/kubecfg_test.go | 393 --------------- pkg/kubecfg/parse.go | 61 --- pkg/kubecfg/parse_test.go | 157 ------ pkg/kubecfg/proxy_server.go | 81 ---- pkg/kubecfg/proxy_server_test.go | 106 ----- pkg/kubecfg/resource_printer.go | 460 ------------------ pkg/kubecfg/resource_printer_test.go | 313 ------------ pkg/kubecfg/validate.go | 51 -- 17 files changed, 4 insertions(+), 2814 deletions(-) delete mode 100755 cluster/kubecfg.sh delete mode 100644 cmd/kubecfg/kubecfg.go delete mode 100644 contrib/completions/bash/kubecfg delete mode 100644 pkg/kubecfg/doc.go delete mode 100644 pkg/kubecfg/kubecfg.go delete mode 100644 pkg/kubecfg/kubecfg_test.go delete mode 100644 pkg/kubecfg/parse.go delete mode 100644 pkg/kubecfg/parse_test.go delete mode 100644 pkg/kubecfg/proxy_server.go delete mode 100644 pkg/kubecfg/proxy_server_test.go delete mode 100644 pkg/kubecfg/resource_printer.go delete mode 100644 pkg/kubecfg/resource_printer_test.go delete mode 100644 pkg/kubecfg/validate.go diff --git a/build/common.sh b/build/common.sh index c815481672..817cbfc9f4 100644 --- a/build/common.sh +++ b/build/common.sh @@ -478,7 +478,6 @@ function kube::release::package_tarballs() { # Clean out any old releases rm -rf "${RELEASE_DIR}" mkdir -p "${RELEASE_DIR}" - kube::release::package_client_tarballs kube::release::package_server_tarballs kube::release::package_salt_tarball @@ -489,7 +488,7 @@ function kube::release::package_tarballs() { # Package up all of the cross compiled clients. Over time this should grow into # a full SDK function kube::release::package_client_tarballs() { - # Find all of the built kubecfg binaries + # Find all of the built client binaries local platform platforms platforms=($(cd "${LOCAL_OUTPUT_BINPATH}" ; echo */*)) for platform in "${platforms[@]}" ; do diff --git a/cluster/kubecfg.sh b/cluster/kubecfg.sh deleted file mode 100755 index 8d11022b94..0000000000 --- a/cluster/kubecfg.sh +++ /dev/null @@ -1,109 +0,0 @@ -#!/bin/bash - -# Copyright 2014 Google Inc. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -o errexit -set -o nounset -set -o pipefail - -KUBE_ROOT=$(dirname "${BASH_SOURCE}")/.. -source "${KUBE_ROOT}/cluster/kube-env.sh" -source "${KUBE_ROOT}/cluster/${KUBERNETES_PROVIDER}/util.sh" - -# Detect the OS name/arch so that we can find our binary -case "$(uname -s)" in - Darwin) - host_os=darwin - ;; - Linux) - host_os=linux - ;; - *) - echo "Unsupported host OS. Must be Linux or Mac OS X." >&2 - exit 1 - ;; -esac - -case "$(uname -m)" in - x86_64*) - host_arch=amd64 - ;; - i?86_64*) - host_arch=amd64 - ;; - amd64*) - host_arch=amd64 - ;; - arm*) - host_arch=arm - ;; - i?86*) - host_arch=x86 - ;; - *) - echo "Unsupported host arch. Must be x86_64, 386 or arm." >&2 - exit 1 - ;; -esac - -# Gather up the list of likely places and use ls to find the latest one. -locations=( - "${KUBE_ROOT}/_output/dockerized/bin/${host_os}/${host_arch}/kubecfg" - "${KUBE_ROOT}/_output/local/bin/${host_os}/${host_arch}/kubecfg" - "${KUBE_ROOT}/platforms/${host_os}/${host_arch}/kubecfg" -) -kubecfg=$( (ls -t "${locations[@]}" 2>/dev/null || true) | head -1 ) - -if [[ ! -x "$kubecfg" ]]; then - { - echo "It looks as if you don't have a compiled kubecfg binary." - echo - echo "If you are running from a clone of the git repo, please run" - echo "'./build/run.sh hack/build-cross.sh'. Note that this requires having" - echo "Docker installed." - echo - echo "If you are running from a binary release tarball, something is wrong. " - echo "Look at http://kubernetes.io/ for information on how to contact the " - echo "development team for help." - } >&2 - exit 1 -fi - -# When we are using vagrant it has hard coded auth. We repeat that here so that -# we don't clobber auth that might be used for a publicly facing cluster. -if [[ "$KUBERNETES_PROVIDER" == "vagrant" ]]; then - auth_config=( - "-auth" "$HOME/.kubernetes_vagrant_auth" - ) -elif [[ "${KUBERNETES_PROVIDER}" == "gke" ]]; then - # While KUBECFG calls remain, we manually pass the auth and cert info. - detect-project &> /dev/null - cluster_config_dir="${GCLOUD_CONFIG_DIR}/${PROJECT}.${ZONE}.${CLUSTER_NAME}" - auth_config=( - "-certificate_authority=${cluster_config_dir}/ca.crt" - "-client_certificate=${cluster_config_dir}/kubecfg.crt" - "-client_key=${cluster_config_dir}/kubecfg.key" - "-auth=${cluster_config_dir}/kubernetes_auth" - ) -else - auth_config=() -fi - -detect-master > /dev/null -if [[ -n "${KUBE_MASTER_IP-}" && -z "${KUBERNETES_MASTER-}" ]]; then - export KUBERNETES_MASTER=https://${KUBE_MASTER_IP} -fi - -"${kubecfg}" "${auth_config[@]:+${auth_config[@]}}" "${@}" diff --git a/cmd/kubecfg/kubecfg.go b/cmd/kubecfg/kubecfg.go deleted file mode 100644 index 1bfb1c521a..0000000000 --- a/cmd/kubecfg/kubecfg.go +++ /dev/null @@ -1,529 +0,0 @@ -/* -Copyright 2014 Google Inc. All rights reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package main - -import ( - "flag" - "fmt" - "io/ioutil" - "net/http" - "os" - "reflect" - "sort" - "strconv" - "strings" - "time" - - "github.com/GoogleCloudPlatform/kubernetes/pkg/api" - "github.com/GoogleCloudPlatform/kubernetes/pkg/api/latest" - "github.com/GoogleCloudPlatform/kubernetes/pkg/api/meta" - "github.com/GoogleCloudPlatform/kubernetes/pkg/client" - "github.com/GoogleCloudPlatform/kubernetes/pkg/kubecfg" - "github.com/GoogleCloudPlatform/kubernetes/pkg/runtime" - "github.com/GoogleCloudPlatform/kubernetes/pkg/util" - "github.com/GoogleCloudPlatform/kubernetes/pkg/version" - "github.com/GoogleCloudPlatform/kubernetes/pkg/version/verflag" - - "github.com/golang/glog" - "github.com/skratchdot/open-golang/open" -) - -var ( - serverVersion = verflag.Version("server_version", verflag.VersionFalse, "Print the server's version information and quit") - preventSkew = flag.Bool("expect_version_match", false, "Fail if server's version doesn't match own version.") - config = flag.String("c", "", "Path or URL to the config file, or '-' to read from STDIN") - selector = flag.String("l", "", "Selector (label query) to use for listing") - fieldSelector = flag.String("fields", "", "Selector (field query) to use for listing") - updatePeriod = flag.Duration("u", 60*time.Second, "Update interval period") - portSpec = flag.String("p", "", "The port spec, comma-separated list of :,...") - servicePort = flag.Int("s", -1, "If positive, create and run a corresponding service on this port, only used with 'run'") - authConfig = flag.String("auth", os.Getenv("HOME")+"/.kubernetes_auth", "Path to the auth info file. If missing, prompt the user. Only used if doing https.") - json = flag.Bool("json", false, "If true, print raw JSON for responses") - yaml = flag.Bool("yaml", false, "If true, print raw YAML for responses") - verbose = flag.Bool("verbose", false, "If true, print extra information") - validate = flag.Bool("validate", false, "If true, try to validate the passed in object using a swagger schema on the api server") - proxy = flag.Bool("proxy", false, "If true, run a proxy to the api server") - www = flag.String("www", "", "If -proxy is true, use this directory to serve static files") - templateFile = flag.String("template_file", "", "If present, load this file as a golang template and use it for output printing") - templateStr = flag.String("template", "", "If present, parse this string as a golang template and use it for output printing") - imageName = flag.String("image", "", "Image used when updating a replicationController. Will apply to the first container in the pod template.") - clientConfig = &client.Config{} - openBrowser = flag.Bool("open_browser", true, "If true, and -proxy is specified, open a browser pointed at the Kubernetes UX. Default true.") - ns = flag.String("ns", "", "If present, the namespace scope for this request.") - nsFile = flag.String("ns_file", os.Getenv("HOME")+"/.kubernetes_ns", "Path to the namespace file") -) - -func init() { - flag.StringVar(&clientConfig.Host, "h", "", "The host to connect to.") - flag.StringVar(&clientConfig.Version, "api_version", latest.Version, "The version of the API to use against this server.") - flag.StringVar(&clientConfig.CAFile, "certificate_authority", "", "Path to a cert. file for the certificate authority") - flag.StringVar(&clientConfig.CertFile, "client_certificate", "", "Path to a client certificate for TLS.") - flag.StringVar(&clientConfig.KeyFile, "client_key", "", "Path to a client key file for TLS.") - flag.BoolVar(&clientConfig.Insecure, "insecure_skip_tls_verify", clientConfig.Insecure, "If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.") -} - -var parser = kubecfg.NewParser(map[string]runtime.Object{ - "pods": &api.Pod{}, - "services": &api.Service{}, - "replicationControllers": &api.ReplicationController{}, - "minions": &api.Node{}, - "nodes": &api.Node{}, - "events": &api.Event{}, -}) - -func usage() { - fmt.Fprintf(os.Stderr, `Usage: kubecfg -h [-c config/file.json|url|-] - -Kubernetes REST API: - - kubecfg [OPTIONS] get|list|create|delete|update <%s>[/] - -Manage replication controllers: - - kubecfg [OPTIONS] stop|rm - kubecfg [OPTIONS] [-u