clouddns

package
v1.11.3 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 17 Imported by: 4

README

clouddns

Name

clouddns - enables serving zone data from GCP Cloud DNS.

Description

The clouddns plugin is useful for serving zones from resource record sets in GCP Cloud DNS. This plugin supports all Google Cloud DNS records. This plugin can be used when CoreDNS is deployed on GCP or elsewhere. Note that this plugin accesses the resource records through the Google Cloud API. For records in a privately hosted zone, it is not necessary to place CoreDNS and this plugin in the associated VPC network. In fact the private hosted zone could be created without any associated VPC and this plugin could still access the resource records under the hosted zone.

Syntax

clouddns [ZONE:PROJECT_ID:HOSTED_ZONE_NAME...] {
    credentials [FILENAME]
    fallthrough [ZONES...]
}
  • ZONE the name of the domain to be accessed. When there are multiple zones with overlapping domains (private vs. public hosted zone), CoreDNS does the lookup in the given order here. Therefore, for a non-existing resource record, SOA response will be from the rightmost zone.

  • PROJECT_ID the project ID of the Google Cloud project.

  • HOSTED_ZONE_NAME the name of the hosted zone that contains the resource record sets to be accessed.

  • credentials is used for reading the credential file from FILENAME (normally a .json file). This field is optional. If this field is not provided then authentication will be done automatically, e.g., through environmental variable GOOGLE_APPLICATION_CREDENTIALS. Please see Google Cloud's authentication method for more details.

  • fallthrough If zone matches and no record can be generated, pass request to the next plugin. If [ZONES...] is omitted, then fallthrough happens for all zones for which the plugin is authoritative. If specific zones are listed (for example in-addr.arpa and ip6.arpa), then only queries for those zones will be subject to fallthrough.

Examples

Enable clouddns with implicit GCP credentials and resolve CNAMEs via 10.0.0.1:

example.org {
    clouddns example.org.:gcp-example-project:example-zone
    forward . 10.0.0.1
}

Enable clouddns with fallthrough:

example.org {
    clouddns example.org.:gcp-example-project:example-zone example.com.:gcp-example-project:example-zone-2 {
        fallthrough example.gov.
    }
}

Enable clouddns with multiple hosted zones with the same domain:

. {
    clouddns example.org.:gcp-example-project:example-zone example.com.:gcp-example-project:other-example-zone
}

Documentation

Overview

Package clouddns implements a plugin that returns resource records from GCP Cloud DNS.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CloudDNS

type CloudDNS struct {
	Next plugin.Handler
	Fall fall.F
	// contains filtered or unexported fields
}

CloudDNS is a plugin that returns RR from GCP Cloud DNS.

func New

func New(ctx context.Context, c gcpDNS, keys map[string][]string, up *upstream.Upstream) (*CloudDNS, error)

New reads from the keys map which uses domain names as its key and a colon separated string of project name and hosted zone name lists as its values, validates that each domain name/zone id pair does exist, and returns a new *CloudDNS. In addition to this, upstream is passed for doing recursive queries against CNAMEs. Returns error if it cannot verify any given domain name/zone id pair.

func (*CloudDNS) Name

func (h *CloudDNS) Name() string

Name implements the Handler interface.

func (*CloudDNS) Run

func (h *CloudDNS) Run(ctx context.Context) error

Run executes first update, spins up an update forever-loop. Returns error if first update fails.

func (*CloudDNS) ServeDNS

func (h *CloudDNS) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error)

ServeDNS implements the plugin.Handler interface.

Jump to

Keyboard shortcuts

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