#7281·kubeedge

ReplicasOverrider should support StatefulSet in EdgeApplication

Author: rahulkr182Created Sep 2, 2026Updated Sep 2, 2026
Labelskind/feature

What would you like to be added/modified:

Extend ReplicasOverrider in the EdgeApplication override system to support StatefulSet (and optionally ReplicaSet), in addition to Deployment.

Since spec.replicas exists at the exact same JSON path (/spec/replicas) across these workload types, ReplicasOverrider should be able to override replica counts for StatefulSets.

Why is this needed:

  1. Inconsistency with other overriders: All other overriders (EnvOverrider, CommandOverrider, ArgsOverrider, ResourcesOverrider, ImageOverrider) already support Pod, Deployment, StatefulSet, ReplicaSet, DaemonSet, and Job. ReplicasOverrider is currently the only one limited to Deployment.

    Overrider Pod Deployment StatefulSet ReplicaSet DaemonSet Job
    EnvOverrider
    CommandOverrider
    ArgsOverrider
    ResourcesOverrider
    ImageOverrider
    ReplicasOverrider
  2. Edge use case: StatefulSets are commonly deployed on edge nodes for stateful workloads like databases (Redis, Mosquitto, embedded DBs), message brokers, and caching layers. Different edge node groups often require different replica counts tailored to edge site capacity.

  3. Root Cause Analysis:

    • GVK Gate: OverriderTargetGVK in cloud/pkg/controllermanager/edgeapplication/constants/constants.go only lists DeploymentGVK.
    • Switch Gate: ReplicasOverrider.ApplyOverrides in cloud/pkg/controllermanager/edgeapplication/overridemanager/replicasoverrider.go only handles DeploymentKind and errors on other kinds.
  4. Proposed Changes:

    • Add StatefulSetGVK to OverriderTargetGVK in constants.go.
    • Add StatefulSetKind to ReplicasOverrider.ApplyOverrides switch in replicasoverrider.go.
    • Update API godoc on Overriders.Replicas in edgeapplication_types.go.
    • Add unit tests in replicasoverrider_test.go.