jakubschwan commented on code in PR #3433:
URL: 
https://github.com/apache/incubator-kie-tools/pull/3433#discussion_r2826824242


##########
packages/sonataflow-operator/test/e2e/platform_test.go:
##########
@@ -468,4 +468,77 @@ var _ = Describe("Platform Use Cases :: ", 
Label("platform"), Ordered, func() {
                Entry("and with broker and platform in the same namespace", 
test.GetPathFromE2EDirectory("platform", "services", "gitops", "knative", 
"platform-level-broker"), false),
                Entry("and with broker and platform in a separate namespace", 
test.GetPathFromE2EDirectory("platform", "services", "gitops", "knative", 
"platform-level-broker"), true),
        )
+
+       DescribeTable("when deploying a SonataFlowPlatform combined with HPA 
for the Data Index", func(testcaseDir string, dataIndexHPAPath string, 
createHPABeforePlatform bool) {
+               if createHPABeforePlatform {
+                       By("Create the data index HPA before the platform")
+                       EventuallyWithOffset(1, func() error {
+                               return 
kubectlApplyFileOnCluster(dataIndexHPAPath, targetNamespace)
+                       }, 3*time.Minute, time.Second).Should(Succeed())
+               }
+
+               By("Deploy the platform and database CRs")
+               EventuallyWithOffset(1, func() error {
+                       return kubectlApplyKustomizeOnCluster(testcaseDir, 
targetNamespace)
+               }, 2*time.Minute, time.Second).Should(Succeed())
+
+               By("Wait for SonataFlowPlatform CR to complete deployments")
+               EventuallyWithOffset(1, func() error {
+                       return 
verifyDataIndexAndJobsServiceAreReady(targetNamespace, "5s")
+               }, 10*time.Minute, 5).Should(Succeed())
+
+               By("Evaluate status of all service's health endpoint")
+               verifyDataIndexAndJobsServiceAreHealthy(targetNamespace)
+
+               if createHPABeforePlatform {
+                       By("Check that the Data Index deployment has 3 replicas 
since the HPA was already created")
+                       EventuallyWithOffset(3, func() bool {
+                               return 
verifyDeploymentReplicas("sonataflow-platform-data-index-service", 
targetNamespace, int32(3))
+                       }, 3*time.Minute, 30*time.Second).Should(BeTrue())
+               } else {
+                       By("Check that the Data Index deployment has 1 replica 
before creating the HPA")
+                       EventuallyWithOffset(1, func() bool {
+                               return 
verifyDeploymentReplicas("sonataflow-platform-data-index-service", 
targetNamespace, int32(1))
+                       }, 3*time.Minute, 30*time.Second).Should(BeTrue())
+
+                       By("Create the data index HPA after the platform")
+                       EventuallyWithOffset(1, func() error {
+                               return 
kubectlApplyFileOnCluster(dataIndexHPAPath, targetNamespace)
+                       }, 3*time.Minute, time.Second).Should(Succeed())
+
+                       By("Check that the data index has 3 replicas after 
creating the HPA")
+                       EventuallyWithOffset(1, func() bool {
+                               return 
verifyDeploymentReplicas("sonataflow-platform-data-index-service", 
targetNamespace, int32(3))
+                       }, 3*time.Minute, 30*time.Second).Should(BeTrue())
+               }
+
+               By("Delete the data index HPA")
+               EventuallyWithOffset(1, func() error {
+                       return kubectlDeleteFileOnCluster(dataIndexHPAPath, 
targetNamespace)
+               }, 3*time.Minute, 30*time.Second).Should(Succeed())
+
+               By("Check that the data index has 1 replica after deleting the 
HPA")
+               EventuallyWithOffset(1, func() bool {
+                       return 
verifyDeploymentReplicas("sonataflow-platform-data-index-service", 
targetNamespace, int32(3))

Review Comment:
   ```suggestion
                        return 
verifyDeploymentReplicas("sonataflow-platform-data-index-service", 
targetNamespace, int32(1))
   ```
   Check that the data index has 1 replica after deleting the HPA



##########
packages/sonataflow-operator/internal/controller/sonataflowplatform_controller.go:
##########
@@ -346,3 +368,36 @@ func contains(slice []operatorapi.WorkFlowCapability, s 
operatorapi.WorkFlowCapa
        }
        return false
 }
+
+// mapHPAToPlatformRequests determines if the referred HorizontalPodAutoscaler 
targets a DI service in given namespace,
+// if any. Analyses if that namespace has an SPF that manges the DI service. 
If that is the case, enqueues a Request to
+// the SPF to give the chance to take an action if needed. We normally want to 
do that in situations where the
+// HorizontalPodAutoscaler was removed (DeleteEvent) to let the SFP restore 
back the DI replicas. In other situations

Review Comment:
   ```suggestion
   // if any. Analyses if that namespace has an SFP that manges the DI service. 
If that is the case, enqueues a Request to
   // the SFP to give the chance to take an action if needed. We normally want 
to do that in situations where the
   // HorizontalPodAutoscaler was removed (DeleteEvent) to let the SFP restore 
back the DI replicas. In other situations
   ```
   small typos in function comment



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to