Skip to content

Instantly share code, notes, and snippets.

View sirhopcount's full-sized avatar

Adrian van Dongen sirhopcount

View GitHub Profile
#!/bin/bash
# configures bash prompt based on current kubernetes cluster context and namespace
# based on https://pracucci.com/display-the-current-kubelet-context-in-the-bash-prompt.html
__kube_ps1()
{
CONTEXT=$(kubectl config view | grep current-context | awk '{ print $NF }' | awk -F '.' '{ print $1 }')
NS=$(kubectl config view $(kubectl config current-context) | grep namespace | awk '{ print $2 }')
if [ -n "$CONTEXT" ]; then
echo "[${CONTEXT}][${NS}]"
@sirhopcount
sirhopcount / README.md
Created June 8, 2017 10:59 — forked from dbiesecke/README.md
Simple gist to show the aptly magic :)

Aptly Real-Live example

Install Repo

$ echo 'deb http://repo.aptly.info/ squeeze main' > /etc/apt/sources.list.d/aptly.list && wget -qO - https://www.aptly.info/pubkey.txt | sudo apt-key add -

$ apt-get update && apt-get install -y -f aptly

@sirhopcount
sirhopcount / var-lib-etcd2.mount
Created April 13, 2017 13:09 — forked from mgoodness/var-lib-etcd2.mount
Systemd unit file to mount EBS volume to /var/etc/data
[Unit]
Description=Mount EBS volume at /var/lib/etcd2
Requires=format-etcd-ebs.service
After=format-etcd-ebs.service
Before=etcd2.service
[Mount]
DirectoryMode=0777
Type=ext4
What=/dev/xvdb
@sirhopcount
sirhopcount / minio-distributed-statefulset.yaml
Created February 22, 2017 08:34 — forked from nitisht/minio-distributed-statefulset.yaml
Create a distributed Minio deployment based on StatefulSets
apiVersion: v1
kind: Service
metadata:
name: minio
labels:
app: minio
spec:
clusterIP: None
ports:
- port: 9000
@sirhopcount
sirhopcount / authentication.rb
Created October 21, 2016 05:08 — forked from theCrab/authentication.rb
A Hanami Framework authentication based on JSON Web Tokens.
# lib/authentications/authentication.rb
# @api auth
# Authentication base class
#
module Authentication
def self.included(base)
base.class_eval do
before :authenticate!
expose :current_user
@sirhopcount
sirhopcount / README.md
Created October 18, 2016 07:47 — forked from lusis/README.md
terraform template to generate serverspec properties

This uses terraform's template_file resource to generate a yaml properties file for serverspec to use.

  • create the Rakefile in your terraform project root
  • create a spec directory and put spec_helper.rb in it
  • create the templates/properties.tmpl.yml file
  • create the serverspec.tf
  • terraform apply

tests

Tests will be matched based on roles defined for a given node.

@sirhopcount
sirhopcount / cloud-config.yml
Created September 26, 2016 06:25 — forked from cbsmith/cloud-config.yml
modifying fleet metadata (from aws meta-data service) before fleet.service start; this is a proof of concept (but it works!)
#cloud-config
---
coreos:
units:
- name: update-fleet-metadata.service
command: start
content: |-
[Unit]
Description=Update Fleet metadata tag
Before=fleet.service
@sirhopcount
sirhopcount / etcd.yml
Created September 15, 2016 06:45 — forked from tomazzaman/etcd.yml
Etcd Kubernetes DaemonSet
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
labels:
name: etcd
name: etcd
spec:
template:
metadata:
labels:
@sirhopcount
sirhopcount / README.md
Created September 7, 2016 14:54 — forked from digital-wonderland/README.md
Unit files to deploy an ElasticSearch cluster on CoreOS via Fleet

What

Unit files to deploy an ElasticSearch cluster on CoreOS via Fleet.

Service discovery & registration is done via etcd.

[email protected] provides a dumb discovery service by registering an elasticsearch host if it should be up. [email protected] registers the service only if it is running.

A service & timer unit for elasticsearch curator is provided which does some housekeeping.

@sirhopcount
sirhopcount / README.md
Created September 6, 2016 13:15 — forked from nathanielks/README.md
Simple wrapper around terraform to manage multiple environments

This script will pull down an S3 remote configuration before running any terraform actions. Assumes the following structure:

main.tf
terraform.cfg
env/dev/vars
env/staging/vars
env/whatever/vars
env/whatever/somefile.tf