jiebi/CodeConvo huggingface dataset:
} func TestSyncCreateTimeout(t *testing.T) { <ins> testOver := make(chan struct{}) defer close(testOver) </ins> storage := SimpleRESTStorage{ injectedFunction: func(obj interface{}) (interface{}, error) { <del> time.Sleep(5 * time.Millisecond) </del> <ins> // Eliminate flakes by ensuring the create operation takes longer than this test. <-testOver </ins> return obj, nil }, }
} func TestOpGet(t *testing.T) { <del> simpleStorage := &SimpleRESTStorage{} </del> <ins> testOver := make(chan struct{}) defer close(testOver) simpleStorage := &SimpleRESTStorage{ injectedFunction: func(obj interface{}) (interface{}, error) { // Eliminate flakes by ensuring the create operation takes longer than this test. <-testOver return obj, nil }, } </ins> handler := New(map[string]RESTStorage{ "foo": simpleStorage, }, codec, "/prefix/version")
for _, service := range services { activeServices.Insert(service.ID) info, exists := proxier.getServiceInfo(service.ID) <del> if exists && info.port == service.Port { </del> <ins> if exists && info.active && info.port == service.Port { </ins> continue } <del> if exists { </del> <ins> if exists && info.port != service.Port { </ins> proxier.StopProxy(service.ID) } glog.Infof("Adding a new service %s on port %d", service.ID, service.Port)
} } <ins> func TestProxyUpdateDeleteUpdate(t *testing.T) { lb := NewLoadBalancerRR() lb.OnUpdate([]api.Endpoints{{JSONBase: api.JSONBase{ID: "echo"}, Endpoints: []string{net.JoinHostPort("127.0.0.1", port)}}}) p := NewProxier(lb) proxyPort, err := p.addServiceOnUnusedPort("echo") if err != nil { t.Fatalf("error adding new service: %#v", err) } conn, err := net.Dial("tcp", net.JoinHostPort("127.0.0.1", proxyPort)) if err != nil { t.Fatalf("error connecting to proxy: %v", err) } conn.Close() p.OnUpdate([]api.Service{}) if err := waitForClosedPort(p, proxyPort); err != nil { t.Fatalf(err.Error()) } proxyPortNum, _ := strconv.Atoi(proxyPort) p.OnUpdate([]api.Service{ {JSONBase: api.JSONBase{ID: "echo"}, Port: proxyPortNum}, }) testEchoConnection(t, "127.0.0.1", proxyPort) } </ins> func TestProxyUpdatePort(t *testing.T) { lb := NewLoadBalancerRR() lb.OnUpdate([]api.Endpoints{{JSONBase: api.JSONBase{ID: "echo"}, Endpoints: []string{net.JoinHostPort("127.0.0.1", port)}}})
} testEchoConnection(t, "127.0.0.1", newPort) } <ins> func TestProxyUpdatePortLetsGoOfOldPort(t *testing.T) { lb := NewLoadBalancerRR() lb.OnUpdate([]api.Endpoints{{JSONBase: api.JSONBase{ID: "echo"}, Endpoints: []string{net.JoinHostPort("127.0.0.1", port)}}}) p := NewProxier(lb) proxyPort, err := p.addServiceOnUnusedPort("echo") if err != nil { t.Fatalf("error adding new service: %#v", err) } // add a new dummy listener in order to get a port that is free l, _ := net.Listen("tcp", ":0") _, newPort, _ := net.SplitHostPort(l.Addr().String()) portNum, _ := strconv.Atoi(newPort) l.Close() // Wait for the socket to actually get free. if err := waitForClosedPort(p, newPort); err != nil { t.Fatalf(err.Error()) } if proxyPort == newPort { t.Errorf("expected difference, got %s %s", newPort, proxyPort) } p.OnUpdate([]api.Service{ {JSONBase: api.JSONBase{ID: "echo"}, Port: portNum}, }) if err := waitForClosedPort(p, proxyPort); err != nil { t.Fatalf(err.Error()) } testEchoConnection(t, "127.0.0.1", newPort) proxyPortNum, _ := strconv.Atoi(proxyPort) p.OnUpdate([]api.Service{ {JSONBase: api.JSONBase{ID: "echo"}, Port: proxyPortNum}, }) if err := waitForClosedPort(p, newPort); err != nil { t.Fatalf(err.Error()) } testEchoConnection(t, "127.0.0.1", proxyPort) } </ins>
trap "teardown" EXIT <del> POD_ID_LIST=$($CLOUDCFG -json -l name=myNginx list pods | jq ".items[].id") </del> <ins> POD_ID_LIST=$($CLOUDCFG '-template={{range.Items}}{{.ID}} {{end}}' -l name=myNginx list pods) </ins> # Container turn up on a clean cluster can take a while for the docker image pull. ALL_RUNNING=0 while [ $ALL_RUNNING -ne 1 ]; do
sleep 5 ALL_RUNNING=1 for id in $POD_ID_LIST; do <del> CURRENT_STATUS=$(remove-quotes $($CLOUDCFG -json get "pods/$(remove-quotes ${id})" | jq '.currentState.info["mynginx"].State.Running and .currentState.info["net"].State.Running')) </del> <ins> CURRENT_STATUS=$($CLOUDCFG -template '{{and .CurrentState.Info.mynginx.State.Running .CurrentState.Info.net.State.Running}}' get pods/$id) </ins> if [ "$CURRENT_STATUS" != "true" ]; then ALL_RUNNING=0 fi
$CLOUDCFG delete services/redismaster $CLOUDCFG delete pods/redis-master-2 <del> POD_LIST_2=$($CLOUDCFG -json list pods | jq ".items[].id") </del> <ins> POD_LIST_2=$($CLOUDCFG '-template={{range.Items}}{{.ID}} {{end}}' list pods) </ins> echo "Pods running after shutdown: ${POD_LIST_2}" exit 0
<ins> #!/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. # Launches an nginx container and verifies it can be reached. Assumes that # we're being called by hack/e2e-test.sh (we use some env vars it sets up). # Exit on error set -e source "${KUBE_REPO_ROOT}/cluster/kube-env.sh" source "${KUBE_REPO_ROOT}/cluster/$KUBERNETES_PROVIDER/util.sh" function validate() { POD_ID_LIST=$($CLOUDCFG '-template={{range.Items}}{{.ID}} {{end}}' -l name=$controller list pods) # Container turn up on a clean cluster can take a while for the docker image pull. ALL_RUNNING=0 while [ $ALL_RUNNING -ne 1 ]; do echo "Waiting for all containers in pod to come up." sleep 5 ALL_RUNNING=1 for id in $POD_ID_LIST; do CURRENT_STATUS=$($CLOUDCFG -template '{{and .CurrentState.Info.datacontroller.State.Running .CurrentState.Info.net.State.Running}}' get pods/$id) if [ "$CURRENT_STATUS" != "true" ]; then ALL_RUNNING=0 fi done done ids=($POD_ID_LIST) if [ ${#ids[@]} -ne $1 ]; then echo "Unexpected number of pods: ${#ids[@]}" exit 1 fi } controller=dataController # Launch a container $CLOUDCFG -p 8080:80 run brendanburns/data 2 $controller function teardown() { echo "Cleaning up test artifacts" $CLOUDCFG stop $controller $CLOUDCFG rm $controller } trap "teardown" EXIT validate 2 $CLOUDCFG resize $controller 1 validate 1 $CLOUDCFG resize $controller 2 validate 2 # TODO: test rolling update here, but to do so, we need to make the update blocking # $CLOUDCFG -u=20s rollingupdate $controller # # Wait for the replica controller to recreate # sleep 10 # # validate 2 exit 0 </ins>
LEAVE_UP=${2:-0} TEAR_DOWN=${3:-0} <del> HAVE_JQ=$(which jq) if [[ -z ${HAVE_JQ} ]]; then echo "Please install jq, e.g.: 'sudo apt-get install jq' or, " echo "'sudo yum install jq' or, " echo "if you're on a mac with homebrew, 'brew install jq'." exit 1 fi </del> # Exit on error set -e
for (( i=0; i <${NUM_MINIONS}; i++)) do KUBE_MINION_IP_ADDRESSES[$i]="${MINION_IP_BASE}$[$i+2]" MINION_NAMES[$i]="${MINION_IP_BASE}$[$i+2]" <del> done </del>  No newline at end of file <ins> VAGRANT_MINION_NAMES[$i]="minion-$[$i+1]" done </ins>
source $(dirname ${BASH_SOURCE})/${KUBE_CONFIG_FILE-"config-default.sh"} function detect-master () { <del> echo "KUBE_MASTER_IP: $KUBE_MASTER_IP" echo "KUBE_MASTER: $KUBE_MASTER" </del> <ins> echo "KUBE_MASTER_IP: $KUBE_MASTER_IP" echo "KUBE_MASTER: $KUBE_MASTER" </ins> } # Get minion IP addresses and store in KUBE_MINION_IP_ADDRESSES[] function detect-minions { <del> echo "Minions already detected" </del> <ins> echo "Minions already detected" </ins> } # Verify prereqs on host machine
} # Instantiate a kubernetes cluster <del> function kube-up { vagrant up </del> <ins> function kube-up { get-password vagrant up echo "Each machine instance has been created." echo "  Now waiting for the Salt provisioning process to complete on each machine." echo "  This can take some time based on your network, disk, and cpu speed." echo "  It is possible for an error to occur during Salt provision of cluster and this could loop forever." # verify master has all required daemons echo "Validating master" MACHINE="master" REQUIRED_DAEMON=("salt-master" "salt-minion" "apiserver" "nginx" "controller-manager" "scheduler") VALIDATED="1" until [ "$VALIDATED" -eq "0" ]; do VALIDATED="0" for daemon in ${REQUIRED_DAEMON[@]}; do vagrant ssh $MACHINE -c "which $daemon" >/dev/null 2>&1 || { printf "."; VALIDATED="1"; sleep 2; } done done # verify each minion has all required daemons for (( i=0; i<${#MINION_NAMES[@]}; i++)); do echo "Validating ${VAGRANT_MINION_NAMES[$i]}" MACHINE=${VAGRANT_MINION_NAMES[$i]} REQUIRED_DAEMON=("salt-minion" "kubelet" "docker") VALIDATED="1" until [ "$VALIDATED" -eq "0" ]; do VALIDATED="0" for daemon in ${REQUIRED_DAEMON[@]}; do vagrant ssh $MACHINE -c "which $daemon" >/dev/null 2>&1 || { printf "."; VALIDATED="1"; sleep 2; } done done done echo echo "Waiting for each minion to be registered with cloud provider" for (( i=0; i<${#MINION_NAMES[@]}; i++)); do COUNT="0" until [ "$COUNT" -eq "1" ]; do $(dirname $0)/kubecfg.sh -template '{{range.Items}}{{.ID}}:{{end}}' list minions > /tmp/minions COUNT=$(grep -c ${MINION_NAMES[i]} /tmp/minions) || { printf "."; sleep 2; COUNT="0"; } done done echo echo "Kubernetes cluster created." echo echo "Kubernetes cluster is running.  Access the master at:" echo echo "  https://${user}:${passwd}@${KUBE_MASTER_IP}" </ins> } # Delete a kubernetes cluster function kube-down { <del> vagrant destroy -f </del> <ins> vagrant destroy -f </ins> } # Update a kubernetes cluster with latest source function kube-push { <del> vagrant provision </del> <ins> vagrant provision </ins> } # Execute prior to running tests to build a release if required for env function test-build-release { <del> echo "Vagrant provider can skip release build" </del> <ins> echo "Vagrant provider can skip release build" </ins> } # Execute prior to running tests to initialize required structure function test-setup { <del> echo "Vagrant test setup complete" </del> <ins> echo "Vagrant test setup complete" </ins> } # Execute after running tests to perform any required clean-up function test-teardown { <del> echo "Vagrant ignores tear-down" </del> <ins> echo "Vagrant ignores tear-down" </ins> } # Set the {user} and {password} environment values required to interact with provider function get-password { <del> export user=vagrant export passwd=vagrant echo "Using credentials: $user:$passwd" </del> <ins> export user=vagrant export passwd=vagrant echo "Using credentials: $user:$passwd" </ins> }
expectedList: []HostPriority{{"machine1", 0}, {"machine2", 0}}, test:         "no resources requested", pods: []api.Pod{ <del> {CurrentState: machine1State, Labels: labels2}, {CurrentState: machine1State, Labels: labels1}, {CurrentState: machine2State, Labels: labels1}, {CurrentState: machine2State, Labels: labels1}, </del> <ins> {DesiredState: machine1State, Labels: labels2}, {DesiredState: machine1State, Labels: labels1}, {DesiredState: machine2State, Labels: labels1}, {DesiredState: machine2State, Labels: labels1}, </ins> }, }, {
expectedList: []HostPriority{{"machine1", 37 /* int(75% / 2) */}, {"machine2", 62 /* int( 75% + 50% / 2) */}}, test:         "no resources requested", pods: []api.Pod{ <del> {DesiredState: cpuOnly, CurrentState: machine1State}, {DesiredState: cpuAndMemory, CurrentState: machine2State}, </del> <ins> {DesiredState: cpuOnly}, {DesiredState: cpuAndMemory}, </ins> }, }, {
expectedList: []HostPriority{{"machine1", 0}, {"machine2", 0}}, test:         "zero minion resources", pods: []api.Pod{ <del> {DesiredState: cpuOnly, CurrentState: machine1State}, {DesiredState: cpuAndMemory, CurrentState: machine2State}, </del> <ins> {DesiredState: cpuOnly}, {DesiredState: cpuAndMemory}, </ins> }, }, }
// Log is intended to be called once at the end of your request handler, via defer func (rl *respLogger) Log() { latency := time.Since(rl.startTime) <del> glog.V(2).Infof("%s %s: (%v) %v%v%v", rl.req.Method, rl.req.RequestURI, latency, rl.status, rl.statusStack, rl.addedInfo) </del> <ins> if glog.V(2) { glog.InfoDepth(1, fmt.Sprintf("%s %s: (%v) %v%v%v", rl.req.Method, rl.req.RequestURI, latency, rl.status, rl.statusStack, rl.addedInfo)) } </ins> } // Header implements http.ResponseWriter.
echo "    echo 'Waiting for metadata MINION_IP_RANGE...'" echo "    sleep 3" echo "done" <ins> echo "" echo "# Remove docker artifacts on minion nodes" echo "iptables -t nat -F" echo "ifconfig docker0 down" echo "brctl delbr docker0" echo "" </ins> echo "EXTRA_DOCKER_OPTS='${EXTRA_DOCKER_OPTS}'" echo "ENABLE_DOCKER_REGISTRY_CACHE='${ENABLE_DOCKER_REGISTRY_CACHE:-false}'" grep -v "^#" "${KUBE_ROOT}/cluster/gce/templates/common.sh"
return readDockerConfigFileFromBytes(contents) } <ins> // HttpError wraps a non-StatusOK error code as an error. type HttpError struct { StatusCode int Url        string } // Error implements error func (he *HttpError) Error() string { return fmt.Sprintf("http status code: %d while fetching url %s", he.StatusCode, he.Url) } </ins> func ReadUrl(url string, client *http.Client, header *http.Header) (body []byte, err error) { req, err := http.NewRequest("GET", url, nil) if err != nil { <del> glog.Errorf("while creating request to read %s: %v", url, err) </del> return nil, err } if header != nil {
} resp, err := client.Do(req) if err != nil { <del> glog.Errorf("while trying to read %s: %v", url, err) </del> return nil, err } defer resp.Body.Close() if resp.StatusCode != http.StatusOK { <del> err := fmt.Errorf("http status code: %d while fetching url %s", resp.StatusCode, url) glog.Errorf("while trying to read %s: %v", url, err) </del> glog.V(2).Infof("body of failing http response: %v", resp.Body) <del> return nil, err </del> <ins> return nil, &HttpError{ StatusCode: resp.StatusCode, Url:        url, } </ins> } contents, err := ioutil.ReadAll(resp.Body) if err != nil { <del> glog.Errorf("while trying to read %s: %v", url, err) </del> return nil, err }
func (g *dockerConfigKeyProvider) Provide() credentialprovider.DockerConfig { // Read the contents of the google-dockercfg metadata key and // parse them as an alternate .dockercfg <del> if cfg, err := credentialprovider.ReadDockerConfigFileFromUrl(dockerConfigKey, g.Client, metadataHeader); err == nil { </del> <ins> if cfg, err := credentialprovider.ReadDockerConfigFileFromUrl(dockerConfigKey, g.Client, metadataHeader); err != nil { glog.Errorf("while reading 'google-dockercfg' metadata: %v", err) } else { </ins> return cfg }
// Provide implements DockerConfigProvider func (g *dockerConfigUrlKeyProvider) Provide() credentialprovider.DockerConfig { // Read the contents of the google-dockercfg-url key and load a .dockercfg from there <del> if url, err := credentialprovider.ReadUrl(dockerConfigUrlKey, g.Client, metadataHeader); err == nil { </del> <ins> if url, err := credentialprovider.ReadUrl(dockerConfigUrlKey, g.Client, metadataHeader); err != nil { glog.Errorf("while reading 'google-dockercfg-url' metadata: %v", err) } else { </ins> if strings.HasPrefix(string(url), "http") { <del> if cfg, err := credentialprovider.ReadDockerConfigFileFromUrl(string(url), g.Client, nil); err == nil { </del> <ins> if cfg, err := credentialprovider.ReadDockerConfigFileFromUrl(string(url), g.Client, nil); err != nil { glog.Errorf("while reading 'google-dockercfg-url'-specified url: %s, %v", string(url), err) } else { </ins> return cfg } } else {
tokenJsonBlob, err := credentialprovider.ReadUrl(metadataToken, g.Client, metadataHeader) if err != nil { <ins> glog.Errorf("while reading access token endpoint: %v", err) </ins> return cfg } email, err := credentialprovider.ReadUrl(metadataEmail, g.Client, metadataHeader) if err != nil { <ins> glog.Errorf("while reading email endpoint: %v", err) </ins> return cfg }
cloud: gce EOF <ins> DOCKER_OPTS="" if [[ -n "${EXTRA_DOCKER_OPTS-}" ]]; then DOCKER_OPTS="${EXTRA_DOCKER_OPTS}" fi </ins> # Decide if enable the cache <del> if [[ "${ENABLE_DOCKER_REGISTRY_CACHE}" == "true" ]]; then </del> <ins> if [[ "${ENABLE_DOCKER_REGISTRY_CACHE}" == "true" ]]; then </ins> REGION=$(echo "${ZONE}" | cut -f 1,2 -d -) echo "Enable docker registry cache at region: " $REGION <del> DOCKER_OPTS="--registry-mirror="https://${REGION}.docker-cache.clustermaster.net"" </del> <ins> DOCKER_OPTS="${DOCKER_OPTS} --registry-mirror='https://${REGION}.docker-cache.clustermaster.net'" fi </ins> <del> cat <<EOF >>/etc/salt/minion.d/grains.conf </del> <ins> if [[ -n "{DOCKER_OPTS}" ]]; then cat <<EOF >>/etc/salt/minion.d/grains.conf </ins> docker_opts: $DOCKER_OPTS EOF fi
echo "ZONE='${ZONE}'" echo "MASTER_NAME='${MASTER_NAME}'" echo "MINION_IP_RANGE='${MINION_IP_RANGES[$i]}'" <ins> echo "EXTRA_DOCKER_OPTS='${EXTRA_DOCKER_OPTS}'" </ins> echo "ENABLE_DOCKER_REGISTRY_CACHE='${ENABLE_DOCKER_REGISTRY_CACHE:-false}'" grep -v "^#" "${KUBE_ROOT}/cluster/gce/templates/common.sh" grep -v "^#" "${KUBE_ROOT}/cluster/gce/templates/salt-minion.sh"
<ins> DOCKER_OPTS="" </ins> {% if grains.docker_opts is defined %} <del> {% set docker_opts = grains.docker_opts %} {% else %} {% set docker_opts = "" %} </del> <ins> DOCKER_OPTS="${DOCKER_OPTS} {{grains.docker_opts}}" </ins> {% endif %} <del> DOCKER_OPTS="{{docker_opts}} --bridge cbr0 --iptables=false --ip-masq=false -r=false" </del> <ins> DOCKER_OPTS="${DOCKER_OPTS} --bridge cbr0 --iptables=false --ip-masq=false -r=false" </ins>
`service`, a client can simply connect to $MYAPP_SERVICE_HOST on port $MYAPP_SERVICE_PORT. <ins> ## Service without selector Services, in addition to providing clean abstraction to access pods, can also abstract any kind of backend: - you want to have an external database cluster in production, but in test you use your own databases. - you want to point your service to a service in another [`namespace`](namespaces.md) or on another cluster. - you are migrating your workload to Kubernetes and some of your backends run outside of Kubernetes. In any of these scenarios you can define a service without a selector: ```json "kind": "Service", "apiVersion": "v1beta1", "id": "myapp", "port": 8765 ``` then you can explicitly map the service to a specific endpoint(s): ```json "kind": "Endpoints", "apiVersion": "v1beta1", "id": "myapp", "endpoints": ["173.194.112.206:80"] ``` Access to the service without a selector works the same as if it had selector. The traffic will be routed to endpoints defined by the user (`173.194.112.206:80` in case of this example). </ins> ## How do they work? Each node in a Kubernetes cluster runs a `service proxy`.  This application
EmptyDir *EmptyDir `json:"emptyDir"` // GCEPersistentDisk represents a GCE Disk resource that is attached to a // kubelet's host machine and then exposed to the pod. <del> GCEPersistentDisk *GCEPersistentDisk `json:"persistentDisk"` </del> <ins> GCEPersistentDisk *GCEPersistentDisk `json:"gcePersistentDisk"` </ins> // GitRepo represents a git repository at a particular revision. GitRepo *GitRepo `json:"gitRepo"` }
<del> // +build !windows /* 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 gce_pd import ( "os" "syscall" ) // Determine if a directory is a mountpoint, by comparing the device for the directory // with the device for it's parent.  If they are the same, it's not a mountpoint, if they're // different, it is. func isMountPoint(file string) (bool, error) { stat, err := os.Stat(file) if err != nil { return false, err } rootStat, err := os.Lstat(file + "/..") if err != nil { return false, err } // If the directory has the same device as parent, then it's not a mountpoint. return stat.Sys().(*syscall.Stat_t).Dev != rootStat.Sys().(*syscall.Stat_t).Dev, nil } </del>
<ins> // +build !windows /* 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 gce_pd import ( "os" "syscall" ) // Determine if a directory is a mountpoint, by comparing the device for the directory // with the device for it's parent.  If they are the same, it's not a mountpoint, if they're // different, it is. func isMountPoint(file string) (bool, error) { stat, err := os.Stat(file) if err != nil { return false, err } rootStat, err := os.Lstat(file + "/..") if err != nil { return false, err } // If the directory has the same device as parent, then it's not a mountpoint. return stat.Sys().(*syscall.Stat_t).Dev != rootStat.Sys().(*syscall.Stat_t).Dev, nil } </ins>
} if event.Type == watch.Error { util.HandleError(fmt.Errorf("error from watch during sync: %v", errors.FromObject(event.Object))) <ins> // Clear the resource version, this may cause us to skip some elements on the watch, // but we'll catch them on the synchronize() call, so it works out. *resourceVersion = "" </ins> continue } glog.V(4).Infof("Got watch: %#v", event) rc, ok := event.Object.(*api.ReplicationController) if !ok { <ins> if status, ok := event.Object.(*api.Status); ok { if status.Status == api.StatusFailure { glog.Errorf("failed to watch: %v", status) // Clear resource version here, as above, this won't hurt consistency, but we // should consider introspecting more carefully here. (or make the apiserver smarter) // "why not both?" *resourceVersion = "" continue } } </ins> util.HandleError(fmt.Errorf("unexpected object: %#v", event.Object)) continue }
<ins> /* Copyright 2015 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 e2e import ( "fmt" "time" "github.com/GoogleCloudPlatform/kubernetes/pkg/client" . "github.com/onsi/ginkgo" ) var _ = Describe("Cadvisor", func() { var c *client.Client BeforeEach(func() { var err error c, err = loadClient() expectNoError(err) }) It("cadvisor should be healthy on every node.", func() { CheckCadvisorHealthOnAllNodes(c) }) }) func CheckCadvisorHealthOnAllNodes(c *client.Client) { By("getting list of nodes") nodeList, err := c.Nodes().List() expectNoError(err) for _, node := range nodeList.Items { // cadvisor is not accessible directly unless its port (4194 by default) is exposed. // Here, we access '/stats/' REST endpoint on the kubelet which polls cadvisor internally. statsResource := fmt.Sprintf("api/v1beta1/proxy/minions/%s/stats/", node.Name) By(fmt.Sprintf("Querying stats from node %s using url %s", node.Name, statsResource)) _, err = c.Get().AbsPath(statsResource).Timeout(1 * time.Second).Do().Raw() expectNoError(err) } } </ins>
#    shasum <tar> # 6. Update this file with new tar version and new hash <del> {% set etcd_version="v0.4.6" %} </del> <ins> {% set etcd_version="v2.0.0" %} </ins> {% set etcd_tar_url="https://storage.googleapis.com/kubernetes-release/etcd/etcd-%s-linux-amd64.tar.gz" | format(etcd_version)  %} <del> {% set etcd_tar_hash="sha1=5db514e30b9f340eda00671230d5136855ae14d7" %} </del> <ins> {% set etcd_tar_hash="sha1=b3cd41d1748bf882a58a98c9585fd5849b943811" %} </ins> etcd-tar: archive: