Skip to content

[Bug] Existing deployment properties suppress the enabled Kubernetes scaling client bean #7912

Closed

Description

@Aias00

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:

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

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).

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions