Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#663] ensure default readiness probe script does not go into 30 retr… #664

Merged
merged 1 commit into from
Jul 26, 2023
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
4 changes: 2 additions & 2 deletions controllers/activemqartemis_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4437,7 +4437,7 @@ var _ = Describe("artemis controller", func() {
Expect(len(createdSs.Spec.Template.Spec.Containers) == 1).Should(BeTrue())
Expect(createdSs.Spec.Template.Spec.Containers[0].ReadinessProbe.ProbeHandler.Exec.Command[0] == "/bin/bash").Should(BeTrue())
Expect(createdSs.Spec.Template.Spec.Containers[0].ReadinessProbe.ProbeHandler.Exec.Command[1] == "-c").Should(BeTrue())
Expect(createdSs.Spec.Template.Spec.Containers[0].ReadinessProbe.ProbeHandler.Exec.Command[2] == "/opt/amq/bin/readinessProbe.sh").Should(BeTrue())
Expect(createdSs.Spec.Template.Spec.Containers[0].ReadinessProbe.ProbeHandler.Exec.Command[2] == "/opt/amq/bin/readinessProbe.sh 1").Should(BeTrue())

CleanResource(createdCrd, createdCrd.Name, defaultNamespace)
})
Expand Down Expand Up @@ -4515,7 +4515,7 @@ var _ = Describe("artemis controller", func() {
Expect(len(createdSs.Spec.Template.Spec.Containers) == 1).Should(BeTrue())
Expect(createdSs.Spec.Template.Spec.Containers[0].ReadinessProbe.ProbeHandler.Exec.Command[0] == "/bin/bash").Should(BeTrue())
Expect(createdSs.Spec.Template.Spec.Containers[0].ReadinessProbe.ProbeHandler.Exec.Command[1] == "-c").Should(BeTrue())
Expect(createdSs.Spec.Template.Spec.Containers[0].ReadinessProbe.ProbeHandler.Exec.Command[2] == "/opt/amq/bin/readinessProbe.sh").Should(BeTrue())
Expect(createdSs.Spec.Template.Spec.Containers[0].ReadinessProbe.ProbeHandler.Exec.Command[2] == "/opt/amq/bin/readinessProbe.sh 1").Should(BeTrue())

CleanResource(createdCrd, createdCrd.Name, defaultNamespace)
})
Expand Down
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
Loading