mirror of
https://github.com/notherealmarco/coredns-deployment.git
synced 2025-05-05 12:32:34 +02:00
Adding CLI for the migration tool (#154)
* Initial commit for the corefile-tool cli for the migration tool * cleanup implementation * nit * add fn to get corefile path * add released command and improve readme
This commit is contained in:
parent
631694b4e3
commit
37f5d0dad4
12 changed files with 495 additions and 3 deletions
|
@ -7,6 +7,8 @@ package migration
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"sort"
|
||||
|
||||
"github.com/coredns/deployment/kubernetes/migration/corefile"
|
||||
)
|
||||
|
||||
|
@ -243,9 +245,10 @@ func Released(dockerImageID string) bool {
|
|||
// ValidVersions returns a list of all versions defined
|
||||
func ValidVersions() []string {
|
||||
var vStrs []string
|
||||
for vStr, _ := range Versions {
|
||||
for vStr := range Versions {
|
||||
vStrs = append(vStrs, vStr)
|
||||
}
|
||||
sort.Strings(vStrs)
|
||||
return vStrs
|
||||
}
|
||||
|
||||
|
@ -261,11 +264,11 @@ func validateVersions(fromCoreDNSVersion, toCoreDNSVersion string) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for next := Versions[fromCoreDNSVersion].nextVersion; next != ""; next = Versions[next].nextVersion {
|
||||
for next := Versions[fromCoreDNSVersion].nextVersion; next != ""; next = Versions[next].nextVersion {
|
||||
if next != toCoreDNSVersion {
|
||||
continue
|
||||
}
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("cannot migrate to '%v' from '%v'", toCoreDNSVersion, fromCoreDNSVersion)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue