Skip to content

Instantly share code, notes, and snippets.

@tgross
tgross / vmctl
Created July 27, 2021 19:27
Fircracker virtual machine control script
#!/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 / install-acls.sh
Created March 31, 2021 17:36
Nomad ACLs setup for development
#!/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" \
### 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:
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
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
@tgross
tgross / plugin.nomad
Created March 25, 2020 14:33
CSI hostpath quick test
job "csi-plugin" {
datacenters = ["dc1"]
group "csi" {
task "plugin" {
driver = "docker"
config {
image = "quay.io/k8scsi/hostpathplugin:v1.2.0"
job "countdash" {
datacenters = ["dc1"]
group "api" {
network {
mode = "bridge"
}
service {
name = "count-api"
job "countdash" {
datacenters = ["dc1"]
group "api" {
network {
mode = "bridge"
}
service {
name = "count-api"
@tgross
tgross / primes.go
Created November 22, 2019 16:14
Dummy application for testing Nomad batch workloads
package main
import (
"fmt"
"os"
"strconv"
)
// return list of primes less than N
func sieveOfEratosthenes(N int) (primes []int) {
[vagrant@test-centos build]$ sudo ~/execsnoop
PCOMM PID PPID RET ARGS
ps 2202 1312 0 /usr/bin/ps afx
nomad 2207 1312 0 /usr/bin/nomad job run countdash.hcl
getconf 2212 2207 0 /usr/bin/getconf CLK_TCK
runc 2216 632 0 /usr/bin/runc --version
docker-init 2221 632 0 /usr/bin/docker-init --version
runc 2222 632 0 /usr/bin/runc --version
docker-init 2227 632 0 /usr/bin/docker-init --version
ps 2228 1312 0 /usr/bin/ps afx