Skip to content

Commit 4a6c9dd

Browse files
committed
Trim down enabled plugins:
* remove trace plugin Signed-off-by: Michael Nairn <[email protected]>
1 parent 8bec8a7 commit 4a6c9dd

File tree

4 files changed

+127
-170
lines changed

4 files changed

+127
-170
lines changed

coredns/plugin/cmd/coredns.go

+2-24
Original file line numberDiff line numberDiff line change
@@ -5,38 +5,16 @@ import (
55

66
"github.com/coredns/caddy"
77
"github.com/coredns/coredns/core/dnsserver"
8-
_ "github.com/coredns/coredns/core/plugin"
98
"github.com/coredns/coredns/coremain"
109

1110
_ "github.com/kuadrant/coredns-kuadrant"
11+
"github.com/kuadrant/coredns-kuadrant/cmd/plugin"
1212
)
1313

14-
var dropPlugins = map[string]bool{
15-
"kubernetes": true,
16-
"k8s_external": true,
17-
}
18-
1914
const pluginVersion = "0.0.0"
2015

21-
// https://github.com/ori-edge/k8s_gateway/blob/master/cmd/coredns.go
2216
func init() {
23-
var directives []string
24-
var alreadyAdded bool
25-
26-
for _, name := range dnsserver.Directives {
27-
28-
if dropPlugins[name] {
29-
if !alreadyAdded {
30-
directives = append(directives, "kuadrant")
31-
alreadyAdded = true
32-
}
33-
continue
34-
}
35-
directives = append(directives, name)
36-
}
37-
38-
dnsserver.Directives = directives
39-
17+
dnsserver.Directives = plugin.Directives
4018
}
4119

4220
func main() {

coredns/plugin/cmd/plugin/plugin.go

+125
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
package plugin
2+
3+
// Cut down version of https://github.com/coredns/coredns/blob/master/core/plugin/zplugin.go
4+
// Only import plugins we want to enable in our build of CoreDNS.
5+
// Note: Any plugin removed here should have it's Directive removed also.
6+
7+
import (
8+
_ "github.com/coredns/caddy/onevent"
9+
_ "github.com/coredns/coredns/plugin/acl"
10+
_ "github.com/coredns/coredns/plugin/any"
11+
_ "github.com/coredns/coredns/plugin/auto"
12+
_ "github.com/coredns/coredns/plugin/autopath"
13+
_ "github.com/coredns/coredns/plugin/azure"
14+
_ "github.com/coredns/coredns/plugin/bind"
15+
_ "github.com/coredns/coredns/plugin/bufsize"
16+
_ "github.com/coredns/coredns/plugin/cache"
17+
_ "github.com/coredns/coredns/plugin/cancel"
18+
_ "github.com/coredns/coredns/plugin/chaos"
19+
_ "github.com/coredns/coredns/plugin/clouddns"
20+
_ "github.com/coredns/coredns/plugin/debug"
21+
_ "github.com/coredns/coredns/plugin/dns64"
22+
_ "github.com/coredns/coredns/plugin/dnssec"
23+
_ "github.com/coredns/coredns/plugin/dnstap"
24+
_ "github.com/coredns/coredns/plugin/erratic"
25+
_ "github.com/coredns/coredns/plugin/errors"
26+
_ "github.com/coredns/coredns/plugin/etcd"
27+
_ "github.com/coredns/coredns/plugin/file"
28+
_ "github.com/coredns/coredns/plugin/forward"
29+
_ "github.com/coredns/coredns/plugin/geoip"
30+
_ "github.com/coredns/coredns/plugin/grpc"
31+
_ "github.com/coredns/coredns/plugin/header"
32+
_ "github.com/coredns/coredns/plugin/health"
33+
_ "github.com/coredns/coredns/plugin/hosts"
34+
_ "github.com/coredns/coredns/plugin/k8s_external"
35+
_ "github.com/coredns/coredns/plugin/kubernetes"
36+
_ "github.com/coredns/coredns/plugin/loadbalance"
37+
_ "github.com/coredns/coredns/plugin/local"
38+
_ "github.com/coredns/coredns/plugin/log"
39+
_ "github.com/coredns/coredns/plugin/loop"
40+
_ "github.com/coredns/coredns/plugin/metadata"
41+
_ "github.com/coredns/coredns/plugin/metrics"
42+
_ "github.com/coredns/coredns/plugin/minimal"
43+
_ "github.com/coredns/coredns/plugin/multisocket"
44+
_ "github.com/coredns/coredns/plugin/nsid"
45+
_ "github.com/coredns/coredns/plugin/pprof"
46+
_ "github.com/coredns/coredns/plugin/ready"
47+
_ "github.com/coredns/coredns/plugin/reload"
48+
_ "github.com/coredns/coredns/plugin/rewrite"
49+
_ "github.com/coredns/coredns/plugin/root"
50+
_ "github.com/coredns/coredns/plugin/route53"
51+
_ "github.com/coredns/coredns/plugin/secondary"
52+
_ "github.com/coredns/coredns/plugin/sign"
53+
_ "github.com/coredns/coredns/plugin/template"
54+
_ "github.com/coredns/coredns/plugin/timeouts"
55+
_ "github.com/coredns/coredns/plugin/tls"
56+
_ "github.com/coredns/coredns/plugin/transfer"
57+
_ "github.com/coredns/coredns/plugin/tsig"
58+
_ "github.com/coredns/coredns/plugin/view"
59+
_ "github.com/coredns/coredns/plugin/whoami"
60+
//_ "github.com/coredns/coredns/plugin/trace"
61+
)
62+
63+
// Directives are registered in the order they should be
64+
// executed.
65+
//
66+
// Ordering is VERY important. Every plugin will
67+
// feel the effects of all other plugin below
68+
// (after) them during a request, but they must not
69+
// care what plugin above them are doing.
70+
var Directives = []string{
71+
"root",
72+
"metadata",
73+
"geoip",
74+
"cancel",
75+
"tls",
76+
"timeouts",
77+
"multisocket",
78+
"reload",
79+
"nsid",
80+
"bufsize",
81+
"bind",
82+
"debug",
83+
//"trace",
84+
"ready",
85+
"health",
86+
"pprof",
87+
"prometheus",
88+
"errors",
89+
"log",
90+
"dnstap",
91+
"local",
92+
"dns64",
93+
"acl",
94+
"any",
95+
"chaos",
96+
"loadbalance",
97+
"tsig",
98+
"cache",
99+
"rewrite",
100+
"header",
101+
"dnssec",
102+
"autopath",
103+
"minimal",
104+
"template",
105+
"transfer",
106+
"hosts",
107+
"route53",
108+
"azure",
109+
"clouddns",
110+
//"k8s_external",
111+
//"kubernetes",
112+
"kuadrant",
113+
"file",
114+
"auto",
115+
"secondary",
116+
"etcd",
117+
"loop",
118+
"forward",
119+
"grpc",
120+
"erratic",
121+
"whoami",
122+
"on",
123+
"sign",
124+
"view",
125+
}

coredns/plugin/go.mod

-27
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,6 @@ require (
2929
github.com/Azure/go-autorest/autorest/to v0.2.0 // indirect
3030
github.com/Azure/go-autorest/logger v0.2.1 // indirect
3131
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
32-
github.com/DataDog/appsec-internal-go v1.8.0 // indirect
33-
github.com/DataDog/datadog-agent/pkg/obfuscate v0.48.0 // indirect
34-
github.com/DataDog/datadog-agent/pkg/remoteconfig/state v0.57.0 // indirect
35-
github.com/DataDog/datadog-go/v5 v5.3.0 // indirect
36-
github.com/DataDog/go-libddwaf/v3 v3.4.0 // indirect
37-
github.com/DataDog/go-tuf v1.1.0-0.5.2 // indirect
38-
github.com/DataDog/sketches-go v1.4.5 // indirect
39-
github.com/Microsoft/go-winio v0.6.1 // indirect
4032
github.com/apparentlymart/go-cidr v1.1.0 // indirect
4133
github.com/aws/aws-sdk-go v1.55.5 // indirect
4234
github.com/aws/aws-sdk-go-v2 v1.32.5 // indirect
@@ -60,9 +52,6 @@ require (
6052
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
6153
github.com/dimchansky/utfbom v1.1.1 // indirect
6254
github.com/dnstap/golang-dnstap v0.4.0 // indirect
63-
github.com/dustin/go-humanize v1.0.1 // indirect
64-
github.com/eapache/queue/v2 v2.0.0-20230407133247-75960ed334e4 // indirect
65-
github.com/ebitengine/purego v0.6.0-alpha.5 // indirect
6655
github.com/emicklei/go-restful/v3 v3.12.0 // indirect
6756
github.com/expr-lang/expr v1.16.9 // indirect
6857
github.com/farsightsec/golang-framestream v0.3.0 // indirect
@@ -88,9 +77,6 @@ require (
8877
github.com/googleapis/enterprise-certificate-proxy v0.3.4 // indirect
8978
github.com/googleapis/gax-go/v2 v2.14.0 // indirect
9079
github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645 // indirect
91-
github.com/hashicorp/go-secure-stdlib/parseutil v0.1.7 // indirect
92-
github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 // indirect
93-
github.com/hashicorp/go-sockaddr v1.0.2 // indirect
9480
github.com/imdario/mergo v0.3.16 // indirect
9581
github.com/infobloxopen/go-trees v0.0.0-20200715205103-96a057b8dfb9 // indirect
9682
github.com/jmespath/go-jmespath v0.4.0 // indirect
@@ -101,30 +87,20 @@ require (
10187
github.com/martinlindhe/base36 v1.1.1 // indirect
10288
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
10389
github.com/mitchellh/go-homedir v1.1.0 // indirect
104-
github.com/mitchellh/mapstructure v1.5.0 // indirect
10590
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
10691
github.com/modern-go/reflect2 v1.0.2 // indirect
10792
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
10893
github.com/onsi/ginkgo/v2 v2.19.0 // indirect
109-
github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492 // indirect
11094
github.com/opentracing/opentracing-go v1.2.1-0.20220228012449-10b1cf09e00b // indirect
111-
github.com/openzipkin-contrib/zipkin-go-opentracing v0.5.0 // indirect
112-
github.com/openzipkin/zipkin-go v0.4.3 // indirect
11395
github.com/oschwald/geoip2-golang v1.11.0 // indirect
11496
github.com/oschwald/maxminddb-golang v1.13.0 // indirect
115-
github.com/outcaste-io/ristretto v0.2.3 // indirect
116-
github.com/philhofer/fwd v1.1.3-0.20240612014219-fbbf4953d986 // indirect
117-
github.com/pkg/errors v0.9.1 // indirect
11897
github.com/prometheus/client_golang v1.20.5 // indirect
11998
github.com/prometheus/client_model v0.6.1 // indirect
12099
github.com/prometheus/common v0.60.1 // indirect
121100
github.com/prometheus/procfs v0.15.1 // indirect
122101
github.com/quic-go/quic-go v0.48.1 // indirect
123-
github.com/ryanuber/go-glob v1.0.0 // indirect
124-
github.com/secure-systems-lab/go-securesystemslib v0.7.0 // indirect
125102
github.com/sirupsen/logrus v1.9.3 // indirect
126103
github.com/spf13/pflag v1.0.5 // indirect
127-
github.com/tinylib/msgp v1.2.1 // indirect
128104
github.com/x448/float16 v0.8.4 // indirect
129105
go.etcd.io/etcd/api/v3 v3.5.17 // indirect
130106
go.etcd.io/etcd/client/pkg/v3 v3.5.17 // indirect
@@ -134,7 +110,6 @@ require (
134110
go.opentelemetry.io/otel v1.29.0 // indirect
135111
go.opentelemetry.io/otel/metric v1.29.0 // indirect
136112
go.opentelemetry.io/otel/trace v1.29.0 // indirect
137-
go.uber.org/atomic v1.11.0 // indirect
138113
go.uber.org/automaxprocs v1.6.0 // indirect
139114
go.uber.org/mock v0.4.0 // indirect
140115
go.uber.org/multierr v1.11.0 // indirect
@@ -150,13 +125,11 @@ require (
150125
golang.org/x/text v0.21.0 // indirect
151126
golang.org/x/time v0.8.0 // indirect
152127
golang.org/x/tools v0.22.0 // indirect
153-
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect
154128
google.golang.org/api v0.206.0 // indirect
155129
google.golang.org/genproto/googleapis/api v0.0.0-20241104194629-dd2ea8efbc28 // indirect
156130
google.golang.org/genproto/googleapis/rpc v0.0.0-20241104194629-dd2ea8efbc28 // indirect
157131
google.golang.org/grpc v1.68.0 // indirect
158132
google.golang.org/protobuf v1.35.2 // indirect
159-
gopkg.in/DataDog/dd-trace-go.v1 v1.69.1 // indirect
160133
gopkg.in/inf.v0 v0.9.1 // indirect
161134
gopkg.in/yaml.v2 v2.4.0 // indirect
162135
gopkg.in/yaml.v3 v3.0.1 // indirect

0 commit comments

Comments
 (0)