diff --git a/internal/controller/constants.go b/internal/controller/constants.go index 4802821..9c5d19a 100644 --- a/internal/controller/constants.go +++ b/internal/controller/constants.go @@ -85,6 +85,16 @@ const ( LlamaStackStartupProbeFailureThreshold = int32(30) LlamaStackProbeFailureThreshold = int32(3) + // Health probe settings for the lightspeed-stack container. + // The startup probe allows up to 30 failures (300s) for initialization, + // while liveness and readiness probes use a tighter threshold of 3 failures. + LightspeedStackLivenessPath = "/liveness" + LightspeedStackReadinessPath = "/readiness" + LightspeedStackProbePeriodSeconds = int32(10) + LightspeedStackProbeTimeoutSeconds = int32(5) + LightspeedStackStartupProbeFailureThreshold = int32(30) + LightspeedStackProbeFailureThreshold = int32(3) + // Data Exporter ExporterConfigVolumeName = "exporter-config" ExporterConfigMountPath = "/etc/config" diff --git a/internal/controller/lcore_config.go b/internal/controller/lcore_config.go index ba46433..df2416a 100644 --- a/internal/controller/lcore_config.go +++ b/internal/controller/lcore_config.go @@ -112,7 +112,8 @@ func buildLCoreUserDataCollectionConfig(_ *common_helper.Helper, instance *apiv1 func buildLCoreAuthenticationConfig(_ *common_helper.Helper, _ *apiv1beta1.OpenStackLightspeed) map[string]interface{} { return map[string]interface{}{ - "module": "k8s", + "module": "k8s", + "skip_for_health_probes": true, } } diff --git a/internal/controller/lcore_deployment.go b/internal/controller/lcore_deployment.go index 99b0f68..120afbc 100644 --- a/internal/controller/lcore_deployment.go +++ b/internal/controller/lcore_deployment.go @@ -147,6 +147,7 @@ func buildLCorePodTemplateSpec(h *common_helper.Helper, ctx context.Context, ins Ports: []corev1.ContainerPort{{Name: "https", ContainerPort: OpenStackLightspeedAppServerContainerPort}}, VolumeMounts: lightspeedStackMounts, Env: lsEnvVars, + StartupProbe: buildLightspeedStackStartupProbe(), LivenessProbe: buildLightspeedStackLivenessProbe(), ReadinessProbe: buildLightspeedStackReadinessProbe(), Resources: corev1.ResourceRequirements{ @@ -651,18 +652,35 @@ func buildLightspeedStackEnvVars(instance *apiv1beta1.OpenStackLightspeed) []cor return envVars } +// buildLightspeedStackStartupProbe returns the startup probe for the lightspeed-stack container. +func buildLightspeedStackStartupProbe() *corev1.Probe { + return &corev1.Probe{ + ProbeHandler: corev1.ProbeHandler{ + HTTPGet: &corev1.HTTPGetAction{ + Path: LightspeedStackReadinessPath, + Port: intstr.FromInt32(OpenStackLightspeedAppServerContainerPort), + Scheme: corev1.URISchemeHTTPS, + }, + }, + PeriodSeconds: LightspeedStackProbePeriodSeconds, + TimeoutSeconds: LightspeedStackProbeTimeoutSeconds, + FailureThreshold: LightspeedStackStartupProbeFailureThreshold, + } +} + // buildLightspeedStackLivenessProbe returns the liveness probe for the lightspeed-stack container. func buildLightspeedStackLivenessProbe() *corev1.Probe { return &corev1.Probe{ ProbeHandler: corev1.ProbeHandler{ - TCPSocket: &corev1.TCPSocketAction{ - Port: intstr.FromInt32(OpenStackLightspeedAppServerContainerPort), + HTTPGet: &corev1.HTTPGetAction{ + Path: LightspeedStackLivenessPath, + Port: intstr.FromInt32(OpenStackLightspeedAppServerContainerPort), + Scheme: corev1.URISchemeHTTPS, }, }, - InitialDelaySeconds: 30, - PeriodSeconds: 10, - TimeoutSeconds: 5, - FailureThreshold: 3, + PeriodSeconds: LightspeedStackProbePeriodSeconds, + TimeoutSeconds: LightspeedStackProbeTimeoutSeconds, + FailureThreshold: LightspeedStackProbeFailureThreshold, } } @@ -670,14 +688,15 @@ func buildLightspeedStackLivenessProbe() *corev1.Probe { func buildLightspeedStackReadinessProbe() *corev1.Probe { return &corev1.Probe{ ProbeHandler: corev1.ProbeHandler{ - TCPSocket: &corev1.TCPSocketAction{ - Port: intstr.FromInt32(OpenStackLightspeedAppServerContainerPort), + HTTPGet: &corev1.HTTPGetAction{ + Path: LightspeedStackReadinessPath, + Port: intstr.FromInt32(OpenStackLightspeedAppServerContainerPort), + Scheme: corev1.URISchemeHTTPS, }, }, - InitialDelaySeconds: 30, - PeriodSeconds: 10, - TimeoutSeconds: 5, - FailureThreshold: 3, + PeriodSeconds: LightspeedStackProbePeriodSeconds, + TimeoutSeconds: LightspeedStackProbeTimeoutSeconds, + FailureThreshold: LightspeedStackProbeFailureThreshold, } } diff --git a/test/kuttl/common/expected-configs/lightspeed-stack-okp.yaml b/test/kuttl/common/expected-configs/lightspeed-stack-okp.yaml index 8ae9bb5..c1091dc 100644 --- a/test/kuttl/common/expected-configs/lightspeed-stack-okp.yaml +++ b/test/kuttl/common/expected-configs/lightspeed-stack-okp.yaml @@ -1,5 +1,6 @@ authentication: module: k8s + skip_for_health_probes: true byok_rag: - rag_id: vs_UUID vector_db_id: vs_UUID diff --git a/test/kuttl/common/expected-configs/lightspeed-stack-update.yaml b/test/kuttl/common/expected-configs/lightspeed-stack-update.yaml index 89d6e04..10d79e1 100644 --- a/test/kuttl/common/expected-configs/lightspeed-stack-update.yaml +++ b/test/kuttl/common/expected-configs/lightspeed-stack-update.yaml @@ -1,5 +1,6 @@ authentication: module: k8s + skip_for_health_probes: true byok_rag: - rag_id: vs_UUID vector_db_id: vs_UUID diff --git a/test/kuttl/common/expected-configs/lightspeed-stack.yaml b/test/kuttl/common/expected-configs/lightspeed-stack.yaml index f0ebae5..645e5bc 100644 --- a/test/kuttl/common/expected-configs/lightspeed-stack.yaml +++ b/test/kuttl/common/expected-configs/lightspeed-stack.yaml @@ -1,5 +1,6 @@ authentication: module: k8s + skip_for_health_probes: true byok_rag: - rag_id: vs_UUID vector_db_id: vs_UUID