Skip to content
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

Replace RabbitMqTransportURLReady by common condition #157

Merged
merged 2 commits into from
Jul 27, 2023
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
18 changes: 0 additions & 18 deletions api/v1beta1/conditions.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ import (

// Telemetry Condition Types used by API objects.
const (
// TelemetryRabbitMqTransportURLReadyCondition Status=True condition which indicates if the RabbitMQ TransportURLUrl is ready
TelemetryRabbitMqTransportURLReadyCondition condition.Type = "TelemetryRabbitMqTransportURLReady"

// CeilometerCentralReadyCondition Status=True condition which indicates if the CeilometerCentral is configured and operational
CeilometerCentralReadyCondition condition.Type = "CeilometerCentralReady"

Expand All @@ -39,21 +36,6 @@ const ()

// Common Messages used by API objects.
const (
//
// TelemetryRabbitMqTransportURLReady condition messages
//
// TelemetryRabbitMqTransportURLReadyInitMessage
TelemetryRabbitMqTransportURLReadyInitMessage = "TelemetryRabbitMqTransportURL not started"

// TelemetryRabbitMqTransportURLReadyRunningMessage
TelemetryRabbitMqTransportURLReadyRunningMessage = "TelemetryRabbitMqTransportURL creation in progress"

// TelemetryRabbitMqTransportURLReadyMessage
TelemetryRabbitMqTransportURLReadyMessage = "TelemetryRabbitMqTransportURL successfully created"

// TelemetryRabbitMqTransportURLReadyErrorMessage
TelemetryRabbitMqTransportURLReadyErrorMessage = "TelemetryRabbitMqTransportURL error occured %s"

//
// CeilometerCentralReady condition messages
//
Expand Down
10 changes: 5 additions & 5 deletions controllers/ceilometercentral_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,10 +282,10 @@ func (r *CeilometerCentralReconciler) reconcileNormal(ctx context.Context, insta
if err != nil {
r.Log.Info("Error getting transportURL. Setting error condition on status and returning")
instance.Status.Conditions.Set(condition.FalseCondition(
telemetryv1.TelemetryRabbitMqTransportURLReadyCondition,
condition.RabbitMqTransportURLReadyCondition,
condition.ErrorReason,
condition.SeverityWarning,
telemetryv1.TelemetryRabbitMqTransportURLReadyErrorMessage,
condition.RabbitMqTransportURLReadyErrorMessage,
err.Error()))
return ctrl.Result{}, err
}
Expand All @@ -299,14 +299,14 @@ func (r *CeilometerCentralReconciler) reconcileNormal(ctx context.Context, insta
if instance.Spec.TransportURLSecret == "" {
r.Log.Info(fmt.Sprintf("Waiting for TransportURL %s secret to be created", transportURL.Name))
instance.Status.Conditions.Set(condition.FalseCondition(
telemetryv1.TelemetryRabbitMqTransportURLReadyCondition,
condition.RabbitMqTransportURLReadyCondition,
condition.RequestedReason,
condition.SeverityInfo,
telemetryv1.TelemetryRabbitMqTransportURLReadyRunningMessage))
condition.RabbitMqTransportURLReadyRunningMessage))
return ctrl.Result{RequeueAfter: time.Duration(10) * time.Second}, nil
}

instance.Status.Conditions.MarkTrue(telemetryv1.TelemetryRabbitMqTransportURLReadyCondition, telemetryv1.TelemetryRabbitMqTransportURLReadyMessage)
instance.Status.Conditions.MarkTrue(condition.RabbitMqTransportURLReadyCondition, condition.RabbitMqTransportURLReadyMessage)
// end transportURL

// ConfigMap
Expand Down
10 changes: 5 additions & 5 deletions controllers/ceilometercompute_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,10 +229,10 @@ func (r *CeilometerComputeReconciler) reconcileNormal(ctx context.Context, insta
if err != nil {
r.Log.Info("Error getting transportURL. Setting error condition on status and returning")
instance.Status.Conditions.Set(condition.FalseCondition(
telemetryv1.TelemetryRabbitMqTransportURLReadyCondition,
condition.RabbitMqTransportURLReadyCondition,
condition.ErrorReason,
condition.SeverityWarning,
telemetryv1.TelemetryRabbitMqTransportURLReadyErrorMessage,
condition.RabbitMqTransportURLReadyErrorMessage,
err.Error()))
return ctrl.Result{}, err
}
Expand All @@ -246,14 +246,14 @@ func (r *CeilometerComputeReconciler) reconcileNormal(ctx context.Context, insta
if instance.Spec.TransportURLSecret == "" {
r.Log.Info(fmt.Sprintf("Waiting for TransportURL %s secret to be created", transportURL.Name))
instance.Status.Conditions.Set(condition.FalseCondition(
telemetryv1.TelemetryRabbitMqTransportURLReadyCondition,
condition.RabbitMqTransportURLReadyCondition,
condition.RequestedReason,
condition.SeverityInfo,
telemetryv1.TelemetryRabbitMqTransportURLReadyRunningMessage))
condition.RabbitMqTransportURLReadyRunningMessage))
return ctrl.Result{RequeueAfter: time.Duration(10) * time.Second}, nil
}

instance.Status.Conditions.MarkTrue(telemetryv1.TelemetryRabbitMqTransportURLReadyCondition, telemetryv1.TelemetryRabbitMqTransportURLReadyMessage)
instance.Status.Conditions.MarkTrue(condition.RabbitMqTransportURLReadyCondition, condition.RabbitMqTransportURLReadyMessage)
// end transportURL

// ConfigMap
Expand Down
5 changes: 0 additions & 5 deletions controllers/telemetry_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,8 @@ func (r *TelemetryReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
instance.Status.Conditions = condition.Conditions{}
// initialize conditions used later as Status=Unknown
cl := condition.CreateList(
condition.UnknownCondition(telemetryv1.TelemetryRabbitMqTransportURLReadyCondition, condition.InitReason, telemetryv1.TelemetryRabbitMqTransportURLReadyInitMessage),
condition.UnknownCondition(telemetryv1.CeilometerCentralReadyCondition, condition.InitReason, telemetryv1.CeilometerCentralReadyInitMessage),
condition.UnknownCondition(telemetryv1.CeilometerComputeReadyCondition, condition.InitReason, telemetryv1.CeilometerComputeReadyInitMessage),
// service account, role, rolebinding conditions
condition.UnknownCondition(condition.ServiceAccountReadyCondition, condition.InitReason, condition.ServiceAccountReadyInitMessage),
condition.UnknownCondition(condition.RoleReadyCondition, condition.InitReason, condition.RoleReadyInitMessage),
condition.UnknownCondition(condition.RoleBindingReadyCondition, condition.InitReason, condition.RoleBindingReadyInitMessage),
)

instance.Status.Conditions.Init(&cl)
Expand Down