Add fields to server_worker to be a boundary resource (#2083)
* 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 contraints, 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. * Updating server_id references to controller_id. * Adding worker tag db writing test. * Move the server table back to the top. * Update comment for the worker object. * Update comment for the worker table. * Update the newWorkerId call to take a context and fix its error. * Correct comment for the wt_network_address domain.
This commit is contained in:
33 files changed
+967
-457
No files matched your search
@@ -6,7 +6,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/hashicorp/boundary/internal/servers/store"
|
||||
"github.com/hashicorp/boundary/internal/types/scope"
|
||||
|
||||
"github.com/hashicorp/boundary/internal/auth/password"
|
||||
"github.com/hashicorp/boundary/internal/authtoken"
|
||||
@@ -181,7 +181,7 @@ func TestTofu(t testing.TB) []byte {
|
||||
}
|
||||
|
||||
// TestWorker inserts a worker into the db to satisfy foreign key constraints.
|
||||
func TestWorker(t *testing.T, conn *db.DB, wrapper wrapping.Wrapper, opt ...Option) *store.Worker {
|
||||
func TestWorker(t *testing.T, conn *db.DB, wrapper wrapping.Wrapper, opt ...Option) *servers.Worker {
|
||||
t.Helper()
|
||||
rw := db.New(conn)
|
||||
kms := kms.TestKms(t, conn, wrapper)
|
||||
@@ -193,11 +193,10 @@ func TestWorker(t *testing.T, conn *db.DB, wrapper wrapping.Wrapper, opt ...Opti
|
||||
id = "test_session_worker-" + id
|
||||
|
||||
name := "test-worker-" + id
|
||||
worker := &store.Worker{
|
||||
PublicId: id,
|
||||
Name: name,
|
||||
Address: "127.0.0.1",
|
||||
}
|
||||
worker := servers.NewWorker(scope.Global.String(),
|
||||
servers.WithPublicId(id),
|
||||
servers.WithName(name),
|
||||
servers.WithAddress("127.0.0.1"))
|
||||
_, _, err = serversRepo.UpsertWorker(context.Background(), worker)
|
||||
require.NoError(t, err)
|
||||
return worker
|
||||
|
||||
Reference in new issue
Block a user