Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View lawrencejones's full-sized avatar

Lawrence Jones lawrencejones

View GitHub Profile
@lawrencejones
lawrencejones / consoles.go
Created October 5, 2020 15:22
Theatre consoles wrapper
package cmd
import (
"bytes"
"context"
"encoding/json"
"fmt"
"os"
"strings"
"text/template"
@lawrencejones
lawrencejones / Makefile
Last active April 24, 2023 13:04
Why you need a service registry
make-it-rain.json: make-it-rain.jsonnet
jsonnet -J $(ANU_ROOT)/utopia/lib -J $(ANU_ROOT)/utopia/jvendor $^ > $@
@lawrencejones
lawrencejones / argocd-rbac.jsonnet
Created September 10, 2020 17:01
ArgoCD configuration
local registry = import 'registry/index.jsonnet';
// Compute the rbac rules that should be configured in ArgoCD, using the service
// registry to determine who should be given what permissions.
//
// This module can be evaluated concretely, which may help to debug the rbac
// list for ArgoCD.
{
_config:: {
// Operator grants- anyone with admin or operator should be permitted to
local app = import 'app.libsonnet';
app {
_config+:: {
release: 'release-bot',
namespace: 'connect-team',
environment: 'production',
app: 'release-bot',
image: 'eu.gcr.io/gc-containers/gocardless/release-bot',
tag: 'TODO',
@lawrencejones
lawrencejones / _hidden.libsonnet
Created June 1, 2020 16:18
Theatre auto-generated CRDs
{
local hidden = (import '_hidden.libsonnet'),
rbac:: {
v1alpha1:: {
local apiVersion = { apiVersion: 'rbac/v1alpha1' },
// Computer generated, description unknown
directoryRoleBinding:: {
new():: {},
withMetadata(metadata):: self + { metadata: metadata },
withMetadataMixin(metadata):: self + { metadata+: metadata },
@lawrencejones
lawrencejones / README.md
Created March 25, 2020 13:57
Find indices that require forcemerging

Force-merge analysis

Find indicies that still require force-merging

@lawrencejones
lawrencejones / main.jsonnet
Created February 11, 2020 20:54
Custom jsonnet library for ES cluster
local k = import 'vendor/k8s.libsonnet';
k {
_config+:: {
name: 'name',
namespace: 'namespace',
node_storage: '5Gi',
labels: { app: 'elastic-cloud' },
version: '7.5.2',
master_replicas: 3,
@lawrencejones
lawrencejones / gocardless-headers.md
Created February 6, 2020 17:59
GoCardless response header changes, from 14th February onward

(a) Request without downcasing opt-in

This is what we'll be serving until February 14th, after which we'll switch to the downcased version by default.

$ curl -v --http1.1 \
    -H "authorization: Bearer $TOKEN" \
    -H 'gocardless-version: 2015-07-06' \
    -H 'content-type: application/json' \
@lawrencejones
lawrencejones / formats.md
Last active January 10, 2020 09:06
Comparison of Postgres logs

Formats

log_min_duration_statement=0, log_statement=none

2020-01-10 09:01:07.456 UTC [9359] LOG:  duration: 0.127 ms  parse <unnamed>: select pg_sleep($1)
2020-01-10 09:01:07.457 UTC [9359] LOG:  duration: 0.078 ms  bind <unnamed>: select pg_sleep($1)
2020-01-10 09:01:07.457 UTC [9359] DETAIL:  parameters: $1 = '2'

2020-01-10 09:01:09.461 UTC [9359] LOG:  duration: 2004.025 ms  execute <unnamed>: select pg_sleep($1)
@lawrencejones
lawrencejones / manifest.go
Created November 16, 2019 13:53
Example of validated manifest
package manifest
import (
"fmt"
"github.com/stretchr/objx"
)
// Manifest describes a single Kubernetes manifest. Manifests should only ever be
// constructed using the NewManifest method, to ensure the resource is well-formed.