Skip to content

Commit 12e6461

Browse files
abaysClaude (Anthropic)
authored andcommitted
[OSPRH-20438] Improve consistency of condition severity usage
Use consistent condition severity across repeated patterns found in our operators, and otherwise use an appropriate severity for conditions unique to each operator. Jira: https://issues.redhat.com/browse/OSPRH-20438 Co-authored-by: Claude (Anthropic) <[email protected]>
1 parent 01613c4 commit 12e6461

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

controllers/placementapi_controller.go

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,13 @@ func ensureSecret(
9292
err := reader.Get(ctx, secretName, secret)
9393
if err != nil {
9494
if k8s_errors.IsNotFound(err) {
95+
// This is currently only used to acquire the password secret, which should have been
96+
// manually created by the user and referenced in the spec, so we treat this as a
97+
// warning because it means that the service will not be able to start.
9598
conditionUpdater.Set(condition.FalseCondition(
9699
condition.InputReadyCondition,
97-
condition.RequestedReason,
98-
condition.SeverityInfo,
100+
condition.ErrorReason,
101+
condition.SeverityWarning,
99102
"%s", fmt.Sprintf("Input data resources missing: %s", "secret/"+secretName.Name)))
100103
return "",
101104
ctrl.Result{},
@@ -306,11 +309,13 @@ func (r *PlacementAPIReconciler) Reconcile(ctx context.Context, req ctrl.Request
306309
&instance.Status.Conditions)
307310
if err != nil {
308311
if k8s_errors.IsNotFound(err) {
312+
// Since the service secret should have been manually created by the user and referenced in the spec,
313+
// we treat this as a warning because it means that the service will not be able to start.
309314
Log.Info(fmt.Sprintf("OpenStack secret %s not found", instance.Spec.Secret))
310315
instance.Status.Conditions.Set(condition.FalseCondition(
311316
condition.InputReadyCondition,
312-
condition.RequestedReason,
313-
condition.SeverityInfo,
317+
condition.ErrorReason,
318+
condition.SeverityWarning,
314319
condition.InputReadyWaitingMessage))
315320
return ctrl.Result{RequeueAfter: time.Second * 10}, nil
316321
}
@@ -385,10 +390,12 @@ func (r *PlacementAPIReconciler) Reconcile(ctx context.Context, req ctrl.Request
385390
)
386391
if err != nil {
387392
if k8s_errors.IsNotFound(err) {
393+
// Since the CA cert secret should have been manually created by the user and provided in the spec,
394+
// we treat this as a warning because it means that the service will not be able to start.
388395
instance.Status.Conditions.Set(condition.FalseCondition(
389396
condition.TLSInputReadyCondition,
390-
condition.RequestedReason,
391-
condition.SeverityInfo,
397+
condition.ErrorReason,
398+
condition.SeverityWarning,
392399
condition.TLSInputReadyWaitingMessage, instance.Spec.TLS.CaBundleSecretName))
393400
return ctrl.Result{}, nil
394401
}
@@ -625,11 +632,13 @@ func (r *PlacementAPIReconciler) ensureNetworkAttachments(
625632
nad, err := nad.GetNADWithName(ctx, h, netAtt, instance.Namespace)
626633
if err != nil {
627634
if k8s_errors.IsNotFound(err) {
635+
// Since the net-attach-def CR should have been manually created by the user and referenced in the spec,
636+
// we treat this as a warning because it means that the service will not be able to start.
628637
Log.Info(fmt.Sprintf("network-attachment-definition %s not found", netAtt))
629638
instance.Status.Conditions.Set(condition.FalseCondition(
630639
condition.NetworkAttachmentsReadyCondition,
631-
condition.RequestedReason,
632-
condition.SeverityInfo,
640+
condition.ErrorReason,
641+
condition.SeverityWarning,
633642
condition.NetworkAttachmentsReadyWaitingMessage,
634643
netAtt))
635644
return nadAnnotations, ctrl.Result{RequeueAfter: time.Second * 10}, nil

0 commit comments

Comments
 (0)