Aias00 opened a new issue, #7698: URL: https://github.com/apache/shenyu/issues/7698
### Current behavior `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`. ### Location and reachable flow - [KubernetesScaler.java:71–90](https://github.com/apache/shenyu/blob/66d7d954ca37d651a5ad916f988a8081157a7ab4/shenyu-admin/src/main/java/org/apache/shenyu/admin/scale/scaler/KubernetesScaler.java#L71) - `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: ```text 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. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
