kubernetes/migration: support simple downgrade cases (#172)

* support basic downgrades

* add unit test for validDownMigration

* add no-op test for downward migration

* document
This commit is contained in:
Chris O'Haver 2019-05-20 16:11:03 -04:00 committed by GitHub
parent 487cb8878d
commit 38ae5466f7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 264 additions and 12 deletions

View file

@ -12,19 +12,22 @@ type plugin struct {
options map[string]option
action pluginActionFn // action affecting this plugin only
add serverActionFn // action to add a new plugin to the server block
downAction pluginActionFn // downgrade action affecting this plugin only
}
type option struct {
status string
replacedBy string
additional string
action optionActionFn // take action affecting this option only
add pluginActionFn // take action to add the option to the plugin
action optionActionFn // action affecting this option only
add pluginActionFn // action to add the option to the plugin
downAction optionActionFn // downgrade action affecting this option only
}
type release struct {
k8sRelease string
nextVersion string
priorVersion string
dockerImageSHA string
plugins map[string]plugin // list of plugins with deprecation status and migration actions
@ -88,6 +91,8 @@ func addToAllServerBlocks(sb *corefile.Server, newPlugin *corefile.Plugin) (*cor
var Versions = map[string]release{
"1.5.0": {
priorVersion: "1.4.0",
k8sRelease: "1.15",
dockerImageSHA: "e83beb5e43f8513fa735e77ffc5859640baea30a882a11cc75c4c3244a737d3c",
plugins: map[string]plugin{
"errors": {
@ -106,6 +111,7 @@ var Versions = map[string]release{
add: func(c *corefile.Server) (*corefile.Server, error) {
return addToKubernetesServerBlocks(c, &corefile.Plugin{Name: "ready"})
},
downAction: removePlugin,
},
"autopath": {},
"kubernetes": {
@ -176,6 +182,7 @@ var Versions = map[string]release{
},
"1.4.0": {
nextVersion: "1.5.0",
priorVersion: "1.3.1",
dockerImageSHA: "70a92e9f6fc604f9b629ca331b6135287244a86612f550941193ec7e12759417",
plugins: map[string]plugin{
"errors": {
@ -255,6 +262,7 @@ var Versions = map[string]release{
},
"1.3.1": {
nextVersion: "1.4.0",
priorVersion: "1.3.0",
k8sRelease: "1.14",
dockerImageSHA: "02382353821b12c21b062c59184e227e001079bb13ebd01f9d3270ba0fcbf1e4",
defaultConf: `.:53 {
@ -351,6 +359,7 @@ var Versions = map[string]release{
},
"1.3.0": {
nextVersion: "1.3.1",
priorVersion: "1.2.6",
dockerImageSHA: "e030773c7fee285435ed7fc7623532ee54c4c1c4911fb24d95cd0170a8a768bc",
plugins: map[string]plugin{
"errors": {
@ -384,6 +393,7 @@ var Versions = map[string]release{
},
},
"k8s_external": {
downAction: removePlugin,
options: map[string]option{
"apex": {},
"ttl": {},
@ -428,6 +438,7 @@ var Versions = map[string]release{
},
"1.2.6": {
nextVersion: "1.3.0",
priorVersion: "1.2.5",
k8sRelease: "1.13",
dockerImageSHA: "81936728011c0df9404cb70b95c17bbc8af922ec9a70d0561a5d01fefa6ffa51",
defaultConf: `.:53 {
@ -515,6 +526,7 @@ var Versions = map[string]release{
},
"1.2.5": {
nextVersion: "1.2.6",
priorVersion: "1.2.4",
dockerImageSHA: "33c8da20b887ae12433ec5c40bfddefbbfa233d5ce11fb067122e68af30291d6",
plugins: map[string]plugin{
"errors": {},
@ -582,6 +594,7 @@ var Versions = map[string]release{
},
"1.2.4": {
nextVersion: "1.2.5",
priorVersion: "1.2.3",
dockerImageSHA: "a0d40ad961a714c699ee7b61b77441d165f6252f9fb84ac625d04a8d8554c0ec",
plugins: map[string]plugin{
"errors": {},
@ -649,6 +662,7 @@ var Versions = map[string]release{
},
"1.2.3": {
nextVersion: "1.2.4",
priorVersion: "1.2.2",
dockerImageSHA: "12f3cab301c826978fac736fd40aca21ac023102fd7f4aa6b4341ae9ba89e90e",
plugins: map[string]plugin{
"errors": {},
@ -716,6 +730,7 @@ var Versions = map[string]release{
},
"1.2.2": {
nextVersion: "1.2.3",
priorVersion: "1.2.1",
k8sRelease: "1.12",
dockerImageSHA: "3e2be1cec87aca0b74b7668bbe8c02964a95a402e45ceb51b2252629d608d03a",
defaultConf: `.:53 {
@ -798,6 +813,7 @@ var Versions = map[string]release{
},
"1.2.1": {
nextVersion: "1.2.2",
priorVersion: "1.2.0",
dockerImageSHA: "fb129c6a7c8912bc6d9cc4505e1f9007c5565ceb1aa6369750e60cc79771a244",
plugins: map[string]plugin{
"errors": {},
@ -862,6 +878,7 @@ var Versions = map[string]release{
add: func(s *corefile.Server) (*corefile.Server, error) {
return addToForwardingServerBlocks(s, &corefile.Plugin{Name: "loop"})
},
downAction: removePlugin,
},
"reload": {},
"loadbalance": {},
@ -869,6 +886,7 @@ var Versions = map[string]release{
},
"1.2.0": {
nextVersion: "1.2.1",
priorVersion: "1.1.4",
dockerImageSHA: "ae69a32f8cc29a3e2af9628b6473f24d3e977950a2cb62ce8911478a61215471",
plugins: map[string]plugin{
"errors": {},
@ -937,6 +955,7 @@ var Versions = map[string]release{
},
"1.1.4": {
nextVersion: "1.2.0",
priorVersion: "1.1.3",
dockerImageSHA: "463c7021141dd3bfd4a75812f4b735ef6aadc0253a128f15ffe16422abe56e50",
plugins: map[string]plugin{
"errors": {},