Skip to content

Instantly share code, notes, and snippets.

View warmfusion's full-sized avatar

Toby Jackson warmfusion

View GitHub Profile
@warmfusion
warmfusion / README.md
Last active May 22, 2019 07:04
ConfTest - AND behaviour on labels error

When testing for two labels being required within a deployment, if either match passes the whole block is accepted.

deny[msg] {
  input.kind = "Deployment"
  not input.spec.selector.matchLabels.app
  not input.spec.selector.matchLabels.release
  msg = sprintf("Deployment[%s] - Containers must provide app/release labls for pod selectors", [name])
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width">
<meta name="theme-color" content="#000">
<title>Grafana</title>
@warmfusion
warmfusion / README.md
Last active June 4, 2021 14:50
Notes from building ETCD / Confd / Haproxy autoconfiguration environment

The following documents a trial of using etcd, and confd to automatically configure a haproxy load balancer.

It is built using a combination of blogs, resources and experimentation, but provides a rough template of the approach that would allow a fully featured balancer to be configured from etcd keyvalues.

TODO

  • Include systemd sidekick unit to automatically register the key's into ETCD based on a docker service (for example) being started
  • A more complete haproxy template that builds a valid, complex haproxy that would be capable of dealing with Future PLC's balancer requirements
# Build initially using instalinux.com
# and adapted with customisations for a two volume server on
# XenServer to automatically provision a 100% LVM mounted to /var/lib/mysql
####################################################################
# PRESEED - Created Mon Sep 5 12:23:52 2016
####################################################################
# Wiki: http://wiki.debian.org/DebianInstaller/Preseed
# Great work! Thanks for preseed and the d-i installer
@warmfusion
warmfusion / README.md
Last active May 21, 2018 15:00
Cloud Init script for building a coreos cluster at home on XenServer using Cloud-Init and ETCD2

This Cloud-init script can be used to bootstrap a Xen based CoreOS server through Xen orchestra.

Features;

  1. Workaround for the lack of /etc/environment on 'unsupported' hypervisors
  2. Static IP allocation to deal with dhcp causing problems (On my network at least)
  3. etcd2 bootstrap discovery using public service and discovery tokens
    1. Manual reconfiguration to allow for membership changes after cluster is operational

Usage

@warmfusion
warmfusion / clockface.rb
Created March 26, 2016 19:28
Ruby code to generate a clock face on a strip of programmable RGB leds on a raspberry pi
require 'ws2801'
WS2801.generate # generate empty strip (Would happen from alone if you just start setting colors)
WS2801.length 12 # default
WS2801.device "/dev/spidev0.0" # default
WS2801.strip []
WS2801.autowrite true # default
@warmfusion
warmfusion / README.md
Created October 5, 2015 14:17
failshell.io/sensu/2013/05/08/high-availability-sensu

High availability monitoring with Sensu

sensu | May 8, 2013

Redundancy. Availability. Scalability. Should sound familiar to you if you work in the web. Every system I build has to fit those 3 main criterias. I would also throw in manageability. If I can’t use Chef with it, I’m probably trying to use the wrong tool for the job.

There’s always been one exception though: my monitoring tool. Nagios. Zabbix. Zenoss. Shinken. Used them all. Each of them have shortcomings when it comes to the four criterias listed above. Different ones for each.

So, that said, a few months back, I was searching for something fresh. Something I could easily manage with Chef. Because I tend to forget things, and I wanted to automate as much as possible our monitoring solution. Don’t get me wrong, there’s nothing as good as developers to monitor your stuff, but I tend to like to know there’s something wrong before they show up at my desk. Even if it’s only 1-2 minutes ;)

@warmfusion
warmfusion / SSL_Cipher_Test.md
Created September 21, 2015 10:43
Uses OpenSSL to test which SSL ciphers are supported on a given backend
Obtaining cipher list from OpenSSL 0.9.8zg 14 July 2015.
Testing ADH-SEED-SHA                   NO (sslv3 alert handshake failure)
Testing DHE-RSA-SEED-SHA               NO (sslv3 alert handshake failure)
Testing DHE-DSS-SEED-SHA               NO (sslv3 alert handshake failure)
Testing SEED-SHA                       NO (sslv3 alert handshake failure)
Testing ADH-AES256-SHA                 NO (sslv3 alert handshake failure)
Testing DHE-RSA-AES256-SHA             YES
Testing DHE-DSS-AES256-SHA             NO (sslv3 alert handshake failure)
Testing AES256-SHA                     NO (sslv3 alert handshake failure)
@warmfusion
warmfusion / check-to-metric-mutator.rb
Last active August 29, 2015 14:27
Sensu Event Status as Graphite Metric
#!/usr/bin/env ruby
#
# Author: Toby Jackson
# Date: 2015-08-11
#
# Usage:
# Add as mutator to a graphitehandler (which accepts all severities)
# to create a new graphite metric for $hostname.$checkname with
# each status value
@warmfusion
warmfusion / user-keymap.json
Created July 31, 2015 14:50
Sublime Settings
[
{ "keys": ["command+shift+r"], "command": "reveal_in_side_bar"}
]