Zot Developer IaC
π Overview
This Infrastructure as Code (IaC) project leverages the power of Pulumi and KinD (Kubernetes in Docker) to provision a Zot service and accompanying resources for Zot development and testing.
π What It Solves
- Rapid Prototyping: Ideal for developing Zot on Kubernetes.
- Local Development: Perfect for testing locally on Kind Kubernetes.
- Automation: Easily integrate into CI/CD pipelines.
π Getting Started
These instructions will help you set up a Zot on KinD cluster.
```bash
usrbinkat@mordor:~/uor-zot/iac$ time pulumi up -y
Updating (dev)
Type Name Status Info
+ pulumi:pulumi:Stack zot-dev created (0.36s) 14 messages
+ ββ my:kind:KindCluster default-cluster created (42s)
+ β ββ command:local:Command default-cluster-deleteCluster created (0.14s)
+ β ββ command:local:Command default-cluster-createCluster created (42s)
+ ββ command:local:Command default-cluster-volumeCheck created (0.36s)
+ ββ kubernetes:apps/v1:Deployment zot-deployment created (27s)
+ ββ kubernetes:core/v1:Service zot-service created (10s)
Resources:
+ 7 created
Duration: 1m29s
real 1m38.564s
user 0m1.734s
sys 0m1.302s
```
π Prerequisites
π₯οΈ Installation
-
Clone the Repository
git clone https://github.com/usrbinkat/pulumi-kind-go.git
cd uor-zot/iac
-
Download Go Deps
go get -u ./...
go mod download
go mod tidy
-
Initialize Pulumi
pulumi stack init dev
-
Run Pulumi
pulumi up
-
Check Your Cluster
kubectl get nodes
π οΈ How It Works
π Components
- Pulumi: Orchestrates the provisioning.
- KinD: Creates a local Kubernetes cluster using Docker containers.
- Go: The IaC logic is written in Go, leveraging Pulumi's Go SDK.
- Zot: The Zot service is deployed to the cluster.
π¨ Code Structure
kind/kind.go
: KinD cluster creation.
kind/volumes.go
: Accelerate kind cluster builds with stateful containerd storage volume.
helper/helper.go
: Utility functions.
zot/zot.go
: Zot service deployment.
π Workflow
- Initialize Configuration: Sets up Pulumi context and configuration.
- Load Cluster Config: Reads the desired Kind cluster setup.
- Manage Docker Volumes: Checks, creates, or deletes Docker volumes as needed.
- Create/Delete KinD Cluster: Uses Pulumi's
local.Command
to run the KinD CLI commands.
- Create/Delete Zot Service: Deploy Zot to k8s with Pulumi's
kubernetes.apps.v1.{Service,Deployment}
resources.
π Customizing the Cluster
For now, the code is set up to deploy a basic zot configuration. Customizations will be added in future releases.
π€ Contributing
Please read CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests.
π License
This project is licensed under the Apache 2.0 License - see the LICENSE.md file for details.
π Acknowledgments
- The Pulumi Team for their fantastic IaC tool.
- Kubernetes for revolutionizing the way we think about container orchestration.
- The ReadME Project for README best practices.
Local Development
export GOFLAGS='-replace=github.com/usrbinkat/pulumi-kind-go=.'