Skip to content

Instantly share code, notes, and snippets.

View rosenhouse's full-sized avatar

Gabe Rosenhouse rosenhouse

View GitHub Profile
#! See https://kubernetes.slack.com/archives/CH8KCCKA5/p1685663088982309
#@ load("@ytt:overlay", "overlay")
---
apiVersion: v1
kind: Service
metadata:
labels:
foo: bar
#! See https://kubernetes.slack.com/archives/CH8KCCKA5/p1685663088982309
#@ load("@ytt:overlay", "overlay")
#@ load("@ytt:template", "template")
---
apiVersion: v1
kind: Service
metadata:
labels:
#! See https://kubernetes.slack.com/archives/CH8KCCKA5/p1685663088982309
#@ load("@ytt:overlay", "overlay")
---
apiVersion: v1
kind: Service
metadata:
labels:
foo: bar
@rosenhouse
rosenhouse / per-port-balancing.yaml
Last active May 13, 2021 22:31
kubernetes per-port backend selection example
# shows how kubernetes kubeproxy can select backends based on which port of a multi-port service is being accessed
# nginx is only listening on port 80
# kuard is only listening on port 8080
# the partial-ports service exposes both 80 and 8080
#
# kubectl -n foo run -it --rm --restart=Never --image=curlimages/curl:7.76.1 test1 -- curl partial-ports:80
# and
# kubectl -n foo run -it --rm --restart=Never --image=curlimages/curl:7.76.1 test1 -- curl partial-ports:8080
# both succeed 100% of the time
---
# parent.yaml
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: some-parent
  namespace: default
data: {}
@rosenhouse
rosenhouse / new.yaml
Last active September 10, 2019 16:23
PSM TLS Passthrough for HTTP2
---
apiVersion: networking.istio.io/v1alpha3
kind: ServiceEntry
metadata:
labels:
cluster-name: gabe
name: 05636106-9670-49f2-9180-dc0d76122990
namespace: psm-system
spec:
endpoints:
brew install kubebuilder
brew install etcd

# build kube-apiserver so we can use it in integration tests
cd ~/workspace/
git clone https://github.com/kubernetes/kubernetes
cd kubernetes
make generated_files
go build -o /usr/local/bin/kube-apiserver ./cmd/kube-apiserver
@rosenhouse
rosenhouse / extract_access_data.sh
Created September 5, 2018 11:40
extract data from gorouter access logs
#!/bin/bash
set -euo pipefail
shopt -s nullglob
# extract data about every request from all access logs across all gorouters
deployment_logs_dir="$1"
LOGREGEX='^(.*?) - \[(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}).(\d+)(.*?)] "(.*?) (.*?) (.*?)" (\d+) (\d+) (\d+) "(.*?)" "(.*?)" "(.*?)" "(.*?)" x_forwarded_for:"(.*?)" x_forwarded_proto:"(.*?)" vcap_request_id:"(.*?)" response_time:(\d+\.\d+) app_id:"(.*?)" app_index:"(.*?)" x_b3_traceid:"(.*?)" x_b3_spanid:"(.*?)" x_b3_parentspanid:"(.*?)"$'

from local machine

git clone https://github.com/envoyproxy/data-plane-api
cd data-plane-api
bazel build //...
protoc \
   -I bazel-data-plane-api/external/googleapis/google/rpc/ \
   -I bazel-data-plane-api/external/com_lyft_protoc_gen_validate/ \
   -I . \
   --include_imports \

System Preferences > Security & Privacy > "Allow" extension from Oracle

Then

sudo /Library/Application\ Support/VirtualBox/LaunchDaemons/VirtualBoxStartup.sh restart