Implementation:SeldonIO Seldon core Operator Main
| Knowledge Sources | |
|---|---|
| Domains | Kubernetes_Operator, Control_Plane, CRD_Management |
| Last Updated | 2026-02-13 14:00 GMT |
Overview
Entry point for the Seldon Core 2 Kubernetes operator that registers and wires all CRD controllers for managing Seldon resources.
Description
The operator/main.go file is the main entry point for the Seldon Core 2 Kubernetes operator binary. It uses the controller-runtime framework (Kubebuilder) to create a manager that hosts seven reconcilers: ModelReconciler, ServerReconciler, PipelineReconciler, ServerConfigReconciler, ExperimentReconciler, SeldonRuntimeReconciler, and SeldonConfigReconciler. Each reconciler watches its corresponding Seldon CRD and synchronizes desired state with the scheduler via a gRPC client.
The operator supports namespace-scoped or cluster-wide operation, leader election, configurable log levels, and TLS for the scheduler connection. It also configures health and readiness probes and a webhook server.
Usage
This is the binary entry point for the Seldon Core 2 operator. Deploy it as a Kubernetes Deployment in the seldon-system namespace. It is not imported as a library; it is compiled and run as a standalone binary.
Code Reference
Source Location
- Repository: SeldonIO_Seldon_core
- File: operator/main.go
- Lines: 1-249
Signature
// CLI flags
flag.BoolVar(&displayVersion, "version", false, "display version and exit")
flag.StringVar(&metricsAddr, "metrics-bind-address", ":4000", "...")
flag.StringVar(&probeAddr, "health-probe-bind-address", ":4001", "...")
flag.StringVar(&namespace, "namespace", "", "...")
flag.StringVar(&watchNamespaces, "watch-namespaces", "", "...")
flag.BoolVar(&enableLeaderElection, "leader-elect", false, "...")
flag.BoolVar(&clusterwide, "clusterwide", false, "...")
flag.StringVar(&logLevel, "log-level", "debug", "...")
flag.BoolVar(&useDeploymentsForServers, "use-deployments-for-servers", false, "...")
// Registered controllers
ModelReconciler
ServerReconciler
PipelineReconciler
ServerConfigReconciler
ExperimentReconciler
SeldonRuntimeReconciler
SeldonConfigReconciler
Import
// Not importable as a library; this is a main package.
// Build with: go build -o operator ./operator/
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| --namespace | string flag | No | Restrict operator to a specific namespace |
| --watch-namespaces | string flag | No | Comma-separated namespaces to watch (clusterwide mode) |
| --clusterwide | bool flag | No | Enable cluster-wide operation (default: false) |
| --leader-elect | bool flag | No | Enable leader election (default: false) |
| --metrics-bind-address | string flag | No | Metrics endpoint address (default: :4000) |
| --health-probe-bind-address | string flag | No | Health probe address (default: :4001) |
| --log-level | string flag | No | Log level (default: debug) |
| --use-deployments-for-servers | bool flag | No | Use Deployments instead of StatefulSets for servers |
Outputs
| Name | Type | Description |
|---|---|---|
| CRD reconciliation | Kubernetes events | Reconciles Model, Server, Pipeline, Experiment, SeldonRuntime, SeldonConfig, ServerConfig CRDs |
| Metrics endpoint | HTTP | Prometheus metrics at --metrics-bind-address |
| Health probes | HTTP | /healthz and /readyz at --health-probe-bind-address |
Usage Examples
Running the Operator
# Run operator in namespace-scoped mode
./operator --namespace seldon-mesh --log-level info
# Run operator in cluster-wide mode
./operator --clusterwide --leader-elect
# Run operator watching specific namespaces
./operator --clusterwide --watch-namespaces "ns1,ns2,ns3" --leader-elect
Kubernetes Deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: seldon-controller-manager
namespace: seldon-system
spec:
replicas: 1
template:
spec:
containers:
- name: manager
image: seldonio/seldon-core-operator:latest
args:
- --clusterwide
- --leader-elect
- --log-level=info
ports:
- containerPort: 4000
name: metrics
- containerPort: 4001
name: probes