Skip to content

Instantly share code, notes, and snippets.

@brianpursley
brianpursley / example-scrape-target.html
Created November 20, 2015 15:35
Example HTML file for scraping
<html>
<head>
<title>Example Web Page</title>
<style>
.container {
display: table;
}
.row {
display: table-row;
}
@brianpursley
brianpursley / lambda.js
Last active March 11, 2017 02:53
AWS Lambda function that publishes to SNS
var AWS = require("aws-sdk");
exports.handler = (event, context, callback) => {
var sns = new AWS.SNS();
sns.publish({
Message: 'YOUR MESSAGE HERE',
Subject: 'YOUR SUBJECT HERE',
TopicArn: 'YOUR SNS TOPIC ARN HERE'
}, function() {
callback(null, {
@brianpursley
brianpursley / backup.sh
Created April 10, 2017 19:54
Script to backup a folder (/share) and capture incremental changes since the last backup in a timestamp-named folder
#!/bin/bash
ts=`date +%Y%m%d_%H%M%S`
rsync -rtm --compare-dest=/mnt/usb1/backups/snapshot --modify-window=2 /share /mnt/usb1/backups/$ts
find /mnt/usb1/backups/$ts -type d -empty -delete
rsync -rt --delete --modify-window=2 /share /mnt/usb1/backups/snapshot
@brianpursley
brianpursley / docker-compose.yml
Created August 30, 2018 02:18
Docker compose config for running Elastic Search and Kibana locally in docker containers
version: '3'
services:
elasticsearch:
container_name: elasticsearch
image: docker.elastic.co/elasticsearch/elasticsearch:6.4.0
volumes:
- esdata:/usr/share/elasticsearch/data
ports:
@brianpursley
brianpursley / install-metrics-server.sh
Last active January 23, 2020 22:48
Download and install metrics-server into a kind kubernetes cluster
wget -O /tmp/metrics-server-master.zip https://github.com/kubernetes-sigs/metrics-server/archive/master.zip
unzip -u /tmp/metrics-server-master.zip -d /tmp
rm /tmp/metrics-server-master.zip
kubectl apply -f /tmp/metrics-server-master/deploy/1.8+/
rm -rf /tmp/metrics-server-master
kubectl patch deploy metrics-server -n kube-system --type json --patch '[{"op":"add","path":"/spec/template/spec/containers/0/args/-","value":"--kubelet-insecure-tls"},{"op":"add","path":"/spec/template/spec/containers/0/args/-","value":"--kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname"}]'
@brianpursley
brianpursley / get-nodeport-url.sh
Last active February 6, 2020 02:06
Script to get address of kubernetes nodeport service when running locally using (using kind for example)
#!/bin/sh
nodeport=$(kubectl get services -o jsonpath="{..nodePort}") && kubectl get node -o jsonpath="{..addresses[0].address}" | xargs -n1 printf -- "http://%s:$nodeport\n"
@brianpursley
brianpursley / test-output.txt
Created May 12, 2020 16:01
make test-integration WHAT=./test/integration/scheduler GOFLAGS="-v" KUBE_TEST_ARGS='-run ^TestNominatedNodeCleanUp$$$$'
+++ [0512 12:00:54] Checking etcd is on PATH
/usr/bin/etcd
+++ [0512 12:00:54] Starting etcd instance
/home/bpursley/go/src/k8s.io/kubernetes/third_party/etcd:/home/bpursley/gems/bin:/home/bpursley/.nvm/versions/node/v12.14.0/bin:/usr/lib/jvm/jdk-13.0.1/bin:/home/bpursley/.local/bin:/home/bpursley/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/bpursley/.dotnet/tools:/usr/share/rvm/bin:/home/bpursley/bin:/usr/local/go/bin:/home/bpursley/go/bin:/home/bpursley/.krew/bin:/home/bpursley/kubectl-plugins
etcd --advertise-client-urls http://127.0.0.1:2379 --data-dir /tmp/tmp.hFmwtBV9wu --listen-client-urls http://127.0.0.1:2379 --debug > "/dev/null" 2>/dev/null
Waiting for etcd to come up.
+++ [0512 12:00:55] On try 1, etcd: : {"health":"true"}
{"header":{"cluster_id":"14841639068965178418","member_id":"10276657743932975437","revision":"2","raft_term":"2"}}+++ [0512 12:00:55] Running integration test cases
+++ [0512 12:00:58] Running tests without code cov
@brianpursley
brianpursley / test-output-pr90978.txt
Created May 12, 2020 16:11
make test-integration WHAT=./test/integration/scheduler GOFLAGS="-v" KUBE_TEST_ARGS='-run ^TestNominatedNodeCleanUp$$$$'
+++ [0512 12:10:46] Checking etcd is on PATH
/usr/bin/etcd
+++ [0512 12:10:46] Starting etcd instance
/home/bpursley/go/src/k8s.io/kubernetes/third_party/etcd:/home/bpursley/gems/bin:/home/bpursley/.nvm/versions/node/v12.14.0/bin:/usr/lib/jvm/jdk-13.0.1/bin:/home/bpursley/.local/bin:/home/bpursley/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/bpursley/.dotnet/tools:/usr/share/rvm/bin:/home/bpursley/bin:/usr/local/go/bin:/home/bpursley/go/bin:/home/bpursley/.krew/bin:/home/bpursley/kubectl-plugins
etcd --advertise-client-urls http://127.0.0.1:2379 --data-dir /tmp/tmp.Ga0I2sAFta --listen-client-urls http://127.0.0.1:2379 --debug > "/dev/null" 2>/dev/null
Waiting for etcd to come up.
+++ [0512 12:10:47] On try 1, etcd: : {"health":"true"}
{"header":{"cluster_id":"14841639068965178418","member_id":"10276657743932975437","revision":"2","raft_term":"2"}}+++ [0512 12:10:47] Running integration test cases
+++ [0512 12:10:52] Running tests without code cov
@brianpursley
brianpursley / flake-culprit-output.txt
Last active May 15, 2020 01:15
output of running `./flake-culprits.sh pull-kubernetes-e2e-kind 250` on 5/14/2020 9:15pm ET
89 [sig-api-machinery] client-go should negotiate watch and report errors with accept \
71 [sig-apps] DisruptionController Listing PodDisruptionBudgets for all namespaces should list and delete a collection of PodDisruptionBudgets
69 [sig-api-machinery] Garbage collector should orphan pods created by rc if delete options say so [Conformance]
68 [sig-storage] Subpath Atomic writer volumes should support subpaths with projected pod [LinuxOnly] [Conformance]
67 [k8s.io] Docker Containers should use the image defaults if command and args are blank [NodeConformance] [Conformance]
67 [k8s.io] Pods should be updated [NodeConformance] [Conformance]
67 [k8s.io] PrivilegedPod [NodeConformance] should enable privileged commands [LinuxOnly]
67 [k8s.io] [sig-node] Security Context should support container.SecurityContext.RunAsUser [LinuxOnly]
67 [sig-storage] ConfigMap should be consumable from pods in volume with mappings [NodeConformance] [Conformance]
67 [sig-storage] Projec
@brianpursley
brianpursley / flake-culprit.sh
Last active May 15, 2020 01:15
Count how many times a test occurs before the first failure, to help track down tests that cause other tests that come after them to fail
#!/bin/bash
#
# Example Usage:
#
# ./flake-culprits.sh pull-kubernetes-e2e-kind 250
#
job=$1
max=$2