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.

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 }