mirror of
https://github.com/floci-io/floci.git
synced 2026-12-03 02:07:58 -05:00
009ac0b4a62e2e1fbf799c19800bd02e7c05d36b
6
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
7505110ed9 |
feat(msk): add configuration revision actions (#2344)
* fix(core): extract shared pagination helper, reject maxResults=0 Closes #2339, #2340. ListResult<T> and its paginate()/encode()/decode() helpers existed as five near-identical private copies (BedrockAgentCoreGatewayService, BedrockAgentCoreIdentityService, BedrockAgentCoreMemoryService, BedrockAgentCoreControlService's three list methods, and MskService), not the two originally scoped in #2340 - the ListResult<T> record was already shared within bedrockagentcorecontrol, which is what earlier scoping missed. Extracts core.common.Pagination + PaginatedResult<T> and migrates every one of them, deleting both now-unused per-service ListResult model classes. Every duplicate collapsed "maxResults omitted" and "maxResults=0" onto the same primitive int, defaulting both to the full page instead of rejecting the explicit zero the way AWS's MaxResults min:1 constraint requires (confirmed against botocore's real kafka and verified live: botocore itself refuses to send MaxResults=0 client-side). Pagination.paginate/parseMaxResults take a boxed Integer so the two cases are distinguishable, and every migrated service now rejects 0 with its own existing error code (ValidationException for the bedrockagentcorecontrol services, BadRequestException for MSK) - the fix lands once, not five times. Also carries over the MskController fix from #2336: an Integer-typed @QueryParam converts before the resource method runs, so a non-numeric maxResults was a bare 404 instead of an AWS-shaped 400. Every migrated REST controller now binds maxResults as a String and calls Pagination.parseMaxResults, closing the same gap in BedrockAgentCoreGatewayController/ControlController/MemoryController that MSK already had fixed. * feat(msk): add configuration revision actions Closes #2338. Adds UpdateConfiguration, ListConfigurationRevisions, and DescribeConfigurationRevision, the three actions #2299 explicitly scoped out ("a separate follow-up issue"). MskConfiguration now stores a full revision history (revisions + serverPropertiesByRevision keyed by revision number) instead of a single latest-revision field - UpdateConfiguration appends rather than overwrites, and DescribeConfigurationRevision is the only action that returns serverProperties (base64), matching AWS's real shapes: Configuration/ DescribeConfigurationResponse/CreateConfigurationResponse never include it, verified against botocore's kafka service model the same way as #2336/#2343 rather than trusting the docs page. ListConfigurationRevisions builds on the shared Pagination.paginate helper from #2343 (cursor = zero-padded revision number) instead of introducing a sixth duplicate of that logic. getLatestRevision() is now derived from the revision list rather than a separately-stored field, so it can never drift out of sync with it. * fix(msk): guard configuration schema upgrade and update-race in UpdateConfiguration Old (pre-revision-history) persisted configurations have latestRevision/ serverProperties keys this class no longer maps, which previously threw and failed the entire msk-configurations.json load; ignore them instead and reject updates against such an entry with a 400 rather than NPE-ing. Also serialize UpdateConfiguration's read-modify-write behind a lock so two concurrent updates for the same ARN can no longer derive the same revision number and silently overwrite each other's serverProperties. * fix(msk): stop leaking mutable revision state through getters MskConfiguration#getRevisions/getServerPropertiesByRevision returned the live internal List/Map, which is why MskService#updateConfiguration was mutating through them directly - and in an order (revision appended, then its properties inserted) that let an unsynchronized reader observe a revision with no server properties yet and NPE on Base64-encoding it. Add MskConfiguration#addRevision to own both writes in the safe order, and have the getters return copies so callers can no longer bypass it. * fix(msk): guard revision reads with the same lock updateConfiguration writes under listConfigurationRevisions/describeConfigurationRevision read revisions and serverPropertiesByRevision - plain, non-thread-safe collections - without holding configurationUpdateLock, so a concurrent updateConfiguration could race the reader's iteration/copy, not just return stale data. * fix(msk): close remaining unsynchronized-read races on configuration revisions Two more gaps in the same family as the last fix: - deleteConfiguration didn't take configurationUpdateLock, so it could race updateConfiguration and get resurrected by the update's trailing put(arn, ...) after the delete already removed the entry. - getLatestRevision() is read directly from MskController with no access to the service's lock at all, so no per-call-site synchronized block can close that gap. Make revisions/serverPropertiesByRevision CopyOnWriteArrayList/ConcurrentHashMap instead, so every current and future reader is safe by construction rather than by remembering to take a lock it may not have access to. * fix(msk): migrate pre-revision-history configurations onto revision 1 A configuration persisted before this PR's schema change stored a single "latestRevision" object plus a flat "serverProperties" string. Those keys were only being swallowed by ignoreUnknown, so the entry loaded with an empty revision list and getLatestRevision() == null. AWS marks Configuration's LatestRevision required, and toConfigurationView builds into a HashMap - which keeps a key with a null value, unlike Map.of - with no NON_NULL inclusion configured anywhere in the application. So DescribeConfiguration and ListConfigurations emitted a required member as an explicit "latestRevision": null for those entries, and UpdateConfiguration rejected them permanently. Map both old keys back onto revision 1 at load time instead. The data was always still there, so this is a migration rather than a degradation, and it un-breaks UpdateConfiguration for those configurations as well. - The setters are deserialize-only: @JsonSetter is an explicit marker, so it survives the @JsonIgnore split on getLatestRevision() without re-enabling the write side. The old shape is read, never written back. - Jackson calls the two setters in whatever order the keys sit in the file, so neither can assemble the revision alone; each buffers its half and the pair completes the migration. - A legacy entry with no serverProperties migrates to an empty string, not null: serverPropertiesByRevision is a ConcurrentHashMap, which rejects null values, and DescribeConfigurationRevision base64-encodes what it finds without a null check. - The updateConfiguration guard stays, now covering only an entry with no revision data at all rather than every pre-schema configuration. Also corrects the comment in listConfigurationRevisions, which still justified its lock by calling the collections plain and non-concurrent. That was true when it was written but stopped being true in 93bc30e7; the lock is kept, for consistency with describeConfigurationRevision reading both collections, not to prevent a torn read. Verified locally: MskServiceTest 34, MskControllerTest 2, MskControllerIntegrationTest 20 - 0 failures, 0 errors. Reverting only the MskConfiguration change fails 6 of the new tests, confirming they bite. |
||
|
|
4c510e576c |
feat(msk): add configuration CRUD (Create/List/Describe/Delete) (#2336)
* feat(msk): add configuration CRUD (Create/List/Describe/Delete) MskController only served /v1/clusters and /api/v2/clusters, so every configuration action 404s. An MSK configuration is the only supported way to set broker-level server_properties, and aws_msk_configuration / aws_msk_domain_policy are first-class Terraform resources - any stack setting broker properties failed before the cluster was even attempted. Adds a second StorageBackend on MskService (msk-configurations.json, mirroring msk-clusters.json), a new MskConfiguration model, and four endpoints on MskController mirroring the existing cluster handlers. serverProperties is base64 on the wire; decoded and kept internal (@JsonIgnore) since AWS only returns it via DescribeConfigurationRevision, which is a separate follow-up issue - this stays plain CRUD. Field names verified against botocore's actual kafka service model rather than trusting the API reference docs verbatim: every field is lowerCamelCase, including DeleteConfigurationResponse's `arn` (the public API reference page shows "Arn" capitalized, which does not match the real wire format). * fix(msk): validate request field types and persist serverProperties CreateConfiguration cast request fields directly (String)/(List<String>), so a wrong-typed field threw ClassCastException instead of an AWS-shaped BadRequestException, surfacing as an internal server error. serverProperties was @JsonIgnore, which excludes it from Jackson serialization entirely - not just REST responses, but also the persistent/hybrid/wal StorageBackend serialization that uses the same model. A configuration would silently lose its broker properties on reload under any non-memory storage mode. The field now serializes normally; the controller instead builds explicit response views for Describe/List/Create so serverProperties still never appears on the wire outside CreateConfiguration's own request, matching AWS (which only returns it via the out-of-scope DescribeConfigurationRevision). * fix(msk): default kafkaVersions to an empty array when omitted kafkaVersions is optional on CreateConfigurationRequest, but asStringList returns null when it's absent, and toConfigurationView put that null straight into the response - AWS's Configuration shape always populates it as an array. Default it the same way description already is. No existing test created a configuration without the field, which is why it slipped through. * feat(msk): support maxResults/nextToken pagination on ListConfigurations ListConfigurations previously returned every configuration in one response, ignoring the maxResults/nextToken query parameters the model declares. Mirrors the existing pagination pattern from BedrockAgentCoreGatewayService (ListResult<T> + a private paginate() helper): the cursor is the last returned item's ARN, base64 URL-encoded, resumed by scanning the ARN-sorted list past that value. maxResults is bounded to [1, 100] and an undecodable token both throw BadRequestException, matching CreateConfiguration's existing error family for this service. |
||
|
|
9e35046647 |
Docs/enviroment instead yml (#764)
* docs: moving all config to env instead of yml * docs: sync with main and new features * docs: reverting docker-compose.yml |
||
|
|
01dbc76fc8 |
feat(docker): named-volume storage for child containers (#743)
Replace the FLOCI_STORAGE_HOST_PERSISTENT_PATH footgun with automatic
named Docker volume management for RDS, OpenSearch, MSK, and ECR.
- Each resource gets a collision-free 6-char hex volumeId generated once
at creation and stored in the model. Container and volume names both use
it: floci-{service}-{volumeId}
- Volumes are labelled floci=true for easy pruning
- Memory mode always removes volumes on resource delete. Persistent modes
retain by default; set prune-volumes-on-delete: true to remove on delete
- Mode detection: FLOCI_STORAGE_HOST_PERSISTENT_PATH set to an absolute
path → host bind-mount mode (legacy); unset or non-absolute → named-
volume mode. Volume names in host-persistent-path are not supported
- Removed the container-storage config key — no longer needed
- Updated docker-compose.yml, and all docs
|
||
|
|
4f0150870a | feat(docker): centralize Docker config and add private registry authentication (#549) | ||
|
|
91071aaae7 |
feat: implement Amazon MSK service with Redpanda orchestration (#419)
* feat: implement Amazon MSK service with Redpanda orchestration * fix: adding missing msk service on the test |