Skip to content

Commit a8a71f8

Browse files
Merge pull request #128 from umago/lsstack-health
Use HTTP health check for lightspeed-stack container
2 parents 3e4f13a + cd15eff commit a8a71f8

6 files changed

Lines changed: 46 additions & 13 deletions

File tree

internal/controller/constants.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,16 @@ const (
8585
LlamaStackStartupProbeFailureThreshold = int32(30)
8686
LlamaStackProbeFailureThreshold = int32(3)
8787

88+
// Health probe settings for the lightspeed-stack container.
89+
// The startup probe allows up to 30 failures (300s) for initialization,
90+
// while liveness and readiness probes use a tighter threshold of 3 failures.
91+
LightspeedStackLivenessPath = "/liveness"
92+
LightspeedStackReadinessPath = "/readiness"
93+
LightspeedStackProbePeriodSeconds = int32(10)
94+
LightspeedStackProbeTimeoutSeconds = int32(5)
95+
LightspeedStackStartupProbeFailureThreshold = int32(30)
96+
LightspeedStackProbeFailureThreshold = int32(3)
97+
8898
// Data Exporter
8999
ExporterConfigVolumeName = "exporter-config"
90100
ExporterConfigMountPath = "/etc/config"

internal/controller/lcore_config.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@ func buildLCoreUserDataCollectionConfig(_ *common_helper.Helper, instance *apiv1
112112

113113
func buildLCoreAuthenticationConfig(_ *common_helper.Helper, _ *apiv1beta1.OpenStackLightspeed) map[string]interface{} {
114114
return map[string]interface{}{
115-
"module": "k8s",
115+
"module": "k8s",
116+
"skip_for_health_probes": true,
116117
}
117118
}
118119

internal/controller/lcore_deployment.go

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ func buildLCorePodTemplateSpec(h *common_helper.Helper, ctx context.Context, ins
147147
Ports: []corev1.ContainerPort{{Name: "https", ContainerPort: OpenStackLightspeedAppServerContainerPort}},
148148
VolumeMounts: lightspeedStackMounts,
149149
Env: lsEnvVars,
150+
StartupProbe: buildLightspeedStackStartupProbe(),
150151
LivenessProbe: buildLightspeedStackLivenessProbe(),
151152
ReadinessProbe: buildLightspeedStackReadinessProbe(),
152153
Resources: corev1.ResourceRequirements{
@@ -651,33 +652,51 @@ func buildLightspeedStackEnvVars(instance *apiv1beta1.OpenStackLightspeed) []cor
651652
return envVars
652653
}
653654

655+
// buildLightspeedStackStartupProbe returns the startup probe for the lightspeed-stack container.
656+
func buildLightspeedStackStartupProbe() *corev1.Probe {
657+
return &corev1.Probe{
658+
ProbeHandler: corev1.ProbeHandler{
659+
HTTPGet: &corev1.HTTPGetAction{
660+
Path: LightspeedStackReadinessPath,
661+
Port: intstr.FromInt32(OpenStackLightspeedAppServerContainerPort),
662+
Scheme: corev1.URISchemeHTTPS,
663+
},
664+
},
665+
PeriodSeconds: LightspeedStackProbePeriodSeconds,
666+
TimeoutSeconds: LightspeedStackProbeTimeoutSeconds,
667+
FailureThreshold: LightspeedStackStartupProbeFailureThreshold,
668+
}
669+
}
670+
654671
// buildLightspeedStackLivenessProbe returns the liveness probe for the lightspeed-stack container.
655672
func buildLightspeedStackLivenessProbe() *corev1.Probe {
656673
return &corev1.Probe{
657674
ProbeHandler: corev1.ProbeHandler{
658-
TCPSocket: &corev1.TCPSocketAction{
659-
Port: intstr.FromInt32(OpenStackLightspeedAppServerContainerPort),
675+
HTTPGet: &corev1.HTTPGetAction{
676+
Path: LightspeedStackLivenessPath,
677+
Port: intstr.FromInt32(OpenStackLightspeedAppServerContainerPort),
678+
Scheme: corev1.URISchemeHTTPS,
660679
},
661680
},
662-
InitialDelaySeconds: 30,
663-
PeriodSeconds: 10,
664-
TimeoutSeconds: 5,
665-
FailureThreshold: 3,
681+
PeriodSeconds: LightspeedStackProbePeriodSeconds,
682+
TimeoutSeconds: LightspeedStackProbeTimeoutSeconds,
683+
FailureThreshold: LightspeedStackProbeFailureThreshold,
666684
}
667685
}
668686

669687
// buildLightspeedStackReadinessProbe returns the readiness probe for the lightspeed-stack container.
670688
func buildLightspeedStackReadinessProbe() *corev1.Probe {
671689
return &corev1.Probe{
672690
ProbeHandler: corev1.ProbeHandler{
673-
TCPSocket: &corev1.TCPSocketAction{
674-
Port: intstr.FromInt32(OpenStackLightspeedAppServerContainerPort),
691+
HTTPGet: &corev1.HTTPGetAction{
692+
Path: LightspeedStackReadinessPath,
693+
Port: intstr.FromInt32(OpenStackLightspeedAppServerContainerPort),
694+
Scheme: corev1.URISchemeHTTPS,
675695
},
676696
},
677-
InitialDelaySeconds: 30,
678-
PeriodSeconds: 10,
679-
TimeoutSeconds: 5,
680-
FailureThreshold: 3,
697+
PeriodSeconds: LightspeedStackProbePeriodSeconds,
698+
TimeoutSeconds: LightspeedStackProbeTimeoutSeconds,
699+
FailureThreshold: LightspeedStackProbeFailureThreshold,
681700
}
682701
}
683702

test/kuttl/common/expected-configs/lightspeed-stack-okp.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
authentication:
22
module: k8s
3+
skip_for_health_probes: true
34
byok_rag:
45
- rag_id: vs_UUID
56
vector_db_id: vs_UUID

test/kuttl/common/expected-configs/lightspeed-stack-update.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
authentication:
22
module: k8s
3+
skip_for_health_probes: true
34
byok_rag:
45
- rag_id: vs_UUID
56
vector_db_id: vs_UUID

test/kuttl/common/expected-configs/lightspeed-stack.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
authentication:
22
module: k8s
3+
skip_for_health_probes: true
34
byok_rag:
45
- rag_id: vs_UUID
56
vector_db_id: vs_UUID

0 commit comments

Comments
 (0)