bump vendor of corefile-migration lib to 1.0.4 which support migration of coredns up to version 1.6.5

This commit is contained in:
Sandeep Rajan
2019-11-12 13:10:35 -05:00
parent f931dad722
commit 2544a764db
5 changed files with 281 additions and 10 deletions

View File

@@ -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

View File

@@ -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{