Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
leon-inf committed Oct 31, 2024
1 parent bbbf47c commit 13c7103
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion apis/apps/v1/componentdefinition_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -1254,7 +1254,7 @@ type ComponentAvailable struct {
// This field is immutable once set.
//
// +optional
WithPhases *string `json:"phases,omitempty"`
WithPhases *string `json:"withPhases,omitempty"`

// Specifies the strategies for determining whether the component is available based on the available probe.
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ spec:

This field is immutable.
properties:
phases:
withPhases:
description: |-
Specifies the phases that the component will go through to be considered available.

Expand Down
6 changes: 3 additions & 3 deletions controllers/apps/transformer_component_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -448,13 +448,13 @@ func (t *componentStatusTransformer) reconcileAvailableCondition(transCtx *compo
)
status, reason, message := func() (metav1.ConditionStatus, string, string) {
if comp.Status.Phase == "" {
return metav1.ConditionUnknown, "Unknown", "component phase is unknown"
return metav1.ConditionUnknown, "Unknown", "the component phase is unknown"
}
phases := sets.New[string](strings.Split(strings.ToLower(*policy.WithPhases), ",")...)
if phases.Has(strings.ToLower(string(comp.Status.Phase))) {
return metav1.ConditionTrue, "Available", fmt.Sprintf("component phase is %s", comp.Status.Phase)
return metav1.ConditionTrue, "Available", fmt.Sprintf("the component phase is %s", comp.Status.Phase)
}
return metav1.ConditionFalse, "Unavailable", fmt.Sprintf("component phase is %s", comp.Status.Phase)
return metav1.ConditionFalse, "Unavailable", fmt.Sprintf("the component phase is %s", comp.Status.Phase)
}()

cond := metav1.Condition{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ spec:

This field is immutable.
properties:
phases:
withPhases:
description: |-
Specifies the phases that the component will go through to be considered available.

Expand Down
2 changes: 1 addition & 1 deletion docs/developer_docs/api-reference/cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -4138,7 +4138,7 @@ VarOption
<tbody>
<tr>
<td>
<code>phases</code><br/>
<code>withPhases</code><br/>
<em>
string
</em>
Expand Down
3 changes: 2 additions & 1 deletion pkg/controller/component/available.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func (h *AvailableEventHandler) handleEvent(event probeEvent, comp *appsv1.Compo
}
available, message := h.evalCond(*policy.WithProbe.Condition, comp.Spec.Replicas, events)
if available {
message = "Component is available"
message = "the available conditions are met"
if len(policy.WithProbe.Description) > 0 {
message = policy.WithProbe.Description
}
Expand Down Expand Up @@ -557,6 +557,7 @@ func GetComponentAvailablePolicy(compDef *appsv1.ComponentDefinition) appsv1.Com
},
},
},
Description: "all replicas are available",
},
}
}
Expand Down

0 comments on commit 13c7103

Please sign in to comment.