Skip to content

Instantly share code, notes, and snippets.

View danehans's full-sized avatar

Daneyon Hansen danehans

View GitHub Profile
TASK: [etcd | Enable etcd] ****************************************************
failed: [core-node02.ctocllab.cisco.com] => {"failed": true}
msg: no service or tool found for: etcd2
FATAL: all hosts have already failed -- aborting
PLAY RECAP ********************************************************************
to retry, use: --limit @/root/cluster.retry
core-node02.ctocllab.cisco.com : ok=34 changed=4 unreachable=0 failed=1
@danehans
danehans / README.md
Created April 1, 2016 23:43 — forked from justenwalker/README.md
Ansible Dynamic Inventory script for etcd

etcd dynamic inventory script

Generarates inventory for ansible from etcd using python-etcd library.

The script assumes etcd.ini to be present alongside it. To choose a different path, set the ETCD_INI_PATH environment variable:

export ETCD_INI_PATH=/path/to/etcd.ini

Ultimate Go Training

Day 1 -- Primer and Introduction

Some Key Thoughts on Go

WYSIWYG. Convention over configuration. Productivity > Performance Know how much your code costs. No hidden overloads, overhead, etc.

@danehans
danehans / golang-tls.md
Created August 3, 2016 22:21 — forked from denji/golang-tls.md
Simple Golang HTTPS/TLS Examples
Generate private key (.key)
# Key considerations for algorithm "RSA" ≥ 2048-bit
openssl genrsa -out server.key 2048
    
# Key considerations for algorithm "ECDSA" ≥ secp384r1
# List ECDSA the supported curves (openssl ecparam -list_curves)
openssl ecparam -genkey -name secp384r1 -out server.key
Provisioning to use Calico
1/20/2017
First, tearing down the cluster, by doing this on each node:
kubeadm reset
rm -rf .kube
systemctl start kubelet.service
Did yum -y update on all nodes as well. Downloaded http://docs.projectcalico.org/v1.6/getting-started/kubernetes/installation/hosted/kubeadm/calico.yaml and then ran "kubectl create -f calico.yaml".
Starting up cluster (with just the master node).
______________________________________________________________
k8s+contiv BGP peering setup
Status:
- able to peer with ASR1K route-reflector
- able to see reflected routes in k8s netctl bgp output
- NOT able to see k8s pod routes in ASR1K
-------------------------------------------------------

There are three easy to make mistakes in go. I present them here in the way they are often found in the wild, not in the way that is easiest to understand.

All three of these mistakes have been made in Kubernetes code, getting past code review at least once each that I know of.

  1. Loop variables are scoped outside the loop.

What do these lines do? Make predictions and then scroll down.

func print(pi *int) { fmt.Println(*pi) }
% openshift-install create manifests --dir=./clusters/gcp-mmasters-6
INFO Consuming "Install Config" from target directory
openshift-install create manifests --dir=./clusters/gcp-mmasters-6 1.78s user 0.06s system 18% cpu 9.806 total
% cat > ./clusters/gcp-mmasters-6/manifests/ingress-controller-01-crd.yaml <<EOF
---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: ingresscontrollers.operator.openshift.io
spec:
@danehans
danehans / Dockerfile
Created January 14, 2020 16:20 — forked from ironcladlou/Dockerfile
Reaper gotcha
FROM golang:1.13.5-buster
COPY main.go /go/reaper.go
RUN go build -o /bin/reaper /go/reaper.go
ENTRYPOINT ["/bin/reaper"]
+----------------------------------------+
+----------------------------------------------------------------------------------------------------------+
| | | CLUSTER OPERATOR |
| +-----------------------+ | | |
| | Gateway | | +----------------------------------+ | |
| +-----------------------+ | | Secret | | |
| | | | +----------------------------------+ | |
| | Listeners +---------->+ | | |
| | TLS | | | | tls.crt | | |
| | CertificateRef + | | | foo.example.com