Skip to content

Instantly share code, notes, and snippets.

@garethr
garethr / cnab-schema.json
Last active December 31, 2018 11:11
CNAB JSON Schema and questions based on the current specification
{
"$schema": "http://json-schema.org/schema#",
"type": "object",
"additionalProperties": false,
"properties": {
"schemaVersion": {
"type": "string"
},
"name": {
"type": "string"

Using Tilt from within a container.

Tilt is great, but it doesn't currently run on Windows. But can we run it in a container on Docker Desktop for Windows instead?

First build a Docker image for Tilt using the Dockerfile in this Gist.

$ docker build -t garethr/tilt .
@garethr
garethr / count.py
Last active October 22, 2018 14:51
Kubernetes kinds used in Helm charts official repo
import glob
from collections import Counter
kinds = []
for filename in glob.iglob('**/*.yaml'):
with open(filename, 'r') as handle:
for line in handle:
if line.strip().startswith('kind:'):
kinds.append(line.strip()[5:])
@garethr
garethr / convert.py
Last active July 7, 2021 02:40 — forked from phaer/convert.py
kubernetes open api to hcl2 spec
import sys
import json
from collections import OrderedDict
from contextlib import contextmanager
def resolve_json_pointer(spec, reference):
prefix, definitions, name = reference.split('/')
return spec.get(definitions).get(name)
@garethr
garethr / compose.hcldec
Created August 4, 2018 10:10
Experimenting with an HCL definition for Compose
object {
attr "version" {
type = string
required = true
}
block_map "services" {
block_type = "service"
labels = ["name"]
object {
@garethr
garethr / README.md
Created December 6, 2017 16:30
Demo from KubeCon metadata talk of kubetest
$ docker run -it -v ${PWD}:/examples garethr/kubetest --tests /examples/tests /examples/app1.yaml --verbose
INFO /examples/app1.yaml should indicate which team owns the deployment
@garethr
garethr / README.md
Last active December 5, 2017 16:22
Lumogon and Kubernetes example

The following demo assumes a running minikube instance.

First grab access to the Docker socket for minikube. On *nix:

eval $(minikube docker-env)

On Windows:

@garethr
garethr / README.md
Created September 21, 2017 12:05
Use docker-ls to query the Europa container registry

Now we have a Europa registry, interacting with the API might be of interest.

Let's grab docker-ls for this demo from https://github.com/mayflower/docker-ls. You can either download the pre-build binaries or build a local docker image like so:

git clone https://github.com/mayflower/docker-ls.git
docker build -t docker-ls .

The following assumes you have a registry running based on the Compose file above, and you have your API token handy.

@garethr
garethr / .env
Last active September 21, 2017 11:37
Launch a local version of Europa from Distelli using Docker Compose. Ideal for testing or experiments.
USER_PASSWORD=Pa55w0rd
USER_NAME=distelli
ROOT_PASSWORD=S3r10usPa55w0rd
DATABASE_NAME=europadb
@garethr
garethr / README.md
Created August 16, 2017 11:29
Pre-generating Puppet certificates

Pre-generating Puppet certificates

On occasion you might have need to generate a set of certificates for a Puppet infrastructure, potentially as part of a provisioning process.

The following works but is not guarenteed to be secure or a good idea. If you follow these instructions then I'm assuming you know exactly what you're doing and you're solving an odd problem, or you're working on Puppet rather than with it.

First create a temporary master: