Skip to content

Instantly share code, notes, and snippets.

View ironcladlou's full-sized avatar

Dan Mace ironcladlou

  • Cary, NC
View GitHub Profile
#!/bin/bash
choice=$(oc get --namespace openshift-etcd --selector etcd pods -o json | jq -r '.items[] | .spec.nodeName + " " + (.status.containerStatuses[] | select(.name=="etcd") | .containerID[8:])' | fzf)
IFS=' ' read node container_id <<< "$choice"
pid=$(oc debug --quiet nodes/$node -- chroot /host crictl inspect -o go-template --template '{{.info.pid}}' $container_id)
oc debug --quiet nodes/$node -- chroot /host strace -Tfe inject=fdatasync:delay_enter=800000 -e trace=fdatasync -p $pid
@ironcladlou
ironcladlou / debug-etcd-operator.sh
Created June 4, 2020 14:23
debug-etcd-operator.sh
#!/bin/bash
set -euo pipefail
function log {
local msg="$1"
echo -e "$\033[32m$(date +'%Y-%m-%d %H:%M:%S') $1 $\033[0;39m"
}
export KUBECONFIG=$(find $HOME/clusters -name kubeconfig | fzf)
@ironcladlou
ironcladlou / cidl.rb
Created May 21, 2020 19:25
CI downloader script
#!/usr/bin/env ruby
require 'uri'
require 'optparse'
def process_gcp(dir)
puts "processing gcp artifacts"
`mv #{dir}/artifacts/e2e-gcp #{dir}/artifacts/must-gather` if Dir.exist?("#{dir}/artifacts/e2e-gcp")
`mv #{dir}/artifacts/e2e-gcp-upgrade #{dir}/artifacts/must-gather` if Dir.exist?("#{dir}/artifacts/e2e-gcp-upgrade")
`tar xf #{dir}/artifacts/must-gather/must-gather.tar -C #{dir}/artifacts/must-gather --strip-components 2`
@ironcladlou
ironcladlou / tcpdump-pod
Last active May 5, 2020 17:28
OpenShift Network Helpers
#!/bin/bash
set -euo pipefail
NAMESPACE=$1
NAME=$2
IMAGE="${IMAGE:-quay.io/dmace/ditm}"
NODE_NAME="$(oc get --namespace $NAMESPACE pods $NAME -o go-template='{{ .spec.nodeName }}')"
CONTAINER_ID_URI="$(oc get --namespace $NAMESPACE pods $NAME -o go-template='{{ (index .status.containerStatuses 0).containerID }}')"
CONTAINER_ID="${CONTAINER_ID_URI:8}"
@ironcladlou
ironcladlou / clusterctl.rb
Created March 19, 2020 11:31
clusterctl.rb
#!/usr/bin/env ruby
require 'json'
require 'yaml'
require 'securerandom'
require 'etc'
require 'optparse'
require 'fileutils'
require 'tmpdir'
@ironcladlou
ironcladlou / TODO.md
Created March 13, 2020 17:28
Azure IPv6 TODO

Requires the following patches to get started:

  • openshift/installer#3251

    Pull the patch manually into the installer:

    git remote add jhixson74 https://github.com/jhixson74/installer.git
    git cherry-pick 11a381308dc2cfb21fcdaf97cc50fc42fd50b1eb
    

This presumably fixes some flakiness.

@ironcladlou
ironcladlou / project-settings.json
Last active February 20, 2020 21:09
Kubernetes VSCode Settings
// This is the project settings.json in the .vscode directory
{
"files.exclude": {
"staging": true,
},
"go.goroot": "/Users/dmace/.go/1.13.8",
"go.gopath": "/Users/dmace/Projects/kubernetes",
"go.toolsEnvVars": {
"GO111MODULE": "off",
"GOFLAGS": ""
@ironcladlou
ironcladlou / Dockerfile
Last active January 14, 2020 16:20
Reaper gotcha
FROM golang:1.13.5-buster
COPY main.go /go/reaper.go
RUN go build -o /bin/reaper /go/reaper.go
ENTRYPOINT ["/bin/reaper"]
stop := make(chan struct{})
go func() {
<-signals.SetupSignalHandler()
stop <- struct{}{}
}()
file := "/wherever"
go func() {
watcher, _ := fsnotify.NewWatcher()
#!/usr/bin/env ruby
# Takes a URL like: https://prow.svc.ci.openshift.org/view/gcs/origin-ci-test/logs/release-openshift-origin-installer-e2e-aws-serial-4.3/1331
require 'uri'
in_url = ARGV[0]
path = in_url.split("/")[5..-1].join("/")