From 2544a764db6d3f1a74eb9cb53d1562c68bc54682 Mon Sep 17 00:00:00 2001 From: Sandeep Rajan Date: Tue, 12 Nov 2019 13:10:35 -0500 Subject: [PATCH] bump vendor of corefile-migration lib to 1.0.4 which support migration of coredns up to version 1.6.5 --- go.mod | 4 +- go.sum | 4 +- .../corefile-migration/migration/migrate.go | 13 +- .../corefile-migration/migration/versions.go | 268 ++++++++++++++++++ vendor/modules.txt | 2 +- 5 files changed, 281 insertions(+), 10 deletions(-) diff --git a/go.mod b/go.mod index 907ecc0049f..62f3554fbb6 100644 --- a/go.mod +++ b/go.mod @@ -36,7 +36,7 @@ require ( github.com/containerd/containerd v1.0.2 // indirect github.com/containerd/typeurl v0.0.0-20190228175220-2a93cfde8c20 // indirect github.com/containernetworking/cni v0.7.1 - github.com/coredns/corefile-migration v1.0.2 + github.com/coredns/corefile-migration v1.0.4 github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e github.com/coreos/pkg v0.0.0-20180108230652-97fdf19511ea github.com/coreos/rkt v1.30.0 // indirect @@ -225,7 +225,7 @@ replace ( github.com/containerd/containerd => github.com/containerd/containerd v1.0.2 github.com/containerd/typeurl => github.com/containerd/typeurl v0.0.0-20190228175220-2a93cfde8c20 github.com/containernetworking/cni => github.com/containernetworking/cni v0.7.1 - github.com/coredns/corefile-migration => github.com/coredns/corefile-migration v1.0.2 + github.com/coredns/corefile-migration => github.com/coredns/corefile-migration v1.0.4 github.com/coreos/etcd => github.com/coreos/etcd v3.3.10+incompatible github.com/coreos/go-etcd => github.com/coreos/go-etcd v2.0.0+incompatible github.com/coreos/go-oidc => github.com/coreos/go-oidc v2.1.0+incompatible diff --git a/go.sum b/go.sum index de71cccca9d..bafeb53feb1 100644 --- a/go.sum +++ b/go.sum @@ -100,8 +100,8 @@ github.com/containerd/typeurl v0.0.0-20190228175220-2a93cfde8c20 h1:14r0i3IeJj6z github.com/containerd/typeurl v0.0.0-20190228175220-2a93cfde8c20/go.mod h1:Cm3kwCdlkCfMSHURc+r6fwoGH6/F1hH3S4sg0rLFWPc= github.com/containernetworking/cni v0.7.1 h1:fE3r16wpSEyaqY4Z4oFrLMmIGfBYIKpPrHK31EJ9FzE= github.com/containernetworking/cni v0.7.1/go.mod h1:LGwApLUm2FpoOfxTDEeq8T9ipbpZ61X79hmU3w8FmsY= -github.com/coredns/corefile-migration v1.0.2 h1:kQga1ATFIZdkBtU6c/oJdtASLcCRkDh3fW8vVyVdvUc= -github.com/coredns/corefile-migration v1.0.2/go.mod h1:OFwBp/Wc9dJt5cAZzHWMNhK1r5L0p0jDwIBc6j8NC8E= +github.com/coredns/corefile-migration v1.0.4 h1:GpAwsgzgLA9HOnt3+Z69xsMVLl0doNnyVfBX79d/P5A= +github.com/coredns/corefile-migration v1.0.4/go.mod h1:OFwBp/Wc9dJt5cAZzHWMNhK1r5L0p0jDwIBc6j8NC8E= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= github.com/coreos/go-oidc v2.1.0+incompatible h1:sdJrfw8akMnCuUlaZU3tE/uYXFgfqom8DBE9so9EBsM= diff --git a/vendor/github.com/coredns/corefile-migration/migration/migrate.go b/vendor/github.com/coredns/corefile-migration/migration/migrate.go index 573f78da52e..23835bd0237 100644 --- a/vendor/github.com/coredns/corefile-migration/migration/migrate.go +++ b/vendor/github.com/coredns/corefile-migration/migration/migrate.go @@ -12,7 +12,7 @@ import ( "github.com/coredns/corefile-migration/migration/corefile" ) -// Deprecated returns a list of deprecation notifications affecting the guven Corefile. Notifications are returned for +// Deprecated returns a list of deprecation notifications affecting the given Corefile. Notifications are returned for // any deprecated, removed, or ignored plugins/directives present in the Corefile. Notifications are also returned for // any new default plugins that would be added in a migration. func Deprecated(fromCoreDNSVersion, toCoreDNSVersion, corefileStr string) ([]Notice, error) { @@ -26,9 +26,6 @@ func Unsupported(fromCoreDNSVersion, toCoreDNSVersion, corefileStr string) ([]No } func getStatus(fromCoreDNSVersion, toCoreDNSVersion, corefileStr, status string) ([]Notice, error) { - if fromCoreDNSVersion == toCoreDNSVersion { - return nil, nil - } err := validUpMigration(fromCoreDNSVersion, toCoreDNSVersion) if err != nil { return nil, err @@ -40,7 +37,9 @@ func getStatus(fromCoreDNSVersion, toCoreDNSVersion, corefileStr, status string) notices := []Notice{} v := fromCoreDNSVersion for { - v = Versions[v].nextVersion + if fromCoreDNSVersion != toCoreDNSVersion { + v = Versions[v].nextVersion + } for _, s := range cf.Servers { for _, p := range s.Plugins { vp, present := Versions[v].plugins[p.Name] @@ -417,10 +416,14 @@ func validateVersion(fromCoreDNSVersion string) error { } func validUpMigration(fromCoreDNSVersion, toCoreDNSVersion string) error { + err := validateVersion(fromCoreDNSVersion) if err != nil { return err } + if fromCoreDNSVersion == toCoreDNSVersion { + return nil + } for next := Versions[fromCoreDNSVersion].nextVersion; next != ""; next = Versions[next].nextVersion { if next != toCoreDNSVersion { continue diff --git a/vendor/github.com/coredns/corefile-migration/migration/versions.go b/vendor/github.com/coredns/corefile-migration/migration/versions.go index 3598bd8ba64..08d556604b4 100644 --- a/vendor/github.com/coredns/corefile-migration/migration/versions.go +++ b/vendor/github.com/coredns/corefile-migration/migration/versions.go @@ -89,10 +89,278 @@ func addToAllServerBlocks(sb *corefile.Server, newPlugin *corefile.Plugin) (*cor return addToServerBlockWithPlugins(sb, newPlugin, []string{}) } +func addOptionToPlugin(pl *corefile.Plugin, newOption *corefile.Option) (*corefile.Plugin, error) { + pl.Options = append(pl.Options, newOption) + return pl, nil +} + var Versions = map[string]release{ + "1.6.5": { + priorVersion: "1.6.4", + dockerImageSHA: "7ec975f167d815311a7136c32e70735f0d00b73781365df1befd46ed35bd4fe7", + defaultConf: `.:53 { + errors + health { + lameduck 5s + } + kubernetes * *** { + pods insecure + upstream + fallthrough in-addr.arpa ip6.arpa + ttl 30 + } + prometheus :9153 + forward . * + cache 30 + loop + reload + loadbalance +}`, + plugins: map[string]plugin{ + "errors": { + options: map[string]option{ + "consolidate": {}, + }, + }, + "log": { + options: map[string]option{ + "class": {}, + }, + }, + "health": { + options: map[string]option{ + "lameduck": { + status: newdefault, + add: func(c *corefile.Plugin) (*corefile.Plugin, error) { + return addOptionToPlugin(c, &corefile.Option{Name: "lameduck 5s"}) + }, + downAction: removeOption, + }, + }, + }, + "ready": {}, + "autopath": {}, + "kubernetes": { + options: map[string]option{ + "endpoint": { + status: ignored, + action: useFirstArgumentOnly, + }, + "tls": {}, + "kubeconfig": {}, + "namespaces": {}, + "labels": {}, + "pods": {}, + "endpoint_pod_names": {}, + "upstream": { + status: ignored, + action: removeOption, + }, + "ttl": {}, + "noendpoints": {}, + "transfer": {}, + "fallthrough": {}, + "ignore": {}, + }, + }, + "k8s_external": { + options: map[string]option{ + "apex": {}, + "ttl": {}, + }, + }, + "prometheus": {}, + "forward": { + options: map[string]option{ + "except": {}, + "force_tcp": {}, + "prefer_udp": {}, + "expire": {}, + "max_fails": {}, + "tls": {}, + "tls_servername": {}, + "policy": {}, + "health_check": {}, + }, + }, + "cache": { + options: map[string]option{ + "success": {}, + "denial": {}, + "prefetch": {}, + }, + }, + "loop": {}, + "reload": {}, + "loadbalance": {}, + }, + }, + "1.6.4": { + nextVersion: "1.6.5", + priorVersion: "1.6.3", + dockerImageSHA: "493ee88e1a92abebac67cbd4b5658b4730e0f33512461442d8d9214ea6734a9b", + plugins: map[string]plugin{ + "errors": { + options: map[string]option{ + "consolidate": {}, + }, + }, + "log": { + options: map[string]option{ + "class": {}, + }, + }, + "health": {}, + "ready": {}, + "autopath": {}, + "kubernetes": { + options: map[string]option{ + "endpoint": { + status: ignored, + action: useFirstArgumentOnly, + }, + "tls": {}, + "kubeconfig": {}, + "namespaces": {}, + "labels": {}, + "pods": {}, + "endpoint_pod_names": {}, + "upstream": { + status: ignored, + action: removeOption, + }, + "ttl": {}, + "noendpoints": {}, + "transfer": {}, + "fallthrough": {}, + "ignore": {}, + }, + }, + "k8s_external": { + options: map[string]option{ + "apex": {}, + "ttl": {}, + }, + }, + "prometheus": {}, + "forward": { + options: map[string]option{ + "except": {}, + "force_tcp": {}, + "prefer_udp": {}, + "expire": {}, + "max_fails": {}, + "tls": {}, + "tls_servername": {}, + "policy": {}, + "health_check": {}, + }, + }, + "cache": { + options: map[string]option{ + "success": {}, + "denial": {}, + "prefetch": {}, + }, + }, + "loop": {}, + "reload": {}, + "loadbalance": {}, + }, + }, + "1.6.3": { + nextVersion: "1.6.4", + priorVersion: "1.6.2", + dockerImageSHA: "cfa7236dab4e3860881fdf755880ff8361e42f6cba2e3775ae48e2d46d22f7ba", + plugins: map[string]plugin{ + "errors": { + options: map[string]option{ + "consolidate": {}, + }, + }, + "log": { + options: map[string]option{ + "class": {}, + }, + }, + "health": {}, + "ready": {}, + "autopath": {}, + "kubernetes": { + options: map[string]option{ + "endpoint": { + status: ignored, + action: useFirstArgumentOnly, + }, + "tls": {}, + "kubeconfig": {}, + "namespaces": {}, + "labels": {}, + "pods": {}, + "endpoint_pod_names": {}, + "upstream": { + status: ignored, + action: removeOption, + }, + "ttl": {}, + "noendpoints": {}, + "transfer": {}, + "fallthrough": {}, + "ignore": {}, + }, + }, + "k8s_external": { + options: map[string]option{ + "apex": {}, + "ttl": {}, + }, + }, + "prometheus": {}, + "forward": { + options: map[string]option{ + "except": {}, + "force_tcp": {}, + "prefer_udp": {}, + "expire": {}, + "max_fails": {}, + "tls": {}, + "tls_servername": {}, + "policy": {}, + "health_check": {}, + }, + }, + "cache": { + options: map[string]option{ + "success": {}, + "denial": {}, + "prefetch": {}, + }, + }, + "loop": {}, + "reload": {}, + "loadbalance": {}, + }, + }, "1.6.2": { + nextVersion: "1.6.3", priorVersion: "1.6.1", dockerImageSHA: "12eb885b8685b1b13a04ecf5c23bc809c2e57917252fd7b0be9e9c00644e8ee5", + defaultConf: `.:53 { + errors + health + kubernetes * *** { + pods insecure + upstream + fallthrough in-addr.arpa ip6.arpa + ttl 30 + } + prometheus :9153 + forward . * + cache 30 + loop + reload + loadbalance +}`, plugins: map[string]plugin{ "errors": { options: map[string]option{ diff --git a/vendor/modules.txt b/vendor/modules.txt index 0b825313601..f995dfcfb20 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -175,7 +175,7 @@ github.com/containernetworking/cni/pkg/types github.com/containernetworking/cni/pkg/types/020 github.com/containernetworking/cni/pkg/types/current github.com/containernetworking/cni/pkg/version -# github.com/coredns/corefile-migration v1.0.2 => github.com/coredns/corefile-migration v1.0.2 +# github.com/coredns/corefile-migration v1.0.4 => github.com/coredns/corefile-migration v1.0.4 github.com/coredns/corefile-migration/migration github.com/coredns/corefile-migration/migration/corefile # github.com/coreos/go-oidc v2.1.0+incompatible => github.com/coreos/go-oidc v2.1.0+incompatible