Skip to content

Implement Nats K/V Streamlining into OPA memory#1

Merged
omer9564 merged 20 commits into
mainfrom
omer/per-12575-nats-kv-store
Aug 7, 2025
Merged

Implement Nats K/V Streamlining into OPA memory#1
omer9564 merged 20 commits into
mainfrom
omer/per-12575-nats-kv-store

Conversation

@omer9564

Copy link
Copy Markdown
Contributor

Enhance GroupCache to utilize gjson for JSON document management, allowing for efficient retrieval and updates. Implement LRU caching for recently accessed paths, with automatic invalidation of affected cache entries upon updates. Introduce comprehensive tests to validate functionality, including cache eviction and document persistence. Update go.mod and go.sum to include necessary dependencies for gjson and sjson.

omer9564 added 3 commits July 24, 2025 18:26
…port. Add Go module and dependencies, along with README documentation and CI workflow setup. Implement core caching logic, group management, and path routing for NATS Key-Value store integration.
…nce group management. Update logging to use OPA's logging package. Adjust tests to reflect changes in configuration structure, focusing on group regex patterns and single group settings.
Enhance GroupCache to utilize gjson for JSON document management, allowing for efficient retrieval and updates. Implement LRU caching for recently accessed paths, with automatic invalidation of affected cache entries upon updates. Introduce comprehensive tests to validate functionality, including cache eviction and document persistence. Update go.mod and go.sum to include necessary dependencies for gjson and sjson.
@linear

linear Bot commented Jul 24, 2025

Copy link
Copy Markdown
PER-12575 Adapt the OPA plugin to hold top K schemas from Nats K/V

The plugin should hold some sort of LRU Cache that is updated automatically from Nats K/V of the schemas used.

The goal is to create an opa plugin that implements the Store and LRU caches the data from Nats K/V into the in-memory store based on path

omer9564 added 14 commits July 28, 2025 19:05
…andling. Update configuration files to set max_bucket_watchers to 1. Enhance EnsureBucketLoaded method to differentiate between root and non-root buckets, and adjust related methods for consistent handling of bucket data loading and OPA store interactions.
…iple files. Remove unused go-vet hook, ensure consistent formatting, and eliminate trailing whitespace in various YAML, Go, and Markdown files.
…ogy consistency. Update comments and method names to replace "group" with "bucket" for clarity. Adjust error messages and logging to reflect the new terminology. Simplify keyToPath function by removing unnecessary error handling.
Introduce new test files for additional functionality, including tests for DataTransformer, NATSClient, and MockStore. Cover various scenarios such as edge cases, error handling, and configuration validation. Refactor existing tests for clarity and consistency, ensuring robust coverage of key functionalities in the NATS store package.
…t panic

Refactor the TestMockStore_Comprehensive function to ensure that the Register method does not panic by asserting the absence of errors during registration. This change enhances the robustness of the test suite for the NATS store package.
Enhance the CI workflow by adding a NATS service setup for JetStream, including health checks and configuration management. Introduce a new configuration file for JetStream and update the PluginFactory to manage bucket data more effectively. This change improves testing capabilities and ensures proper configuration of the NATS server during CI runs.
Enhance the NATS store plugin by adding a default logger instantiation in the New method of the PluginFactory. This change ensures that a logger is available for testing scenarios when none is provided, improving the robustness of the plugin's logging capabilities.
Introduce a new golangci-lint configuration file to define linting rules and settings for the project. Update the CI workflow to include a NATS service setup with health checks, ensuring proper environment for linting. Additionally, refactor the NATS store plugin to improve error handling for bucket name and key type assertions, enhancing robustness and clarity in the codebase.
Refactor the golangci-lint configuration to enhance linting rules and settings, including increased confidence for revive and added staticcheck. Update the GitHub Actions workflow to use golangci-lint version v2.3.1, ensuring compatibility and improved linting performance.
@omer9564 omer9564 marked this pull request as ready for review August 5, 2025 13:53
Introduce a new Dockerfile for building the OPA binary with the NATS store plugin. The Dockerfile includes multi-stage builds for dependency management and a non-root user setup. Additionally, add main.go to implement the OPA runtime with the NATS plugin, enhancing the project's capabilities. Update docker-compose.yaml to reference the new Dockerfile and adjust the command for running the OPA server.
@omer9564 omer9564 changed the title Omer/per-12575-nats-kv-store Implement Nats K/V Streamlining into OPA memory Aug 7, 2025
Update the README.md to include a detailed project layout, highlighting the directory structure and key components. Add new configuration options for the NATS plugin, including `max_bucket_watchers` and `root_bucket`. Introduce built-in functions for interacting with NATS K/V, along with usage examples. Revise usage instructions for the custom OPA binary and Docker integration, improving clarity and completeness of documentation.
Rename example directory from `handledpaths` to `opa-nats` to better reflect its purpose. Update README.md to point to the new example location and provide clearer instructions for using the OPA with NATS plugin. Add new configuration files for Docker Compose and OPA, and include a test policy in Rego to verify functionality. Remove the old `main.go` example to streamline the project structure.
@omer9564 omer9564 merged commit 009545b into main Aug 7, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant