Skip to content

Commit 332afcc

Browse files
Add additional ingress rule for root path in ScalityUI configuration
1 parent 84c7467 commit 332afcc

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

internal/controller/scalityui/controller_test.go

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -683,10 +683,17 @@ var _ = Describe("ScalityUI Shell Features", func() {
683683
}, eventuallyTimeout, eventuallyInterval).Should(Succeed())
684684

685685
By("Verifying the Ingress has basic configuration")
686-
Expect(ingress.Spec.Rules).To(HaveLen(1))
686+
Expect(ingress.Spec.Rules).To(HaveLen(2))
687+
688+
// Check /shell path (first rule)
687689
Expect(ingress.Spec.Rules[0].HTTP.Paths).To(HaveLen(1))
688690
Expect(ingress.Spec.Rules[0].HTTP.Paths[0].Path).To(Equal("/shell"))
689691
Expect(ingress.Spec.Rules[0].HTTP.Paths[0].Backend.Service.Name).To(Equal(resourceName + "-service"))
692+
693+
// Check / path (second rule)
694+
Expect(ingress.Spec.Rules[1].HTTP.Paths).To(HaveLen(1))
695+
Expect(ingress.Spec.Rules[1].HTTP.Paths[0].Path).To(Equal("/"))
696+
Expect(ingress.Spec.Rules[1].HTTP.Paths[0].Backend.Service.Name).To(Equal(resourceName + "-service"))
690697
})
691698

692699
It("should create a custom Ingress when network configuration is provided", func() {
@@ -726,8 +733,9 @@ var _ = Describe("ScalityUI Shell Features", func() {
726733
By("Verifying the Ingress has the specified host and class")
727734
Expect(ingress.Spec.IngressClassName).NotTo(BeNil())
728735
Expect(*ingress.Spec.IngressClassName).To(Equal("nginx"))
729-
Expect(ingress.Spec.Rules).To(HaveLen(1))
736+
Expect(ingress.Spec.Rules).To(HaveLen(2))
730737
Expect(ingress.Spec.Rules[0].Host).To(Equal("test.example.com"))
738+
Expect(ingress.Spec.Rules[1].Host).To(Equal("test.example.com"))
731739

732740
By("Verifying the Ingress has the specified annotations")
733741
Expect(ingress.Annotations).To(HaveKey("nginx.ingress.kubernetes.io/ssl-redirect"))
@@ -762,9 +770,19 @@ var _ = Describe("ScalityUI Shell Features", func() {
762770
}, eventuallyTimeout, eventuallyInterval).Should(Succeed())
763771

764772
By("Verifying the path configuration allows access to the application")
773+
Expect(ingress.Spec.Rules).To(HaveLen(2))
774+
775+
// Check /shell path (first rule)
776+
Expect(ingress.Spec.Rules[0].HTTP.Paths).To(HaveLen(1))
765777
Expect(ingress.Spec.Rules[0].HTTP.Paths[0].Path).To(Equal("/shell"))
766778
Expect(ingress.Spec.Rules[0].HTTP.Paths[0].PathType).NotTo(BeNil())
767779
Expect(*ingress.Spec.Rules[0].HTTP.Paths[0].PathType).To(Equal(networkingv1.PathTypePrefix))
780+
781+
// Check / path (second rule)
782+
Expect(ingress.Spec.Rules[1].HTTP.Paths).To(HaveLen(1))
783+
Expect(ingress.Spec.Rules[1].HTTP.Paths[0].Path).To(Equal("/"))
784+
Expect(ingress.Spec.Rules[1].HTTP.Paths[0].PathType).NotTo(BeNil())
785+
Expect(*ingress.Spec.Rules[1].HTTP.Paths[0].PathType).To(Equal(networkingv1.PathTypePrefix))
768786
})
769787
})
770788
})

internal/controller/scalityui/ingress.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ func getIngressRules(cr ScalityUI) []resources.IngressHostPath {
7373
Host: getHostname(cr),
7474
Path: "/shell",
7575
},
76+
{
77+
Host: getHostname(cr),
78+
Path: "/",
79+
},
7680
}
7781
return rules
7882
}

0 commit comments

Comments
 (0)