jiebi/CodeConvo huggingface dataset:
done } <del> # Given a yaml file, add or mutate the given env variable </del> <ins> # Quote something appropriate for a yaml string. </ins> # <del> # TODO(zmerlynn): Yes, this is an O(n^2) build-up right now. If we end # up with so many environment variables feeding into Salt that this # matters, there's probably an issue... function add-to-env { ${KUBE_ROOT}/cluster/gce/kube-env.py "$1" "$2" "$3" </del> <ins> # TODO(zmerlynn): Note that this function doesn't so much "quote" as # "strip out quotes", and we really should be using a YAML library for # this, but PyYAML isn't shipped by default, and *rant rant rant ... SIGH* function yaml-quote { echo "'$(echo "${@}" | sed -e "s/'/''/g")'" </ins> } # $1: if 'true', we're building a master yaml, else a node
local file=$2 rm -f ${file} <del> add-to-env ${file} ENV_TIMESTAMP "$(date -uIs)" # Just to track it add-to-env ${file} KUBERNETES_MASTER "${master}" add-to-env ${file} INSTANCE_PREFIX "${INSTANCE_PREFIX}" add-to-env ${file} NODE_INSTANCE_PREFIX "${NODE_INSTANCE_PREFIX}" add-to-env ${file} SERVER_BINARY_TAR_URL "${SERVER_BINARY_TAR_URL}" add-to-env ${file} SALT_TAR_URL "${SALT_TAR_URL}" add-to-env ${file} PORTAL_NET "${PORTAL_NET}" add-to-env ${file} ENABLE_CLUSTER_MONITORING "${ENABLE_CLUSTER_MONITORING:-false}" add-to-env ${file} ENABLE_NODE_MONITORING "${ENABLE_NODE_MONITORING:-false}" add-to-env ${file} ENABLE_CLUSTER_LOGGING "${ENABLE_CLUSTER_LOGGING:-false}" add-to-env ${file} ENABLE_NODE_LOGGING "${ENABLE_NODE_LOGGING:-false}" add-to-env ${file} LOGGING_DESTINATION "${LOGGING_DESTINATION:-}" add-to-env ${file} ELASTICSEARCH_LOGGING_REPLICAS "${ELASTICSEARCH_LOGGING_REPLICAS:-}" add-to-env ${file} ENABLE_CLUSTER_DNS "${ENABLE_CLUSTER_DNS:-false}" add-to-env ${file} DNS_REPLICAS "${DNS_REPLICAS:-}" add-to-env ${file} DNS_SERVER_IP "${DNS_SERVER_IP:-}" add-to-env ${file} DNS_DOMAIN "${DNS_DOMAIN:-}" add-to-env ${file} MASTER_HTPASSWD "${MASTER_HTPASSWD}" </del> <ins> cat >$file <<EOF ENV_TIMESTAMP: $(yaml-quote $(date -uIs)) KUBERNETES_MASTER: $(yaml-quote ${master}) INSTANCE_PREFIX: $(yaml-quote ${INSTANCE_PREFIX}) NODE_INSTANCE_PREFIX: $(yaml-quote ${NODE_INSTANCE_PREFIX}) SERVER_BINARY_TAR_URL: $(yaml-quote ${SERVER_BINARY_TAR_URL}) SALT_TAR_URL: $(yaml-quote ${SALT_TAR_URL}) PORTAL_NET: $(yaml-quote ${PORTAL_NET}) ENABLE_CLUSTER_MONITORING: $(yaml-quote ${ENABLE_CLUSTER_MONITORING:-false}) ENABLE_NODE_MONITORING: $(yaml-quote ${ENABLE_NODE_MONITORING:-false}) ENABLE_CLUSTER_LOGGING: $(yaml-quote ${ENABLE_CLUSTER_LOGGING:-false}) ENABLE_NODE_LOGGING: $(yaml-quote ${ENABLE_NODE_LOGGING:-false}) LOGGING_DESTINATION: $(yaml-quote ${LOGGING_DESTINATION:-}) ELASTICSEARCH_LOGGING_REPLICAS: $(yaml-quote ${ELASTICSEARCH_LOGGING_REPLICAS:-}) ENABLE_CLUSTER_DNS: $(yaml-quote ${ENABLE_CLUSTER_DNS:-false}) DNS_REPLICAS: $(yaml-quote ${DNS_REPLICAS:-}) DNS_SERVER_IP: $(yaml-quote ${DNS_SERVER_IP:-}) DNS_DOMAIN: $(yaml-quote ${DNS_DOMAIN:-}) MASTER_HTPASSWD: $(yaml-quote ${MASTER_HTPASSWD}) EOF </ins> if [[ "${master}" != "true" ]]; then <del> add-to-env ${file} KUBERNETES_MASTER_NAME "${MASTER_NAME}" add-to-env ${file} ZONE "${ZONE}" add-to-env ${file} EXTRA_DOCKER_OPTS "${EXTRA_DOCKER_OPTS}" add-to-env ${file} ENABLE_DOCKER_REGISTRY_CACHE "${ENABLE_DOCKER_REGISTRY_CACHE:-false}" </del> <ins> cat >>$file <<EOF KUBERNETES_MASTER_NAME: $(yaml-quote ${MASTER_NAME}) ZONE: $(yaml-quote ${ZONE}) EXTRA_DOCKER_OPTS: $(yaml-quote ${EXTRA_DOCKER_OPTS}) ENABLE_DOCKER_REGISTRY_CACHE: $(yaml-quote ${ENABLE_DOCKER_REGISTRY_CACHE:-false}) EOF </ins> fi }
}) AfterEach(func() { <del> // Remove any remaining pods from this test DeleteRC(c, ns, RCName) </del> <ins> // Remove any remaining pods from this test if the // replication controller still exists and the replica count // isn't 0.  This means the controller wasn't cleaned up // during the test so clean it up here rc, err := c.ReplicationControllers(ns).Get(RCName) if err == nil && rc.Spec.Replicas != 0 { DeleteRC(c, ns, RCName) } </ins> }) It("should allow starting 100 pods per node", func() {
if [[ ${GOOS} == "windows" ]]; then bin="${bin}.exe" fi <del> CGO_ENABLED=0 go build -installsuffix cgo -o "${output_path}/${bin}"  </del> <ins> go build -o "${output_path}/${bin}"  </ins> "${goflags[@]:+${goflags[@]}}"  -ldflags "${version_ldflags}"  "${binary}" done else <del> CGO_ENABLED=0 go install -installsuffix cgo "${goflags[@]:+${goflags[@]}}"  </del> <ins> go install "${goflags[@]:+${goflags[@]}}"  </ins> -ldflags "${version_ldflags}"  "${binaries[@]}" fi
Long:    create_long, Example: create_example, Run: func(cmd *cobra.Command, args []string) { <del> err := RunCreate(f, out, cmd, filenames) cmdutil.CheckErr(err) </del> <ins> cmdutil.CheckErr(ValidateArgs(cmd, args)) cmdutil.CheckErr(RunCreate(f, out, cmd, filenames)) </ins> }, } cmd.Flags().VarP(&filenames, "filename", "f", "Filename, directory, or URL to file to use to create the resource") return cmd } <ins> func ValidateArgs(cmd *cobra.Command, args []string) error { if len(args) != 0 { return cmdutil.UsageError(cmd, "Unexpected args: %v", args) } return nil } </ins> func RunCreate(f *Factory, out io.Writer, cmd *cobra.Command, filenames util.StringList) error { schema, err := f.Validator() if err != nil {
"testing" "github.com/GoogleCloudPlatform/kubernetes/pkg/client" <ins> "github.com/GoogleCloudPlatform/kubernetes/pkg/kubectl/cmd" </ins> ) <ins> func TestExtraArgsFail(t *testing.T) { buf := bytes.NewBuffer([]byte{}) f, _, _ := NewAPIFactory() c := f.NewCmdCreate(buf) if cmd.ValidateArgs(c, []string{"rc"}) == nil { t.Errorf("unexpected non-error") } } </ins> func TestCreateObject(t *testing.T) { _, _, rc := testData() rc.Items[0].Name = "redis-master-controller"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api" "github.com/GoogleCloudPlatform/kubernetes/pkg/api/resource" "github.com/GoogleCloudPlatform/kubernetes/pkg/client" <ins> "github.com/GoogleCloudPlatform/kubernetes/pkg/fieldpath" </ins> "github.com/GoogleCloudPlatform/kubernetes/pkg/fields" "github.com/GoogleCloudPlatform/kubernetes/pkg/labels" "github.com/GoogleCloudPlatform/kubernetes/pkg/types"
fmt.Fprintf(out, "    Ready:t%vn", printBool(status.Ready)) fmt.Fprintf(out, "    Restart Count:t%dn", status.RestartCount) <ins> fmt.Fprintf(out, "    Variables:n") for _, e := range container.Env { if e.ValueFrom != nil && e.ValueFrom.FieldRef != nil { valueFrom := envValueFrom(pod, e) fmt.Fprintf(out, "      %s:t%s (%s:%s)n", e.Name, valueFrom, e.ValueFrom.FieldRef.APIVersion, e.ValueFrom.FieldRef.FieldPath) } else { fmt.Fprintf(out, "      %s:t%sn", e.Name, e.Value) } } </ins> } } <ins> func envValueFrom(pod *api.Pod, e api.EnvVar) string { internalFieldPath, _, err := api.Scheme.ConvertFieldLabel(e.ValueFrom.FieldRef.APIVersion, "Pod", e.ValueFrom.FieldRef.FieldPath, "") if err != nil { return "" // pod validation should catch this on create } valueFrom, err := fieldpath.ExtractFieldPathAsString(pod, internalFieldPath) if err != nil { return "" // pod validation should catch this on create } return valueFrom } </ins> func printBool(value bool) string { if value { return "True"
}, expectedElements: []string{"test", "State", "Waiting", "Ready", "True", "Restart Count", "7", "Image", "image"}, }, <ins> //env { container: api.Container{Name: "test", Image: "image", Env: []api.EnvVar{{Name: "envname", Value: "xyz"}}}, status: api.ContainerStatus{ Name:         "test", Ready:        true, RestartCount: 7, }, expectedElements: []string{"test", "State", "Waiting", "Ready", "True", "Restart Count", "7", "Image", "image", "envname", "xyz"}, }, </ins> // Using limits. { container: api.Container{
set -e <ins> #clean all init/init.d/configs function do_backup_clean() { #backup all config files init_files=`ls init_conf` for i in $init_files do if [ -f /etc/init/$i ] then mv /etc/init/${i} /etc/init/${i}.bak fi done initd_files=`ls initd_scripts` for i in $initd_files do if [ -f /etc/init.d/$i ] then mv /etc/init.d/${i} /etc/init.d/${i}.bak fi done default_files=`ls default_scripts` for i in $default_files do if [ -e /etc/default/$i ] then mv /etc/default/${i} /etc/default/${i}.bak fi done # clean work dir if [ ! -d ./work ] then mkdir work fi cp -rf default_scripts init_conf initd_scripts work } </ins> function cpMaster(){ # copy /etc/init files <del> cp init_conf/etcd.conf /etc/init/ cp init_conf/kube-apiserver.conf /etc/init/ cp init_conf/kube-controller-manager.conf /etc/init/ cp init_conf/kube-scheduler.conf /etc/init/ </del> <ins> cp work/init_conf/etcd.conf /etc/init/ cp work/init_conf/kube-apiserver.conf /etc/init/ cp work/init_conf/kube-controller-manager.conf /etc/init/ cp work/init_conf/kube-scheduler.conf /etc/init/ </ins> # copy /etc/initd/ files <del> cp initd_scripts/etcd /etc/init.d/ cp initd_scripts/kube-apiserver /etc/init.d/ cp initd_scripts/kube-controller-manager /etc/init.d/ cp initd_scripts/kube-scheduler /etc/init.d/ </del> <ins> cp work/initd_scripts/etcd /etc/init.d/ cp work/initd_scripts/kube-apiserver /etc/init.d/ cp work/initd_scripts/kube-controller-manager /etc/init.d/ cp work/initd_scripts/kube-scheduler /etc/init.d/ </ins> # copy default configs <del> cp default_scripts/etcd /etc/default/ cp default_scripts/kube-apiserver /etc/default/ cp default_scripts/kube-scheduler /etc/default/ cp default_scripts/kube-controller-manager /etc/default/ </del> <ins> cp work/default_scripts/etcd /etc/default/ cp work/default_scripts/kube-apiserver /etc/default/ cp work/default_scripts/kube-scheduler /etc/default/ cp work/default_scripts/kube-controller-manager /etc/default/ </ins> } function cpMinion(){ # copy /etc/init files <del> cp init_conf/etcd.conf /etc/init/ cp init_conf/kubelet.conf /etc/init/ cp init_conf/flanneld.conf /etc/init/ cp init_conf/kube-proxy.conf /etc/init/ </del> <ins> cp work/init_conf/etcd.conf /etc/init/etcd.conf cp work/init_conf/kubelet.conf /etc/init/kubelet.conf cp work/init_conf/flanneld.conf /etc/init/flanneld.conf cp work/init_conf/kube-proxy.conf /etc/init/ </ins> # copy /etc/initd/ files <del> cp initd_scripts/etcd /etc/init.d/ cp initd_scripts/flanneld /etc/init.d/ cp initd_scripts/kubelet /etc/init.d/ cp initd_scripts/kube-proxy /etc/init.d/ </del> <ins> cp work/initd_scripts/etcd /etc/init.d/ cp work/initd_scripts/flanneld /etc/init.d/ cp work/initd_scripts/kubelet /etc/init.d/ cp work/initd_scripts/kube-proxy /etc/init.d/ </ins> # copy default configs <del> cp default_scripts/etcd /etc/default/ cp default_scripts/flanneld /etc/default/ cp default_scripts/kube-proxy /etc/default cp default_scripts/kubelet /etc/default/ </del> <ins> cp work/default_scripts/etcd /etc/default/ cp work/default_scripts/flanneld /etc/default/ cp work/default_scripts/kube-proxy /etc/default cp work/default_scripts/kubelet /etc/default/ </ins> } # check if input IP in machine list
# set values in ETCD_OPTS function configEtcd(){ <del> echo ETCD_OPTS="-name $1 -initial-advertise-peer-urls http://$2:2380 -listen-peer-urls http://$2:2380 -initial-cluster-token etcd-cluster-1 -initial-cluster $3 -initial-cluster-state new" > default_scripts/etcd </del> <ins> echo ETCD_OPTS="-name $1 -initial-advertise-peer-urls http://$2:2380 -listen-peer-urls http://$2:2380 -initial-cluster-token etcd-cluster-1 -initial-cluster $3 -initial-cluster-state new" > work/default_scripts/etcd </ins> } # check root
inList $etcdName $myIP configEtcd $etcdName $myIP $cluster # For minion set MINION IP in default_scripts/kubelet <del> sed -i "s/MY_IP/${myIP}/g" default_scripts/kubelet sed -i "s/MASTER_IP/${masterIP}/g" default_scripts/kubelet sed -i "s/MASTER_IP/${masterIP}/g" default_scripts/kube-proxy </del> <ins> sed -i "s/MY_IP/${myIP}/g" work/default_scripts/kubelet sed -i "s/MASTER_IP/${masterIP}/g" work/default_scripts/kubelet sed -i "s/MASTER_IP/${masterIP}/g" work/default_scripts/kube-proxy </ins> # For master set MINION IPs in kube-controller-manager <del> if [ -z "$minionIPs" ]; then </del> <ins> if [ -z "$minionIPs" ]; then </ins> #one node act as both minion and master role minionIPs="$myIP" else minionIPs="$minionIPs,$myIP" fi <del> sed -i "s/MINION_IPS/${minionIPs}/g" default_scripts/kube-controller-manager </del> <ins> sed -i "s/MINION_IPS/${minionIPs}/g" work/default_scripts/kube-controller-manager </ins> cpMaster cpMinion
inList $etcdName $myIP configEtcd $etcdName $myIP $cluster # set MINION IPs in kube-controller-manager <del> sed -i "s/MINION_IPS/${minionIPs}/g" default_scripts/kube-controller-manager </del> <ins> sed -i "s/MINION_IPS/${minionIPs}/g" work/default_scripts/kube-controller-manager </ins> cpMaster break ;;
inList $etcdName $myIP configEtcd $etcdName $myIP $cluster # set MINION IP in default_scripts/kubelet <del> sed -i "s/MY_IP/${myIP}/g" default_scripts/kubelet sed -i "s/MASTER_IP/${masterIP}/g" default_scripts/kubelet sed -i "s/MASTER_IP/${masterIP}/g" default_scripts/kube-proxy </del> <ins> sed -i "s/MY_IP/${myIP}/g" work/default_scripts/kubelet sed -i "s/MASTER_IP/${masterIP}/g" work/default_scripts/kubelet sed -i "s/MASTER_IP/${masterIP}/g" work/default_scripts/kube-proxy </ins> cpMinion break ;;
# Find all of the built client binaries local platform platforms platforms=($(cd "${LOCAL_OUTPUT_BINPATH}" ; echo */*)) <del> for platform in "${platforms[@]}"; do </del> <ins> for platform in "${platforms[@]}" ; do </ins> local platform_tag=${platform///-} # Replace a "/" for a "-" <del> kube::log::status "Starting tarball: client $platform_tag" </del> <ins> kube::log::status "Building tarball: client $platform_tag" </ins> <del> ( local release_stage="${RELEASE_STAGE}/client/${platform_tag}/kubernetes" rm -rf "${release_stage}" mkdir -p "${release_stage}/client/bin" </del> <ins> local release_stage="${RELEASE_STAGE}/client/${platform_tag}/kubernetes" rm -rf "${release_stage}" mkdir -p "${release_stage}/client/bin" </ins> <del> local client_bins=("${KUBE_CLIENT_BINARIES[@]}") if [[ "${platform%/*}" == "windows" ]]; then client_bins=("${KUBE_CLIENT_BINARIES_WIN[@]}") fi </del> <ins> local client_bins=("${KUBE_CLIENT_BINARIES[@]}") if [[ "${platform%/*}" == "windows" ]]; then client_bins=("${KUBE_CLIENT_BINARIES_WIN[@]}") fi </ins> <del> # This fancy expression will expand to prepend a path # (${LOCAL_OUTPUT_BINPATH}/${platform}/) to every item in the # KUBE_CLIENT_BINARIES array. cp "${client_bins[@]/#/${LOCAL_OUTPUT_BINPATH}/${platform}/}"  "${release_stage}/client/bin/" </del> <ins> # This fancy expression will expand to prepend a path # (${LOCAL_OUTPUT_BINPATH}/${platform}/) to every item in the # KUBE_CLIENT_BINARIES array. cp "${client_bins[@]/#/${LOCAL_OUTPUT_BINPATH}/${platform}/}"  "${release_stage}/client/bin/" </ins> <del> kube::release::clean_cruft </del> <ins> kube::release::clean_cruft </ins> <del> local package_name="${RELEASE_DIR}/kubernetes-client-${platform_tag}.tar.gz" kube::release::create_tarball "${package_name}" "${release_stage}/.." ) & </del> <ins> local package_name="${RELEASE_DIR}/kubernetes-client-${platform_tag}.tar.gz" kube::release::create_tarball "${package_name}" "${release_stage}/.." </ins> done <del> kube::log::status "Waiting on tarballs" wait || { kube::log::error "client tarball creation failed"; exit 1; } </del> } # Package up all of the server binaries
if [[ "${TRAVIS:-}" != "true" ]]; then local go_version go_version=($(go version)) <del> if [[ "${go_version[2]}" < "go1.6" ]]; then </del> <ins> if [[ "${go_version[2]}" < "go1.6" && "${go_version[2]}" != "devel" ]]; then </ins> kube::log::usage_from_stdin <<EOF Detected go version: ${go_version[*]}. Kubernetes requires go version 1.6 or greater.
return nil, err } if len(addrs) > 0 { <del> // This interface should suffice. break </del> <ins> for _, addr := range addrs { if addrIP, _, err := net.ParseCIDR(addr.String()); err == nil { if addrIP.To4() != nil { ip = addrIP.To4() break } } } if ip != nil { // This interface should suffice. break } </ins> } } } <del> if i == len(intfs) { return nil, err </del> <ins> if ip == nil { return nil, fmt.Errorf("no acceptable interface from host") </ins> } glog.V(4).Infof("Choosing interface %s for from-host portals", intfs[i].Name) <del> addrs, err := intfs[i].Addrs() if err != nil { return nil, err } glog.V(4).Infof("Interface %s = %s", intfs[i].Name, addrs[0].String()) ip, _, err := net.ParseCIDR(addrs[0].String()) if err != nil { return nil, err } </del> return ip, nil }
``` ### NFS <del> Kubernetes NFS volumes allow an existing NFS share to be made available to containers within a pod. </del> <ins> Kubernetes NFS volumes allow an existing NFS share to be made available to containers within a pod. </ins> <del> [The NFS Pod example](https://github.com/GoogleCloudPlatform/kubernetes/blob/master/examples/nfs/test.yaml) demonstrates how to specify the usage of an NFS volume within a pod. In this example one can see that a volumeMount called "myshare" is being mounted onto /var/www/html/mount-test in the container "testpd". The volume "myshare" is defined as type nfs, with the NFS server serving from 172.17.0.2 and exporting directory /tmp as the share. The mount being created in this example is not read only. </del> <ins> See the [NFS Pod examples](https://github.com/GoogleCloudPlatform/kubernetes/blob/master/examples/nfs/) section for more details. For example, [nfs-web-pod.yaml](https://github.com/GoogleCloudPlatform/kubernetes/blob/master/examples/nfs/nfs-web-pod.yaml) demonstrates how to specify the usage of an NFS volume within a pod. In this example one can see that a `volumeMount` called "nfs" is being mounted onto `/var/www/html` in the container "web". The volume "nfs" is defined as type `nfs`, with the NFS server serving from `nfs-server.default.kube.local` and exporting directory `/` as the share. The mount being created in this example is not read only. </ins>
### SEE ALSO * [kubectl](kubectl.md)	 - kubectl controls the Kubernetes cluster manager <del> ###### Auto generated by spf13/cobra at 2015-05-28 22:43:52.329286408 +0000 UTC </del> <ins> ###### Auto generated by spf13/cobra at 2015-05-29 22:39:51.164275749 +0000 UTC </ins> [![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/kubectl_get.md?pixel)]()
-s "http://127.0.0.1:${API_PORT}" --match-server-version ) <del> [ "$(kubectl get minions -t '{{ .apiVersion }}' "${kube_flags[@]}")" == "v1beta3" ] </del> <ins> [ "$(kubectl get nodes -t '{{ .apiVersion }}' "${kube_flags[@]}")" == "v1beta3" ] </ins> else kube_flags=( -s "http://127.0.0.1:${API_PORT}" --match-server-version --api-version="${version}" ) <del> [ "$(kubectl get minions -t '{{ .apiVersion }}' "${kube_flags[@]}")" == "${version}" ] </del> <ins> [ "$(kubectl get nodes -t '{{ .apiVersion }}' "${kube_flags[@]}")" == "${version}" ] </ins> fi id_field=".metadata.name" labels_field=".metadata.labels"
########### <del> # Minions # </del> <ins> # Nodes # </ins> ########### if [[ "${version}" = "v1beta1" ]] || [[ "${version}" = "v1beta2" ]]; then <del> kube::log::status "Testing kubectl(${version}:minions)" </del> <ins> kube::log::status "Testing kubectl(${version}:nodes)" </ins> <del> kube::test::get_object_assert minions "{{range.items}}{{$id_field}}:{{end}}" '127.0.0.1:' </del> <ins> kube::test::get_object_assert nodes "{{range.items}}{{$id_field}}:{{end}}" '127.0.0.1:' </ins> <del> # TODO: I should be a MinionList instead of List kube::test::get_object_assert minions '{{.kind}}' 'List' </del> <ins> kube::test::get_object_assert nodes '{{.kind}}' 'List' </ins> <del> kube::test::describe_object_assert minions "127.0.0.1" "Name:" "Conditions:" "Addresses:" "Capacity:" "Pods:" </del> <ins> kube::test::describe_object_assert nodes "127.0.0.1" "Name:" "Conditions:" "Addresses:" "Capacity:" "Pods:" </ins> fi
Possible resources include pods (po), replication controllers (rc), services (svc), nodes, events (ev), component statuses (cs), limit ranges (limits), <del> minions (mi), persistent volumes (pv), persistent volume claims (pvc) </del> <ins> nodes (no), persistent volumes (pv), persistent volume claims (pvc) </ins> or resource quotas (quota). By specifying the output as 'template' and providing a Go template as the value
// mapper. func (e ShortcutExpander) VersionAndKindForResource(resource string) (defaultVersion, kind string, err error) { resource = expandResourceShortcut(resource) <del> return e.RESTMapper.VersionAndKindForResource(resource) </del> <ins> defaultVersion, kind, err = e.RESTMapper.VersionAndKindForResource(resource) // TODO: remove this once v1beta1 and v1beta2 are deprecated if err == nil && kind == "Minion" { err = fmt.Errorf("Alias minion(s) is deprecated. Use node(s) instead") } return defaultVersion, kind, err </ins> } // expandResourceShortcut will return the expanded version of resource
// implementation of the error interface func (f *FitError) Error() string { <del> output := fmt.Sprintf("failed to find fit for pod: %v", f.Pod) </del> <ins> output := fmt.Sprintf("failed to find fit for pod, ") </ins> for node, predicateList := range f.FailedPredicates { output = output + fmt.Sprintf("Node %s: %s", node, strings.Join(predicateList.List(), ",")) }
- `kubectl config set-cluster $CLUSTER_NAME --server=http://$MASTER_IP --insecure-skip-tls-verify=true` - Otherwise, do this to set the apiserver ip, client certs, and user credentials. - `kubectl config set-cluster $CLUSTER_NAME --certificate-authority=$CA_CERT --embed-certs=true --server=https://$MASTER_IP` <del> - `kubectl config set-credentials $CLUSTER_NAME --client-certificate=$CLI_CERT --client-key=$CLI_KEY --embed-certs=true --token=$TOKEN` </del> <ins> - `kubectl config set-credentials $USER --client-certificate=$CLI_CERT --client-key=$CLI_KEY --embed-certs=true --token=$TOKEN` </ins> - Set your cluster as the default cluster to use: <del> - `kubectl config set-context $CLUSTER_NAME --cluster=$CLUSTER_NAME --user=admin` - `kubectl config use-context $CONTEXT  --cluster=$CONTEXT` </del> <ins> - `kubectl config set-context $CONTEXT_NAME --cluster=$CLUSTER_NAME --user=$USER` - `kubectl config use-context $CONTEXT_NAME` </ins> Next, make a kubeconfig file for the kubelets and kube-proxy.  There are a couple of options for how many distinct files to make:
continue } <ins> instance, err := s.getInstanceById(instanceID) if err != nil { return nil, err } instanceName := orEmpty(instance.PrivateDNSName) </ins> routeName := clusterName + "-" + destinationCIDR <del> routes = append(routes, &cloudprovider.Route{routeName, instanceID, destinationCIDR}) </del> <ins> routes = append(routes, &cloudprovider.Route{routeName, instanceName, destinationCIDR}) </ins> } return routes, nil
for _, volumeKindDir := range volumeKindDirs { volumeKind := volumeKindDir.Name() volumeKindPath := path.Join(podVolDir, volumeKind) <del> volumeNameDirs, err := ioutil.ReadDir(volumeKindPath) </del> <ins> // ioutil.ReadDir exits without returning any healthy dir when encountering the first lstat error // but skipping dirs means no cleanup for healthy volumes. switching to a no-exit api solves this problem volumeNameDirs, volumeNameDirsStat, err := util.ReadDirNoExit(volumeKindPath) </ins> if err != nil { return []*volumeTuple{}, fmt.Errorf("could not read directory %s: %v", volumeKindPath, err) } <del> for _, volumeNameDir := range volumeNameDirs { volumes = append(volumes, &volumeTuple{Kind: volumeKind, Name: volumeNameDir.Name()}) </del> <ins> for i, volumeNameDir := range volumeNameDirs { if volumeNameDir != nil { volumes = append(volumes, &volumeTuple{Kind: volumeKind, Name: volumeNameDir.Name()}) } else { lerr := volumeNameDirsStat[i] glog.Errorf("Could not read directory %s: %v", podVolDir, lerr) } </ins> } } return volumes, nil
} return true, nil } <ins> // borrowed from ioutil.ReadDir // ReadDir reads the directory named by dirname and returns // a list of directory entries, minus those with lstat errors func ReadDirNoExit(dirname string) ([]os.FileInfo, []error, error) { if dirname == "" { dirname = "." } f, err := os.Open(dirname) if err != nil { return nil, nil, err } defer f.Close() names, err := f.Readdirnames(-1) list := make([]os.FileInfo, 0, len(names)) errs := make([]error, 0, len(names)) for _, filename := range names { fip, lerr := os.Lstat(dirname + "/" + filename) if os.IsNotExist(lerr) { // File disappeared between readdir + stat. // Just treat it as if it didn't exist. continue } list = append(list, fip) errs = append(errs, lerr) } return list, errs, nil } </ins>