Piggy Bank

Overview Piggy Bank was born from a desire to easily store accessible secrets anywhere and not needing to expose HTTP ports for things like Vault. This project is no where near as robust as Vault (hence the name Piggy Bank) but it is desirable to be able to store secrets in the NATS KV store and have secrets be accessible to services using the bus. Authentication Authentication and authorization is done by using normal NATS auth....

August 29, 2022 · 3 min · 431 words · John Hooks

Goless

Overview It’s been a goal of mine for a while to write a Kubernetes operator. I was playing with Kubeless and I didn’t like how they implemented their support for Golang so I decided to write my own. Operators Operators are a deployment of a Kubernetes controller and Custom Resource Definitions (CRDs). The controller watches in a loop for new custom resources created and then takes some action. The controller lets you extend the ability of Kubernetes without directly changing any Kubernetes code....

October 2, 2021 · 2 min · 389 words · John Hooks

Bbolt Client

I use BoltDb in a few projects of mine because it’s lightweight and easily embedded in Go. However, everytime I write something that uses BoltDB I find myself writing a ton of boilerplate to complete the same tasks in every project. For example to create a bucket you need something like this: package main import ( "go.etcd.io/bbolt" "log" "fmt" ) func main() { db, err := bbolt.Open("mydb.db", 0664, nil) if err !...

May 29, 2021 · 3 min · 501 words · John Hooks

Functional Options

I was looking at ways to do method chaining in Go and found this article from Jon Calhoun about functional options. He made some really good points. I read through it probably three times, and being the dull knife that I am had trouble wrapping my head around it. So I sat down and tried to figure it out. I figured I’d put this post together for anyone who is in the same boat as me and wants a nice simple example of how functional options work....

August 4, 2020 · 4 min · 684 words · John Hooks

Contributing to Go Projects

Contributing to projects on GitHub is a great way to learn, contribute, and help make the software you use better. Normally, you would just make a fork of the project and then clone your fork and do your work. Then you would push to a branch in your fork and open a pull request for that branch. Go is a little different however. Since the imports are specific paths to GitHub/GitLab/etc projects you can’t necessarily just fork the project and do work in your fork....

April 20, 2020 · 2 min · 299 words · John Hooks

Testing Terraform with Terratest

This should be another short one. One of the advantages of IaC (infrastructure as code) is the fact you can test the things you write. There are multiple tools to test your Terraform configs with, but Gruntwork has created an awesome Go package to test your Terraform configs called Terratest. The advantage to Terratest is you just write Go like you would with anything else and it just works. Here’s an example module to create an ec2 instance:...

March 6, 2020 · 2 min · 355 words · John Hooks

Using Terraform and Ansible Together

This should be a short one. So Ansible has dynamic inventories however I’ve found it a bit slow with VMware if you have a lot of infrastructure to parse through (a lot being around 3,000 VMs in your vCenter and slow being around 15 minutes). I also couldn’t figure out a way to use tags to limit what you’re searching on. This admittedly could have changed recently but since I’ve been using this method I haven’t tried too hard to find out....

February 1, 2020 · 2 min · 219 words · John Hooks