jiebi/CodeConvo huggingface dataset:
Change:
If a ReplicaController has a selector that doesn't match the template it'll just create tons and tons of pods. It should validate that the pods it is creating have a good chance of satisfying its selector.
It would also be useful to validate that the selector doesn't obviously overlap with selectors of other replicationControllers.

Discussion:
if labels.Set(controller.DesiredState.ReplicaSelector).AsSelector().Empty() { allErrs = append(allErrs, errs.NewInvalid("ReplicationController.ReplicaSelector", controller.DesiredState.ReplicaSelector)) } <ins> selector := labels.Set(controller.DesiredState.ReplicaSelector).AsSelector() labels := labels.Set(controller.DesiredState.PodTemplate.Labels) if !selector.Matches(labels) { allErrs = append(allErrs, errs.NewInvalid("ReplicaController.DesiredState.PodTemplate.Labels", controller.DesiredState.PodTemplate)) } </ins> if controller.DesiredState.Replicas < 0 { allErrs = append(allErrs, errs.NewInvalid("ReplicationController.Replicas", controller.DesiredState.Replicas)) }

Version: "v1beta1", }, }, <ins> Labels: validSelector, </ins> } successCases := []ReplicationController{

PodTemplate: validPodTemplate, }, }, <ins> "selector_doesnt_match": { JSONBase: JSONBase{ID: "abc"}, DesiredState: ReplicationControllerState{ ReplicaSelector: map[string]string{"foo": "bar"}, PodTemplate:     validPodTemplate, }, }, </ins> "invalid manifest": { JSONBase: JSONBase{ID: "abc"}, DesiredState: ReplicationControllerState{

}, }, }, <ins> Labels: map[string]string{"a": "b"}, </ins> } func TestCreateController(t *testing.T) {
Change:
I0825 04:43:42. ] GET /logs: (51.111us) 301 goroutine 315 [running]: (respLogger).WriteHeader(0xc21036a240, 0x12d) +0x9c net/http.Redirect(0x7f4d60b7ed80, 0xc21036a240, 0xc2101a7680, 0xc2102bbd60, 0x6, ...) +0x436 net/http.(redirectHandler).ServeHTTP(0xc2103089c0, 0x7f4d60b7ed80, 0xc21036a240, 0xc2101a7680) +0x5e net/http.(ServeMux).ServeHTTP(0xc2102f4030, 0x7f4d60b7ed80, 0xc21036a240, 0xc2101a7680) +0x163 ·002(0x7f4d60b7ed48, 0xc2102c5140, 0xc2101a7680) +0x197 net/http.HandlerFunc.ServeHTTP(0xc210309180, 0x7f4d60b7ed48, 0xc2102c5140, 0xc2101a7680) +0x40 (defaultAPIServer).ServeHTTP(0xc210308a60, 0x7f4d60b7ed48, 0xc2102c5140, 0xc2101a7680) +0x51 net/http.serverHandler.ServeHTTP(0xc210317960, 0x7f4d60b7ed48, 0xc2102c5140, 0xc2101a7680) +0x16e net/http.(conn).serve(0xc2102b2180) +0x7b7 created by net/http.(Server).Serve +0x28b
Is it just that 301 isn't in the list of things to not show a stacktrace for?

Discussion:
group *APIGroup } <ins> const ( StatusUnprocessableEntity = 422 ) </ins> // Handle returns a Handler function that expose the provided storage interfaces // as RESTful resources at prefix, serialized by codec, and also includes the support // http resources.

httplog.StatusIsNot( http.StatusOK, http.StatusAccepted, <ins> http.StatusMovedPermanently, </ins> http.StatusTemporaryRedirect, http.StatusConflict, http.StatusNotFound, <ins> StatusUnprocessableEntity, </ins> ), ).Log()
Change:
-s=118 -p 9376:9376 run thockin/hostname 3 hostnameController results in a validation error: Service.ID: invalid value 'hostnameController' "hostnameController" is accepted for the replication controller, but not for the service ID.

Discussion:
"github.com/GoogleCloudPlatform/kubernetes/pkg/api" "github.com/GoogleCloudPlatform/kubernetes/pkg/client" "github.com/GoogleCloudPlatform/kubernetes/pkg/labels" <ins> "github.com/GoogleCloudPlatform/kubernetes/pkg/util" </ins> "github.com/GoogleCloudPlatform/kubernetes/pkg/util/wait" "github.com/GoogleCloudPlatform/kubernetes/pkg/version" "github.com/golang/glog"

// RunController creates a new replication controller named 'name' which creates 'replicas' pods running 'image'. func RunController(image, name string, replicas int, client client.Interface, portSpec string, servicePort int) error { <ins> if servicePort > 0 && !util.IsDNSLabel(name) { return fmt.Errorf("Service creation requested, but an invalid name for a service was provided (%s). Service names must be valid DNS labels.", name) } </ins> controller := &api.ReplicationController{ JSONBase: api.JSONBase{ ID: name,
Change:
The Rackspace integration broke the GCE deploy. With Debian Wheezy the jinja2 version (package python-jinja2) is jinja2 version 2.6. This doesn't have support for the filter used in . Even though we don't hit that case for GCE, jinja apparently verifies the entire file. The VMWare folks hit this too and worked around it with a funky loop. We probably need to use the same logic for rackspace. (The jinja2 version comes from the debian repository instead of pypi as installed by the salt bootstrap scripts. We might be able to grab a newer version for GCE but that seems more difficult.)
I can get to this by EOD but if someone else wants to pick it up feel free.
I'll see if the VMWare code is workable for us.
I'm trying that out now. Thanks for following up.
My only issue with this solution for Rackspace is the use of eth0. For us, eth0 is a public IP address and means communication between apiserver <-kubelet will be over the net. It's fine for the time being but I'll send an updated PR that re-focuses on eth2 for Rackspace.
I missed that! I should have looked more carefully. I'll get this one in and we can fix it up and try and share some code.
Sounds good. I'll have some other minor updates as well.

Discussion:
{% if grains.cloud == 'azure' %} MACHINES="{{ salt['mine.get']('roles:kubernetes-pool', 'grains.items', expr_form='grain').values()|join(',', attribute='hostnamef') }}" {% set machines = "-machines $MACHINES" %} <del> {% elif grains.cloud is defined and grains.cloud == 'rackspace' %} MACHINES="{{ salt['mine.get']('roles:kubernetes-pool', 'grains.items', expr_form='grain').values()|map(attribute='ip_interfaces.eth2')|map('first')|join(',') }}" {% set machines = "-machines $MACHINES" %} {% set minion_regexp = "" %} </del> {% endif %} <del> {% if grains.cloud == 'vsphere' %} </del> <ins> {% if grains.cloud == 'rackspace' or grains.cloud == 'vsphere' %} </ins> # Collect IPs of minions as machines list. <del> # Use a bash array to build the value we need. It doesn't appear to be # possible call functions map or zip, or use lambda's from Jinja. </del> <ins> # # Use a bash array to build the value we need. Jinja 2.7 does support a 'map' # filter that would simplify this.  However, some installations (specifically # Debian Wheezy) only install Jinja 2.6. </ins> MACHINE_IPS=() {% for addrs in salt['mine.get']('roles:kubernetes-pool', 'network.ip_addrs', expr_form='grain').values() %} MACHINE_IPS+=( {{ addrs[0] }} ) {% endfor %} {% set machines = "-machines=$(echo ${MACHINE_IPS[@]} | xargs -n1 echo | paste -sd,)" %} <ins> {% set minion_regexp = "" %} </ins> {% endif %} {% endif %}
Change:
It's hard to tell if they match right now.
who has been changing this stuff. :)
Ah yes... I was thinking of adding a flag to print the %r of the version.Info... Do you think that would be an appropriate flag name? I'll start working on the PR since it's probably time to refactor the code to take the other bits from git I have been pushing through ldflags...
I'd change the current behavior rather than add a new flag. I don't really care which way it ends up looking as long as both flags print the same format :)
Fixed by

Discussion:
) var ( <del> serverVersion = flag.Bool("server_version", false, "Print the server's version number.") </del> <ins> serverVersion = verflag.Version("server_version", verflag.VersionFalse, "Print the server's version information and quit") </ins> preventSkew   = flag.Bool("expect_version_match", false, "Fail if server's version doesn't match own version.") httpServer    = flag.String("h", "", "The host to connect to.") config        = flag.String("c", "", "Path to the config file.")

} } <del> if *serverVersion { </del> <ins> if *serverVersion != verflag.VersionFalse { </ins> got, err := kubeClient.ServerVersion() if err != nil { fmt.Printf("Couldn't read version from server: %vn", err) os.Exit(1) } <del> fmt.Printf("Server Version: %#vn", got) os.Exit(0) </del> <ins> if *serverVersion == verflag.VersionRaw { fmt.Printf("%#vn", *got) os.Exit(0) } else { fmt.Printf("Server: Kubernetes %sn", got) os.Exit(0) } </ins> } if *preventSkew {
Change:
The salt configs assume that anything under "os_family = RedHat" will use the ovs mechanisms that are only set up for vagrant. This means that we can't use Fedora on GCE.
I can clean this up today.

Discussion:
<del> {% if grains['os_family'] == 'RedHat' %} </del> <ins> {% if grains.network_mode is defined and grains.network_mode == 'openvswitch' %} </ins> openvswitch: pkg:

grains: node_ip: $MASTER_IP master_ip: $MASTER_IP <ins> network_mode: openvswitch </ins> etcd_servers: $MASTER_IP cloud_provider: vagrant roles:

# Our minions will have a pool role to distinguish them from the master. cat <<EOF >/etc/salt/minion.d/grains.conf grains: <ins> network_mode: openvswitch </ins> node_ip: $MINION_IP etcd_servers: $MASTER_IP roles:

master_ip | (Optional) The IP address that the apiserver will bind against node_ip | (Optional) The IP address to use to address this node minion_ip | (Optional) Mapped to the kubelet hostname_override, K8S TODO - change this name <ins> network_mode | (Optional) Networking model to use among nodes: *openvswitch* </ins> roles | (Required) 1. **kubernetes-master** means this machine is the master in the kubernetes cluster.  2. **kubernetes-pool** means this machine is a kubernetes-minion.  Depending on the role, the Salt scripts will provision different resources on the machine. These keys may be leveraged by the Salt sls files to branch behavior.
Change:
As I discovered the hard way, if the json GCS api is not turned on for a project, will not surface this error, but just loop 'forever'. API access errors should be easy to catch, so it would be great to surface them on cluster startup and abort with a useful message. (I might take a look at this).
This is described in step 3 of But I agree that it would be better if the tool could catch this case and let the user know (it bit me the first time I tried to run that script as well).

Discussion:
# This script will build a dev release and bring up a new cluster with that # release. <ins> set -e </ins> # First build the binaries $(dirname $0)/build-go.sh if [ "$?" != "0" ]; then

# exit on any error set -e <ins> gsutil_version=$(gsutil version | awk '{split($0,a," "); print a[3]}') # Warning! uses lexical comparison.  This really only works for major versions, or minor versions up to x.9 min_gsutil_version="4.0" if [[ "$gsutil_version" < "$min_gsutil_version" ]]; then echo "gsutil version $min_gsutil_version or greater is required, please run 'gcloud components upgrade'" exit 1 fi </ins> SCRIPT_DIR=$(CDPATH="" cd $(dirname $0); pwd) source $SCRIPT_DIR/config.sh
Change:
We need to be very clear to users who are trying k8s out where they can turn for help. It's unfortunate when a user is having trouble with cloud provider XYZ and they ask for help on IRC and nobody answers.

Discussion:
<ins> # Maintainers People responsible for ports of Kubernetes to different environments. CC at least one maintainer on relevant issues and PRs. ## OS Distributions * RedHat, Fedora: [Clayton Coleman](https://github.com/smarterclayton), [Derek Carr](https://github.com/derekwaynecarr), [Scott Collier](https://github.com/scollier) * CoreOS: [Kelsey Hightower](https://github.com/kelseyhightower) ## Providers / Environments * GCE: [Brendan Burns](https://github.com/brendandburns), [Joe Beda](https://github.com/jbeda), [Daniel Smith](https://github.com/lavalamp), [Tim Hockin](https://github.com/thockin) * Azure: [Jeff Mendoza](https://github.com/jeffmendoza) * Vsphere: [Pieter Noordhuis](https://github.com/pietern) * Rackspace: [Ryan Richard](https://github.com/doublerr) * Ovirt: [Federico Simoncelli](https://github.com/simon3z) * Local: [Derek Carr](https://github.com/derekwaynecarr) * Vagrant: [Derek Carr](https://github.com/derekwaynecarr) </ins>  No newline at end of file
Change:
The kubecfg -c option is used to pass a file pointer to a representation of a model object on disk (pod, replicationController, service) for use by the operation. It would be nice if I could do the following: Where kubecfg sees the http:// and does a network operation to fetch resource for me. This would let users who want to build tutorials on how to use kubernetes to avoid steps to manually download the files locally via curl and unzip, etc. and would also let scripters that use the kubecfg client to avoid needing write access on the terminal where they run kubecfg to perform basic actions.

Discussion:
"flag" "fmt" "io/ioutil" <ins> "net/http" </ins> "os" "reflect" "sort"

serverVersion = flag.Bool("server_version", false, "Print the server's version number.") preventSkew   = flag.Bool("expect_version_match", false, "Fail if server's version doesn't match own version.") httpServer    = flag.String("h", "", "The host to connect to.") <del> config        = flag.String("c", "", "Path to the config file.") </del> <ins> config        = flag.String("c", "", "Path or URL to the config file.") </ins> selector      = flag.String("l", "", "Selector (label 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 <external>:<internal>,...")

return strings.Join(types, "|") } <ins> // readConfigData reads the bytes from the specified filesytem or network location associated with the *config flag func readConfigData() []byte { // we look for http:// or https:// to determine if valid URL, otherwise do normal file IO if strings.Index(*config, "http://") == 0 || strings.Index(*config, "https://") == 0 { resp, err := http.Get(*config) if err != nil { glog.Fatalf("Unable to access URL %v: %vn", *config, err) } defer resp.Body.Close() if resp.StatusCode != 200 { glog.Fatalf("Unable to read URL, server reported %d %s", resp.StatusCode, resp.Status) } data, err := ioutil.ReadAll(resp.Body) if err != nil { glog.Fatalf("Unable to read URL %v: %vn", *config, err) } return data } else { data, err := ioutil.ReadFile(*config) if err != nil { glog.Fatalf("Unable to read %v: %vn", *config, err) } return data } } </ins> // readConfig reads and parses pod, replicationController, and service // configuration files. If any errors log and exit non-zero. func readConfig(storage string) []byte { if len(*config) == 0 { glog.Fatal("Need config file (-c)") } <del> data, err := ioutil.ReadFile(*config) if err != nil { glog.Fatalf("Unable to read %v: %vn", *config, err) } data, err = parser.ToWireFormat(data, storage, runtime.DefaultCodec) </del> <ins> data, err := parser.ToWireFormat(readConfigData(), storage, runtime.DefaultCodec) </ins> if err != nil { glog.Fatalf("Error parsing %v as an object for %v: %vn", *config, storage, err) }
Change:
kube-proxy listens on all ports, but should be configurable. create a flag to specify which interface to listen on. Thanks for finding this bug.
For context, some providers apparently do external IPs by having a whole interface that gets 1:1 NAT without any firewalling. We do not want service ports on those interfaces. , Brian Ketelsen wrote:

Discussion:
configFile     = flag.String("configfile", "/tmp/proxy_config", "Configuration file for the proxy") master         = flag.String("master", "", "The address of the Kubernetes API server (optional)") etcdServerList util.StringList <ins> bindAddress    = flag.String("bindaddress", "0.0.0.0", "The address for the proxy server to serve on (set to 0.0.0.0 or "" for all interfaces)") </ins> ) func init() {

glog.Infof("Using configuration file %s", *configFile) loadBalancer := proxy.NewLoadBalancerRR() <del> proxier := proxy.NewProxier(loadBalancer) </del> <ins> proxier := proxy.NewProxier(loadBalancer, *bindAddress) </ins> // Wire proxier to handle changes to services serviceConfig.RegisterHandler(proxier) // And wire loadBalancer to handle changes to endpoints to services

loadBalancer LoadBalancer mu           sync.Mutex // protects serviceMap serviceMap   map[string]*serviceInfo <ins> address      string </ins> } <del> // NewProxier returns a new Proxier given a LoadBalancer. func NewProxier(loadBalancer LoadBalancer) *Proxier { </del> <ins> // NewProxier returns a new Proxier given a LoadBalancer and an // address on which to listen func NewProxier(loadBalancer LoadBalancer, address string) *Proxier { </ins> return &Proxier{ loadBalancer: loadBalancer, serviceMap:   make(map[string]*serviceInfo), <ins> address:      address, </ins> } }

func (proxier *Proxier) addServiceOnUnusedPort(service string) (string, error) { unusedPortLock.Lock() defer unusedPortLock.Unlock() <del> l, err := net.Listen("tcp", ":0") </del> <ins> l, err := net.Listen("tcp", net.JoinHostPort(proxier.address, "0")) </ins> if err != nil { return "", err }

proxier.StopProxy(service.ID) } glog.Infof("Adding a new service %s on port %d", service.ID, service.Port) <del> listener, err := net.Listen("tcp", fmt.Sprintf(":%d", service.Port)) </del> <ins> listener, err := net.Listen("tcp", net.JoinHostPort(proxier.address, strconv.Itoa(service.Port))) </ins> if err != nil { glog.Infof("Failed to start listening for %s on %d", service.ID, service.Port) continue

lb.OnUpdate([]api.Endpoints{ {JSONBase: api.JSONBase{ID: "echo"}, Endpoints: []string{net.JoinHostPort("127.0.0.1", port)}}}) <del> p := NewProxier(lb) </del> <ins> p := NewProxier(lb, "127.0.0.1") </ins> proxyPort, err := p.addServiceOnUnusedPort("echo") if err != nil {

lb := NewLoadBalancerRR() lb.OnUpdate([]api.Endpoints{{JSONBase: api.JSONBase{ID: "echo"}, Endpoints: []string{net.JoinHostPort("127.0.0.1", port)}}}) <del> p := NewProxier(lb) </del> <ins> p := NewProxier(lb, "127.0.0.1") </ins> proxyPort, err := p.addServiceOnUnusedPort("echo") if err != nil {
Change:
Currently the master VM specified by the Vagrantfile does not have the built kubecfg binary in the vagrant user's path. This request is to have this binary present on the host system and in the vagrant user's path so I can Vagrant ssh into the machine and do 'kubecfg list pods'.
I'm going to generalize this a little so that kubecfg is available in our general cluster install scripts. This should be easier as we move to binary installs.
Should be kubectl, not kubecfg, but otherwise is a good idea. etcd tools would be useful, too:
I'll take this on if no one else wants to do it. May take me a day or two to get to it.
Thinking out loud here... do we really want to encourage people to do admin and/or job runny stuff on their master?
I see it as a debugging tool.

Discussion:
cp "${KUBE_SERVER_BINARIES[@]/#/${LOCAL_OUTPUT_BINPATH}/${platform}/}"  "${release_stage}/server/bin/" <ins> # Include the client binaries here too as they are useful debugging tools. cp "${KUBE_CLIENT_BINARIES[@]/#/${LOCAL_OUTPUT_BINPATH}/${platform}/}"  "${release_stage}/server/bin/" </ins> local package_name="${RELEASE_DIR}/kubernetes-server-${platform_tag}.tar.gz" kube::release::create_tarball "${package_name}" "${release_stage}/.." done

rm -rf "${release_stage}" mkdir -p "${release_stage}" <del> cp -R "${LOCAL_OUTPUT_BINPATH}" "${release_stage}/platforms" </del> <ins> # Copy all of the client binaries in here, but not test or server binaries. # The server binaries are included with the server binary tarball. local platform for platform in "${KUBE_CLIENT_PLATFORMS[@]}"; do mkdir -p "${release_stage}/platforms/${platform}" cp "${KUBE_CLIENT_BINARIES[@]/#/${LOCAL_OUTPUT_BINPATH}/${platform}/}"  "${release_stage}/platforms/${platform}" done </ins> # We want everything in /cluster except saltbase.  That is only needed on the # server.

<ins> /usr/local/bin/kubecfg: file.managed: - source: salt://kube-bins/kubecfg - user: root - group: root - mode: 755 /usr/local/bin/kubectl: file.managed: - source: salt://kube-bins/kubectl - user: root - group: root - mode: 755 </ins>

- controller-manager - scheduler - nginx <ins> - kube-client-tools </ins> - logrotate {% if grains['cloud'] is defined and grains['cloud'] == 'azure' %} - openvpn
Change:
to reproduce: create vagrant kubernetes with 5 minions. try guest book example on it. After provisioning: then kill 10.245.2.6 minion: then we get: Nothing changes even after waiting for significant period of time. Please note, that while redis-master wasn't in replication controller and it's not expected for it to restart, it's still wrongfully marked as Running.

Discussion:
} func getPodStatus(pod *api.Pod, minions client.MinionInterface) (api.PodStatus, error) { <del> if pod.CurrentState.Info == nil || pod.CurrentState.Host == "" { </del> <ins> if pod.CurrentState.Host == "" { </ins> return api.PodWaiting, nil } res, err := minions.ListMinions()

if !found { return api.PodTerminated, nil } <ins> if pod.CurrentState.Info == nil { return api.PodWaiting, nil } </ins> running := 0 stopped := 0 unknown := 0

&api.Pod{ DesiredState: desiredState, CurrentState: api.PodState{ <ins> Host: "machine-2", }, }, api.PodTerminated, "no info, but bad machine", }, { &api.Pod{ DesiredState: desiredState, CurrentState: api.PodState{ </ins> Info: map[string]docker.Container{ "containerA": runningState, "containerB": runningState,
Change:
I was running through the vSphere instructions a couple weeks ago and got hung up on the clusterresource issue documented here: Seeing that is was fixed and how i didn't make much progress - I decdied to start over from scratch on a new vm. Now it appears that something is broken on git as seems i cant pull the source anymore -- or maybe the instructions are broken. ( Tried this on two seperate ubuntu 14.04 vms to make sure it wasn't something on first machine) Can't seem to get past this.... go get can't load package: package no buildable Go source files in Maybe i am missing something?
Our root repo isn't actually a go package as there are no buildable files there. Instead I'd follow the instructions here: Where did you see those instructions? I'd love to fix it up.
Thanks for the heads up! I will give those instructions a try. Here is what I was using:
Has that changed recently? I recall copying the initial set of instructions from the GCE guide.
You might have caught a snapshot when the instructions were broken. There was a lot in flight there. I'll send a PR to fix up the instructions.
Thanks .

Discussion:
6. Get the Kubernetes source: ```sh <del> go get github.com/GoogleCloudPlatform/kubernetes cd $GOPATH/src/github.com/GoogleCloudPlatform/kubernetes </del> <ins> mkdir -p $GOPATH/src/github.com/GoogleCloudPlatform git clone https://github.com/GoogleCloudPlatform/kubernetes.git cd kubernetes </ins> ``` ### Setup
Change:
When following the "run locally" guide I ran in to this issue: I found that is the function start_etcd which is calling (something like): I'm on Ubuntu 14.04 and installed etcd using the go get / go install as detailed in . Update: This is because I'm using go get / go install. If you take a look at it says not to use the master branch (breaking changes). You need to install etcd from the releases, not from go get. So I suppose the guide should be updated to point to ?
Hm, I thought we fixed this already? I guess maybe it was wrong in multiple places.
Certainly in the locally guide here: It lists a "go get, go install" way to get etcd
Thanks for the fix!
what exact version of etcd do we need?
If you look in the install- script it shows the revision we chose. Brendan On Oct 25, 2014 9:49 PM, "Ming Fang" wrote:

Discussion:
#### etcd <del> You need an etcd somewhere in your path. To get from head: </del> <ins> You need an [etcd](https://github.com/coreos/etcd) somewhere in your path. Get the [latest release](https://github.com/coreos/etcd/releases/) and place it in `/usr/bin`. </ins> <del> ``` go get github.com/coreos/etcd go install github.com/coreos/etcd sudo ln -s "$GOPATH/bin/etcd" /usr/bin/etcd # Or just use the packaged one: sudo ln -s "$REPO_ROOT/target/bin/etcd" /usr/bin/etcd ``` </del> ### Starting the cluster