Remove the server_id from session table, change it to worker_id on session_connection (#2070)

* Remove the server_id from session table, change it to worker_id on session_connection

This is step 1 in updating the worker table.  The worker is becoming a public resource so it must have
a public id.  We drop the server_id column on the session_connection table and add the worker_id column
so we can use the wt_public_key type.  Since db migrations are applied while the controller is offline,
it should be safe to assume all session connections are not in a running state, thus allowing us to null
out all the worker ids in the session_connection table.

For now we don't have very good enforcement of the wt_public_id constraints, since the id is currently
defined in the worker config, but this will soon change and the worker's id will be generated by the
controller.
This commit is contained in:
Todd authored and GitHub committed 2022-05-16 15:14:12 -07:00
1 parent 0581e164f1
commit 472d7d520a
43 files changed
+578 -1079

No files matched your search

@@ -7,11 +7,6 @@ import "google/protobuf/timestamp.proto";
option go_package = "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/sessions;sessions";
message WorkerInfo {
// The address of the worker.
string address = 10; // @gotags: `class:"public"`
}
message SessionState {
// The status of the Session, e.g. "pending", "active", "canceling", "terminated".
string status = 10; // @gotags: `class:"public"`
@@ -49,6 +44,13 @@ message Connection {
// Session contains all fields related to a Session resource
message Session {
// Worker info previously contained only the worker's address but was never
// populated either in the database or on the API. While worker id information
// may become helpful on a session in the future, the worker id seems the most
// relevant information since the address can change between the time the
// session is created and a session connection is made through that worker.
reserved "worker_info";
// Output only. The ID of the Session.
string id = 10; // @gotags: `class:"public"`
@@ -97,9 +99,6 @@ message Session {
// Output only. The current status of this Session.
string status = 180; // @gotags: `class:"public"`
// Output only. Worker information given to the client.
repeated WorkerInfo worker_info = 190 [json_name = "worker_info"];
// Output only. The certificate generated for the session. Raw DER bytes.
bytes certificate = 200; // @gotags: `class:"public"`