Skip to content

Commit dd31b37

Browse files
authored
Merge pull request #28 from Netcracker/feature/add_probes_to_all_services
feat: IMplement probes for all services
2 parents dd2644f + d815eb5 commit dd31b37

File tree

4 files changed

+64
-2
lines changed

4 files changed

+64
-2
lines changed

operator/charts/helm/rabbitmq/templates/deployment.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,16 @@ spec:
8080
httpGet:
8181
path: /healthz
8282
port: 8081
83+
readinessProbe:
84+
httpGet:
85+
path: /readyz
86+
port: 8081
87+
scheme: HTTP
88+
initialDelaySeconds: 40
89+
timeoutSeconds: 15
90+
periodSeconds: 15
91+
successThreshold: 1
92+
failureThreshold: 5
8393
resources:
8494
limits:
8595
cpu: {{ default "100m" .Values.operator.resources.limits.cpu }}
@@ -156,6 +166,14 @@ spec:
156166
periodSeconds: 10
157167
successThreshold: 1
158168
failureThreshold: 5
169+
readinessProbe:
170+
tcpSocket:
171+
port: {{ template "disasterRecovery.port" . }}
172+
initialDelaySeconds: 10
173+
timeoutSeconds: 30
174+
periodSeconds: 10
175+
successThreshold: 1
176+
failureThreshold: 5
159177
env:
160178
- name: NAMESPACE
161179
valueFrom:

operator/charts/helm/rabbitmq/templates/integration_tests/deployment.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,14 @@ spec:
166166
periodSeconds: 20
167167
successThreshold: 1
168168
failureThreshold: 5
169+
livenessProbe:
170+
tcpSocket:
171+
port: 8080
172+
initialDelaySeconds: 20
173+
timeoutSeconds: 5
174+
periodSeconds: 20
175+
successThreshold: 1
176+
failureThreshold: 5
169177
volumes:
170178
- name: output
171179
emptyDir: {}

operator/charts/helm/rabbitmq/templates/rabbit_monitoring_external_deployment.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,4 +98,20 @@ spec:
9898
memory: {{ default "100Mi" .Values.telegraf.resources.requests.memory }}
9999
securityContext:
100100
{{- include "rabbitmq.globalContainerSecurityContext" . | nindent 12 }}
101+
livenessProbe:
102+
tcpSocket:
103+
port: 8096
104+
initialDelaySeconds: 40
105+
timeoutSeconds: 5
106+
periodSeconds: 15
107+
successThreshold: 1
108+
failureThreshold: 5
109+
readinessProbe:
110+
tcpSocket:
111+
port: 8096
112+
initialDelaySeconds: 40
113+
timeoutSeconds: 15
114+
periodSeconds: 15
115+
successThreshold: 1
116+
failureThreshold: 5
101117
{{ end }}

operator/src/handler.py

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
import requests
2626
from kubernetes import client as client, config as k8s_config
2727
from kubernetes.client import V1ObjectMeta, V1EnvVar, V1Container, V1PodSpec, \
28-
V1PodTemplateSpec, V1ContainerPort, \
28+
V1PodTemplateSpec, V1TCPSocketAction, V1ContainerPort, \
2929
V1ExecAction, V1EnvVarSource, V1ObjectFieldSelector, V1VolumeMount, \
3030
V1ResourceRequirements, V1SecretKeySelector, \
3131
V1Volume, V1ConfigMapVolumeSource, V1KeyToPath, V1ConfigMap, V1Lifecycle, \
@@ -642,6 +642,24 @@ def generate_telegraf_deployment_config_body(self):
642642

643643
telegraf_labels = {'name': telegraf_name, 'component': telegraf_name}
644644
telegraf_custom_labels = self.get_custom_labels(telegraf_labels, 'telegraf')
645+
646+
liveness = V1Probe(
647+
tcp_socket=V1TCPSocketAction(port=8096),
648+
initial_delay_seconds=30,
649+
timeout_seconds=5,
650+
period_seconds=15,
651+
success_threshold=1,
652+
failure_threshold=20,
653+
)
654+
655+
readiness = V1Probe(
656+
tcp_socket=V1TCPSocketAction(port=8096),
657+
initial_delay_seconds=30,
658+
timeout_seconds=5,
659+
period_seconds=15,
660+
success_threshold=1,
661+
failure_threshold=20,
662+
)
645663
podtemplate = V1PodTemplateSpec(
646664
metadata=V1ObjectMeta(labels=telegraf_custom_labels),
647665
spec=V1PodSpec(containers=[V1Container(name=telegraf_name,
@@ -650,7 +668,9 @@ def generate_telegraf_deployment_config_body(self):
650668
termination_message_path='/dev/termination-log',
651669
image_pull_policy=image_pull_policy,
652670
resources=telegraf_resources,
653-
security_context=self.get_container_security_context())],
671+
security_context=self.get_container_security_context(),
672+
readiness_probe=readiness,
673+
liveness_probe=liveness,)],
654674
security_context=self.get_security_context("telegraf"),
655675
affinity=self.get_affinity_rules(),
656676
tolerations=self.get_tolerations(),

0 commit comments

Comments
 (0)