Skip to content

Instantly share code, notes, and snippets.

@negz
negz / HeliosSoloTesting.java
Last active December 7, 2015 19:26
Potential helios solo / testing usage.
package com.spotify.wiggum;
import com.google.common.net.HostAndPort;
import com.spotify.helios.testing.TemporaryJob;
import com.spotify.helios.testing.TemporaryJobs;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
@negz
negz / vol.py
Created October 12, 2016 04:01
secret-volume creation snippet
#!/usr/bin/env python
import logging
import sys
import requests
def main():
logging.basicConfig(level=logging.DEBUG)
@negz
negz / play.go
Created October 13, 2016 00:04
SRV resolution test
func main() {
log := zap.New(zap.NewTextEncoder(), zap.AddCaller(), zap.DebugLevel)
lib := dns.NewLookupLib("127.0.0.1:53")
srv := "_talos._https.example.org"
b := lb.New(&lb.Config{Dns: lib, Strategy: random.RandomStrategy}, srv)
for {
time.Sleep(time.Second)
a, err := b.Next()
@negz
negz / audit.py
Created February 15, 2017 17:21
Log audit script
import json
json_lines = [json.loads(line) for line in open("sumo.json", "r").readlines()]
for line in json_lines:
host = line.get("host")
if host is None:
print "Line missing host key"
if host == "":
print "Line has empty host key"
@negz
negz / linkerd-client-state.json
Created January 30, 2018 23:52
linkerd HTTPS failure
{
"/$/inet/localhost/8001": {
"state": "bound",
"addresses": [
"localhost:8001"
]
},
"/$/io.buoyant.rinet/443/www.example.org": {
"state": "bound",
"addresses": [
@negz
negz / linkerd-init-container.yaml
Created January 31, 2018 01:46
linkerd init container for transparent HTTP proxy
initContainers:
- name: linkerd-transparent-proxy
env:
- name: L5D_HOST
valueFrom:
fieldRef:
fieldPath: status.hostIP
- name: L5D_PORT
value: "4140"
image: googlecontainer/debian-iptables-amd64:v9
@negz
negz / requested.sh
Created February 21, 2018 04:47
Kubernetes Cluster requested resources
#!/bin/bash
set -e
KUBECTL="kubectl"
NODES=$($KUBECTL get nodes --no-headers -o custom-columns=NAME:.metadata.name)
function usage() {
local node_count=0
local total_percent_cpu=0
{
"/$/inet/localhost/8001": {
"state": "bound",
"addresses": [
"localhost:8001"
]
},
"/%/io.l5d.k8s.daemonset/kube-system/http-incoming/l5d/#/io.l5d.k8s.http/live/80/nginx": {
"state": "bound",
"addresses": [
{
"/%/io.l5d.k8s.daemonset/kube-system/http-incoming/l5d/#/io.l5d.k8s.http/live/8080/tasking-api": {
"state": "bound",
"addresses": [
"REDACTED.0.52:4141",
"REDACTED.2.173:4141",
"REDACTED.0.232:4141"
]
}
}
@negz
negz / client_state.json
Created October 11, 2018 07:11
linkerd unable to reach API server
// 20181010231740
// http://tfk-negz-ing-8gmr.REDACTED:9990/client_state.json
{
"/$/inet/localhost/8001": {
"state": "bound",
"addresses": [
"localhost:8001"
]
},