Skip to content

Conversation

@rhoninl
Copy link
Collaborator

@rhoninl rhoninl commented May 20, 2025

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

  • unit test
  • e2e test
  • other (please specify)

Special notes for your reviewer:

Release note:

Copilot AI review requested due to automatic review settings May 20, 2025 10:41
@rhoninl rhoninl requested review from saiyan86 and tomqin93 as code owners May 20, 2025 10:41
Copy link

Copilot AI left a 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
Copy link

codecov bot commented May 20, 2025

Codecov Report

Attention: Patch coverage is 0% with 212 lines in your changes missing coverage. Please review.

Project coverage is 29.98%. Comparing base (53ef475) to head (8422228).
Report is 15 commits behind head on main.

Files with missing lines Patch % Lines
pkg/gateway/nats/gatewaynats.go 0.00% 144 Missing ⚠️
pkg/gateway/nats/client/nats.go 0.00% 34 Missing ⚠️
pkg/k8s/api/v1alpha1/zz_generated.deepcopy.go 0.00% 34 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@tomqin93 tomqin93 left a 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

@rhoninl rhoninl requested a review from tomqin93 May 21, 2025 10:23
@tomqin93 tomqin93 requested a review from Copilot May 22, 2025 05:57
Copy link

Copilot AI left a 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 Gateway to 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()
Copy link

Copilot AI May 22, 2025

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.

Copilot uses AI. Check for mistakes.
Copy link
Contributor

@tomqin93 tomqin93 left a 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()
Copy link
Contributor

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

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.

4 participants