Skip to content

Commit 5f3d167

Browse files
Merge pull request #624 from abays/fix_warn_error
[OSPRH-19613] Improve consistency of condition severity usage
2 parents 40d18a7 + b3e1960 commit 5f3d167

File tree

2 files changed

+21
-8
lines changed

2 files changed

+21
-8
lines changed

controllers/keystoneapi_controller.go

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -797,11 +797,13 @@ func (r *KeystoneAPIReconciler) reconcileNormal(
797797
err.Error()))
798798
return ctrl.Result{}, err
799799
} else if (result != ctrl.Result{}) {
800-
// This case is "secret not found". VerifySecret already logs a message for it
800+
// This case is "secret not found". VerifySecret already logs a message for it.
801+
// We treat this as a warning because it means that the service will not be able to start
802+
// while we are waiting for the secret to be created manually by the user.
801803
instance.Status.Conditions.Set(condition.FalseCondition(
802804
condition.InputReadyCondition,
803-
condition.RequestedReason,
804-
condition.SeverityInfo,
805+
condition.ErrorReason,
806+
condition.SeverityWarning,
805807
condition.InputReadyWaitingMessage))
806808
return result, nil
807809
}
@@ -842,6 +844,8 @@ func (r *KeystoneAPIReconciler) reconcileNormal(
842844
instance.Status.TransportURLSecret = transportURL.Status.SecretName
843845

844846
if instance.Status.TransportURLSecret == "" {
847+
// Since the TransportURL secret is automatically created by the Infra operator,
848+
// we treat this as an info (because the user is not responsible for manually creating it).
845849
Log.Info(fmt.Sprintf("Waiting for TransportURL %s secret to be created", transportURL.Name))
846850
instance.Status.Conditions.Set(condition.FalseCondition(
847851
condition.RabbitMqTransportURLReadyCondition,
@@ -860,6 +864,9 @@ func (r *KeystoneAPIReconciler) reconcileNormal(
860864
memcached, err := memcachedv1.GetMemcachedByName(ctx, helper, instance.Spec.MemcachedInstance, instance.Namespace)
861865
if err != nil {
862866
if k8s_errors.IsNotFound(err) {
867+
// Memcached should be automatically created by the encompassing OpenStackControlPlane,
868+
// so if it is missing at this point, we treat it as an info (because the user is not
869+
// responsible for manually creating it).
863870
Log.Info(fmt.Sprintf("memcached %s not found", instance.Spec.MemcachedInstance))
864871
instance.Status.Conditions.Set(condition.FalseCondition(
865872
condition.MemcachedReadyCondition,
@@ -970,10 +977,12 @@ func (r *KeystoneAPIReconciler) reconcileNormal(
970977
)
971978
if err != nil {
972979
if k8s_errors.IsNotFound(err) {
980+
// Since the CA cert secret should have been manually created by the user and provided in the spec,
981+
// we treat this as a warning because it means that the service will not be able to start.
973982
instance.Status.Conditions.Set(condition.FalseCondition(
974983
condition.TLSInputReadyCondition,
975-
condition.RequestedReason,
976-
condition.SeverityInfo,
984+
condition.ErrorReason,
985+
condition.SeverityWarning,
977986
condition.TLSInputReadyWaitingMessage,
978987
instance.Spec.TLS.CaBundleSecretName))
979988
return ctrl.Result{}, nil
@@ -996,6 +1005,8 @@ func (r *KeystoneAPIReconciler) reconcileNormal(
9961005
certsHash, err := instance.Spec.TLS.API.ValidateCertSecrets(ctx, helper, instance.Namespace)
9971006
if err != nil {
9981007
if k8s_errors.IsNotFound(err) {
1008+
// Since the OpenStackControlPlane creates the API service certs secrets,
1009+
// we treat this as an info (because the user is not responsible for manually creating them).
9991010
instance.Status.Conditions.Set(condition.FalseCondition(
10001011
condition.TLSInputReadyCondition,
10011012
condition.RequestedReason,
@@ -1041,11 +1052,13 @@ func (r *KeystoneAPIReconciler) reconcileNormal(
10411052
nad, err := nad.GetNADWithName(ctx, helper, netAtt, instance.Namespace)
10421053
if err != nil {
10431054
if k8s_errors.IsNotFound(err) {
1055+
// Since the net-attach-def CR should have been manually created by the user and referenced in the spec,
1056+
// we treat this as a warning because it means that the service will not be able to start.
10441057
Log.Info(fmt.Sprintf("network-attachment-definition %s not found", netAtt))
10451058
instance.Status.Conditions.Set(condition.FalseCondition(
10461059
condition.NetworkAttachmentsReadyCondition,
1047-
condition.RequestedReason,
1048-
condition.SeverityInfo,
1060+
condition.ErrorReason,
1061+
condition.SeverityWarning,
10491062
condition.NetworkAttachmentsReadyWaitingMessage,
10501063
netAtt))
10511064
return ctrl.Result{RequeueAfter: time.Second * 10}, nil

tests/functional/keystoneapi_controller_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -982,7 +982,7 @@ var _ = Describe("Keystone controller", func() {
982982
ConditionGetterFunc(KeystoneConditionGetter),
983983
condition.TLSInputReadyCondition,
984984
corev1.ConditionFalse,
985-
condition.RequestedReason,
985+
condition.ErrorReason,
986986
fmt.Sprintf("TLSInput is missing: %s", CABundleSecretName),
987987
)
988988
th.ExpectCondition(

0 commit comments

Comments
 (0)