mirror of
https://github.com/notherealmarco/coredns-deployment.git
synced 2025-05-05 20:42:33 +02:00
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:
parent
9fd69a4c0b
commit
487cb8878d
2 changed files with 57 additions and 3 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue