Skip to content

Commit 83b5990

Browse files
Merge pull request #376 from abays/OSPRH-20114
[OSPRH-20114] Improve consistency of condition severity usage
2 parents 9582b06 + 04aa09b commit 83b5990

8 files changed

+66
-31
lines changed

controllers/designate_controller.go

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,13 @@ func getSecret(
8080
secret, hash, err := oko_secret.GetSecret(ctx, h, secretName, namespace)
8181
if err != nil {
8282
if k8s_errors.IsNotFound(err) {
83+
// Since service secrets should have been manually created by the user and referenced in the spec,
84+
// we treat this as a warning because it means that the service will not be able to start.
8385
h.GetLogger().Info(fmt.Sprintf("Secret %s not found", secretName))
8486
conditions.Set(condition.FalseCondition(
8587
condition.InputReadyCondition,
86-
condition.RequestedReason,
87-
condition.SeverityInfo,
88+
condition.ErrorReason,
89+
condition.SeverityWarning,
8890
condition.InputReadyWaitingMessage))
8991
return ctrl.Result{RequeueAfter: time.Duration(10) * time.Second}, nil
9092
}
@@ -1389,11 +1391,14 @@ func (r *DesignateReconciler) generateServiceConfigMaps(
13891391
transportURLSecret, _, err := oko_secret.GetSecret(ctx, h, instance.Status.TransportURLSecret, instance.Namespace)
13901392
if err != nil {
13911393
if k8s_errors.IsNotFound(err) {
1394+
// Since the TransportURL secret should have been automatically created by the operator,
1395+
// but if reconciliation reaches this point and the secret is somehow missing, we treat
1396+
// this as a warning because ithat the service will not be able to start.
13921397
Log.Info(fmt.Sprintf("TransportURL secret %s not found", instance.Status.TransportURLSecret))
13931398
instance.Status.Conditions.Set(condition.FalseCondition(
13941399
condition.InputReadyCondition,
1395-
condition.RequestedReason,
1396-
condition.SeverityInfo,
1400+
condition.ErrorReason,
1401+
condition.SeverityWarning,
13971402
condition.InputReadyWaitingMessage))
13981403
return nil
13991404
}
@@ -1411,11 +1416,13 @@ func (r *DesignateReconciler) generateServiceConfigMaps(
14111416
adminPasswordSecret, _, err := oko_secret.GetSecret(ctx, h, instance.Spec.Secret, instance.Namespace)
14121417
if err != nil {
14131418
if k8s_errors.IsNotFound(err) {
1419+
// Since the service secret should have been manually created by the user and referenced in the spec,
1420+
// we treat this as a warning because it means that the service will not be able to start.
14141421
Log.Info(fmt.Sprintf("AdminPassword secret %s not found", instance.Spec.Secret))
14151422
instance.Status.Conditions.Set(condition.FalseCondition(
14161423
condition.InputReadyCondition,
1417-
condition.RequestedReason,
1418-
condition.SeverityInfo,
1424+
condition.ErrorReason,
1425+
condition.SeverityWarning,
14191426
condition.InputReadyWaitingMessage))
14201427
return nil
14211428
}

controllers/designateapi_controller.go

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -756,10 +756,12 @@ func (r *DesignateAPIReconciler) reconcileNormal(ctx context.Context, instance *
756756
)
757757
if err != nil {
758758
if k8s_errors.IsNotFound(err) {
759+
// Since the CA cert secret should have been manually created by the user and referenced in the spec,
760+
// we treat this as a warning because it means that the service will not be able to start.
759761
instance.Status.Conditions.Set(condition.FalseCondition(
760762
condition.TLSInputReadyCondition,
761-
condition.RequestedReason,
762-
condition.SeverityInfo,
763+
condition.ErrorReason,
764+
condition.SeverityWarning,
763765
condition.TLSInputReadyWaitingMessage, instance.Spec.TLS.CaBundleSecretName))
764766
return ctrl.Result{}, nil
765767
}
@@ -780,6 +782,8 @@ func (r *DesignateAPIReconciler) reconcileNormal(ctx context.Context, instance *
780782
certsHash, err := instance.Spec.TLS.API.ValidateCertSecrets(ctx, helper, instance.Namespace)
781783
if err != nil {
782784
if k8s_errors.IsNotFound(err) {
785+
// Since the OpenStackControlPlane creates the API service certs secrets,
786+
// we treat this as an info (because the user is not responsible for manually creating them).
783787
instance.Status.Conditions.Set(condition.FalseCondition(
784788
condition.TLSInputReadyCondition,
785789
condition.RequestedReason,
@@ -900,11 +904,13 @@ func (r *DesignateAPIReconciler) reconcileNormal(ctx context.Context, instance *
900904
nad, err := nad.GetNADWithName(ctx, helper, netAtt, instance.Namespace)
901905
if err != nil {
902906
if k8s_errors.IsNotFound(err) {
907+
// Since the net-attach-def CR should have been manually created by the user and referenced in the spec,
908+
// we treat this as a warning because it means that the service will not be able to start.
903909
Log.Info(fmt.Sprintf("network-attachment-definition %s not found", netAtt))
904910
instance.Status.Conditions.Set(condition.FalseCondition(
905911
condition.NetworkAttachmentsReadyCondition,
906-
condition.RequestedReason,
907-
condition.SeverityInfo,
912+
condition.ErrorReason,
913+
condition.SeverityWarning,
908914
condition.NetworkAttachmentsReadyWaitingMessage,
909915
netAtt))
910916
return ctrl.Result{RequeueAfter: time.Second * 10}, nil
@@ -1172,11 +1178,13 @@ func (r *DesignateAPIReconciler) generateServiceConfigMaps(
11721178
adminPasswordSecret, _, err := oko_secret.GetSecret(ctx, h, instance.Spec.Secret, instance.Namespace)
11731179
if err != nil {
11741180
if k8s_errors.IsNotFound(err) {
1181+
// Since the service secret should have been manually created by the user and referenced in the spec,
1182+
// we treat this as a warning because it means that the service will not be able to start.
11751183
Log.Info(fmt.Sprintf("AdminPassword secret %s not found", instance.Spec.Secret))
11761184
instance.Status.Conditions.Set(condition.FalseCondition(
11771185
condition.InputReadyCondition,
1178-
condition.RequestedReason,
1179-
condition.SeverityInfo,
1186+
condition.ErrorReason,
1187+
condition.SeverityWarning,
11801188
condition.InputReadyWaitingMessage))
11811189
return nil
11821190
}

controllers/designatebackendbind9_controller.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -500,11 +500,13 @@ func (r *DesignateBackendbind9Reconciler) reconcileNormal(ctx context.Context, i
500500
nad, err := nad.GetNADWithName(ctx, helper, netAtt, instance.Namespace)
501501
if err != nil {
502502
if k8s_errors.IsNotFound(err) {
503+
// Since the net-attach-def CR should have been manually created by the user and referenced in the spec,
504+
// we treat this as a warning because it means that the service will not be able to start.
503505
Log.Info(fmt.Sprintf("network-attachment-definition %s not found", netAtt))
504506
instance.Status.Conditions.Set(condition.FalseCondition(
505507
condition.NetworkAttachmentsReadyCondition,
506-
condition.RequestedReason,
507-
condition.SeverityInfo,
508+
condition.ErrorReason,
509+
condition.SeverityWarning,
508510
condition.NetworkAttachmentsReadyWaitingMessage,
509511
netAtt))
510512
return ctrl.Result{RequeueAfter: time.Second * 10}, nil
@@ -719,10 +721,12 @@ func (r *DesignateBackendbind9Reconciler) generateServiceConfigMaps(
719721
nad, err := nad.GetNADWithName(ctx, h, netAtt, instance.Namespace)
720722
if err != nil {
721723
if k8s_errors.IsNotFound(err) {
724+
// Since the net-attach-def CR should have been manually created by the user and referenced in the spec,
725+
// we treat this as a warning because it means that the service will not be able to start.
722726
Log.Info(fmt.Sprintf("network-attachment-definition %s not found, cannot configure pod", netAtt))
723727
instance.Status.Conditions.Set(condition.FalseCondition(
724728
condition.NetworkAttachmentsReadyCondition,
725-
condition.RequestedReason,
729+
condition.ErrorReason,
726730
condition.SeverityWarning, // Severity is just warning because while we expect it, we will retry.
727731
condition.NetworkAttachmentsReadyErrorMessage,
728732
netAtt))

controllers/designatecentral_controller.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -486,10 +486,12 @@ func (r *DesignateCentralReconciler) reconcileNormal(ctx context.Context, instan
486486
)
487487
if err != nil {
488488
if k8s_errors.IsNotFound(err) {
489+
// Since the CA cert secret should have been manually created by the user and referenced in the spec,
490+
// we treat this as a warning because it means that the service will not be able to start.
489491
instance.Status.Conditions.Set(condition.FalseCondition(
490492
condition.TLSInputReadyCondition,
491-
condition.RequestedReason,
492-
condition.SeverityInfo,
493+
condition.ErrorReason,
494+
condition.SeverityWarning,
493495
condition.TLSInputReadyWaitingMessage, instance.Spec.TLS.CaBundleSecretName))
494496
return ctrl.Result{}, nil
495497
}

controllers/designatemdns_controller.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -503,10 +503,12 @@ func (r *DesignateMdnsReconciler) reconcileNormal(ctx context.Context, instance
503503
)
504504
if err != nil {
505505
if k8s_errors.IsNotFound(err) {
506+
// Since the CA cert secret should have been manually created by the user and referenced in the spec,
507+
// we treat this as a warning because it means that the service will not be able to start.
506508
instance.Status.Conditions.Set(condition.FalseCondition(
507509
condition.TLSInputReadyCondition,
508-
condition.RequestedReason,
509-
condition.SeverityInfo,
510+
condition.ErrorReason,
511+
condition.SeverityWarning,
510512
condition.TLSInputReadyWaitingMessage, instance.Spec.TLS.CaBundleSecretName))
511513
return ctrl.Result{}, nil
512514
}
@@ -613,11 +615,13 @@ func (r *DesignateMdnsReconciler) reconcileNormal(ctx context.Context, instance
613615
nad, err := nad.GetNADWithName(ctx, helper, netAtt, instance.Namespace)
614616
if err != nil {
615617
if k8s_errors.IsNotFound(err) {
618+
// Since the net-attach-def CR should have been manually created by the user and referenced in the spec,
619+
// we treat this as a warning because it means that the service will not be able to start.
616620
Log.Info(fmt.Sprintf("network-attachment-definition %s not found", netAtt))
617621
instance.Status.Conditions.Set(condition.FalseCondition(
618622
condition.NetworkAttachmentsReadyCondition,
619-
condition.RequestedReason,
620-
condition.SeverityInfo,
623+
condition.ErrorReason,
624+
condition.SeverityWarning,
621625
condition.NetworkAttachmentsReadyWaitingMessage,
622626
netAtt))
623627
return ctrl.Result{RequeueAfter: time.Second * 10}, nil

controllers/designateproducer_controller.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -505,10 +505,12 @@ func (r *DesignateProducerReconciler) reconcileNormal(ctx context.Context, insta
505505
)
506506
if err != nil {
507507
if k8s_errors.IsNotFound(err) {
508+
// Since the CA cert secret should have been manually created by the user and referenced in the spec,
509+
// we treat this as a warning because it means that the service will not be able to start.
508510
instance.Status.Conditions.Set(condition.FalseCondition(
509511
condition.TLSInputReadyCondition,
510-
condition.RequestedReason,
511-
condition.SeverityInfo,
512+
condition.ErrorReason,
513+
condition.SeverityWarning,
512514
condition.TLSInputReadyWaitingMessage, instance.Spec.TLS.CaBundleSecretName))
513515
return ctrl.Result{}, nil
514516
}
@@ -536,11 +538,13 @@ func (r *DesignateProducerReconciler) reconcileNormal(ctx context.Context, insta
536538
nad, err := nad.GetNADWithName(ctx, helper, netAtt, instance.Namespace)
537539
if err != nil {
538540
if k8s_errors.IsNotFound(err) {
541+
// Since the net-attach-def CR should have been manually created by the user and referenced in the spec,
542+
// we treat this as a warning because it means that the service will not be able to start.
539543
Log.Info(fmt.Sprintf("network-attachment-definition %s not found", netAtt))
540544
instance.Status.Conditions.Set(condition.FalseCondition(
541545
condition.NetworkAttachmentsReadyCondition,
542-
condition.RequestedReason,
543-
condition.SeverityInfo,
546+
condition.ErrorReason,
547+
condition.SeverityWarning,
544548
condition.NetworkAttachmentsReadyWaitingMessage,
545549
netAtt))
546550
return ctrl.Result{RequeueAfter: time.Second * 10}, nil

controllers/designateunbound_controller.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,11 +347,13 @@ func (r *UnboundReconciler) reconcileNormal(ctx context.Context, instance *desig
347347
nad, err := nad.GetNADWithName(ctx, helper, networkAttachment, instance.Namespace)
348348
if err != nil {
349349
if k8s_errors.IsNotFound(err) {
350+
// Since the net-attach-def CR should have been manually created by the user and referenced in the spec,
351+
// we treat this as a warning because it means that the service will not be able to start.
350352
Log.Info(fmt.Sprintf("network-attachment-definition %s not found", networkAttachment))
351353
instance.Status.Conditions.Set(condition.FalseCondition(
352354
condition.NetworkAttachmentsReadyCondition,
353-
condition.RequestedReason,
354-
condition.SeverityInfo,
355+
condition.ErrorReason,
356+
condition.SeverityWarning,
355357
condition.NetworkAttachmentsReadyWaitingMessage,
356358
networkAttachment))
357359
return ctrl.Result{RequeueAfter: time.Second * 10}, nil

controllers/designateworker_controller.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -505,10 +505,12 @@ func (r *DesignateWorkerReconciler) reconcileNormal(ctx context.Context, instanc
505505
)
506506
if err != nil {
507507
if k8s_errors.IsNotFound(err) {
508+
// Since the CA cert secret should have been manually created by the user and referenced in the spec,
509+
// we treat this as a warning because it means that the service will not be able to start.
508510
instance.Status.Conditions.Set(condition.FalseCondition(
509511
condition.TLSInputReadyCondition,
510-
condition.RequestedReason,
511-
condition.SeverityInfo,
512+
condition.ErrorReason,
513+
condition.SeverityWarning,
512514
condition.TLSInputReadyWaitingMessage, instance.Spec.TLS.CaBundleSecretName))
513515
return ctrl.Result{}, nil
514516
}
@@ -585,11 +587,13 @@ func (r *DesignateWorkerReconciler) reconcileNormal(ctx context.Context, instanc
585587
nad, err := nad.GetNADWithName(ctx, helper, netAtt, instance.Namespace)
586588
if err != nil {
587589
if k8s_errors.IsNotFound(err) {
590+
// Since the net-attach-def CR should have been manually created by the user and referenced in the spec,
591+
// we treat this as a warning because it means that the service will not be able to start.
588592
Log.Info(fmt.Sprintf("network-attachment-definition %s not found", netAtt))
589593
instance.Status.Conditions.Set(condition.FalseCondition(
590594
condition.NetworkAttachmentsReadyCondition,
591-
condition.RequestedReason,
592-
condition.SeverityInfo,
595+
condition.ErrorReason,
596+
condition.SeverityWarning,
593597
condition.NetworkAttachmentsReadyWaitingMessage,
594598
netAtt))
595599
return ctrl.Result{RequeueAfter: time.Second * 10}, nil

0 commit comments

Comments
 (0)