Skip to content

Commit e899475

Browse files
committed
MCP: Liveness probe
Add a liveness probe on the rhos-mcp container. This commit depends on the lightspeed-mcps PR #18 [1] that adds the `/health` endpoint. [1]: openstack-k8s-operators/lightspeed-mcps#18
1 parent b894b79 commit e899475

4 files changed

Lines changed: 22 additions & 2 deletions

File tree

internal/controller/assets/mcp_server_config.yaml.tmpl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
---
2-
ip: 127.0.0.1
2+
# Bind to all interfaces so the kubelet liveness probe can reach /health.
3+
# This is safe: the container has no declared ports or Service, so nothing
4+
# routes external traffic to it.
5+
ip: 0.0.0.0
36
port: 8080
47
debug: false
58
workers: 1

internal/controller/constants.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,12 @@ const (
118118
LightspeedStackStartupProbeFailureThreshold = int32(30)
119119
LightspeedStackProbeFailureThreshold = int32(3)
120120

121+
// Health probe settings for the rhoso-mcps container.
122+
MCPServerHealthPath = "/health"
123+
MCPServerProbePeriodSeconds = int32(10)
124+
MCPServerProbeTimeoutSeconds = int32(5)
125+
MCPServerProbeFailureThreshold = int32(3)
126+
121127
// Data Exporter
122128
ExporterConfigVolumeName = "exporter-config"
123129
ExporterConfigMountPath = "/etc/config"

internal/controller/lcore_deployment.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,17 @@ func buildLCorePodTemplateSpec(h *common_helper.Helper, ctx context.Context, ins
232232
corev1.ResourceMemory: resource.MustParse("200Mi"),
233233
},
234234
},
235+
LivenessProbe: &corev1.Probe{
236+
ProbeHandler: corev1.ProbeHandler{
237+
HTTPGet: &corev1.HTTPGetAction{
238+
Path: MCPServerHealthPath,
239+
Port: intstr.FromInt32(MCPServerPort),
240+
},
241+
},
242+
PeriodSeconds: MCPServerProbePeriodSeconds,
243+
TimeoutSeconds: MCPServerProbeTimeoutSeconds,
244+
FailureThreshold: MCPServerProbeFailureThreshold,
245+
},
235246
ImagePullPolicy: corev1.PullIfNotPresent,
236247
}
237248
containers = append(containers, mcpContainer)

test/kuttl/tests/rhoso-mcps-configuration/05-assert-rhos-mcp-config-merged.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ commands:
3737
3838
# Template defaults should be preserved
3939
assert_yaml_field "port" "8080"
40-
assert_yaml_field "ip" "127.0.0.1"
40+
assert_yaml_field "ip" "0.0.0.0"
4141
assert_yaml_field "openstack.ca_cert" "./tls-ca-bundle.pem"
4242
assert_yaml_field "openstack.insecure" "False"
4343
assert_yaml_field "openshift.insecure" "False"

0 commit comments

Comments
 (0)