Skip to content

jacaudi/nextdns-crossplane-composition

Repository files navigation

NextDNS Crossplane Composition

This project provides a Crossplane Composition and CompositeResourceDefinition (XRD) for managing NextDNS profiles using Crossplane and the provider-http with Go templating.

Overview

  • Crossplane enables you to declaratively manage cloud and external resources using Kubernetes CRDs.
  • provider-http allows Crossplane to manage any resource with an HTTP API.
  • function-go-templating enables dynamic resource generation using Go templates in Crossplane compositions.
  • This composition lets you manage NextDNS profiles as Kubernetes resources, mapping your desired state to the NextDNS API.

How It Works

  • You define a Profile custom resource (CR) in Kubernetes, specifying your NextDNS profile configuration.
  • The composition uses Go templating to generate an HTTP Request resource, which interacts with the NextDNS API to create, update, and delete profiles.
  • Secrets and status are injected back into Kubernetes for use by other resources or applications.
  • See example/nextdnsprofile/claim.yaml for a sample Profile resource.

Installation

Prerequisites

  1. Kubernetes Cluster: Ensure you have a Kubernetes cluster running (e.g., Minikube, Kind, EKS, GKE).
    • v1.29+ recommended
  2. Install Crossplane: Follow the official docs.

Composition Installation Steps (Configuration Package)

Create a Configuration resource referencing your published package:

apiVersion: pkg.crossplane.io/v1
kind: Configuration
metadata:
  name: nextdns-crossplane-composition
spec:
  package: ghcr.io/jacaudi/nextdns-crossplane-composition:v1.0.0

Apply it:

kubectl apply -f configuration.yaml

Configuration

  1. Create the provider config:

    kubectl apply -f example/nextdnsprofile/providerconfig.yaml
  2. Create a secret with your NextDNS API key:

    kubectl create secret generic nextdns-api-key \
      --from-literal=api-key=<YOUR_NEXTDNS_API_KEY> \
      -n crossplane-system
  3. Apply a Profile claim:

    kubectl apply -f example/nextdnsprofile/claim.yaml

5. Verify Installation

Check that the package, XRD, and Composition are installed:

kubectl get xrd
kubectl get composition

Troubleshooting

  • Ensure all Crossplane pods, provider-http, and function-go-templating pods are running in the crossplane-system namespace.
  • Check CRD status with kubectl get crd profiles.nextdns.jacaudi.io.
  • Check resource status with kubectl describe profile <name>.
  • Review provider and function logs for errors.

References

About

This project provides a Crossplane Composition for managing NextDNS profiles

Topics

Resources

License

Stars

Watchers

Forks

Packages