❤️ this project is a clone of external-dns-vultr-webhook with adaptations for Dreamhost using go-dreamhost project from @adamantal. It is in alpha and massively experimental, so please take care when you use it. It should not be used in production!
ExternalDNS is a Kubernetes add-on for automatically managing Domain Name System (DNS) records for Kubernetes services by using different DNS providers. By default, Kubernetes manages DNS records internally, but ExternalDNS takes this functionality a step further by delegating the management of DNS records to an external DNS provider such as this one. Therefore, the Dreamhost webhook allows to manage your Dreamhost domains inside your kubernetes cluster with ExternalDNS.
To use ExternalDNS with Dreamhost, you need your Dreamhost API token of the account managing your domains, which you can generate by visiting this page on the Dreamhost website.
For detailed technical instructions on how the Dreamhost webhook is deployed using the Bitnami Helm charts for ExternalDNS, see deployment instructions.
The deployment can be performed in every way Kubernetes supports. The following example shows the deployment as a sidecar container in the ExternalDNS pod using the Bitnami Helm charts for ExternalDNS.
The webhook can be installed using either the Bitnami chart or the ExternalDNS one.
First, create the Dreamhost secret:
kubectl create secret generic dreamhost-credentials --from-literal=api-key='<EXAMPLE_PLEASE_REPLACE>' -n external-dnsSkip this if you already have the ExternalDNS repository added:
helm repo add external-dns https://kubernetes-sigs.github.io/external-dns/You can then create the helm values file, for example
external-dns-dreamhost-values.yaml:
namespace: external-dns
policy: sync
provider:
  name: webhook
  webhook:
    image:
      repository: asymingt/external-dns-dreamhost-webhook
      tag: v0.1.2
    env:
      - name: DREAMHOST_API_KEY
        valueFrom:
          secretKeyRef:
            name: dreamhost-credentials
            key: api-key
    livenessProbe:
      httpGet:
        path: /health
        port: http-wh-metrics
      initialDelaySeconds: 10
      timeoutSeconds: 5
    readinessProbe:
      httpGet:
        path: /ready
        port: http-wh-metrics
      initialDelaySeconds: 10
      timeoutSeconds: 5
interval: 10mAnd then:
# install external-dns with helm
helm install external-dns-dreamhost external-dns/external-dns -f external-dns-dreamhost-values.yaml --version 1.14.3 -n external-dnsThe following environment variables are available:
| Variable | Description | Notes | 
|---|---|---|
| DREAMHOST_API_KEY | Dreamhost API token | Mandatory | 
| DRY_RUN | If set, changes won't be applied | Default: false | 
| WEBHOOK_HOST | Webhook hostname or IP address | Default: localhost | 
| WEBHOOK_PORT | Webhook port | Default: 8888 | 
| HEALTH_HOST | Liveness and readiness hostname | Default: 0.0.0.0 | 
| HEALTH_PORT | Liveness and readiness port | Default: 8080 | 
| READ_TIMEOUT | Servers' read timeout in ms | Default: 60000 | 
| WRITE_TIMEOUT | Servers' write timeout in ms | Default: 60000 | 
Additional environment variables for domain filtering:
| Environment variable | Description | 
|---|---|
| DOMAIN_FILTER | Filtered domains | 
| EXCLUDE_DOMAIN_FILTER | Excluded domains | 
| REGEXP_DOMAIN_FILTER | Regex for filtered domains | 
| REGEXP_DOMAIN_FILTER_EXCLUSION | Regex for excluded domains | 
If the REGEXP_DOMAIN_FILTER is set, the following variables will be used to
build the filter:
- REGEXP_DOMAIN_FILTER
- REGEXP_DOMAIN_FILTER_EXCLUSION
otherwise, the filter will be built using:
- DOMAIN_FILTER
- EXCLUDE_DOMAIN_FILTER
While tweaking the configuration, there are some points to take into consideration:
- 
if WEBHOOK_HOSTandHEALTH_HOSTare set to the same address/hostname or one of them is set to0.0.0.0remember to use different ports.
- 
if your records don't get deleted when applications are uninstalled, you might want to verify the policy in use for ExternalDNS: if it's upsert-onlyno deletion will occur. It must be set tosyncfor deletions to be processed. Please add the following toexternal-dns-dreamhost-values.yamlif you want this strategy:policy: sync 
The basic development tasks are provided by make. Run make help to see the
available targets.