Skip to content

Commit

Permalink
update: change initcondition to NewComponentConditon()
Browse files Browse the repository at this point in the history
Signed-off-by: Wen Zhou <[email protected]>
  • Loading branch information
zdtsw committed Aug 28, 2024
1 parent 99d41b4 commit 6985e6b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ func (r *DataScienceClusterReconciler) reconcileSubComponent(ctx context.Context
// only set to init condition e.g Unknonw for the very first time when component is not in the list
if !isExistStatus {
instance, err := status.UpdateWithRetry(ctx, r.Client, instance, func(saved *dscv1.DataScienceCluster) {
status.UpdateCondition(&saved.Status.Conditions, status.InitComponentCondition(componentName, enabled))
status.NewComponentCondition(&saved.Status.Conditions, componentName, enabled)
})
if err != nil {
_ = r.reportError(err, instance, "failed to update DataScienceCluster conditions before first time reconciling "+componentName)
Expand Down
8 changes: 4 additions & 4 deletions controllers/status/component_condition.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@ import (
corev1 "k8s.io/api/core/v1"
)

// Component init condition.
// Component init condition when it is just created
// type: <component>Ready
// status: Unknown
// reason: ReconcileStart
func InitComponentCondition(componentName string, enabled bool) conditionsv1.Condition {
func NewComponentCondition(conditions *[]conditionsv1.Condition, componentName string, enabled bool) {
managementstatue := "not Managed"
if enabled {
managementstatue = "Managed"
}
return conditionsv1.Condition{
conditionsv1.SetStatusCondition(conditions, conditionsv1.Condition{
Type: conditionsv1.ConditionType(componentName + PhaseReady),
Status: corev1.ConditionUnknown,
Reason: ReconcileStartReason,
Message: "Component managementStatus is " + managementstatue,
}
})
}

// Component reconilce success.
Expand Down
2 changes: 1 addition & 1 deletion controllers/status/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
// doServiceMeshStuff manages the Service Mesh configuration process during DSCInitialization reconcile.
// It creates a reporter and reports any conditions derived from the service mesh configuration process.
//
// func (r *DSCInitializationReconciler) doStdoServiceMeshStuffff(instance *dsciv1.DSCInitialization) error {
// func (r *DSCInitializationReconciler) doServiceMeshStuff(instance *dsciv1.DSCInitialization) error {
// reporter := createReporter(r.Client, instance, &conditionsv1.Condition{
// Type: status.CapabilityServiceMesh,
// Status: corev1.ConditionTrue,
Expand Down

0 comments on commit 6985e6b

Please sign in to comment.