Skip to content

Latest commit

Β 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ Kubernetes Operator Masterclass

Welcome to the definitive, production-grade guide to building Kubernetes Operators in Go.

This repository is not a collection of fragmented snippets. It is a comprehensive, heavily-architected masterclass designed to take you from a theoretical understanding of the Kubernetes Control Plane to deploying enterprise-grade, highly reliable Operators using the exact same patterns employed by Google, Red Hat, and CoreOS.

If you have ever struggled with the undocumented nuances of client-go, the asynchronous chaos of Informer caches, or the terrifying lifecycle of garbage collection, this is the book you have been waiting for.


πŸ“– The Textbook

The theoretical deep-dives are located in the book/ directory. These are not 2-sentence tutorials. Every chapter contains massive, pedagogical explanations, strict Go code implementations, and intricate ASCII diagrams detailing the exact flow of data through the Kubernetes API Server.


πŸ’» The Modular Codebase

Theory is useless without execution.

Inside the hands_on/ directory, you will find a massive collection of Go projects. These are not monolithic scripts. Every project from Chapter 4 onwards strictly follows the industry-standard Kubebuilder Directory Layout:

hands_on/ch08_status/
β”œβ”€β”€ api/
β”‚   └── v1/
β”‚       └── database_types.go      <-- (OpenAPI Markers & DeepCopy logic)
β”œβ”€β”€ cmd/
β”‚   └── main.go                    <-- (Manager Bootstrap & Scheme Wiring)
β”œβ”€β”€ internal/
β”‚   └── controller/
β”‚       └── status_controller.go   <-- (Pure Reconciler Logic & Guard Clauses)
β”œβ”€β”€ go.mod
└── go.sum

Every single main.go file is fully runnable. Every single Reconciler is meticulously documented line-by-line, explaining why the code is written the way it is.

To run any example:

cd hands_on/ch08_status
go run cmd/main.go

πŸ—οΈ Architectural Philosophy

This repository strictly enforces the following design patterns:

  1. Level-Triggered Reconciliation: We never assume the object passed to the queue is fresh. We always Get() the latest state from the Local Cache.
  2. The Flat Reconciler: You will not find nested if/else statements in this repository. All business logic is flattened using early-return Guard Clauses.
  3. Strict DeepCopying: We never mutate pointers retrieved from the Informer cache to prevent catastrophic global state corruption.

Dive in, and master the Control Plane.

About

A hands-on guide and living book for mastering Kubernetes Operator development. Learn the control plane, build CRDs, and write custom reconciliation loops using Go and Kubebuilder.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages