From 485a29dee7410d5fb87fb1e173999191c20fbe63 Mon Sep 17 00:00:00 2001 From: Leon Date: Fri, 29 Aug 2025 16:30:47 +0800 Subject: [PATCH 1/2] init --- pkg/controller/component/available.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pkg/controller/component/available.go b/pkg/controller/component/available.go index a75157df54c..22910a15c58 100644 --- a/pkg/controller/component/available.go +++ b/pkg/controller/component/available.go @@ -542,8 +542,12 @@ func GetComponentAvailablePolicy(compDef *appsv1.ComponentDefinition) appsv1.Com // has available policy defined if compDef.Spec.Available != nil { policy := *compDef.Spec.Available - if policy.WithProbe != nil && policy.WithProbe.TimeWindowSeconds == nil { - policy.WithProbe.TimeWindowSeconds = timeWindowSeconds() + if policy.WithProbe != nil { + if policy.WithProbe.TimeWindowSeconds == nil { + policy.WithProbe.TimeWindowSeconds = timeWindowSeconds() + } + policy.WithPhases = nil + policy.WithRole = nil } return policy } From 649c4aa24a3f824eaf96cf17c7133c1c6698e30a Mon Sep 17 00:00:00 2001 From: Leon Date: Mon, 1 Sep 2025 15:33:57 +0800 Subject: [PATCH 2/2] update API --- apis/apps/v1/componentdefinition_types.go | 2 ++ config/crd/bases/apps.kubeblocks.io_componentdefinitions.yaml | 3 +++ deploy/helm/crds/apps.kubeblocks.io_componentdefinitions.yaml | 3 +++ docs/developer_docs/api-reference/cluster.md | 1 + 4 files changed, 9 insertions(+) diff --git a/apis/apps/v1/componentdefinition_types.go b/apis/apps/v1/componentdefinition_types.go index c2ce1ee2e1c..7498345c0d3 100644 --- a/apis/apps/v1/componentdefinition_types.go +++ b/apis/apps/v1/componentdefinition_types.go @@ -1253,6 +1253,8 @@ type ComponentAvailable struct { // Specifies the strategies for determining whether the component is available based on the available probe. // + // If specified, it will take precedence over the WithPhases and WithRole fields. + // // This field is immutable once set. // // +optional diff --git a/config/crd/bases/apps.kubeblocks.io_componentdefinitions.yaml b/config/crd/bases/apps.kubeblocks.io_componentdefinitions.yaml index 743527b79a3..aba2cf74843 100644 --- a/config/crd/bases/apps.kubeblocks.io_componentdefinitions.yaml +++ b/config/crd/bases/apps.kubeblocks.io_componentdefinitions.yaml @@ -119,6 +119,9 @@ spec: Specifies the strategies for determining whether the component is available based on the available probe. + If specified, it will take precedence over the WithPhases and WithRole fields. + + This field is immutable once set. properties: condition: diff --git a/deploy/helm/crds/apps.kubeblocks.io_componentdefinitions.yaml b/deploy/helm/crds/apps.kubeblocks.io_componentdefinitions.yaml index 743527b79a3..aba2cf74843 100644 --- a/deploy/helm/crds/apps.kubeblocks.io_componentdefinitions.yaml +++ b/deploy/helm/crds/apps.kubeblocks.io_componentdefinitions.yaml @@ -119,6 +119,9 @@ spec: Specifies the strategies for determining whether the component is available based on the available probe. + If specified, it will take precedence over the WithPhases and WithRole fields. + + This field is immutable once set. properties: condition: diff --git a/docs/developer_docs/api-reference/cluster.md b/docs/developer_docs/api-reference/cluster.md index f60fd33e292..56d3f34481b 100644 --- a/docs/developer_docs/api-reference/cluster.md +++ b/docs/developer_docs/api-reference/cluster.md @@ -4612,6 +4612,7 @@ ComponentAvailableWithProbe (Optional)

Specifies the strategies for determining whether the component is available based on the available probe.

+

If specified, it will take precedence over the WithPhases and WithRole fields.

This field is immutable once set.