k8s-teams-controller
is a kubernetes controller for the teams.aftouh.io
CRD.
Team is a cluster scoped resource that manages team's namespace and resourcequota.
apiVersion: aftouh.io/v1
kind: Team
metadata:
name: poc-dev
spec:
name: poc
environment: dev
description: "poc team is creating a product ..."
resourceQuota:
hard:
pods: "4"
This project is created to build a sample of a kubernetes controller and understand what's under the hood.
This kubernetes controller sample helped me so much 🙏.
- k8s.io/code-generator: generate deepcopy, clientset, informers and listers of the team CRD
- ko: build and deploy controller in the kubernetes cluster
Run controller locally:
go run ./cmd/controller -kubeconfig ~/.kube/config -v 5
Run within a kubernetes cluster using ko
:
# login to dockerhub
docker login
export KO_DOCKER_REPO=ftahmed
# build & deploy using ko
ko apply -f config/
Command for generating deepcopy, clientset, infromers and listers of the team resource
go mod vendor
./hack/update-codegen.sh
go test -v ./...