You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] KubernetesScaler dereferences an uninitialized V1Scale spec before every replica update #7698
scaleByNum() creates new V1Scale() and immediately calls Objects.requireNonNull(scale.getSpec()).setReplicas(replicaCount). A new Kubernetes V1Scale has a null spec. This throws NullPointerException before replaceNamespacedDeploymentScale() is reached. The method catches only ApiException.
ScaleTaskInitializer.run() and policy updates invoke ScaleService.executeScaling(); active fixed/time-window policies call scaleByNum().
Dynamic actions call scaleByAction(), then the same scaleByNum().
Impact / priority
P1 / High; confidence high, confirmed. Every actual replica update through this helper fails, including with a complete valid policy and a working Kubernetes client. Fixed/time-window scaling is unusable and dynamic actions cannot apply their computed replica count. If an active fixed policy is restored at startup, the uncaught exception can also fail the startup runner.
Reproduction / validation
A standalone Java probe compiled the current KubernetesScaler.java against client-java-api 17.0.2 and called scaleByNum(3). It fails before dereferencing the API dependency:
java.lang.NullPointerException
at java.base/java.util.Objects.requireNonNull(Objects.java:208)
at org.apache.shenyu.admin.scale.scaler.KubernetesScaler.scaleByNum(KubernetesScaler.java:74)
An isolated native reviewer independently traced the startup, policy-update and dynamic-action paths and confirmed the defect. No live Kubernetes cluster was used; the failure occurs during local request construction.
Expected behavior / suggested fix
Attach a V1ScaleSpec to the request before setting replicas (the type is already imported), then issue the scale API request. Verify the replica field is present in the outbound object and that fixed and dynamic policy paths reach the API.
Related existing issues
Searched 3,078 historical issues, open PR titles and live V1Scale/scaling searches. #5521 is the broad autoscaling feature task. #6624 / PR #7193 concern a partial policy object cached after a selective database update. This failure is independent: a fully populated policy still fails because the Kubernetes request's spec is never initialized.
Reviewed revision
Apache ShenYu 2.7.2-SNAPSHOT, master@66d7d954ca37d651a5ad916f988a8081157a7ab4. This repository review excludes unit-test and CI issue categories.
Activity
fix(admin): initialise V1Scale spec before setting replicas (#7698) (#…