ReplicasOverrider should support StatefulSet in EdgeApplication
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:
Inconsistency with other overriders: All other overriders (
EnvOverrider,CommandOverrider,ArgsOverrider,ResourcesOverrider,ImageOverrider) already supportPod,Deployment,StatefulSet,ReplicaSet,DaemonSet, andJob.ReplicasOverrideris currently the only one limited toDeployment.Overrider Pod Deployment StatefulSet ReplicaSet DaemonSet Job EnvOverrider ✅ ✅ ✅ ✅ ✅ ✅ CommandOverrider ✅ ✅ ✅ ✅ ✅ ✅ ArgsOverrider ✅ ✅ ✅ ✅ ✅ ✅ ResourcesOverrider ✅ ✅ ✅ ✅ ✅ ✅ ImageOverrider ✅ ✅ ✅ ✅ ✅ ✅ ReplicasOverrider ❌ ✅ ❌ ❌ ❌ ❌ 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.
Root Cause Analysis:
- GVK Gate:
OverriderTargetGVKincloud/pkg/controllermanager/edgeapplication/constants/constants.goonly listsDeploymentGVK. - Switch Gate:
ReplicasOverrider.ApplyOverridesincloud/pkg/controllermanager/edgeapplication/overridemanager/replicasoverrider.goonly handlesDeploymentKindand errors on other kinds.
- GVK Gate:
Proposed Changes:
- Add
StatefulSetGVKtoOverriderTargetGVKinconstants.go. - Add
StatefulSetKindtoReplicasOverrider.ApplyOverridesswitch inreplicasoverrider.go. - Update API godoc on
Overriders.Replicasinedgeapplication_types.go. - Add unit tests in
replicasoverrider_test.go.
- Add
Source: kubeedge/kubeedge