Skip to content

pkg/controller/status/status: Set reasons for conditions #114

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/insights-archive-sample/config/clusteroperator/insights
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,26 @@
{
"type": "Degraded",
"status": "False",
"reason": "AsExpected",
"lastTransitionTime": "2020-03-18T12:14:52Z"
},
{
"type": "Available",
"status": "True",
"reason": "AsExpected",
"lastTransitionTime": "2020-03-18T12:14:52Z"
},
{
"type": "Progressing",
"status": "False",
"lastTransitionTime": "2020-03-18T12:16:52Z",
"reason": "AsExpected",
"message": "Monitoring the cluster"
},
{
"type": "Disabled",
"status": "False",
"reason": "AsExpected",
"lastTransitionTime": "2020-03-18T12:16:52Z"
}
],
Expand Down
7 changes: 7 additions & 0 deletions pkg/controller/status/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ func (c *Controller) merge(existing *configv1.ClusterOperator) *configv1.Cluster
setOperatorStatusCondition(&existing.Status.Conditions, configv1.ClusterOperatorStatusCondition{
Type: configv1.OperatorDegraded,
Status: configv1.ConditionFalse,
Reason: "AsExpected",
})
}

Expand All @@ -224,6 +225,7 @@ func (c *Controller) merge(existing *configv1.ClusterOperator) *configv1.Cluster
setOperatorStatusCondition(&existing.Status.Conditions, configv1.ClusterOperatorStatusCondition{
Type: OperatorDisabled,
Status: configv1.ConditionFalse,
Reason: "AsExpected",
})
}

Expand All @@ -240,6 +242,7 @@ func (c *Controller) merge(existing *configv1.ClusterOperator) *configv1.Cluster
setOperatorStatusCondition(&existing.Status.Conditions, configv1.ClusterOperatorStatusCondition{
Type: configv1.OperatorDegraded,
Status: configv1.ConditionFalse,
Reason: "AsExpected",
})
}

Expand All @@ -260,6 +263,7 @@ func (c *Controller) merge(existing *configv1.ClusterOperator) *configv1.Cluster
setOperatorStatusCondition(&existing.Status.Conditions, configv1.ClusterOperatorStatusCondition{
Type: configv1.OperatorAvailable,
Status: configv1.ConditionTrue,
Reason: "AsExpected",
})

// update the Progressing condition with a summary of the current state
Expand All @@ -272,6 +276,7 @@ func (c *Controller) merge(existing *configv1.ClusterOperator) *configv1.Cluster
setOperatorStatusCondition(&existing.Status.Conditions, configv1.ClusterOperatorStatusCondition{
Type: configv1.OperatorProgressing,
Status: configv1.ConditionTrue,
Reason: "Initializing",
Message: "Initializing the operator",
})
}
Expand All @@ -281,6 +286,7 @@ func (c *Controller) merge(existing *configv1.ClusterOperator) *configv1.Cluster
setOperatorStatusCondition(&existing.Status.Conditions, configv1.ClusterOperatorStatusCondition{
Type: configv1.OperatorProgressing,
Status: configv1.ConditionFalse,
Reason: "Degraded",
Message: "An error has occurred",
})

Expand All @@ -299,6 +305,7 @@ func (c *Controller) merge(existing *configv1.ClusterOperator) *configv1.Cluster
setOperatorStatusCondition(&existing.Status.Conditions, configv1.ClusterOperatorStatusCondition{
Type: configv1.OperatorProgressing,
Status: configv1.ConditionFalse,
Reason: "AsExpected",
Message: "Monitoring the cluster",
})
}
Expand Down
4 changes: 4 additions & 0 deletions pkg/gather/clusterconfig/testdata/clusteroperators.json
Original file line number Diff line number Diff line change
Expand Up @@ -837,22 +837,26 @@
{
"type": "Degraded",
"status": "False",
"reason": "AsExpected",
"lastTransitionTime": "2020-04-17T12:12:48Z"
},
{
"type": "Available",
"status": "True",
"reason": "AsExpected",
"lastTransitionTime": "2020-04-17T12:12:48Z"
},
{
"type": "Progressing",
"status": "False",
"reason": "AsExpected",
"lastTransitionTime": "2020-04-17T12:14:48Z",
"message": "Monitoring the cluster"
},
{
"type": "Disabled",
"status": "False",
"reason": "AsExpected",
"lastTransitionTime": "2020-04-17T12:14:48Z"
}
],
Expand Down