Commit Graph
2872 Commits
Author SHA1 Message Date
David Kanney 2342e4b644 fix(target): Assign session connection limit to SessionAuthorization.ConnectionLimit (#5396)
* fix(target): Assign session connection limit to SessionAuthorization.ConnectionLimit

* test(target): Update TestAuthorizeSession & TestAuthorizeSessionTypedCredentials to check session connection limit
2024-12-30 14:16:39 -05:00
Damian Debkowski dd1482b5ac test(cluster): check worker status multiple times (#5393) 2024-12-23 11:39:58 -08:00
Johan Brandhorst-Satzkorn 1a6320794e cmd: propagate keyring reading errors (#5360)
Reading a token from the keyring can sometimes fail for reasons
other than the token not being present in the keyring. This PR
introduces a new error used to indicate that the token requested
could not be found in the keyring and propagates errors from the
keyring up to the caller, so that the caller can act on them.

Additionally, this fixes a bug in the client cache where it would
incorrectly assume that a token had been removed from the
keyring, when in fact there was an error reading from the keyring.
2024-12-23 09:21:18 -08:00
Damian Debkowski 98bb4c8c31 test(cluster): split tests between parallel and sequential packages (#5390) 2024-12-20 13:53:37 -08:00
Johan Brandhorst-Satzkorn 1b6b22ef4f internal/daemon/worker: improve runtime and reduce noise (#5387)
TestRotationTicking would previously wait for 5 rotations, which is
pretty slow considering each rotation takes 20 seconds. Reduce
the number to 3, and use require instead of assert to remove
noise during flaky test runs.

This doesn't fix the flakiness of this test, but it should reduce the log spam.
2024-12-20 12:02:22 -08:00
Johan Brandhorst-Satzkorn 20f11ab01b Revert "internal/daemon: speed up multi-worker tests (#5370)" (#5386)
Unfortunately, this started causing the enterprise tests to break in
an unexpected way. Reverting to spend some more time testing the changes.
2024-12-19 09:29:48 -08:00
Johan Brandhorst-Satzkorn 862a30c389 internal/daemon: speed up multi-worker tests (#5370)
Instead of sleeping, we can poll for the desired state. Also,
run shutdowns in parallel.
2024-12-17 09:18:27 -08:00
David Kanney f62e67584e chore: Clarify GrantHash behavior when there are no GrantTuples (#5334)
* chore: Simplify appending

* test(grants): De-dupe hash comparison

* chore(grants): Remove TODO & add clarifying comment

* test(grants): Add test cases to enforce empty grants behavior
2024-12-06 16:45:38 -05:00
Johan Brandhorst-Satzkorn c85fad27f6 internal/event: avoid reusing canceled context (#5304)
Don't error in ReleaseGate if the context used for the original
event has been cancelled. Any error in ReleaseGate causes the
controller to terminate its startup. If a user was trying to send
a request to the Boundary controller as it started up, the context
tied to the request would be reused to attempt logging the
observation associated with the request after the logging gate
was released. This would always fail, as the context associated
with the request was canceled.

We now use a new context timeout for events logged after the release
gate is released, if the original context was canceled.
2024-12-04 09:50:25 -08:00
Bharath Gajjala 58cc322c63 Refactor redundant append operations in test setup (#5211)
* Refactor redundant append operations in test setup

- Simplified code by removing unnecessary if-else conditions in the wantUserIds and wantGroupIds blocks.

Fixes #5205

* chore: fmt fix
2024-12-03 08:47:51 -05:00
Johan Brandhorst-Satzkorn 10370edf59 internal/commands/server: prevent test panic on timeout (#5249)
Previously, if one of these tests failed to start their servers before
the timeout, there was a risk that the goroutine started to run
the server would invoke t.Errorf after the test itself had concluded.
Replace t.Errorf with fmt.Printf to avoid the panic, and include
the test name for debugging.
2024-11-22 09:57:41 -08:00
Michael Gaffney e086fd3007 test(batch): Fix data races in tests
Fixes: 9b984b0ab6
2024-11-19 08:49:57 -05:00
Johan Brandhorst-Satzkorn a2be306eb4 More managed groups limit fixes (#5245)
* internal/handlers/managed_groups: ensure membership lookup is unlimited

Previously, we would only show the first 10,000 members in the group,
giving the impression that a complete list was performed. Now we
list all members.

* internal/handlers/accounts: ensure group lookup is unlimited

Previously, we would only show the first 10,000 managed group
memberships. Now we list all group memberships of an account.
2024-11-15 10:27:20 -08:00
Johan Brandhorst-Satzkorn d830bdd416 internal/auth/oidc: ensure all managed groups are tested on auth (#5242)
Previously, we would list the managed groups with an implied
filter of db.DefaultLimit (10,000), which would incorrectly remove
a user from managed group memberships if there were more
than 10,000 managed groups in an auth method. Explicitly
set the list limit to unlimited to ensure all managed groups are
updated appropriately.
2024-11-14 15:47:08 -08:00
Elim Tsiagbey 514bcc19f6 feat(gcp): add GCP plugin (#5229)
Add GCP as a supported plugin for dynamic host catalogs
2024-11-08 11:09:29 -05:00
Hugo f227020b67 feat(scheduler): Use job table to select jobs to run
This commit changes the logic around selecting jobs to run. Before this,
Boundary used a view "job_jobs_to_run" which was a collation of all jobs
that were not running and scheduled to run. When jobs were requested to
run, Boundary would look at this view, grab a certain amount of jobs and
insert them into the "job_run" table. Importantly, while the amount of
jobs to be scheduled at once defaulted to 1 in the scheduler package,
this was entirely overriden in the controller package to -1 (no limit,
run all jobs that the query would return).

With this commit, Boundary now looks at the "job" table directly for
jobs to run, regardless of job run status. This was done to improve DB
performance as the view (which queried all "job_run" rows) was causing
significant DB contention.

Additionally, the option to limit job runs is now removed since it was
already hardcoded to -1 and not user-configurable anyways.

Should the need arise to implement this limit again, this will have to
be done in a different way since the new query does not account for
running jobs and limiting the rows returned after jobs are already
running would yield a no-op (the new query inserts nothing into
"job_run" if any given job is already running).
2024-11-06 16:15:49 +00:00
Hugo 27c432a748 feat(scheduler): Drop completed job runs as they complete
Before this change, upon the completion of a job run, the scheduler
would update a job_run entry with the completed status as well as the
number of objects affected by the run. Additionally, we then had a
cleaner job whose scope was deleting these completed entries from
job_run.

This commit changes this design to drop the cleaner job the and rolls
its functionality directly into the scheduler. Now, when any given job
run is complete, the scheduler will automatically delete it from the
job_run table itself.

In addition, the completed status has been removed as a valid status as
it is not set anymore.

This change follows a decision that given the data in these job_run
entries is already being deleted by the cleaner job, updating its state
when a job completes just to have it deleted is not efficient.
Additionally, no use-case for this data was surfaced.
2024-11-05 17:10:39 +00:00
daniandDamian Debkowski 62c41191ff [fix] allow IPv6 controllers, workers, and targets (#5221)
Co-authored-by: Damian Debkowski <damian.debkowski@hashicorp.com>
2024-11-01 13:27:40 -04:00
Michael Gaffney 9529491fa6 feat(session): Delete terminated sessions in batches
This changes the periodic job that deletes terminated sessions to delete
the those sessions in batches. Prior to this, a single SQL DELETE
command was used to delete all qualifying terminated sessions. In
systems under heavy load, the statement could timeout leading to a
situation where no qualifying terminated sessions were ever being
deleted.
2024-10-25 10:25:52 -04:00
Michael Gaffney 9b984b0ab6 feat(batch): Add batching for SQL jobs
This adds a new `batch` package under the `scheduler` package.
2024-10-25 10:25:51 -04:00
Michael Gaffney 8c291a2934 feat(scheduler): Add retries to job status
This adds retries as an attribute to JobStatus allowing a job to
indicate liveness to the scheduler when work has not progressed.
A job could use this and the statusThreshold passed into the Run method
to break work up into batches that would otherwise timeout if all the
work was attempted at once, for example a long running SQL delete
command.
2024-10-25 10:25:51 -04:00
Michael Gaffney 9354a4ebcf refactor(scheduler): Add statusThreshold parameter to job.Run
The scheduler monitors running jobs to make sure they are not hung. If
the status of a running job does not change after a duration (the
interruptThreshold in the scheduler), the scheduler kills the job. This
change passes the scheduler's interruptThreshold to the job when it
calls Run() on the job.
2024-10-25 10:25:51 -04:00
Michael Gaffney 50ab600519 docs(scheduler): Clarify Job and JobStatus
This adds more details to the Job interface and the JobStatus struct to
clarify how the scheduler uses them.
2024-10-25 10:25:50 -04:00
Irena Rindos 36158056d9 feat(workers): add VerifyKnownWorkers repo function (#5189) 2024-10-23 13:41:44 -04:00
Irena Rindos dfde64e648 chore(server): fix const ops (#5190) 2024-10-23 08:42:36 -04:00
Jim ffd0d2a7d3 feat (cache): impl. soft-delete of users in cache (#5173) 2024-10-18 10:33:29 -04:00
Irena Rindos 7798906e4e chore: update version and add Next to changelog post-release (#5179)
* chore: update version and add Next to changelog post-release
2024-10-15 13:40:55 -04:00
Cameron Perera 2e3fdb718c bump ui commit to 0ff91f9 (#5172) 2024-10-10 15:04:49 -05:00
Lisbet Alvarez 987cdb3b64 bump ui commit to 857bf01 (#5170) 2024-10-09 15:58:44 -07:00
Johan Brandhorst-Satzkorn ab922b5786 internal/clientcache/cmd/cache: restart cache on version mismatch (#5165)
Restart the client cache if it is found to be a version below the
version of the CLI during client cache hook execution.
2024-10-09 14:26:33 -04:00
Cameron Perera f656509739 bump ui commit to 0d55812 (#5158) 2024-10-08 13:57:31 -05:00
Cameron Perera a7105868d1 bump ui commit to 64e568bd (#5150) 2024-10-04 12:18:37 -05:00
Timothy Messier 21230e1c61 db: Re-order migrations for next release (#5146)
Refs: 37bf59243a
Refs: 3609658edd
2024-10-01 15:36:05 -04:00
Cameron Perera d9055bd316 bump ui commit to d3c789c66c (#5147) 2024-10-01 14:35:21 -05:00
Michael Gaffney 9119effa9e fix(session): Fix query for orphaned connections (#5138) 2024-10-01 10:16:29 -04:00
Timothy Messier 3609658edd perf(session): Avoid select when canceling session (#5140)
When a resource relating to a session is deleted,
notably a target, host, or auth_token, the corresponding sessions are
marked as canceled via a database trigger that calls the cancel_session
function. This function was performing a select as part of the insert
call to ensure that it would not attempt to insert a session_sate of
canceled if it was an invalid state transition. However, since this
function was first introduced, there has been additional constraints
added that would prevent an invalid state transition. In addition,
performing a select as part of an insert increases the chances for
contention with other queries that interact with the session_state
table, especially since a large number of sessions and session_state
rows can be included in a single transaction when things like
auth_tokens or targets get deleted.

Now, the cancel_function will perform the insert, and catch any of the
potential violations, allowing the query to continue without needing to
perform the select, thus reduction the potential for contention.
2024-10-01 10:14:06 -04:00
Irena Rindos 10a33eb7a0 Bump boundary version & update changelog (#5143)
* Bump version to 0.18
2024-10-01 09:58:31 -04:00
Hugo ec2d5d4285 feat(host/plugin): Support empty host catalog secrets 2024-09-30 21:24:18 +01:00
Hugo a5237cc171 feat(host/plugin): Use plugin client pkg func on job_set_sync 2024-09-30 21:24:18 +01:00
Hugo 5b5aa484da feat(host/plugin): Extract plugin client functionality to pkg func 2024-09-30 21:24:18 +01:00
Hugo ee9f9fb4a1 feat(worker): Support running AWS host plugin 2024-09-30 21:24:18 +01:00
Hugo 60dc0ec3ff feat(host/plugin): Always send plugin information on DHC requests 2024-09-30 21:24:18 +01:00
Hugo c3d03f69d8 feat(cmd): Support plugin host catalog worker filter 2024-09-30 21:24:18 +01:00
Hugo b8046a3ef3 feat(handlers/host_catalogs): Support plugin host catalog worker filter 2024-09-30 21:24:18 +01:00
Hugo 7449fd6f2a feat(host/plugin): Implement worker filter 2024-09-30 21:24:18 +01:00
Hugo 22b54c8b97 fix(event): Prevent eventer data races by removing shallow object copy (#5139)
This issue was surfaced through other changes (PR 5137).

Given that the eventer works in a singleton pattern (see sysEventer
global variable), performing this shallow object copy can cause a data
race because the copy operation reads the underlying eventer data
structures. At the same time, given the global nature of this eventer,
other goroutines can be writing to those same data structures.

Since we're already using a singleton pattern in this package, and given
that the current copy operation is shallow, copying the object doesn't
seem necessary, so this commit changes `StandardWriter` to build the
`logAdapter` with the `e` eventer directly instead of copying it.
2024-09-30 12:17:56 -07:00
Ryan Derr de141e34a9 Worker Connection Failure Add Controller Target (#5109)
* ICU-11692 Add Upstream Controller Addrs When Throwing Controller Connection Failure

* Reference Consistant Load Variable For Client Connection
2024-09-30 11:51:55 -07:00
Timothy Messier 37bf59243a refact(session): Replace state start_time/end_time with time range (#5134)
This replaces the start_time, end_time, and previous_end_time columns on
the session_state table with a time range column that records when the
state was active. This allowed for dropping several constraints on the
session_state table that were used to ensure that states for a session
did not overlap. Instead this can be ensured with a single exclusion
constraint. By reducing the number of constraints, it improves the
performance for a number of queries involved with session state. Most
notably when resolving delete cascades of resources related to sessions,
such as targets, where as part of the delete transaction large numbers
of sessions get canceled. Similarly, when sessions get deleted, and the
corresponding session_state rows are deleted, these constraints all must
be checked during the transaction.

The domain layer continues to expose StartTime and EndTime fields on
session.State. However it drops PreviousEndTime, which was never used by
anything calling the domain layer.

See:
    https://www.postgresql.org/docs/current/ddl-constraints.html#DDL-CONSTRAINTS-EXCLUSION
    https://www.postgresql.org/docs/current/rangetypes.html
2024-09-30 14:39:19 -04:00
Jeff Mitchell dc74e725d4 Some clarity updates to comments in ACL code (#5136) 2024-09-27 12:24:33 -04:00
Timothy Messier 632d048f7b lint: Fix linter errors
(cherry picked from commit 51a2b2035f9c6bb51fe8f5f1defeeb514183fecd)
2024-09-24 14:18:54 +00:00