kubernetes/migration: dont error out on no-op same-verison upgrades (#171)

* dont error out on no-op same-verison upgrades

* test case fixes
This commit is contained in:
Chris O'Haver 2019-05-20 11:22:18 -04:00 committed by GitHub
parent 9fd69a4c0b
commit 487cb8878d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 57 additions and 3 deletions

View file

@ -26,15 +26,18 @@ func Unsupported(fromCoreDNSVersion, toCoreDNSVersion, corefileStr string) ([]No
}
func getStatus(fromCoreDNSVersion, toCoreDNSVersion, corefileStr, status string) ([]Notice, error) {
notices := []Notice{}
if fromCoreDNSVersion == toCoreDNSVersion {
return nil, nil
}
err := validateVersions(fromCoreDNSVersion, toCoreDNSVersion)
if err != nil {
return notices, err
return nil, err
}
cf, err := corefile.New(corefileStr)
if err != nil {
return notices, err
return nil, err
}
notices := []Notice{}
v := fromCoreDNSVersion
for {
v = Versions[v].nextVersion
@ -126,6 +129,9 @@ func getStatus(fromCoreDNSVersion, toCoreDNSVersion, corefileStr, status string)
// If deprecations is true, deprecated plugins/options will be migrated as soon as they are deprecated.
// If deprecations is false, deprecated plugins/options will be migrated only once they become removed or ignored.
func Migrate(fromCoreDNSVersion, toCoreDNSVersion, corefileStr string, deprecations bool) (string, error) {
if fromCoreDNSVersion == toCoreDNSVersion {
return corefileStr, nil
}
err := validateVersions(fromCoreDNSVersion, toCoreDNSVersion)
if err != nil {
return "", err