diff --git a/controller/persistence/migration_initialize.go b/controller/persistence/migration_initialize.go index a9c1bdaf0..0b1ec8451 100644 --- a/controller/persistence/migration_initialize.go +++ b/controller/persistence/migration_initialize.go @@ -316,6 +316,7 @@ var tunnelDefinitions = map[string]interface{}{ "low": map[string]interface{}{"$ref": "#/definitions/portNumber"}, "high": map[string]interface{}{"$ref": "#/definitions/portNumber"}, }, + "required": []interface{}{"low", "high"}, }, "protocolName": map[string]interface{}{ "type": "string", diff --git a/controller/persistence/migrations.go b/controller/persistence/migrations.go index f939b22ee..c8ba8e6f4 100644 --- a/controller/persistence/migrations.go +++ b/controller/persistence/migrations.go @@ -22,7 +22,7 @@ import ( ) const ( - CurrentDbVersion = 21 + CurrentDbVersion = 22 FieldVersion = "version" ) @@ -91,6 +91,11 @@ func (m *Migrations) migrate(step *boltz.MigrationStep) int { step.SetError(m.stores.ConfigType.Update(step.Ctx, hostV2ConfigType, nil)) } + if step.CurrentVersion < 22 { + step.SetError(m.stores.ConfigType.Update(step.Ctx, hostV1ConfigType, nil)) + step.SetError(m.stores.ConfigType.Update(step.Ctx, hostV2ConfigType, nil)) + } + // current version if step.CurrentVersion <= CurrentDbVersion { return CurrentDbVersion diff --git a/tunnel/entities/host.v1.json b/tunnel/entities/host.v1.json index 3e39477d5..c97ca8eb9 100644 --- a/tunnel/entities/host.v1.json +++ b/tunnel/entities/host.v1.json @@ -71,7 +71,11 @@ "high": { "$ref": "#/$defs/portNumber" } - } + }, + "required": [ + "low", + "high" + ] }, "protocolName": { "type": "string", @@ -136,7 +140,7 @@ { "if": { "properties": { - "forwardProtocol": { + "forwardPort": { "const": true } }, @@ -173,7 +177,7 @@ }, { "items": { - "$ref": "#/$defs/dialAddress" + "$ref": "#/$defs/listenAddress" } } ] diff --git a/tunnel/entities/host.v2.json b/tunnel/entities/host.v2.json index 9aaba7e57..1f9ddb60b 100644 --- a/tunnel/entities/host.v2.json +++ b/tunnel/entities/host.v2.json @@ -156,7 +156,11 @@ "high": { "$ref": "#/definitions/portNumber" } - } + }, + "required": [ + "low", + "high" + ] }, "protocolName": { "type": "string", @@ -258,7 +262,7 @@ { "if": { "properties": { - "forwardProtocol": { + "forwardPort": { "const": true } }, @@ -295,7 +299,7 @@ }, { "items": { - "$ref": "#/definitions/dialAddress" + "$ref": "#/definitions/listenAddress" } } ]