Skip to content

BerryBytes/01cloud-dns-controller

01Cloud DNS Controller

Build License Version

Kubernetes controller that automatically creates and deletes DNS records for Namespaces based on annotations.

Features

  • Watches Namespace add/update/delete events.
  • Creates DNS records on namespace creation.
  • Deletes DNS records on namespace deletion.
  • Supports multiple DNS providers:
    • Google Cloud DNS
    • AWS Route53
    • Cloudflare
  • Uses environment-based configuration for credentials and runtime behavior.

Installation

Prerequisites

  • Go 1.21+
  • Access to a Kubernetes cluster
  • DNS provider credentials

Build

go mod tidy
go build -o 01cloud-dns-controller .

Docker

docker build -t 01cloud-dns-controller:latest .

Usage

Run locally (out-of-cluster)

cp .env.sample .env
# edit .env with real values
./01cloud-dns-controller --kubeconfig="$HOME/.kube/config"

Run in cluster

cp .env.sample .env
# edit .env with real values
./01cloud-dns-controller

Namespace annotation example

apiVersion: v1
kind: Namespace
metadata:
	name: demo
	annotations:
		app.01cloud.io/dns_provider: cloudflare   # one of: gcp | aws | cloudflare
		app.01cloud.io/dns_base: example.com
		app.01cloud.io/dns_target: lb.example.net
		app.01cloud.io/dns_type: CNAME

Configuration

The controller reads configuration from environment variables.

Variable Required Description
BASE_DOMAIN optional Base domain for your platform.
ZONE_NAME required DNS zone name / hosted zone identifier (provider-specific usage).
GCLOUD_PROJECT required for GCP Google Cloud project ID for Cloud DNS.
AWS_DEFAULT_REGION required for AWS AWS region.
AWS_ACCESS_KEY_ID required for AWS AWS access key ID.
AWS_SECRET_ACCESS_KEY required for AWS AWS secret access key.
CLOUDFLARE_API_TOKEN required for Cloudflare Cloudflare API token with DNS edit permissions.

Tip: Use .env.sample as your starting point and keep secrets in .env (already ignored by Git).

Contributing

Contributions are welcome. Please read CONTRIBUTING.md before opening issues or pull requests.

Security

Please do not report vulnerabilities publicly. See SECURITY.md for responsible disclosure instructions.

License

This project is currently licensed under Apache License 2.0. See LICENSE.


About

01Cloud-Dns-Controller is a Kubernetes controller that automatically creates and deletes DNS records for Namespaces based on annotations.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors