Aias00 opened a new issue, #7912:
URL: https://github.com/apache/shenyu/issues/7912

   ### Behavior and reproduction
   
   KubernetesConfiguration makes creation of AppsV1Api conditional on the 
*absence of DeploymentProperties*, even though those properties are the 
configuration needed to create the client and are enabled by the same 
configuration class.
   
   Executed at `fda742c48e7f553c9964cf74b36732326d0fde00` with 
ApplicationContextRunner:
   
   ```java
   new ApplicationContextRunner()
       .withPropertyValues("shenyu.k8s.scale.enabled=true")
       .withBean(DeploymentProperties.class, DeploymentProperties::new)
       .withUserConfiguration(KubernetesConfiguration.class)
       .run(context -> { /* inspect bean counts and ConditionEvaluationReport 
*/ });
   ```
   
   Observed: context starts with zero AppsV1Api beans. The condition report 
explicitly says scale.enabled=true matched, but apiClient's OnMissingBean 
condition failed because deploymentProperties already exists. The decision 
depends on bean registration, not the values of those properties; supplying a 
pre-registered/custom properties bean disables the client factory. The scaler 
factory has the same wrong missing-properties condition.
   
   The component KubernetesScaler accepts Optional.empty(). A subsequent 
scaleByNum(3) was also executed and throws NullPointerException because 
appsV1Api is null; only ApiException is handled. Do not interpret this report 
as proof that every default Boot registration ordering fails: the explicit 
pre-registered-properties path above is the verified trigger.
   
   ### Location and cause
   
   - [Client factory guarded by missing 
DeploymentProperties](https://github.com/apache/shenyu/blob/fda742c48e7f553c9964cf74b36732326d0fde00/shenyu-admin/src/main/java/org/apache/shenyu/admin/config/KubernetesConfiguration.java#L50)
   - [Scaler factory uses the same properties 
absence](https://github.com/apache/shenyu/blob/fda742c48e7f553c9964cf74b36732326d0fde00/shenyu-admin/src/main/java/org/apache/shenyu/admin/config/KubernetesConfiguration.java#L76)
   - [Optional client becomes 
nullable](https://github.com/apache/shenyu/blob/fda742c48e7f553c9964cf74b36732326d0fde00/shenyu-admin/src/main/java/org/apache/shenyu/admin/scale/scaler/KubernetesScaler.java#L43)
   - [Unchecked client 
dereference](https://github.com/apache/shenyu/blob/fda742c48e7f553c9964cf74b36732326d0fde00/shenyu-admin/src/main/java/org/apache/shenyu/admin/scale/scaler/KubernetesScaler.java#L77)
   
   ### Expected behavior / suggested repair
   
   Use the client/scaler bean types as the relevant back-off conditions rather 
than the existence of their configuration properties. Preserve supported custom 
client/properties overrides. Make disabled/unavailable scaling explicit so 
applying a policy does not fail with a null dereference. Cover standard 
binding, pre-registered properties, a custom AppsV1Api, enabled/disabled mode 
and missing-client policy activation.
   
   Medium severity, high confidence for the reproduced configuration. Distinct 
from #7698 (uninitialized V1Scale spec) and #7886 (time-window scheduling).
   


-- 
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]

Reply via email to