Skip to content

Instantly share code, notes, and snippets.

View arschles's full-sized avatar
🎯
Focusing

Aaron Schlesinger arschles

🎯
Focusing
View GitHub Profile
@arschles
arschles / sample_claim.yaml
Last active September 1, 2016 21:25
Sample Steward manifest
kind: ConfigMap
apiVersion: v1
metadata:
name: claim-1
namespace: default
labels:
type: service-plan-claim
data:
service-id: "helm-alpine"
plan-id: "standard"
@arschles
arschles / ctx.go
Created August 26, 2016 20:51
Golang 1.7 Contexts
package main
import (
"context"
"log"
"net/http"
"sync"
"time"
)
@arschles
arschles / logs.txt
Created April 25, 2016 21:47
Storage Logs
ENG000656:workflow-manager-api aaronschlesinger$ kd logs -f deis-database-sr5al
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.
The database cluster will be initialized with locale "en_US.utf8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".
Data page checksums are disabled.
@arschles
arschles / auth_middleware.go
Last active April 21, 2016 23:29
rudimentary auth middleware
func WithAuth(tokenToCheck, tokenHeaderName string, next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if r.Header.Get(tokenHeaderName) != tokenToCheck {
http.Error(w, "not authorized", http.StatusUnauthorized)
return
}
next.ServeHTTP(w, r)
})
}
@arschles
arschles / controller_logs.txt
Last active April 11, 2016 19:04
deis-controller flapping
ENG000656:workflow-e2e aaronschlesinger$ kd logs -f deis-controller-rbexd
system information:
Django Version: 1.9.3
Python 3.5.1
Django checks:
System check identified no issues (2 silenced).
Health Checks:
Checking if database is alive
Database is alive!
Database Migrations:
@arschles
arschles / router_consensus.md
Last active March 29, 2016 22:57
router consensus protocol

Internal update protocol

  1. When the leader gets a new configuration, it assigns a monotonically increasing version number to it and stores it in a k8s annotation (similar to how the leader election algorithm uses annotations). The version # will be for router-internal use only.
  2. When the leader gets a new configuration, it increments the version, stores it in the annotation, then sends the version along with the new configuration to all other router replicas. Each replica only responds when it has finished updating both its config and version number. If any replica doesn't respond within a reasonable timeout, the leader terminates it.
  3. When a non-leader comes online with a version #, it compares its local known value with that in the annotation. If they don't match, it requests the most up to date version number and config from the leader
  4. When a non-leader comes online with no version, it requests the most up to date version and config from the leader.
  5. If a non-leader gets one or more configurat
@arschles
arschles / deis-demo-notes-2016-01-07.md
Last active April 4, 2016 04:50
Deis v2 Alpha Demo Notes - January 7, 2016

We're going to overview the entire process of installing a new Deis cluster on an existing Kubernetes cluster, creating and configuring your app, deploying code, and scaling up.

0: Prerequisites

  • A working Kubernetes cluster on Google Container Engine (Deis, of course, works anywhere Kubernetes can be installed, but the installation instructions in step 1 are tailored to GKE)
  • The Kubernetes client CLI (kubectl) installed on the PATH, and configured to talk to the aforementioned cluster
  • An alias called kd to kubectl --namespace=deis (alias kd="kubectl --namespace=deis" will create it in most shells). This alias will be useful since the Helm Deis chart installs all of the components into the deis namespace
  • The Helm CLI installed on the PATH. Helm is our open source Kubernetes package manager. Find it at https://github.com/helm/helm
  • Ensure you have no installed Helm repository called deis (helm repo remove deis if you do)
  • Ensure no `d
@arschles
arschles / setup_guide.md
Created December 29, 2015 00:49
k8s setup guide for Deis v2
Name Cloud? Local? Level of Configurability Ease of setup
kube-up.sh on 1.1 Yes Yes High Medium
micro-kube No (technically, I think you can with some extra work, since Vagrant supports spinning up cloud VMs. Instructions not in the micro-kube README though) Yes Low High
GKE Yes No Low High
Digital Ocean using Terraform Yes No Medium  Easy
@arschles
arschles / rm-docker-containers.sh
Created December 15, 2015 23:52
remove all exited docker containers
sudo docker ps -a | grep Exited | cut -d ' ' -f 1 | xargs docker rm
@arschles
arschles / monorepo.md
Last active November 16, 2023 11:32
Why We Should Use Monolithic Repositories

I think we should have all our code in a monolithic repository.

I've detailed the big benefits to having one, addressed possible issues to having one, and mentioned a few risks to not moving to a monorepo below.

Benefits To Adopting a Monolithic Repo

Golang package dependencies

  1. Single vendor/ dir at the top level of deis/deis
  2. All internal packages use the same external dependencies