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

DEVOPS-30642 disable liveness probes #395

Merged
merged 1 commit into from
Jan 22, 2025
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
1 change: 1 addition & 0 deletions helm/db-controller/templates/tests/dbproxy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ metadata:
namespace: {{ .Release.Namespace }}
labels:
{{- include "db-proxy-test.labels" . | nindent 4 }}
persistance.atlas.infoblox.com/allow-deletion: enabled
annotations:
# ensure this runs on the new db-controller, not the existing one
"helm.sh/hook": "test"
Expand Down
2 changes: 1 addition & 1 deletion helm/db-controller/templates/tests/dsnexec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ spec:
- /bin/sh
- -c
- |
ls /etc/secrets
test -f /etc/secrets/uri_dsn.txt || { echo "Error: URI file does not exist"; exit 1; }
cat /etc/secrets/uri_dsn.txt
for i in $(seq 1 10); do
echo "Attempt $i: Connecting to PostgreSQL..."
Expand Down
1 change: 1 addition & 0 deletions helm/db-controller/templates/tests/roleclaim.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ metadata:
namespace: {{ .Release.Namespace }}
labels:
{{- include "db-controller.labels" . | nindent 4 }}
persistance.atlas.infoblox.com/allow-deletion: enabled
annotations:
"helm.sh/hook": test
"helm.sh/hook-weight": "-4"
Expand Down
1 change: 1 addition & 0 deletions internal/webhook/dbproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
)

var (
// TODO: align this with the path used in dsnexec.go
MountPathProxy = "/dbproxy"
VolumeNameProxy = "dbproxydsn"
ContainerNameProxy = "dbproxy"
Expand Down
14 changes: 7 additions & 7 deletions internal/webhook/dsnexec.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,12 @@ func mutatePodExec(ctx context.Context, pod *corev1.Pod, secretName string, dsnE
var readinessProbe *corev1.Probe
if enableReady {
readinessProbe = &corev1.Probe{

ProbeHandler: corev1.ProbeHandler{
Exec: &corev1.ExecAction{
Command: []string{
"/bin/sh",
"-c",
"psql -h localhost -c \"SELECT 1\"",
fmt.Sprintf("psql \"$(cat %s/%s)\" -c \"SELECT 1\"", MountPathExec, SecretKey),
},
},
},
Expand All @@ -94,9 +93,10 @@ func mutatePodExec(ctx context.Context, pod *corev1.Pod, secretName string, dsnE
}
}

// FIXME: figure out a liveness probe for dsnexec
var livenessProbe *corev1.Probe

if enableLiveness {
_ = livenessProbe
if false && enableLiveness {
livenessProbe = &corev1.Probe{
ProbeHandler: corev1.ProbeHandler{
Exec: &corev1.ExecAction{
Expand Down Expand Up @@ -128,9 +128,9 @@ func mutatePodExec(ctx context.Context, pod *corev1.Pod, secretName string, dsnE
Value: fmt.Sprintf("%s/%s", MountPathExec, SecretKey),
},
},
// Test connection to upstream database
LivenessProbe: livenessProbe,
// Test connection to pgbouncer
// FIXME: figure out a liveness probe for dsnexec
// LivenessProbe: livenessProbe,
// Test connection to specified database
ReadinessProbe: readinessProbe,
VolumeMounts: []corev1.VolumeMount{
{
Expand Down
3 changes: 2 additions & 1 deletion internal/webhook/dsnexec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ var _ = Describe("dsnexec defaulting", func() {
Expect(sidecar.VolumeMounts[0].MountPath).To(Equal(MountPathExec))
Expect(sidecar.VolumeMounts[0].ReadOnly).To(BeTrue())
Expect(sidecar.ReadinessProbe).ToNot(BeNil())
Expect(sidecar.LivenessProbe).ToNot(BeNil())
// FIXME: liveness probes deactivated DEVOPS-30642
// Expect(sidecar.LivenessProbe).ToNot(BeNil())
})

It("pre-mutated pods are not re-mutated", func() {
Expand Down
Loading