Skip to content

Commit 9f3564f

Browse files
committed
add nomad plugin
1 parent 3626280 commit 9f3564f

File tree

7 files changed

+62
-18
lines changed

7 files changed

+62
-18
lines changed

.dockerignore

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,18 @@
1-
*
2-
!coredns
1+
*.md
2+
*.yml
3+
*.yaml
4+
Makefile*
5+
Dockerfile*
6+
7+
.circleci
8+
.github
9+
.dockerignore
10+
.gitignore
11+
.yamllint
12+
man
13+
notes
14+
test
15+
CODEOWNERS
16+
LICENSE
17+
coredns
18+

Dockerfile.build

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
FROM golang:1.20.1 as build
2+
WORKDIR /app
3+
4+
COPY ["go.mod", "go.sum", "./"]
5+
6+
RUN go mod download
7+
8+
COPY . .
9+
10+
RUN go build -o ./coredns
11+
12+
FROM gcr.io/distroless/base-debian11:latest
13+
14+
COPY --from=build /app/coredns /
15+
16+
EXPOSE 53 53/udp
17+
ENTRYPOINT ["/coredns"]

core/dnsserver/zdirectives.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,7 @@ var Directives = []string{
4646
"template",
4747
"transfer",
4848
"hosts",
49-
"route53",
50-
"azure",
51-
"clouddns",
52-
"k8s_external",
53-
"kubernetes",
49+
"nomad",
5450
"file",
5551
"auto",
5652
"secondary",

core/plugin/zplugin.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,11 @@ import (
99
_ "github.com/coredns/coredns/plugin/any"
1010
_ "github.com/coredns/coredns/plugin/auto"
1111
_ "github.com/coredns/coredns/plugin/autopath"
12-
_ "github.com/coredns/coredns/plugin/azure"
1312
_ "github.com/coredns/coredns/plugin/bind"
1413
_ "github.com/coredns/coredns/plugin/bufsize"
1514
_ "github.com/coredns/coredns/plugin/cache"
1615
_ "github.com/coredns/coredns/plugin/cancel"
1716
_ "github.com/coredns/coredns/plugin/chaos"
18-
_ "github.com/coredns/coredns/plugin/clouddns"
1917
_ "github.com/coredns/coredns/plugin/debug"
2018
_ "github.com/coredns/coredns/plugin/dns64"
2119
_ "github.com/coredns/coredns/plugin/dnssec"
@@ -30,8 +28,6 @@ import (
3028
_ "github.com/coredns/coredns/plugin/header"
3129
_ "github.com/coredns/coredns/plugin/health"
3230
_ "github.com/coredns/coredns/plugin/hosts"
33-
_ "github.com/coredns/coredns/plugin/k8s_external"
34-
_ "github.com/coredns/coredns/plugin/kubernetes"
3531
_ "github.com/coredns/coredns/plugin/loadbalance"
3632
_ "github.com/coredns/coredns/plugin/local"
3733
_ "github.com/coredns/coredns/plugin/log"
@@ -46,7 +42,6 @@ import (
4642
_ "github.com/coredns/coredns/plugin/reload"
4743
_ "github.com/coredns/coredns/plugin/rewrite"
4844
_ "github.com/coredns/coredns/plugin/root"
49-
_ "github.com/coredns/coredns/plugin/route53"
5045
_ "github.com/coredns/coredns/plugin/secondary"
5146
_ "github.com/coredns/coredns/plugin/sign"
5247
_ "github.com/coredns/coredns/plugin/template"
@@ -57,4 +52,5 @@ import (
5752
_ "github.com/coredns/coredns/plugin/tsig"
5853
_ "github.com/coredns/coredns/plugin/view"
5954
_ "github.com/coredns/coredns/plugin/whoami"
55+
_ "github.com/mr-karan/coredns-nomad"
6056
)

go.mod

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ require (
2121
github.com/infobloxopen/go-trees v0.0.0-20200715205103-96a057b8dfb9
2222
github.com/matttproud/golang_protobuf_extensions v1.0.4
2323
github.com/miekg/dns v1.1.62
24+
github.com/mr-karan/coredns-nomad v0.0.0-20230105084401-d4544c11e248
2425
github.com/opentracing/opentracing-go v1.2.0
2526
github.com/openzipkin-contrib/zipkin-go-opentracing v0.5.0
2627
github.com/openzipkin/zipkin-go v0.4.3
@@ -105,9 +106,14 @@ require (
105106
github.com/google/uuid v1.6.0 // indirect
106107
github.com/googleapis/enterprise-certificate-proxy v0.3.4 // indirect
107108
github.com/googleapis/gax-go/v2 v2.14.0 // indirect
109+
github.com/gorilla/websocket v1.5.0 // indirect
110+
github.com/hashicorp/cronexpr v1.1.1 // indirect
111+
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
112+
github.com/hashicorp/go-rootcerts v1.0.2 // indirect
108113
github.com/hashicorp/go-secure-stdlib/parseutil v0.1.7 // indirect
109114
github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 // indirect
110115
github.com/hashicorp/go-sockaddr v1.0.2 // indirect
116+
github.com/hashicorp/nomad/api v0.0.0-20230102161616-d71d7fd056a5 // indirect
111117
github.com/imdario/mergo v0.3.12 // indirect
112118
github.com/jmespath/go-jmespath v0.4.0 // indirect
113119
github.com/josharian/intern v1.0.0 // indirect

go.sum

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ github.com/dimchansky/utfbom v1.1.1 h1:vV6w1AhK4VMnhBno/TPVCoK9U/LP0PkLCS9tbxHdi
109109
github.com/dimchansky/utfbom v1.1.1/go.mod h1:SxdoEBH5qIqFocHMyGOXVAybYJdr71b1Q/j0mACtrfE=
110110
github.com/dnstap/golang-dnstap v0.4.0 h1:KRHBoURygdGtBjDI2w4HifJfMAhhOqDuktAokaSa234=
111111
github.com/dnstap/golang-dnstap v0.4.0/go.mod h1:FqsSdH58NAmkAvKcpyxht7i4FoBjKu8E4JUPt8ipSUs=
112+
github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4=
113+
github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
112114
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
113115
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
114116
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
@@ -198,17 +200,27 @@ github.com/googleapis/enterprise-certificate-proxy v0.3.4 h1:XYIDZApgAnrN1c855gT
198200
github.com/googleapis/enterprise-certificate-proxy v0.3.4/go.mod h1:YKe7cfqYXjKGpGvmSg28/fFvhNzinZQm8DGnaburhGA=
199201
github.com/googleapis/gax-go/v2 v2.14.0 h1:f+jMrjBPl+DL9nI4IQzLUxMq7XrAqFYB7hBPqMNIe8o=
200202
github.com/googleapis/gax-go/v2 v2.14.0/go.mod h1:lhBCnjdLrWRaPvLWhmc8IS24m9mr07qSYnHncrgo+zk=
203+
github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc=
204+
github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
201205
github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645 h1:MJG/KsmcqMwFAkh8mTnAwhyKoB+sTAnY4CACC110tbU=
202206
github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645/go.mod h1:6iZfnjpejD4L/4DwD7NryNaJyCQdzwWwH2MWhCA90Kw=
207+
github.com/hashicorp/cronexpr v1.1.1 h1:NJZDd87hGXjoZBdvyCF9mX4DCq5Wy7+A/w+A7q0wn6c=
208+
github.com/hashicorp/cronexpr v1.1.1/go.mod h1:P4wA0KBl9C5q2hABiMO7cp6jcIg96CDh1Efb3g1PWA4=
203209
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
210+
github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ=
211+
github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48=
204212
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
213+
github.com/hashicorp/go-rootcerts v1.0.2 h1:jzhAVGtqPKbwpyCPELlgNWhE1znq+qwJtW5Oi2viEzc=
214+
github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8=
205215
github.com/hashicorp/go-secure-stdlib/parseutil v0.1.7 h1:UpiO20jno/eV1eVZcxqWnUohyKRe1g8FPV/xH1s/2qs=
206216
github.com/hashicorp/go-secure-stdlib/parseutil v0.1.7/go.mod h1:QmrqtbKuxxSWTN3ETMPuB+VtEiBJ/A9XhoYGv8E1uD8=
207217
github.com/hashicorp/go-secure-stdlib/strutil v0.1.1/go.mod h1:gKOamz3EwoIoJq7mlMIRBpVTAUn8qPCrEclOKKWhD3U=
208218
github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 h1:kes8mmyCpxJsI7FTwtzRqEy9CdjCtrXrXGuOpxEA7Ts=
209219
github.com/hashicorp/go-secure-stdlib/strutil v0.1.2/go.mod h1:Gou2R9+il93BqX25LAKCLuM+y9U2T4hlwvT1yprcna4=
210220
github.com/hashicorp/go-sockaddr v1.0.2 h1:ztczhD1jLxIRjVejw8gFomI1BQZOe2WoVOu0SyteCQc=
211221
github.com/hashicorp/go-sockaddr v1.0.2/go.mod h1:rB4wwRAUzs07qva3c5SdrY/NEtAUjGlgmH/UkBUC97A=
222+
github.com/hashicorp/nomad/api v0.0.0-20230102161616-d71d7fd056a5 h1:ZD6Gn0HQI7y/MDaMs02KffIIViWR4sR1TzEHOvBs/5k=
223+
github.com/hashicorp/nomad/api v0.0.0-20230102161616-d71d7fd056a5/go.mod h1:EM/2XaEwHziSB4NdWZ6MfE65TcvgWwVawOUBT8kVRqE=
212224
github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU=
213225
github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
214226
github.com/infobloxopen/go-trees v0.0.0-20200715205103-96a057b8dfb9 h1:w66aaP3c6SIQ0pi3QH1Tb4AMO3aWoEPxd1CNvLphbkA=
@@ -250,6 +262,8 @@ github.com/miekg/dns v1.1.62/go.mod h1:mvDlcItzm+br7MToIKqkglaGhlFMHJ9DTNNWONWXb
250262
github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc=
251263
github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
252264
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
265+
github.com/mitchellh/go-testing-interface v1.14.1 h1:jrgshOhYAUVNMAJiKbEu7EqAwgJJ2JqpQmpLJOu07cU=
266+
github.com/mitchellh/go-testing-interface v1.14.1/go.mod h1:gfgS7OtZj6MA4U1UrDRp04twqAjfvlZyCfX3sDjEym8=
253267
github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo=
254268
github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
255269
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
@@ -259,6 +273,8 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w
259273
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
260274
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
261275
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
276+
github.com/mr-karan/coredns-nomad v0.0.0-20230105084401-d4544c11e248 h1:m75vwPLac4xVg5setDIQo9k3fQdJtDRamGrQEGg781Q=
277+
github.com/mr-karan/coredns-nomad v0.0.0-20230105084401-d4544c11e248/go.mod h1:1rFYVKi/Xuh+MyW7speFbHb0+2kcYpJQBSMtHeSV0uc=
262278
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
263279
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
264280
github.com/onsi/ginkgo/v2 v2.19.0 h1:9Cnnf7UHo57Hy3k6/m5k3dRfGTMXGvxhHFvkDTCTpvA=
@@ -312,6 +328,8 @@ github.com/ryanuber/go-glob v1.0.0 h1:iQh3xXAumdQ+4Ufa5b25cRpC5TYKlno6hsv6Cb3pkB
312328
github.com/ryanuber/go-glob v1.0.0/go.mod h1:807d1WSdnB0XRJzKNil9Om6lcp/3a0v4qIHxIXzX/Yc=
313329
github.com/secure-systems-lab/go-securesystemslib v0.7.0 h1:OwvJ5jQf9LnIAS83waAjPbcMsODrTQUpJ02eNLUoxBg=
314330
github.com/secure-systems-lab/go-securesystemslib v0.7.0/go.mod h1:/2gYnlnHVQ6xeGtfIqFy7Do03K4cdCY0A/GlJLDKLHI=
331+
github.com/shoenig/test v0.5.2 h1:ELZ7qZ/6CPrT71PXrSe2TFzLs4/cGCqqU5lZ5RhZ+B8=
332+
github.com/shoenig/test v0.5.2/go.mod h1:xYtyGBC5Q3kzCNyJg/SjgNpfAa2kvmgA0i5+lQso8x0=
315333
github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
316334
github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI=
317335
github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=

plugin.cfg

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,10 @@ minimal:minimal
5555
template:template
5656
transfer:transfer
5757
hosts:hosts
58-
route53:route53
59-
azure:azure
60-
clouddns:clouddns
61-
k8s_external:k8s_external
62-
kubernetes:kubernetes
58+
nomad:github.com/mr-karan/coredns-nomad
6359
file:file
6460
auto:auto
6561
secondary:secondary
66-
etcd:etcd
6762
loop:loop
6863
forward:forward
6964
grpc:grpc

0 commit comments

Comments
 (0)