Skip to content

Commit d2e55e0

Browse files
committed
Update nginx data plane pod count
1 parent 4376f41 commit d2e55e0

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

internal/mode/static/telemetry/collector.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,13 +509,17 @@ func parseDirectiveContextMapIntoLists(directiveContextMap map[sfDirectiveContex
509509
func getNginxPodCount(g *graph.Graph) int64 {
510510
var count int64
511511
for _, gateway := range g.Gateways {
512+
replicas := int64(1)
513+
512514
np := gateway.EffectiveNginxProxy
513515
if np != nil &&
514516
np.Kubernetes != nil &&
515517
np.Kubernetes.Deployment != nil &&
516518
np.Kubernetes.Deployment.Replicas != nil {
517-
count += int64(*np.Kubernetes.Deployment.Replicas)
519+
replicas = int64(*np.Kubernetes.Deployment.Replicas)
518520
}
521+
522+
count += replicas
519523
}
520524

521525
return count

internal/mode/static/telemetry/collector_test.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,9 @@ var _ = Describe("Collector", Ordered, func() {
517517
1,
518518
}
519519

520-
expData.NginxPodCount = int64(4)
520+
// one gateway with one replica + one gateway with three replicas + one gateway with replica field
521+
// empty
522+
expData.NginxPodCount = int64(5)
521523
expData.ControlPlanePodCount = int64(2)
522524

523525
data, err := dataCollector.Collect(ctx)
@@ -782,6 +784,7 @@ var _ = Describe("Collector", Ordered, func() {
782784
GatewayAttachedNpCount: 1,
783785
BackendTLSPolicyCount: 1,
784786
}
787+
expData.NginxPodCount = 1
785788

786789
data, err := dataCollector.Collect(ctx)
787790

0 commit comments

Comments
 (0)