Skip to content

Instantly share code, notes, and snippets.

View thockin's full-sized avatar

Tim Hockin thockin

View GitHub Profile
We have an API type which roughly looks like:
```
type ResourcePool struct {
// standard stuff
Devices []Device
}
type Device struct {
Name string
package main
import (
"bytes"
"testing"
)
//
// Baseline perf for single operations
//
@thockin
thockin / ingress-prod-v6.yaml.diff
Created March 28, 2021 18:26
Tweaks I made to k8s.io config (beyond the existing prod yamls) for managed certs
--- ingress-prod-v6.yaml 2021-03-16 16:03:15.916458352 +0000
+++ thockin.ingress-prod-v6.yaml 2021-03-28 18:23:41.981625351 +0000
@@ -4,12 +4,12 @@
name: k8s-io-v6
labels:
app: k8s-io
- namespace: k8s-io-prod
+ namespace: thockin-test-certs
annotations:
- kubernetes.io/ingress.global-static-ip-name: k8s-io-ingress-prod-v6
@thockin
thockin / generate_svc_create_test_inputs.go
Created November 25, 2020 08:24
Hack to generate testcases for service REST create-test
package main
import (
"fmt"
"strings"
)
func strlist(strs ...string) []string {
return strs
}
@thockin
thockin / generate_svc_test_matrix.go
Last active November 20, 2020 00:39
Code to generate all full set of service IP-Family test cases
package main
import (
"fmt"
"strings"
)
func strlist(strs ...string) []string {
return strs
}
@thockin
thockin / nginx.conf
Last active March 21, 2023 11:00
Idea: nginx vanity domain fronting gcr.io
# This is a GCR vanity domain. It aliases our domain to a specific
# bucket in GCR.
# e.g.`docker pull gcr.example.com/foobar` -> gcr.io/my_bucket/foobar
server {
server_name gcr.example.com;
listen 80;
listen 443 ssl;
location = /v2/ {
# If we redirect this, it can detect as unauthorized, but the token
package main
import (
"fmt"
"sync"
"time"
"k8s.io/client-go/pkg/util/flowcontrol"
"github.com/golang/glog"
@thockin
thockin / gist:36674d78bf213608f0e2ae4de06ef30d
Last active August 28, 2016 16:36
Use docker to build Go, via Makefile
bin/$(ARCH)/$(BIN): FORCE
@mkdir -p bin/$(ARCH)
@mkdir -p .go/src/$(GO_PKG) .go/pkg .go/bin .go/std/$(ARCH)
docker run \
-u $$(id -u):$$(id -g) \
-v $$(pwd)/.go:/go \
-v $$(pwd):/go/src/$(GO_PKG) \
-v $$(pwd)/bin/$(ARCH):/go/bin \
-v $$(pwd)/.go/std/$(ARCH):/usr/local/go/pkg/linux_$(ARCH)_static \
$(BUILD_IMAGE) \
```
# hostA exists
root@kubernetes-minion-32zi:/home/thockin# curl 10.244.1.27:9376
hostA
# no ipvs yet
root@kubernetes-minion-32zi:/home/thockin# ipvsadm
IP Virtual Server version 1.2.1 (size=4096)
Prot LocalAddress:Port Scheduler Flags
-> RemoteAddress:Port Forward Weight ActiveConn InActConn
root@test1:/home/thockin# ps auxw | grep docker
root 2312 0.0 0.0 7840 1976 pts/1 S+ 15:46 0:00 grep docker
root@test1:/home/thockin# curl https://get.docker.com | sh >/dev/null 2>&1
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 10858 100 10858 0 0 54886 0 --:--:-- --:--:-- --:--:-- 88276
root@test1:/home/thockin# ps auxw | grep docker
root 3868 0.0 0.5 85400 20768 ? Sl 15:47 0:00 /usr/bin/docker daemon -p /var/run/docker.pid