Skip to content

Commit

Permalink
fix(controller): registry status condition constants
Browse files Browse the repository at this point in the history
Signed-off-by: Fabrizio Sestito <[email protected]>
  • Loading branch information
fabriziosestito committed Oct 18, 2024
1 parent 66792b3 commit 22c6ff7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions api/v1alpha1/registry_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ type RegistrySpec struct {
}

const (
DiscoveringCondition = "Discovering"
DiscoveredCondition = "Discovered"
RegistryDiscoveringCondition = "Discovering"
RegistryDiscoveredCondition = "Discovered"
)

const (
DiscoveryRequestedReason = "DiscoveryRequested"
FailedToRequestDiscoveryReason = "FailedToRequestDiscovery"
RegistryDiscoveryRequestedReason = "DiscoveryRequested"
RegistryFailedToRequestDiscoveryReason = "FailedToRequestDiscovery"
)

// RegistryStatus defines the observed state of Registry
Expand Down
8 changes: 4 additions & 4 deletions internal/controller/registry_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ func (r *RegistryReconciler) Reconcile(ctx context.Context, req ctrl.Request) (c
}
if err := r.Publisher.Publish(&msg); err != nil {
meta.SetStatusCondition(&registry.Status.Conditions, metav1.Condition{
Type: v1alpha1.RegistryConditionDiscovering,
Type: v1alpha1.RegistryDiscoveringCondition,
Status: metav1.ConditionUnknown,
Reason: v1alpha1.RegistryReasonFailedToRequestDiscovery,
Reason: v1alpha1.RegistryFailedToRequestDiscoveryReason,
Message: "Failed to communicate with the workers",
})
if err := r.Status().Update(ctx, &registry); err != nil {
Expand All @@ -80,9 +80,9 @@ func (r *RegistryReconciler) Reconcile(ctx context.Context, req ctrl.Request) (c

meta.SetStatusCondition(&registry.Status.Conditions,
metav1.Condition{
Type: v1alpha1.RegistryConditionDiscovering,
Type: v1alpha1.RegistryDiscoveringCondition,
Status: metav1.ConditionTrue,
Reason: v1alpha1.RegistryReasonDiscoveryRequested,
Reason: v1alpha1.RegistryDiscoveryRequestedReason,
Message: "Registry discovery in progress",
})
if err := r.Status().Update(ctx, &registry); err != nil {
Expand Down
4 changes: 2 additions & 2 deletions internal/controller/registry_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ var _ = Describe("Registry Controller", func() {
}, Equal(metav1.Condition{
Type: "Discovering",
Status: metav1.ConditionTrue,
Reason: v1alpha1.DiscoveryRequestedReason,
Reason: v1alpha1.RegistryDiscoveryRequestedReason,
Message: "Registry discovery in progress",
}))))
})
Expand Down Expand Up @@ -135,7 +135,7 @@ var _ = Describe("Registry Controller", func() {
}, Equal(metav1.Condition{
Type: "Discovering",
Status: metav1.ConditionUnknown,
Reason: v1alpha1.FailedToRequestDiscoveryReason,
Reason: v1alpha1.RegistryFailedToRequestDiscoveryReason,
Message: "Failed to communicate with the workers",
}))))
})
Expand Down

0 comments on commit 22c6ff7

Please sign in to comment.