jiebi/CodeConvo huggingface dataset:
Change:
Pulls of images from private repos hosted on the default registry, , fail because the images are not prefixed, thus the fails. I've figured out a hacky way of getting around this issue by manually editing the .dockercfg but as a more permanent solution, I'd like to propose using authentication with the default registry if it is provided in the .dockercfg. Opening this issue to start some discussion. I'll attach a first pass at this in a pull request.

Discussion:
sort.Sort(sort.Reverse(sort.StringSlice(dk.index))) } <ins> const defaultRegistryHost = "index.docker.io/v1/" </ins> func (dk *dockerKeyring) lookup(image string) (docker.AuthConfiguration, bool) { // range over the index as iterating over a map does not provide // a predictable ordering

return dk.creds[k], true } <ins> // use credentials for the default registry if provided if auth, ok := dk.creds[defaultRegistryHost]; ok { return auth, true } </ins> return docker.AuthConfiguration{}, false }
Change:
The client/cache interface has a method which is supposed to return a of the IDs in a store. This is a bit misleading and should probably be renamed to 'Contents' or 'ContainedIDs'.
Thoughts
I tend to agree. contains to me should always return a bool and take an input key. Sent from my iPhone
Yeah, I agree, both of the suggested names would be an improvement.

Discussion:
return list } <del> // Contains returns a util.StringSet containing all IDs of stored the items. </del> <ins> // ContainedIDs returns a util.StringSet containing all IDs of stored the items. </ins> // This is a snapshot of a moment in time, and one should keep in mind that // other go routines can add or remove items after you call this. <del> func (c *FIFO) Contains() util.StringSet { </del> <ins> func (c *FIFO) ContainedIDs() util.StringSet { </ins> c.lock.RLock() defer c.lock.RUnlock() set := util.StringSet{}

} func (p *Poller) sync(e Enumerator) { <del> current := p.store.Contains() </del> <ins> current := p.store.ContainedIDs() </ins> for i := 0; i < e.Len(); i++ { id, object := e.Get(i) p.store.Update(id, object)

for line, pairs := range item.steps { p.sync(testEnumerator(pairs)) <del> ids := s.Contains() </del> <ins> ids := s.ContainedIDs() </ins> for _, pair := range pairs { if !ids.Has(pair.id) { t.Errorf("%v, %v: expected to find entry for %v, but did not.", testCase, line, pair.id)

<-done // We never added anything, verify that. <del> if e, a := 0, len(s.Contains()); e != a { </del> <ins> if e, a := 0, len(s.ContainedIDs()); e != a { </ins> t.Errorf("expected %v, got %v", e, a) } }

Update(id string, obj interface{}) Delete(id string) List() []interface{} <del> Contains() util.StringSet </del> <ins> ContainedIDs() util.StringSet </ins> Get(id string) (item interface{}, exists bool) // Replace will delete the contents of the store, using instead the

return list } <del> // Contains returns a util.StringSet containing all IDs of stored the items. </del> <ins> // ContainedIDs returns a util.StringSet containing all IDs of stored the items. </ins> // This is a snapshot of a moment in time, and one should keep in mind that // other go routines can add or remove items after you call this. <del> func (c *cache) Contains() util.StringSet { </del> <ins> func (c *cache) ContainedIDs() util.StringSet { </ins> c.lock.RLock() defer c.lock.RUnlock() set := util.StringSet{}

} // Check that ID list is correct. <del> ids := store.Contains() </del> <ins> ids := store.ContainedIDs() </ins> if !ids.HasAll("a", "c", "e") { t.Errorf("missing items") }

} // Check that ID list is correct. <del> ids := store.Contains() </del> <ins> ids := store.ContainedIDs() </ins> if !ids.HasAll("foo", "bar") { t.Errorf("missing items") }

glog.V(2).Infof("About to try and schedule pod %vn"+ "tknown minions: %vn"+ "tknown scheduled pods: %vn", <del> pod.Name, minionCache.Contains(), podCache.Contains()) </del> <ins> pod.Name, minionCache.ContainedIDs(), podCache.ContainedIDs()) </ins> return pod }, Error: factory.makeDefaultErrorFunc(&podBackoff, podQueue),
Change:
When wgetting to this address during the installation process, this just fails silently. Turns out the issue is that if you take a raw and curl that address you get a TLS error. I've fixed it by changing to , but obviously that's more risky.
Related (filed after an email exchange around wget) I don't have easy access to the vSphere so I can't verify how it relates to my debian install.
Yes, that is exactly the error I was experiencing.
Does curl work? Or is it busted too?
Curl is not installed on the image by default. I'm building a new image based on Debian 7.7 where I pull in curl by default, so we can switch to using that everywhere (instead of an awkward mix of wget and curl).
Thanks for reporting this I hadn't seen this yet. I uploaded a new VMDK that includes curl and updated the deployment scripts to use curl. I verified that deployment works again for me.
I can confirm that this works now with latest build from master on ESX. Probably still won't work with v0.4.3 (even w new image) since the scripts still used wget back then.
We are probably going to fork for v0.5 soon. But I can backport if this trips folks up. sent from tiny keyboard On Nov 12, 2014 9:09 AM, "Ben Smith" wrote:

Discussion:
# # -M installs the master set +x <del> wget -q -O - https://bootstrap.saltstack.com | sh -s -- -M -X </del> <ins> curl -L --connect-timeout 20 --retry 6 --retry-delay 10 https://bootstrap.saltstack.com | sh -s -- -M -X </ins> set -x <del> echo $MASTER_HTPASSWD > /srv/salt/nginx/htpasswd </del>

# # We specify -X to avoid a race condition that can cause minion failure to # install.  See https://github.com/saltstack/salt-bootstrap/issues/270 <del> wget -q -O - https://bootstrap.saltstack.com | sh -s -- -X </del> <ins> curl -L --connect-timeout 20 --retry 6 --retry-delay 10 https://bootstrap.saltstack.com | sh -s -- -X </ins>

### Setup <del> Download a prebuilt Debian VMDK to be used as base image: </del> <ins> Download a prebuilt Debian 7.7 VMDK that we'll use as a base image: </ins> ```sh <del> wget https://storage.googleapis.com/govmomi/vmdk/kube.vmdk.gz{,.md5} </del> <ins> curl --remote-name-all https://storage.googleapis.com/govmomi/vmdk/2014-11-11/kube.vmdk.gz{,.md5} </ins> md5sum -c kube.vmdk.gz.md5 gzip -d kube.vmdk.gz ``` <del> Upload this VMDK to your vSphere instance: </del> <ins> Import this VMDK into your vSphere datastore: </ins> ```sh export GOVC_URL='user:pass@hostname'

govc import.vmdk kube.vmdk ./kube/ ``` <del> Verify that the VMDK was correctly uploaded and expanded to 10GiB: </del> <ins> Verify that the VMDK was correctly uploaded and expanded to ~3GiB: </ins> ```sh govc datastore.ls ./kube/
Change:
We now have pretty structured way of validating api object, but the error message to end user is not descriptive, e.g. when creating a replication controller with restart policy 'never', we get: even as simple as label name, we shouldn't assume end-user is familiar with our requirement. Apart from what is wrong, we'd better also give why it is wrong.
The main thing wrong here is not having a useful String() method. and have both been pretty adamant about not attaching code to API objects, but here's a clear UX justification. What if we only attached methods to internal API objects, not versioned ones? Also: this should print %#v, rather than %+v, which would be a BIT more readable.
Orrrr we could switch to spew, which is already a dep.
Actually we're printing a reflect.Value there, which makes no sense at all. I will fix. EDIT: no we aren't, I can't read-- will still fix though

Discussion:
"fmt" "strings" <ins> "github.com/davecgh/go-spew/spew" </ins> "github.com/golang/glog" )

ValidationErrorTypeForbidden ValidationErrorType = "FieldValueForbidden" ) <del> // ValueOf converts a ValidationErrorType into its corresponding error message. func ValueOf(t ValidationErrorType) string { </del> <ins> // String converts a ValidationErrorType into its corresponding error message. func (t ValidationErrorType) String() string { </ins> switch t { case ValidationErrorTypeNotFound: return "not found"

var _ error = &ValidationError{} func (v *ValidationError) Error() string { <del> s := fmt.Sprintf("%s: %s '%v'", v.Field, ValueOf(v.Type), v.BadValue) </del> <ins> s := spew.Sprintf("%s: %s '%+v'", v.Field, v.Type, v.BadValue) </ins> if v.Detail != "" { s += fmt.Sprintf(": %s", v.Detail) }

} } <del> func TestValidationError(t *testing.T) { </del> <ins> func TestValidationErrorUsefulMessage(t *testing.T) { </ins> s := NewFieldInvalid("foo", "bar", "deet").Error() <del> if !strings.Contains(s, "foo") || !strings.Contains(s, "bar") || !strings.Contains(s, "deet") || !strings.Contains(s, ValueOf(ValidationErrorTypeInvalid)) { t.Errorf("error message did not contain expected values, got %s", s) </del> <ins> t.Logf("message: %v", s) for _, part := range []string{"foo", "bar", "deet", ValidationErrorTypeInvalid.String()} { if !strings.Contains(s, part) { t.Errorf("error message did not contain expected part '%v'", part) } } type complicated struct { Baz   int Qux   string Inner interface{} KV    map[string]int } s = NewFieldRequired( "foo", &complicated{ Baz:   1, Qux:   "aoeu", Inner: &complicated{Qux: "asdf"}, KV:    map[string]int{"Billy": 2}, }, ).Error() t.Logf("message: %v", s) for _, part := range []string{ "foo", ValidationErrorTypeRequired.String(), "Baz", "Qux", "Inner", "KV", "1", "aoeu", "asdf", "Billy", "2", } { if !strings.Contains(s, part) { t.Errorf("error message did not contain expected part '%v'", part) } </ins> } }
Change:
To reproduce: Start a cluster via hack/local-up- Start some pods Kill the cluster "docker ps -a" should show the pod containers running still Start the cluster again "etcdctl ls /registry" should show that there is no boundpods directory -- only minions and services "docker ps -a" should show the old pod containers still running Start a new pod After, say, 10s, "docker ps -a" should show the old containers dead /cc
I suspect the cause of this might be : which guarantees that the pod sync logic is never called if is nil. Need to get a repro to confirm.

Discussion:
} func (s *sourceEtcd) run() { <del> watching := s.helper.Watch(s.key, 0) </del> <ins> boundPods := api.BoundPods{} err := s.helper.ExtractToList(s.key, &boundPods) if err != nil { glog.Errorf("etcd failed to retrieve the value for the key %q. Error: %v", s.key, err) return } // Push update. Maybe an empty PodList to allow EtcdSource to be marked as seen s.updates <- kubelet.PodUpdate{boundPods.Items, kubelet.SET, kubelet.EtcdSource} index, _ := s.helper.ResourceVersioner.ResourceVersion(&boundPods) watching := s.helper.Watch(s.key, index) </ins> for { select { case event, ok := <-watching.ResultChan():

// It returns a list of containers, or an error if one occurs. func eventToPods(ev watch.Event) ([]api.BoundPod, error) { pods := []api.BoundPod{} <ins> if ev.Object == nil { return pods, nil } </ins> boundPods, ok := ev.Object.(*api.BoundPods) if !ok { return pods, errors.New("unable to parse response as BoundPods")

{ input: watch.Event{Object: nil}, pods:  []api.BoundPod{}, <del> fail:  true, </del> <ins> fail:  false, </ins> }, { input: watch.Event{Object: &api.BoundPods{}},

if !os.IsNotExist(err) { return err } <ins> // Emit an update with an empty PodList to allow FileSource to be marked as seen s.updates <- kubelet.PodUpdate{[]api.BoundPod{}, kubelet.SET, kubelet.FileSource} </ins> return fmt.Errorf("path does not exist, ignoring") }

NewSourceFile("random_non_existent_path", time.Millisecond, ch) select { case got := <-ch: <del> t.Errorf("Expected no update, Got %#v", got) </del> <ins> update := got.(kubelet.PodUpdate) expected := CreatePodUpdate(kubelet.SET, kubelet.FileSource) if !api.Semantic.DeepEqual(expected, update) { t.Fatalf("Expected %#v, Got %#v", expected, update) } </ins> case <-time.After(2 * time.Millisecond): <ins> t.Errorf("Expected update, timeout instead") </ins> } }

return fmt.Errorf("%v: %v", s.url, resp.Status) } if len(data) == 0 { <ins> // Emit an update with an empty PodList to allow HTTPSource to be marked as seen s.updates <- kubelet.PodUpdate{[]api.BoundPod{}, kubelet.SET, kubelet.HTTPSource} </ins> return fmt.Errorf("zero-length data received from %v", s.url) } // Short circuit if the manifest has not changed since the last time it was read.

} case <-time.After(kl.resyncInterval): glog.V(4).Infof("Periodic sync") <del> if kl.pods == nil { continue } </del> } err := handler.SyncPods(kl.pods)
Change:
kubectl describe emits 1024 NULL characters prior to actual text. This prevents all text-based processing tools from working on its output. /cc
This has got to be due to:
(IRL discussion: there's no reason to pass 1024 0 bytes to NewBuffer.)
Fixing in PR .

Discussion:
<ins> # Replication controller tools ## resize.sh Resizes a replication controller to the specified number of pods. ``` $ resize.sh usage: resize.sh <replication controller name> <size> $ resize.sh redisslave 4 ``` ## stop.sh Resizes a replication controller to 0 pods and waits until the pods are deleted. ``` $ stop.sh usage: stop.sh <replication controller name> $ stop.sh redisslave ``` </ins>

<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. # This command resizes a replication controller using kubectl. KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../.. KUBECTL="${KUBE_ROOT}/cluster/kubectl.sh" if [[ $# != 2 ]] ; then echo "usage: $0 <replication controller name> <size>" >&2 exit 1 fi rc="$1" size="$2" "${KUBECTL}" get -o json rc "$rc" | sed 's/"replicas": [0-9][0-9]*/"replicas": '"$size"'/' | "${KUBECTL}" update -f - rc "$rc" </ins>

<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. # This command resizes a replication controller to 0. KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../.. KUBECTL="${KUBE_ROOT}/cluster/kubectl.sh" RESIZE="${KUBE_ROOT}/contrib/rctools/resize.sh" if [[ $# != 1 ]] ; then echo "usage: $0 <replication controller name>" >&2 exit 1 fi rc="$1" "${RESIZE}" "$rc" 0 # kubectl describe output includes a line like: # Replicas:       2 current / 2 desired # Wait until it shows 0 pods while true; do pods=$(${KUBECTL} describe rc "$rc" | awk '/^Replicas:/{print $2}') if [[ "$pods" -eq 0 ]] ; then exit 0 else echo "$pods remaining..." fi sleep 1 done exit 1 </ins>

func tabbedString(f func(io.Writer) error) (string, error) { out := new(tabwriter.Writer) <del> b := make([]byte, 1024) buf := bytes.NewBuffer(b) </del> <ins> buf := &bytes.Buffer{} </ins> out.Init(buf, 0, 8, 1, 't', 0) err := f(out)
Change:
We introduced UID / UUID to provide time-based uniqueness, but UID / UUID are not user friendly. We are going to have this kind of issues in general at client side.
Yeah, describe does a "get" first, so it has the UID available.
Pretty sure this is a feature until we have a way to lookup dead pods. On Nov 21, 2014 2:47 PM, "Daniel Smith" wrote:

Discussion:
if err != nil { return nil, err } <del> // TODO: search by UID if it's set fields := labels.Set{ "involvedObject.kind":      ref.Kind, "involvedObject.namespace": ref.Namespace, "involvedObject.name":      ref.Name, }.AsSelector() </del> if e.namespace != "" && ref.Namespace != e.namespace { return nil, fmt.Errorf("won't be able to find any events of namespace '%v' in namespace '%v'", ref.Namespace, e.namespace) } <del> return e.List(labels.Everything(), fields) </del> <ins> fields := labels.Set{} if ref.Kind != "" { fields["involvedObject.kind"] = ref.Kind } if ref.Namespace != "" { fields["involvedObject.namespace"] = ref.Namespace } if ref.Name != "" { fields["involvedObject.name"] = ref.Name } if ref.UID != "" { fields["involvedObject.uid"] = ref.UID } return e.List(labels.Everything(), fields.AsSelector()) </ins> }

labels.Everything(), labels.Set{ "involvedObject.name":      name, <del> "involvedObject.kind":      "Pod", </del> "involvedObject.namespace": namespace, }.AsSelector(), )

glog.Errorf("Unable to convert pod manifest: %v", err) } <del> events, _ := d.Events(namespace).Search(pod) </del> <ins> var events *api.EventList if ref, err := api.GetReference(pod); err != nil { glog.Errorf("Unable to construct reference to '%#v': %v", pod, err) } else { ref.Kind = "" // Find BoundPod objects, too! events, _ = d.Events(namespace).Search(ref) } </ins> return tabbedString(func(out io.Writer) error { fmt.Fprintf(out, "Name:t%sn", pod.Name)
Change:
Repro: Create a pod that attempts to mount a GCE PD that is mis-formatted Delete the pod Expected: GCE PD should be detached Observed: GCE PD is not detached.
Chatted with offline and understand the problem with more detail: The basic problem is when filesystem on PD is unformatted, the mount is going to fail. Kubernetes doesn't do cleanup by detaching the PD. Two potential solutions were proposed: 1) use built-in utility: safeformatand_mount in GCE image to format and mount PD to avoid extra step to format the PD disk. 2) Handle mount failure properly. I think we might need handle both anyway. Brendan mentioned that you are looking at a potential new controller for PD, whose responsible is attaching and detaching PD disks. Do you have any latest status on this topic?
No latest status. I haven't done any actual work on it yet. The idea would be to scan the pods assigned to each node, and attaches (or detaches) any PDs that the node needs (or no longer needs). I'm still coming up to speed on a lot of the architectural concepts, so I'd love some guidance.
Now that Tim's volume re-factor has gone in, I'm going to re-visit this issue. Assigning to me.

Discussion:
legacyMode bool } <ins> func detachDiskLogError(pd *gcePersistentDisk) { err := pd.manager.DetachDisk(pd, "/dev/disk/by-id/google-"+pd.pdName) if err != nil { glog.Warningf("Failed to detach disk: %v (%v)", pd, err) } } </ins> // SetUp attaches the disk and bind mounts to the volume path. func (pd *gcePersistentDisk) SetUp() error { if pd.legacyMode {

volPath := pd.GetPath() if err := os.MkdirAll(volPath, 0750); err != nil { <ins> // TODO: we should really eject the attach/detach out into its own control loop. detachDiskLogError(pd) </ins> return err }

err = pd.mounter.Mount(globalPDPath, pd.GetPath(), "", mount.FlagBind|flags, "") if err != nil { os.RemoveAll(pd.GetPath()) <ins> // TODO: we should really eject the attach/detach out into its own control loop. detachDiskLogError(pd) </ins> return err }
Change:
wrote in : This snuck in without namespace support - can you open an issue to support namespace context? Also, how should we handle when we want to use logs for other types of resources (that map to pods, or map to non containers)?
- I can submit a PR to fix this up today if you are backlogged.
Sure, sgtm. Thanks! On Nov 25, 2014 8:35 AM, "Derek Carr" wrote:

Discussion:
if len(args) != 2 { usageError(cmd, "<pod> and <container> are required for log") } <ins> namespace := getKubeNamespace(cmd) </ins> client := getKubeClient(cmd) <del> pod, err := client.Pods("default").Get(args[0]) </del> <ins> pod, err := client.Pods(namespace).Get(args[0]) </ins> checkErr(err) data, err := client.RESTClient.Get(). Path("proxy/minions"). Path(pod.Status.Host). Path("containerLogs"). <del> Path(getKubeNamespace(cmd)). </del> <ins> Path(namespace). </ins> Path(args[0]). Path(args[1]). Do().
Change:
This happened to me several times while debugging an e2e test. My branch was based on commit and had changes only to
docker inspect says the container exited 0
kubelet HTTP says the pod exited 0:
kubectl says it failed:
Events does not show any success or failure even. Seems like it doesn't show that for any pods, succeeded or failed.
Apiserver sees the exit code 0:
The problem might be related to there being zero values for startedAt or finishedAt. The command may have exited so quickly that docker could not record these values, and we may be somehow treating unset values for these as failure.
adding sleep 5 to my command causes docker to set the startedAt and finishedAt to reasonable values, but the pod still shows up as failed. Note that I use a different pod name each time I try to avoid that sort of obvious mistake.
So, the apiserver v1beta1 message knows that it is terminated with exit code 0. But, both kubectl and my go code in my go e2e test thing this means failed. I'm starting to suspect the conversion code.
The problem is that a v1beta1 pod can never see that a pod is failed or succeded. So it defaults to PodFailed. Grrrrrrraaaaahhhhhh!
In line 184 of
This is going to be confusing for people unless we change this.
I believe the latest fix for PodStatus should resolve the issue here. I will double confirm it before closing it.

Discussion:
PodWaiting PodStatus = "Waiting" // PodRunning means that the pod is up and running. PodRunning PodStatus = "Running" <del> // PodTerminated means that the pod has stopped. </del> <ins> // PodTerminated means that the pod has stopped with error(s) </ins> PodTerminated PodStatus = "Terminated" // PodUnknown means that we failed to obtain info about the pod. PodUnknown PodStatus = "Unknown" <ins> // PodSucceeded means that the pod has stopped without error(s) PodSucceeded PodStatus = "Succeeded" </ins> ) type ContainerStateWaiting struct {

case newer.PodRunning: *out = PodRunning case newer.PodSucceeded: <del> *out = PodTerminated </del> <ins> *out = PodSucceeded </ins> case newer.PodFailed: *out = PodTerminated case newer.PodUnknown:

case PodTerminated: // Older API versions did not contain enough info to map to PodSucceeded *out = newer.PodFailed <ins> case PodSucceeded: *out = newer.PodSucceeded </ins> case PodUnknown: *out = newer.PodUnknown default:

PodTerminated PodStatus = "Terminated" // PodUnknown means that we failed to obtain info about the pod. PodUnknown PodStatus = "Unknown" <ins> // PodSucceeded means that the pod has stopped without error(s) PodSucceeded PodStatus = "Succeeded" </ins> ) type ContainerStateWaiting struct {
Change:
When using AWS to get a cluster turned up as described , running the kube- script doe not result in the VPC being deleted. The following error is shown: Deleting VPC Traceback (most recent call last): File "&lt;string", line 1, in &lt;moduleKeyError: 'Tags And the VPC is not deleted
This should be fixed by
this is now fixed (I think...)

Discussion:
} function get_vpc_id { <del> python -c 'import json,sys; lst = [str(vpc["VpcId"]) for vpc in json.load(sys.stdin)["Vpcs"] for tag in vpc["Tags"] if tag["Value"] == "kubernetes-vpc"]; print "".join(lst)' </del> <ins> python -c 'import json,sys; lst = [str(vpc["VpcId"]) for vpc in json.load(sys.stdin)["Vpcs"] for tag in vpc.get("Tags", []) if tag["Value"] == "kubernetes-vpc"]; print "".join(lst)' </ins> } function get_subnet_id {
Change:
The health check that says "..failed health check" even before checking if an error occurred.

Discussion:
return Unknown, fmt.Errorf("missing exec parameters") } data, err := e.runner.RunInContainer(podFullName, podUUID, container.Name, container.LivenessProbe.Exec.Command) <del> glog.V(1).Infof("container %s failed health check: %s", podFullName, string(data)) </del> <ins> glog.V(1).Infof("container %s health check response: %s", podFullName, string(data)) </ins> if err != nil { return Unknown, err }