Skip to content

Instantly share code, notes, and snippets.

@tgross
tgross / 0001-sdnotify-support.patch
Created July 10, 2023 02:21
WIP for sdnotify support for Nomad
From 0607eb94aba1566e12c7f688a2c0876906ab05f8 Mon Sep 17 00:00:00 2001
From: Tim Gross <tgross@hashicorp.com>
Date: Sun, 9 Jul 2023 22:20:44 -0400
Subject: [PATCH] sdnotify support
---
command/agent/agent.go | 18 ++++++++++++++
command/agent/command.go | 9 +++++++
command/agent/notify_default.go | 18 ++++++++++++++
command/agent/notify_linux.go | 44 +++++++++++++++++++++++++++++++++
@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) {