mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-19 18:02:01 +00:00
Merge pull request #91856 from wawa0210/bump-corefile-migration
update corefile-migration library to 1.0.8
This commit is contained in:
commit
2930723a25
4
go.mod
4
go.mod
@ -29,7 +29,7 @@ require (
|
||||
github.com/codegangsta/negroni v1.0.0 // indirect
|
||||
github.com/container-storage-interface/spec v1.2.0
|
||||
github.com/containernetworking/cni v0.7.1
|
||||
github.com/coredns/corefile-migration v1.0.6
|
||||
github.com/coredns/corefile-migration v1.0.8
|
||||
github.com/coreos/go-oidc v2.1.0+incompatible
|
||||
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e
|
||||
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f
|
||||
@ -211,7 +211,7 @@ replace (
|
||||
github.com/containerd/ttrpc => github.com/containerd/ttrpc v1.0.0
|
||||
github.com/containerd/typeurl => github.com/containerd/typeurl v1.0.0
|
||||
github.com/containernetworking/cni => github.com/containernetworking/cni v0.7.1
|
||||
github.com/coredns/corefile-migration => github.com/coredns/corefile-migration v1.0.6
|
||||
github.com/coredns/corefile-migration => github.com/coredns/corefile-migration v1.0.8
|
||||
github.com/coreos/bbolt => github.com/coreos/bbolt v1.3.2
|
||||
github.com/coreos/etcd => github.com/coreos/etcd v3.3.10+incompatible
|
||||
github.com/coreos/go-oidc => github.com/coreos/go-oidc v2.1.0+incompatible
|
||||
|
4
go.sum
4
go.sum
@ -108,8 +108,8 @@ github.com/containerd/typeurl v1.0.0 h1:7LMH7LfEmpWeCkGcIputvd4P0Rnd0LrIv1Jk2s5o
|
||||
github.com/containerd/typeurl v1.0.0/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.6 h1:hB6vclp2g/KeXe9n1oz/PafgieUahsOYeHMQA+RJ4Hg=
|
||||
github.com/coredns/corefile-migration v1.0.6/go.mod h1:OFwBp/Wc9dJt5cAZzHWMNhK1r5L0p0jDwIBc6j8NC8E=
|
||||
github.com/coredns/corefile-migration v1.0.8 h1:y/DSRGlmrLPTMUGWR81MgFC2ITLiaTGkbth0BqW3wvc=
|
||||
github.com/coredns/corefile-migration v1.0.8/go.mod h1:OFwBp/Wc9dJt5cAZzHWMNhK1r5L0p0jDwIBc6j8NC8E=
|
||||
github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=
|
||||
github.com/coreos/etcd v3.3.10+incompatible h1:jFneRYjIvLMLhDLCzuTuU4rSJUjRplcJQ7pD7MnhC04=
|
||||
github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
|
||||
|
22
vendor/github.com/coredns/corefile-migration/migration/corefile/corefile.go
generated
vendored
22
vendor/github.com/coredns/corefile-migration/migration/corefile/corefile.go
generated
vendored
@ -76,7 +76,7 @@ func (c *Corefile) ToString() (out string) {
|
||||
}
|
||||
|
||||
func (s *Server) ToString() (out string) {
|
||||
str := strings.Join(s.DomPorts, " ")
|
||||
str := strings.Join(escapeArgs(s.DomPorts), " ")
|
||||
strs := []string{}
|
||||
for _, p := range s.Plugins {
|
||||
strs = append(strs, strings.Repeat(" ", indent)+p.ToString())
|
||||
@ -88,7 +88,7 @@ func (s *Server) ToString() (out string) {
|
||||
}
|
||||
|
||||
func (p *Plugin) ToString() (out string) {
|
||||
str := strings.Join(append([]string{p.Name}, p.Args...), " ")
|
||||
str := strings.Join(append([]string{p.Name}, escapeArgs(p.Args)...), " ")
|
||||
strs := []string{}
|
||||
for _, o := range p.Options {
|
||||
strs = append(strs, strings.Repeat(" ", indent*2)+o.ToString())
|
||||
@ -100,10 +100,26 @@ func (p *Plugin) ToString() (out string) {
|
||||
}
|
||||
|
||||
func (o *Option) ToString() (out string) {
|
||||
str := strings.Join(append([]string{o.Name}, o.Args...), " ")
|
||||
str := strings.Join(append([]string{o.Name}, escapeArgs(o.Args)...), " ")
|
||||
return str
|
||||
}
|
||||
|
||||
// escapeArgs returns the arguments list escaping and wrapping any argument containing whitespace in quotes
|
||||
func escapeArgs(args []string) []string {
|
||||
var escapedArgs []string
|
||||
for _, a := range args {
|
||||
// if there is white space, wrap argument with quotes
|
||||
if len(strings.Fields(a)) > 1 {
|
||||
// escape quotes
|
||||
a = strings.Replace(a, "\"", "\\\"", -1)
|
||||
// wrap with quotes
|
||||
a = "\"" + a + "\""
|
||||
}
|
||||
escapedArgs = append(escapedArgs, a)
|
||||
}
|
||||
return escapedArgs
|
||||
}
|
||||
|
||||
func (s *Server) FindMatch(def []*Server) (*Server, bool) {
|
||||
NextServer:
|
||||
for _, sDef := range def {
|
||||
|
31
vendor/github.com/coredns/corefile-migration/migration/migrate.go
generated
vendored
31
vendor/github.com/coredns/corefile-migration/migration/migrate.go
generated
vendored
@ -6,6 +6,7 @@ package migration
|
||||
// helper functions that make this easier to implement.
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"regexp"
|
||||
"sort"
|
||||
@ -27,7 +28,7 @@ func Unsupported(fromCoreDNSVersion, toCoreDNSVersion, corefileStr string) ([]No
|
||||
}
|
||||
|
||||
func getStatus(fromCoreDNSVersion, toCoreDNSVersion, corefileStr, status string) ([]Notice, error) {
|
||||
err := validUpMigration(fromCoreDNSVersion, toCoreDNSVersion)
|
||||
err := ValidUpMigration(fromCoreDNSVersion, toCoreDNSVersion)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -128,7 +129,7 @@ func Migrate(fromCoreDNSVersion, toCoreDNSVersion, corefileStr string, deprecati
|
||||
if fromCoreDNSVersion == toCoreDNSVersion {
|
||||
return corefileStr, nil
|
||||
}
|
||||
err := validUpMigration(fromCoreDNSVersion, toCoreDNSVersion)
|
||||
err := ValidUpMigration(fromCoreDNSVersion, toCoreDNSVersion)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
@ -394,6 +395,16 @@ func Released(dockerImageSHA string) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// VersionFromSHA returns the version string matching the dockerImageSHA.
|
||||
func VersionFromSHA(dockerImageSHA string) (string, error) {
|
||||
for vStr, v := range Versions {
|
||||
if v.dockerImageSHA == dockerImageSHA {
|
||||
return vStr, nil
|
||||
}
|
||||
}
|
||||
return "", errors.New("sha unsupported")
|
||||
}
|
||||
|
||||
// ValidVersions returns a list of all versions defined
|
||||
func ValidVersions() []string {
|
||||
var vStrs []string
|
||||
@ -404,14 +415,7 @@ func ValidVersions() []string {
|
||||
return vStrs
|
||||
}
|
||||
|
||||
func validateVersion(fromCoreDNSVersion string) error {
|
||||
if _, ok := Versions[fromCoreDNSVersion]; !ok {
|
||||
return fmt.Errorf("start version '%v' not supported", fromCoreDNSVersion)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func validUpMigration(fromCoreDNSVersion, toCoreDNSVersion string) error {
|
||||
func ValidUpMigration(fromCoreDNSVersion, toCoreDNSVersion string) error {
|
||||
|
||||
err := validateVersion(fromCoreDNSVersion)
|
||||
if err != nil {
|
||||
@ -429,6 +433,13 @@ func validUpMigration(fromCoreDNSVersion, toCoreDNSVersion string) error {
|
||||
return fmt.Errorf("cannot migrate up to '%v' from '%v'", toCoreDNSVersion, fromCoreDNSVersion)
|
||||
}
|
||||
|
||||
func validateVersion(fromCoreDNSVersion string) error {
|
||||
if _, ok := Versions[fromCoreDNSVersion]; !ok {
|
||||
return fmt.Errorf("start version '%v' not supported", fromCoreDNSVersion)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func validDownMigration(fromCoreDNSVersion, toCoreDNSVersion string) error {
|
||||
err := validateVersion(fromCoreDNSVersion)
|
||||
if err != nil {
|
||||
|
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
@ -164,7 +164,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.6 => github.com/coredns/corefile-migration v1.0.6
|
||||
# github.com/coredns/corefile-migration v1.0.8 => github.com/coredns/corefile-migration v1.0.8
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user