Skip to content

[refactor] Remove the prometheus dependency on pubsub#784

Merged
sknat merged 1 commit intomasterfrom
abasu-prom-rem-pubsub
Jan 8, 2026
Merged

[refactor] Remove the prometheus dependency on pubsub#784
sknat merged 1 commit intomasterfrom
abasu-prom-rem-pubsub

Conversation

@aritrbas
Copy link
Copy Markdown
Collaborator

@aritrbas aritrbas commented Sep 11, 2025

Overview

  • This PR removes the Prometheus server's dependency on the pubsub infrastructure.
  • The changes establish a direct communication channel between the Felix server and Prometheus for pod lifecycle events.
  • The logic for tracking pod interfaces in Prometheus remains identical - only the invocation mechanism is changed from pubsub events to direct method calls.

What Changed

Before:

  • Prometheus subscribed to pod events via the pubsub infrastructure, listening to common.PodAdded and common.PodDeleted events on a channel.

After:

  • Prometheus is directly owned by the Felix server and receives pod events through explicit method calls.
  • Prometheus server is now instantiated directly in NewFelixServer().
  • ServePrometheus() is started as a goroutine within ServeFelix() using the tomb lifecycle manager.
  • Direct calls to s.prometheusServer.OnPodAdded() and s.prometheusServer.OnPodDeleted() are now made for pod event handling.
  • Public methods OnPodAdded() and OnPodDeleted() are added in prometheus.go that directly handle pod lifecycle events.

Event Flow:

  • CNI server adds/deletes a pod and publishes PodAdded/PodDeleted event to Felix's event channel.
  • Felix's handleFelixServerEvents() processes the event.
  • Felix calls workloadAdded()/WorkloadRemoved() to update policy state.
  • Felix directly calls s.prometheusServer.OnPodAdded()/s.prometheusServer.OnPodDeleted() to notify Prometheus.
  • Prometheus updates its internal pod interface tracking maps.

@aritrbas aritrbas changed the title Remove the prometheus dependancy on pubsub Remove the prometheus dependency on pubsub Sep 11, 2025
@aritrbas aritrbas self-assigned this Sep 11, 2025
Copy link
Copy Markdown
Collaborator

@sknat sknat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR @aritrbas ! lgtm !
let's wait for the parent to be merged before upstreaming this

@sknat sknat changed the title Remove the prometheus dependency on pubsub [refactor] Remove the prometheus dependency on pubsub Jan 7, 2026
Copy link
Copy Markdown
Collaborator

@sknat sknat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can cherry pick this part of the refactoring safely on master and merge it before waiting for the rest of the other patches to go in

Comment thread calico-vpp-agent/cmd/calico_vpp_dataplane.go Outdated
Comment thread calico-vpp-agent/felix/felix_server.go Outdated
Signed-off-by: Aritra Basu <aritrbas@cisco.com>
@aritrbas aritrbas force-pushed the abasu-prom-rem-pubsub branch from 2f12f72 to d77c172 Compare January 7, 2026 22:19
@aritrbas aritrbas changed the base branch from nsk-split-svc to master January 7, 2026 22:19
Copy link
Copy Markdown
Collaborator

@sknat sknat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm ! thanks

@sknat sknat merged commit 6f89d6b into master Jan 8, 2026
2 checks passed
@sknat sknat deleted the abasu-prom-rem-pubsub branch January 8, 2026 15:08
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.

2 participants