Skip to content

Commit

Permalink
Merge pull request #1900 from RomanBednar/OCPBUGS-44374
Browse files Browse the repository at this point in the history
OCPBUGS-44374: CSI controller conditions should provide reason and message
  • Loading branch information
openshift-merge-bot[bot] authored Dec 10, 2024
2 parents 8d0b2ce + ccd9d2d commit 85e36bc
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,11 @@ func (c *CSIDriverNodeServiceController) syncManaged(ctx context.Context, opSpec
WithStatus(opv1.ConditionTrue)

if daemonSet.Status.NumberAvailable > 0 {
availableCondition = availableCondition.WithStatus(opv1.ConditionTrue)
availableCondition = availableCondition.
WithStatus(opv1.ConditionTrue).
WithMessage("DaemonSet is available").
WithReason("AsExpected")

} else {
availableCondition = availableCondition.
WithStatus(opv1.ConditionFalse).
Expand All @@ -209,7 +213,9 @@ func (c *CSIDriverNodeServiceController) syncManaged(ctx context.Context, opSpec
// Set Progressing condition
progressingCondition := applyoperatorv1.OperatorCondition().
WithType(c.instanceName + opv1.OperatorStatusTypeProgressing).
WithStatus(opv1.ConditionFalse)
WithStatus(opv1.ConditionFalse).
WithMessage("DaemonSet is not progressing").
WithReason("AsExpected")

if ok, msg := isProgressing(opStatus, daemonSet); ok {
progressingCondition = progressingCondition.
Expand Down
11 changes: 9 additions & 2 deletions pkg/operator/deploymentcontroller/deployment_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,11 @@ func (c *DeploymentController) syncManaged(ctx context.Context, opSpec *opv1.Ope
availableCondition := applyoperatorv1.
OperatorCondition().WithType(c.instanceName + opv1.OperatorStatusTypeAvailable)
if deployment.Status.AvailableReplicas > 0 {
availableCondition = availableCondition.WithStatus(opv1.ConditionTrue)
availableCondition = availableCondition.
WithStatus(opv1.ConditionTrue).
WithMessage("Deployment is available").
WithReason("AsExpected")

} else {
availableCondition = availableCondition.
WithStatus(opv1.ConditionFalse).
Expand All @@ -286,7 +290,10 @@ func (c *DeploymentController) syncManaged(ctx context.Context, opSpec *opv1.Ope
if slices.Contains(c.conditions, opv1.OperatorStatusTypeProgressing) {
progressingCondition := applyoperatorv1.OperatorCondition().
WithType(c.instanceName + opv1.OperatorStatusTypeProgressing).
WithStatus(opv1.ConditionFalse)
WithStatus(opv1.ConditionFalse).
WithMessage("Deployment is not progressing").
WithReason("AsExpected")

if ok, msg := isProgressing(deployment); ok {
progressingCondition = progressingCondition.
WithStatus(opv1.ConditionTrue).
Expand Down

0 comments on commit 85e36bc

Please sign in to comment.