Repository navigation
feat(dir): add sync-netsec job - #2298
Conversation
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
efc80be to
516af9d
Compare
516af9d to
de96b3a
Compare
ramizpolic
left a comment
There was a problem hiding this comment.
overall its good, just a couple of pointers here and there. i would just like to clarify the client before merging
| criteria: | ||
| domain: network_security |
There was a problem hiding this comment.
Could we possibly extend this to encapsulate an AND relationship of all skills and domains to sync. When we have a reusable sync job (ie. being able to define multiple sync jobs), this would allow usage of "sync specific filters that match", or serve for general data synchronization/replication.
| criteria: | |
| domain: network_security | |
| criteria: | |
| domains: | |
| - network_security | |
| - some other domain | |
| skills: | |
| - skillA | |
| - skillB |
which syncs everything that has at least these labels
There was a problem hiding this comment.
yes, thanks for pointing it out!
CronJobs support this so the reconciler job should support it as well
but note that these would use OR because search uses OR - not AND
There was a problem hiding this comment.
Why do we need to redeclare the client? We already have access to our actual DIR go client which we use in things like sync, etc. We should simply reuse that
There was a problem hiding this comment.
Hi @ramizpolic! Fair point, though to be precise this isn't a redeclared client — it's reconciler/tasks/metrics/grpc.go moved into its own package. You're right that what it holds already duplicates client.SearchRouting, but we can't drop it entirely: in daemon mode the reconciler has no DIR client at all since routing runs in-process over the embedded Badger store, so the tasks need an interface satisfied by both types.RoutingAPI and the gRPC client — and those two spell the same operations differently (Search vs SearchRouting, plus GetProviderCount with incompatible signatures).
There was a problem hiding this comment.
im not sure what the problem is still by using client. you can use client even when in daemon mode
There was a problem hiding this comment.
🟡 Changes recommended
Stream errors, capped-search starvation, unvalidated peer addresses, and unsafe configuration edge cases can produce incomplete or unbounded synchronization.
5 open findings
Reject non-positive intervals before creating tickers · New Reject limits exceeding the protobuf uint32 range · New Propagate stream errors instead of treating partial results as complete · New Add pagination to prevent repeated limited search results · New Validate peer addresses before creating sync jobs · New
What changed in this PR
Adds a reconciler-managed sync job to replace the Kubernetes sync-netsec CronJob.
Changes:
- Adds configurable routing search, peer grouping, dry-run, and sync creation.
- Introduces a shared standalone routing gRPC client.
- Wires sync configuration into daemon, Docker, and Helm deployments.
| File | Description |
|---|---|
reconciler/tasks/sync/task.go |
Implements sync execution. |
reconciler/tasks/sync/task_test.go |
Tests sync behavior. |
reconciler/tasks/sync/group.go |
Groups results by peer. |
reconciler/tasks/sync/config.go |
Defines sync configuration. |
reconciler/tasks/sync/config_test.go |
Tests configuration defaults. |
reconciler/tasks/metrics/task.go |
References shared routing client. |
reconciler/tasks/metrics/grpc.go |
Removes metrics-specific client. |
reconciler/service/service.go |
Registers the sync task. |
reconciler/service/service_test.go |
Tests task registration. |
reconciler/routing/client.go |
Adds shared routing gRPC client. |
reconciler/routing/client_test.go |
Tests routing RPC behavior. |
reconciler/main.go |
Initializes shared routing access. |
reconciler/config/config.go |
Adds sync settings and defaults. |
reconciler/config/config_test.go |
Tests sync environment settings. |
install/docker/reconciler.env |
Documents Docker configuration. |
install/charts/dir/values.yaml |
Adds parent-chart sync values. |
install/charts/dir/apiserver/values.yaml |
Adds subchart sync values. |
cli/cmd/daemon/daemon.config.yaml |
Adds daemon sync defaults. |
cli/cmd/daemon/daemon_test.go |
Tests safe daemon defaults. |
cli/cmd/daemon/config.go |
Registers daemon sync defaults. |
🧠 Review effort: Balanced
Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.
| if err != nil { | ||
| logger.Error("error receiving search result", "error", err) | ||
|
|
||
| return |
There was a problem hiding this comment.
this is not a huge problem, I'm not sure it's a problem at all
| MinMatchScore: &minScore, | ||
| Limit: &limit, |
There was a problem hiding this comment.
I understand this is a limitation and I would be open to iterating on it further in future PRs. The point if this PR though is to migrate the sync CronJobs. And this is how the CronJobs work as well. I will open an issue for this, but I would like to get this PR merged first, then we can address limitations
| func (t *Task) createPeerSync(peer *peerGroup) error { | ||
| switch { | ||
| case peer.dirAddr != "": | ||
| id, err := t.db.CreateSync(peer.dirAddr, peer.cids, "", "") |
There was a problem hiding this comment.
I think this is fine. We're using the search results which should contain valid endpoints. If not, then we can let it retry. This is how CronJobs work too. We can create an issue for this though and add a fix for it later, similar to above
e053eac to
fd3c251
Compare
|
LGTM @csirmazbendeguz with a couple of nits:
|
fd3c251 to
cc0b4d5
Compare
Thanks! I renamed it to domains. |
Signed-off-by: Bendegúz Csirmaz <[email protected]>
cc0b4d5 to
126ce32
Compare


#2136
This PR adds the
syncjob. This is the migration of the K8S CronJobsync-netsecto the reconciler.