docteurklein / lube

Less painful Local Kubernetes with cue-lang

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

lube

Less painful Local Kubernetes with cue-lang.

dependencies

setup local k8s cluster (once)

k3d create --volume $HOME:$HOME --enable-registry --registry-name=registry.localhost --publish 80:80
export KUBECONFIG="$(k3d get-kubeconfig --name='k3s-default')"

export NS="$(basename $PWD)"
kubectl create ns "$NS"
kubectl config set-context --current --namespace="$NS"

deploy

kubectl create configmap terraform --from-file terraform || \
kubectl create configmap terraform --from-file terraform -o yaml --dry-run | kubectl replace -f -
cue -t NS=$NS -t PWD=$PWD yaml ./services/*/local
cue -t vhost=test.example.org -t NS=$NS -t PWD=$PWD apply ./services/*/local ./terraform

curl -isSL 0/accounting -H 'Host: accounting.test.example.org'

delete

kubectl delete ns "$NS"

auto cleanup

kubectl apply -n default -f janitor/rbac.yaml
cue -t NS=default apply ./janitor

download latest kubernetes definitions

Note: This might break stuff.

xargs -P0 -L1 -n1 -I{} sh -c 'go get {} && cue get go {}' <<-EOF
   k8s.io/api/core/v1
   k8s.io/api/apps/v1
   k8s.io/api/batch/v1
   k8s.io/api/apps/v1beta1
   k8s.io/api/extensions/v1beta1
EOF

About

Less painful Local Kubernetes with cue-lang


Languages

Language:Dockerfile 58.8%Language:HCL 41.2%