-
Notifications
You must be signed in to change notification settings - Fork 129
🚧 Add NatsIO Gateway #1190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
🚧 Add NatsIO Gateway #1190
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a new NatsIO gateway for EdgeDevice integration, enabling messaging via publisher and subscriber modes.
- Implements a new Gateway in pkg/gateway/natsio with configuration loading and instruction handling.
- Adds a minimal NatsIO client wrapper and updates deployment/Docker configurations.
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| pkg/gateway/natsio/gatewaynatsio.go | Implements the NatsIO Gateway with instruction processing |
| pkg/gateway/natsio/client/natsio.go | Provides a lightweight NatsIO client wrapper |
| go.mod | Adds required dependencies for NatsIO |
| examples/natsio_gw_http/deploy.yaml | Provides Kubernetes deployment configurations |
| dockerfiles/Dockerfile.gatewayNatsio | Builds the gateway binary with multi-stage Docker configuration |
| cmd/gateway/cmdnatsio/main.go | Entry point for launching the NatsIO Gateway application |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1190 +/- ##
==========================================
- Coverage 31.20% 29.98% -1.23%
==========================================
Files 55 57 +2
Lines 4864 5076 +212
==========================================
+ Hits 1518 1522 +4
- Misses 3211 3420 +209
+ Partials 135 134 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rhoninl added some comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a NatsIO gateway for deviceShifu, enabling publish/subscribe interactions with a NATS server via HTTP-based device instructions.
- Implements
Gatewayto load instructions from a ConfigMap, start subscribers and publishers, and manage a NATS client - Adds a lightweight NATS client wrapper, updates dependencies, and provides a Dockerfile
- Supplies an example deployment manifest and detailed design documentation
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/gateway/nats/gatewaynats.go | New Gateway implementation: configuration loading, start routines |
| pkg/gateway/nats/client/nats.go | NATS client wrapper with Publish and Subscribe methods |
| go.mod | Added github.com/nats-io/nats.go and related indirect modules |
| examples/natsio_gw_http/deploy.yaml | Sample ConfigMap and Deployment for NATS gateway |
| docs/design/gateway/natsio-gateway.md | Design doc for NATS gateway component |
| dockerfiles/Dockerfile.gatewayNATS | Multi-stage Dockerfile for building the gateway binary |
| cmd/gateway/cmdnats/main.go | Main entrypoint wiring gateway start and shutdown |
| ) | ||
|
|
||
| func main() { | ||
| client, err := nats.New() |
Copilot
AI
May 22, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The deployment example sets NATS_URL as an environment variable, but nats.New() does not read it. Consider allowing the gateway to accept the NATS address from an env var for consistency with the sample manifest.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rhoninl added more comments, please take a look
| ) | ||
|
|
||
| func main() { | ||
| client, err := nats.New() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's also make options such as timeout, retry configurable.
Also configure the client name for troubleshooting
What this PR does / why we need it:
Will this PR make the community happier?
Which issue this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)format, will close that issue when PR gets merged): fixes #How is this PR tested
Special notes for your reviewer:
Release note: