v0.1.13: Strategy Recreate + preStop + liveness fix (ERR-SQS-06 root cause)
- ensureDeployment: Strategy Recreate (not RollingUpdate) — prevents H2 file lock when two pods mount same PVC simultaneously during rollout restart - preStop: sleep 3 — graceful H2 shutdown before SIGTERM - livenessProbe timeoutSeconds: 3 — prevents false positive on GC pause - terminationGracePeriodSeconds: 15 - doc: thinking log, ERR-SQS-06, progress.md, architecture SVG schema
This commit is contained in:
@@ -533,6 +533,12 @@ func (r *QueueServiceReconciler) ensureDeployment(ctx context.Context, qs *sqsv1
|
||||
"sqs.kube5s.ru/tenant": qs.Spec.TenantID,
|
||||
},
|
||||
},
|
||||
// Recreate: старый pod убивается ДО создания нового.
|
||||
// H2 MVStore держит FileChannel.lock() на /data/elasticmq.mv.db —
|
||||
// при RollingUpdate два pod лезут в один PVC одновременно = ERR-SQS-06.
|
||||
Strategy: appsv1.DeploymentStrategy{
|
||||
Type: appsv1.RecreateDeploymentStrategyType,
|
||||
},
|
||||
Template: corev1.PodTemplateSpec{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Labels: sqsLabels(qs.Spec.TenantID),
|
||||
@@ -543,6 +549,8 @@ func (r *QueueServiceReconciler) ensureDeployment(ctx context.Context, qs *sqsv1
|
||||
SecurityContext: &corev1.PodSecurityContext{
|
||||
FSGroup: func() *int64 { v := int64(999); return &v }(),
|
||||
},
|
||||
// 15 сек — достаточно для graceful shutdown JVM + H2 fsync.
|
||||
TerminationGracePeriodSeconds: func() *int64 { v := int64(15); return &v }(),
|
||||
Containers: func() []corev1.Container {
|
||||
ctrs := []corev1.Container{
|
||||
{
|
||||
@@ -605,8 +613,17 @@ func (r *QueueServiceReconciler) ensureDeployment(ctx context.Context, qs *sqsv1
|
||||
},
|
||||
InitialDelaySeconds: 5,
|
||||
PeriodSeconds: 10,
|
||||
TimeoutSeconds: 3,
|
||||
FailureThreshold: 5,
|
||||
},
|
||||
// preStop: 3 сек на graceful shutdown H2 перед SIGTERM.
|
||||
Lifecycle: &corev1.Lifecycle{
|
||||
PreStop: &corev1.LifecycleHandler{
|
||||
Exec: &corev1.ExecAction{
|
||||
Command: []string{"sh", "-c", "sleep 3"},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
if qs.Spec.EnableUI {
|
||||
|
||||
Reference in New Issue
Block a user