Skip to content

Commit b3e1960

Browse files
abaysClaude (Anthropic)
andcommitted
[OSPRH-19613] Use warning and error severity where appropriate
https://issues.redhat.com/browse/OSPRH-19613 Co-authored-by: Claude (Anthropic) <[email protected]>
1 parent b498778 commit b3e1960

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
@@ -796,11 +796,13 @@ func (r *KeystoneAPIReconciler) reconcileNormal(
796796
err.Error()))
797797
return ctrl.Result{}, err
798798
} else if (result != ctrl.Result{}) {
799-
// This case is "secret not found". VerifySecret already logs a message for it
799+
// This case is "secret not found". VerifySecret already logs a message for it.
800+
// We treat this as a warning because it means that the service will not be able to start
801+
// while we are waiting for the secret to be created manually by the user.
800802
instance.Status.Conditions.Set(condition.FalseCondition(
801803
condition.InputReadyCondition,
802-
condition.RequestedReason,
803-
condition.SeverityInfo,
804+
condition.ErrorReason,
805+
condition.SeverityWarning,
804806
condition.InputReadyWaitingMessage))
805807
return result, nil
806808
}
@@ -841,6 +843,8 @@ func (r *KeystoneAPIReconciler) reconcileNormal(
841843
instance.Status.TransportURLSecret = transportURL.Status.SecretName
842844

843845
if instance.Status.TransportURLSecret == "" {
846+
// Since the TransportURL secret is automatically created by the Infra operator,
847+
// we treat this as an info (because the user is not responsible for manually creating it).
844848
Log.Info(fmt.Sprintf("Waiting for TransportURL %s secret to be created", transportURL.Name))
845849
instance.Status.Conditions.Set(condition.FalseCondition(
846850
condition.RabbitMqTransportURLReadyCondition,
@@ -859,6 +863,9 @@ func (r *KeystoneAPIReconciler) reconcileNormal(
859863
memcached, err := memcachedv1.GetMemcachedByName(ctx, helper, instance.Spec.MemcachedInstance, instance.Namespace)
860864
if err != nil {
861865
if k8s_errors.IsNotFound(err) {
866+
// Memcached should be automatically created by the encompassing OpenStackControlPlane,
867+
// so if it is missing at this point, we treat it as an info (because the user is not
868+
// responsible for manually creating it).
862869
Log.Info(fmt.Sprintf("memcached %s not found", instance.Spec.MemcachedInstance))
863870
instance.Status.Conditions.Set(condition.FalseCondition(
864871
condition.MemcachedReadyCondition,
@@ -969,10 +976,12 @@ func (r *KeystoneAPIReconciler) reconcileNormal(
969976
)
970977
if err != nil {
971978
if k8s_errors.IsNotFound(err) {
979+
// Since the CA cert secret should have been manually created by the user and provided in the spec,
980+
// we treat this as a warning because it means that the service will not be able to start.
972981
instance.Status.Conditions.Set(condition.FalseCondition(
973982
condition.TLSInputReadyCondition,
974-
condition.RequestedReason,
975-
condition.SeverityInfo,
983+
condition.ErrorReason,
984+
condition.SeverityWarning,
976985
condition.TLSInputReadyWaitingMessage,
977986
instance.Spec.TLS.CaBundleSecretName))
978987
return ctrl.Result{}, nil
@@ -995,6 +1004,8 @@ func (r *KeystoneAPIReconciler) reconcileNormal(
9951004
certsHash, err := instance.Spec.TLS.API.ValidateCertSecrets(ctx, helper, instance.Namespace)
9961005
if err != nil {
9971006
if k8s_errors.IsNotFound(err) {
1007+
// Since the OpenStackControlPlane creates the API service certs secrets,
1008+
// we treat this as an info (because the user is not responsible for manually creating them).
9981009
instance.Status.Conditions.Set(condition.FalseCondition(
9991010
condition.TLSInputReadyCondition,
10001011
condition.RequestedReason,
@@ -1040,11 +1051,13 @@ func (r *KeystoneAPIReconciler) reconcileNormal(
10401051
nad, err := nad.GetNADWithName(ctx, helper, netAtt, instance.Namespace)
10411052
if err != nil {
10421053
if k8s_errors.IsNotFound(err) {
1054+
// Since the net-attach-def CR should have been manually created by the user and referenced in the spec,
1055+
// we treat this as a warning because it means that the service will not be able to start.
10431056
Log.Info(fmt.Sprintf("network-attachment-definition %s not found", netAtt))
10441057
instance.Status.Conditions.Set(condition.FalseCondition(
10451058
condition.NetworkAttachmentsReadyCondition,
1046-
condition.RequestedReason,
1047-
condition.SeverityInfo,
1059+
condition.ErrorReason,
1060+
condition.SeverityWarning,
10481061
condition.NetworkAttachmentsReadyWaitingMessage,
10491062
netAtt))
10501063
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)