Skip to content

Commit

Permalink
[#663] ensure default readiness probe script does not go into 30 retr…
Browse files Browse the repository at this point in the history
…y loop
  • Loading branch information
gtully committed Jul 26, 2023
1 parent db6e382 commit 8e60661
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
3 changes: 1 addition & 2 deletions controllers/activemqartemis_reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -1971,8 +1971,7 @@ var command = []string{
var betterCommand = []string{
"/bin/bash",
"-c",
"/opt/amq/bin/readinessProbe.sh",
"1", // retries/count - so we get fast feedback and can configure via the Probe
"/opt/amq/bin/readinessProbe.sh 1", // retries/count - so we get fast feedback and can configure via the Probe
// "1", sleep seconds not applicable with 1 retry
}

Expand Down
14 changes: 13 additions & 1 deletion controllers/activemqartemisscaledown_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,18 @@ var _ = Describe("Scale down controller", func() {
brokerCrd.Spec.DeploymentPlan.Clustered = &booleanTrue
brokerCrd.Spec.DeploymentPlan.Size = common.Int32ToPtr(2)
brokerCrd.Spec.DeploymentPlan.PersistenceEnabled = true
// scale down is very sensitive to dns availability of ordinal 0
brokerCrd.Spec.DeploymentPlan.ReadinessProbe = &corev1.Probe{
InitialDelaySeconds: 1,
InitialDelaySeconds: 2,
TimeoutSeconds: 2,
PeriodSeconds: 5,
FailureThreshold: 5,
}
brokerCrd.Spec.DeploymentPlan.LivenessProbe = &corev1.Probe{
InitialDelaySeconds: 2,
TimeoutSeconds: 2,
PeriodSeconds: 5,
FailureThreshold: 5,
}
Expect(k8sClient.Create(ctx, brokerCrd)).Should(Succeed())

Expand Down Expand Up @@ -114,6 +123,9 @@ var _ = Describe("Scale down controller", func() {
queryCmd := []string{"amq-broker/bin/artemis", "queue", "stat", "--silent", "--url", "tcp://" + podWithOrdinal + ":61616", "--queueName", "DLQ"}
stdout, err := RunCommandInPod(podWithOrdinal, brokerName+"-container", queryCmd)
g.Expect(err).To(BeNil())
if verbose {
fmt.Printf("\nQSTAT_OUTPUT: %v\n", *stdout)
}
fields := strings.Split(*stdout, "|")
g.Expect(fields[4]).To(Equal("MESSAGE_COUNT"), *stdout)
g.Expect(strings.TrimSpace(fields[14])).To(Equal("1"), *stdout)
Expand Down

0 comments on commit 8e60661

Please sign in to comment.