Golang, also known as Go, is a programming language developed by Google that is used to create software for various operating systems and frameworks.
This course will guide you through Golang, focusing on its use in developing Kubernetes Operators.
Introduction
-
Setting Up Your Golang Environment:
- Understanding Environment Variables: Demystify essential variables like GOPATH, GO111MODULE, and GOBIN.
- Using the
go
Command: Learn basic usage of thego
command with subcommands for interacting with Golang. - Your First Go Program: Create a simple “Hello, World!” program to understand package structure and program execution (go run vs. go build).
-
Learn by Example:
- Core Concepts: Dive into the fundamentals of Go programming, including:
- Types
- Constants/Variables
- Functions
- Arrays/Slices
- Loops
- Maps
- Conditionals (if/else, switch)
- Pointers
- Structs
- Methods (Pointer vs. Value Receivers)
- Interfaces
- Core Concepts: Dive into the fundamentals of Go programming, including:
Building Go Projects
-
Go Projects and Modules:
- Managing Dependencies: Learn about Go modules and how to structure your Go projects.
- Project Organization: Explore how Go projects are typically organized using the
this
keyword as an example.
-
Network Programming with Go:
- HTTP Clients and Servers: Discover how to build basic HTTP servers with GET and POST endpoints, including JSON decoding for handling requests.
-
Interacting with Kubernetes from Go:
- Beyond
kubectl
: Understand what happens under the hood ofkubectl
commands. - Golang Kubernetes Client Library: Learn how to use the Golang Kubernetes client library to make authenticated API requests to the Kubernetes API server.
- Emulating
kubectl
Commands: Use the client library to simulate basickubectl
commands like getting pods or creating deployments.
- Beyond
-
Running Golang Applications Anywhere:
- Dockerizing Golang Projects: Package your Go application as a Docker container for portability.
- Running in a Kubernetes Cluster: Explore considerations for running Kubernetes-aware Go applications inside a Kubernetes cluster using InClusterConfig.
Kubernetes Controllers and Operators
-
Introduction to Control and Admission:
- Controller Basics: Get introduced to the concept of controllers and their role in managing Kubernetes resources.
- Admission Control: Understand the purpose of validating and mutating resources with Dynamic Admission Controllers.
- Built-in and Third-Party Controllers: Explore examples of built-in controllers like deployment and cronjob controllers, alongside popular third-party controllers like aws-lb-controller and ingress-nginx.
-
Building Custom Admission Controllers:
- Validating Webhooks: Create a custom webhook to validate a Kubernetes deployment for the presence of environment variables.
- Mutating Webhooks: Develop a mutating webhook to inject environment variables into every Kubernetes deployment automatically.
-
The Power of Kubernetes Operators:
- Operators Demystified: Get introduced to the concept of Kubernetes Operators and their benefits for extending Kubernetes functionality.
- Use Cases for Operators: Explore how operators are used to interact with third-party services and control resource lifecycle.
- Custom Resource Definitions (CRDs): Learn about CRDs and their role in operator functionality, with examples like ArgoCD, Crossplane, and Tekton.
-
Simplified Operator Development with Operator SDK:
- Building Operators from Scratch: Understand the complexity of creating operators from scratch.
- Operator SDK to the Rescue: Discover how the Operator SDK simplifies operator development with generated code.
- Creating Custom Operators: Use a tutorial to build practical custom operators, such as a GitHub repository operator or an S3 bucket operator.