pulumi-kind-go

command module
v0.0.0-...-80305e3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 4, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

README ΒΆ

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
  1. Clone the Repository

    git clone https://github.com/usrbinkat/pulumi-kind-go.git
    cd uor-zot/iac
    
  2. Download Go Deps

    go get -u ./...
    go mod download
    go mod tidy
    
  3. Initialize Pulumi

    pulumi stack init dev
    
  4. Run Pulumi

    pulumi up
    
  5. Check Your Cluster

    kubectl get nodes
    

πŸ› οΈ How It Works

πŸ“š Components
  1. Pulumi: Orchestrates the provisioning.
  2. KinD: Creates a local Kubernetes cluster using Docker containers.
  3. Go: The IaC logic is written in Go, leveraging Pulumi's Go SDK.
  4. 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
  1. Initialize Configuration: Sets up Pulumi context and configuration.
  2. Load Cluster Config: Reads the desired Kind cluster setup.
  3. Manage Docker Volumes: Checks, creates, or deletes Docker volumes as needed.
  4. Create/Delete KinD Cluster: Uses Pulumi's local.Command to run the KinD CLI commands.
  5. 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=.'

Documentation ΒΆ

Overview ΒΆ

File: main.go

Directories ΒΆ

Path Synopsis
utils
File: cert-manager/utils/config.go Use: code to read configuration values from environment variables or Pulumi configuration.
File: cert-manager/utils/config.go Use: code to read configuration values from environment variables or Pulumi configuration.
File: helper/helper.go
File: helper/helper.go
File: kind/kind.go
File: kind/kind.go
Zot/deploy.go
Zot/deploy.go

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL