Skip to content

Instantly share code, notes, and snippets.

View eparis's full-sized avatar

Eric Paris eparis

  • Red Hat
  • Raleigh, NC
View GitHub Profile
@eparis
eparis / gist:ddbf2b41ad14f5e0d993
Created April 16, 2015 21:29
My thoughts on the kubernetes Mount() function
func doMount(source string, target string, fstype string, options []string) (string, error) {
// Build mount command as follows:
// mount [-t $fstype] [-o $options] [--source $source] --target $target
mountArgs := []string{}
if len(fstype) > 0 {
mountArgs = append(mountArgs, "-t", fstype)
}
if options != nil && len(options) > 0 {
mountArgs = append(mountArgs, "-o", strings.Join(options, ","))
}
@eparis
eparis / gist:183e866b1d85f408db6e
Created April 20, 2015 00:04
SchedulingDisabled Test
{
minion: api.Node{
ObjectMeta: api.ObjectMeta{Name: "foo2"},
Spec: api.NodeSpec{Unschedulable: true},
Status: api.NodeStatus{Conditions: []api.NodeCondition{
{Type: api.NodeReady, Status: api.ConditionTrue},
{Type: api.NodeReady, Status: api.ConditionTrue}}},
},
status: "Ready,SchedulingDisabled",
},
# rm -rf /var/lib/kubelet/*
# docker run --rm -ti -v /var/lib/kubelet:/var/lib/kubelet fedora /bin/bash
bash-4.3# ls -l /var/lib/kubelet/
total 0

Outside of the container, on the host

# mkdir /var/lib/kubelet/subdir
// argsMinusFirstX removes only the first x from args. Otherwise, commands that look like
// openshift admin policy add-role-to-user admin my-user, lose the admin argument (arg[4]).
func argsMinusFirstX(args []string, x string) []string {
for i, y := range args {
if x == y {
return append(args[:i], args[i+1:]...)
}
}
return args
}
diff --git a/contrib/completions/bash/kubectl b/contrib/completions/bash/kubectl
index 639d768..5f546db 100644
--- a/contrib/completions/bash/kubectl
+++ b/contrib/completions/bash/kubectl
@@ -157,14 +157,13 @@ __handle_word()
}
# call kubectl get $1,
-# use the first column in compgen
-# we could use templates, but then would need a template per resource
@eparis
eparis / gist:3a7488e5aa5acf3fedbe
Last active August 29, 2015 14:21
Openshift - Who Wrote
Ignore filter on "(Godeps|third_party|api/swagger-spec|pkg/ui/datafile.go|www/.*/shared/assets/sampleData1.json|pkg/assets/bindata.go)"
Grabbing changesets...done       
Processed 1692 csets from 73 developers
3 employers found
A total of 240876 lines added, 105802 removed (delta 135074)

Developers with the most changesets

@eparis
eparis / gist:f8b3005671e06547665a
Last active August 29, 2015 14:21
Docker - who wrote

Corp Contributors to Docker

I'm ignoring all merge commits and I'm ignoring all files that match the following regex. This cuts out huge numbers of automatically generated files which hugely skew results.

Ignore filter on "(Godeps|third_party|vendor|docs/theme|.svg|api/swagger-spec|pkg/ui/datafile.go|www/.*/shared/assets/sampleData1.json|pkg/assets/bindata.go)"

Top changeset contributors by employer

(Unknown)                 4520 (47.9%)
"Docker"                  3821 (40.5%)
# etcdctl get /coreos.com/network/config
{"Network": "4.0.0.0/8", "SubnetLen": 24, "Backend": {"Type": "vxlan"}}
# etcdctl ls /coreos.com/network/subnets
server:
flanneld --etcd-endpoints="http://127.0.0.1:4001" --listen=":8081"
client1:
flanneld --remote="10.12.6.179:8081"
@eparis
eparis / gist:42ec63e538150d5b39fc
Created June 26, 2015 22:02
e2e dns test failure

/var/lib/kubernetes-unit-test/_output/local/bin/linux/amd64/e2e.test --provider="local" --ginkgo.v=true --ginkgo.focus="DNS" --kubeconfig="$HOME/.kubernetes_auth" --host="http://127.0.0.1:8080"

"
>>> testContext.KubeConfig: /root/.kubernetes_auth
INFO: Waiting up to 10m0s for all pods (need at least 0) in namespace 'default' to be running and ready
INFO: 12 / 12 pods in namespace 'default' are running and ready (5 seconds elapsed)
Running Suite: Kubernetes e2e suite
===================================
18:48:37 rpm -qa kube\* brew\*
18:48:37 kubernetes-unit-test-0.17.1-6.el7.x86_64
18:48:37 brewkoji-1.9-1.el7eng.noarch
18:48:54
18:48:54 PLAY [ans_cluster_post] *******************************************************
18:48:54
18:48:54 TASK: [Install basic packages] ************************************************
18:48:54 ok: [10.8.53.188] => (item=brewkoji,coreutils,etcd,hostname,rsync,NetworkManager)
18:48:54
18:48:54 TASK: [Show result of pkg update] *********************************************