Skip to content
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
8 changes: 7 additions & 1 deletion internal/controller/ready/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,17 @@ func ComputeReadyCondition(hv *kvmv1.Hypervisor) metav1.Condition {

// Priority 5: Onboarding not started, aborted, or not succeeded
if onboardingCondition == nil {
message := "Onboarding not started"
if !hv.Spec.LifecycleEnabled {
message = "Onboarding not started: lifecycle management is disabled"
} else if hv.Status.HypervisorID == "" || hv.Status.ServiceID == "" {
message = "Onboarding not started: waiting for nova-compute to register the hypervisor in Nova (HypervisorID/ServiceID not yet available)"
}
return metav1.Condition{
Type: kvmv1.ConditionTypeReady,
Status: metav1.ConditionFalse,
Reason: kvmv1.ConditionReasonOnboarding,
Message: "Onboarding not started",
Message: message,
}
}

Expand Down
30 changes: 28 additions & 2 deletions internal/controller/ready/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,13 +278,39 @@ var _ = Describe("ComputeReadyCondition", func() {
})

Context("Priority 5: Onboarding not started/aborted/not succeeded", func() {
It("should return Ready=False when no onboarding condition exists", func() {
It("should mention lifecycle disabled when lifecycleEnabled is false", func() {
hv.Spec.LifecycleEnabled = false

result := ComputeReadyCondition(hv)

Expect(result.Type).To(Equal(kvmv1.ConditionTypeReady))
Expect(result.Status).To(Equal(metav1.ConditionFalse))
Expect(result.Reason).To(Equal(kvmv1.ConditionReasonOnboarding))
Expect(result.Message).To(ContainSubstring("lifecycle management is disabled"))
})

It("should mention waiting for nova-compute when HypervisorID/ServiceID are missing", func() {
hv.Spec.LifecycleEnabled = true

result := ComputeReadyCondition(hv)

Expect(result.Type).To(Equal(kvmv1.ConditionTypeReady))
Expect(result.Status).To(Equal(metav1.ConditionFalse))
Expect(result.Reason).To(Equal(kvmv1.ConditionReasonOnboarding))
Expect(result.Message).To(ContainSubstring("waiting for nova-compute"))
})

It("should return generic not started when lifecycle is enabled and IDs are present", func() {
hv.Spec.LifecycleEnabled = true
hv.Status.HypervisorID = "some-id"
hv.Status.ServiceID = "some-service-id"

result := ComputeReadyCondition(hv)

Expect(result.Type).To(Equal(kvmv1.ConditionTypeReady))
Expect(result.Status).To(Equal(metav1.ConditionFalse))
Expect(result.Reason).To(Equal(kvmv1.ConditionReasonOnboarding))
Expect(result.Message).To(ContainSubstring("not started"))
Expect(result.Message).To(Equal("Onboarding not started"))
})

It("should return Ready=False when onboarding was aborted", func() {
Expand Down
Loading