Architecture

Understanding the gNMIc Operator architecture

Overview

The gNMIc Operator follows the Kubernetes operator pattern to manage gNMIc telemetry collectors. It watches Custom Resources and reconciles the actual state with the desired state.

Components

┌───────────────────────────────────────────────────────────────────────┐
│                         Kubernetes Cluster                            │
│                                                                       │
│  ┌─────────────────────────────────────────────────────────────────┐  │
│  │                    gNMIc Operator                               │  │
│  │                                                                 │  │
│  │  ┌─────────────────┐  ┌─────────────────┐  ┌─────────────────┐  │  │
│  │  │ Cluster         │  │ Pipeline        │  │ Other           │  │  │
│  │  │ Controller      │  │ Controller      │  │ Controllers     │  │  │
│  │  └─────────────────┘  └─────────────────┘  └─────────────────┘  │  │
│  └───────────┼────────────────────┼────────────────────────────────┘  │
│              │                    │                                   │
│              ▼                    ▼                                   │
│  ┌──────────────────────────────────────────────────────────────────┐ │
│  │                    Custom Resources                              │ │
│  │  ┌─────────┐ ┌──────────┐ ┌────────┐ ┌──────────────┐ ┌────────┐ │ │
│  │  │ Cluster │ │ Pipeline │ │ Target │ │ Subscription │ │ Output │ │ │
│  │  └─────────┘ └──────────┘ └────────┘ └──────────────┘ └────────┘ │ │
│  └──────────────────────────────────────────────────────────────────┘ │
│              │                                                        │
│              ▼                                                        │
│  ┌───────────────────────────────────────────────────────────────────┐│
│  │                    Managed Resources                              ││
│  │  ┌─────────────┐ ┌─────────────────┐ ┌───────────┐ ┌───────────┐  ││
│  │  │ StatefulSet │ │ Headless Service│ │ ConfigMap │ │ Services  │  ││
│  │  └─────────────┘ └─────────────────┘ └───────────┘ └───────────┘  ││
│  └───────────────────────────────────────────────────────────────────┘│
│              │                                                        │
│              ▼                                                        │
│  ┌───────────────────────────────────────────────────────────────────┐│
│  │                       gNMIc Pods                                  ││
│  │  ┌─────────────┐ ┌─────────────┐ ┌─────────────┐                  ││
│  │  │ gnmic-0     │ │ gnmic-1     │ │ gnmic-2     │                  ││
│  │  │ (targets    │ │ (targets    │ │ (targets    │                  ││
│  │  │  A, B, C)   │ │  D, E, F)   │ │  G, H, I)   │                  ││
│  │  └─────────────┘ └─────────────┘ └─────────────┘                  ││
│  └───────────────────────────────────────────────────────────────────┘│
└───────────────────────────────────────────────────────────────────────┘

Cluster Controller

The Cluster Controller is the primary controller responsible for:

  1. Creating StatefulSets: Deploys gNMIc pods with intial config (REST API, TLS certs,…)
  2. Managing Services: Creates headless service for pod DNS and Prometheus services for metrics
  3. Building Configuration: Aggregates all pipelines and builds the gNMIc pods configuration
  4. Distributing Targets: Assigns targets to pods
  5. Applying Configuration: Sends configuration to each pod via REST API

Why StatefulSet?

The operator uses StatefulSets instead of Deployments for several reasons:

FeatureStatefulSetDeployment
Pod namingPredictable (gnmic-0, gnmic-1)Random (gnmic-xyz123)
Pod DNSIndividual DNS recordsNo individual DNS
ScalingOrdered (add/remove from end)Random
IdentityStable across restartsChanges on restart

Stable pod identities enable:

  • Direct communication: Operator can send config to specific pods
  • Deterministic distribution: Same target goes to same pod index
  • Ordered scaling: Predictable behavior when scaling up/down. Paired with a pod drain strategy, it enables controlled cluster scaling

Configuration Flow

Configuration flows from Custom Resources to gNMIc pods:

┌─────────┐  ┌──────────┐  ┌────────────┐  ┌────────┐
│ Targets │  │ Subs     │  │ Outputs    │  │ Inputs │
└────┬────┘  └────┬─────┘  └─────┬──────┘  └───┬────┘
     │            │              │             │
     └────────────┴──────────────┴─────────────┘
                        │
                        ▼
               ┌────────────────┐
               │    Pipeline    │
               │  (references)  │
               └───────┬────────┘
                       │
                       ▼
               ┌────────────────┐
               │ Plan Builder   │
               └───────┬────────┘
                       │
                       ▼
               ┌────────────────┐
               │ Target         │
               │ Distribution   │
               └───────┬────────┘
                       │
          ┌────────────┼────────────┐
          ▼            ▼            ▼
     ┌─────────┐  ┌─────────┐  ┌─────────┐
     │ Pod 0   │  │ Pod 1   │  │ Pod 2   │
     │ REST API│  │ REST API│  │ REST API│
     └─────────┘  └─────────┘  └─────────┘

Watches and Triggers

The Cluster Controller watches multiple resources to react to changes:

ResourceWatch TypeTrigger Condition
ClusterPrimary (For)Spec changes
StatefulSetOwnedAny Change
ServiceOwnedSpec changes
PipelineWatchSpec changes
TargetWatchSpec changes
TargetProfileWatchSpec changes
SubscriptionWatchSpec changes
OutputWatchSpec changes
InputWatchSpec changes
ProcessorWatchSpec changes

Changes to any watched resource trigger Cluster reconciliation, ensuring configuration stays synchronized.