Skip to content

Instantly share code, notes, and snippets.

@tgross
tgross / vmctl
Created Jul 27, 2021
Fircracker virtual machine control script
View vmctl
#!/usr/bin/env bash
set -euo pipefail
help() {
cat <<EOF
vmctl [COMMAND] [ARGS]
Launch firecracker VMs from configuration templates with networks
managed by CNI. VM configuration is stored in $VM_CONFIG_DIR
and network configuration is stored in $NET_CONFIG_DIR
@tgross
tgross / trace.log
Created Mar 11, 2022
TF_LOG=trace output
View trace.log
2022-03-11T16:15:27.973-0500 [INFO] Terraform version: 1.1.4
2022-03-11T16:15:27.974-0500 [INFO] Go runtime version: go1.17.2
2022-03-11T16:15:27.974-0500 [INFO] CLI args: []string{"terraform", "apply", "-auto-approve", "-var", "ip_address=[REDACTED]", "-var", "key_file_path=/Users/timgross/tmp/windowsupload/ssh.key"}
2022-03-11T16:15:27.974-0500 [TRACE] Stdout is a terminal of width 107
2022-03-11T16:15:27.974-0500 [TRACE] Stderr is a terminal of width 107
2022-03-11T16:15:27.974-0500 [TRACE] Stdin is a terminal
2022-03-11T16:15:27.974-0500 [DEBUG] Attempting to open CLI config file: /Users/timgross/.terraformrc
2022-03-11T16:15:27.974-0500 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2022-03-11T16:15:27.974-0500 [DEBUG] ignoring non-existing provider search directory terraform.d/plugins
2022-03-11T16:15:27.974-0500 [DEBUG] ignoring non-existing provider search directory /Users/timgross/.terraform.d/plugins
View containerd redis task with network_mode = "bridge"
$ sudo bpftrace ./execsnoop.bt
Attaching 3 probes...
TIME(ms) PID ARGS
1892 9766 /sbin/iptables --version
1893 9767 /sbin/iptables -t filter -S --wait
1895 9768 /sbin/iptables -t filter -C NOMAD-ADMIN -o nomad -d 172.26.64.0/20 -j ACCEPT --wait
1896 9769 /opt/cni/bin/bridge
2413 9803 /lib/udev/bridge-network-interface
2414 9805 /bin/networkctl list --no-pager --no-legend
2416 9806 /lib/open-iscsi/net-interface-handler start
@tgross
tgross / install-acls.sh
Created Mar 31, 2021
Nomad ACLs setup for development
View install-acls.sh
#!/bin/bash
set -e
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
ROOT_TOKEN=$(nomad acl bootstrap | awk '/Secret ID/{print $4}')
export NOMAD_TOKEN="$ROOT_TOKEN"
nomad acl policy apply \
-description "Anonymous policy" \
View gist:42753922b6488910b1e7691505599da5
### Keybase proof
I hereby claim:
* I am tgross on github.
* I am tgross (https://keybase.io/tgross) on keybase.
* I have a public key ASBkr5QXPfZ8YHaM4yjIRRHc0Jwq8Ne3cHxkdbhAjgUgXwo
To claim this, I am signing this object:
View trace.log
null_resource.example: Creating...
null_resource.example: Provisioning with 'remote-exec'...
null_resource.example (remote-exec): Connecting to remote host via SSH...
null_resource.example (remote-exec): Host: 127.0.0.1
null_resource.example (remote-exec): User: vagrant
null_resource.example (remote-exec): Password: false
null_resource.example (remote-exec): Private key: true
null_resource.example (remote-exec): Certificate: false
null_resource.example (remote-exec): SSH Agent: true
null_resource.example (remote-exec): Checking Host Key: false
View crash.log
2021-01-08T11:50:49.442-0500 [INFO] Terraform version: 0.15.0 alpha20210107
2021-01-08T11:50:49.442-0500 [INFO] Go runtime version: go1.15.2
2021-01-08T11:50:49.442-0500 [INFO] CLI args: []string{"/Users/tim/bin/terraform", "apply", "-auto-approve"}
2021-01-08T11:50:49.442-0500 [DEBUG] Attempting to open CLI config file: /Users/tim/.terraformrc
2021-01-08T11:50:49.442-0500 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2021-01-08T11:50:49.443-0500 [DEBUG] ignoring non-existing provider search directory terraform.d/plugins
2021-01-08T11:50:49.443-0500 [DEBUG] ignoring non-existing provider search directory /Users/tim/.terraform.d/plugins
2021-01-08T11:50:49.443-0500 [DEBUG] ignoring non-existing provider search directory /Users/tim/Library/Application Support/io.terraform/plugins
2021-01-08T11:50:49.443-0500 [DEBUG] ignoring non-existing provider search directory /Library/Application Support/io.terraform/plugins
2021-01-08T11:50:49.443-0500 [INFO] CLI command args: []string{"apply", "-auto-appr
View results.log
▶ NOMAD_TEST_LOG_LEVEL=info go test -v ./client/allocrunner/taskrunner -run=TestTasklet_Exec_Fast
=== RUN TestTasklet_Exec_Fast
TestTasklet_Exec_Fast: testlog.go:34: 2020-04-14T16:23:22.506-0400 [WARN] taskrunner/tasklet.go:144: tasklet timed out: timeout=3s
[goroutine 20] complete: finished 1001
[goroutine 20] complete: finished 1001
[goroutine 20] complete: finished 1001
[goroutine 20] complete: finished 1001
[goroutine 20] complete: finished 1001
[goroutine 20] complete: finished 1001
[goroutine 20] complete: finished 1001
@tgross
tgross / plugin.nomad
Created Mar 25, 2020
CSI hostpath quick test
View plugin.nomad
job "csi-plugin" {
datacenters = ["dc1"]
group "csi" {
task "plugin" {
driver = "docker"
config {
image = "quay.io/k8scsi/hostpathplugin:v1.2.0"
View connect-java.nomad
job "countdash" {
datacenters = ["dc1"]
group "api" {
network {
mode = "bridge"
}
service {
name = "count-api"