sqs-operator v0.1.11: fix ensureService UI port, FILE_LOCK=NO for H2
This commit is contained in:
@@ -667,14 +667,27 @@ func (r *QueueServiceReconciler) ensureService(ctx context.Context, qs *sqsv1alp
|
||||
Selector: map[string]string{
|
||||
"sqs.kube5s.ru/tenant": qs.Spec.TenantID,
|
||||
},
|
||||
Ports: []corev1.ServicePort{
|
||||
Ports: func() []corev1.ServicePort {
|
||||
// Базовый порт ElasticMQ — всегда
|
||||
ports := []corev1.ServicePort{
|
||||
{
|
||||
Name: "sqs-http",
|
||||
Port: int32(elasticMQPort),
|
||||
TargetPort: intstr.FromInt(elasticMQPort),
|
||||
Protocol: corev1.ProtocolTCP,
|
||||
},
|
||||
},
|
||||
}
|
||||
// Порт UI — только если enableUI=true; при self-healing сервис пересоздаётся с нужными портами
|
||||
if qs.Spec.EnableUI {
|
||||
ports = append(ports, corev1.ServicePort{
|
||||
Name: "ui-http",
|
||||
Port: int32(elasticMQUIPort),
|
||||
TargetPort: intstr.FromInt(elasticMQUIPort),
|
||||
Protocol: corev1.ProtocolTCP,
|
||||
})
|
||||
}
|
||||
return ports
|
||||
}(),
|
||||
},
|
||||
}
|
||||
return r.Create(ctx, svc)
|
||||
|
||||
@@ -16,11 +16,12 @@ func GenerateConfig(tenantID, externalHost string, persistence bool, autoCreateQ
|
||||
persistenceBlock := ""
|
||||
if persistence {
|
||||
// H2 база данных хранит очереди и сообщения между рестартами pod.
|
||||
// Файл /data/elasticmq.db — на PVC тенанта.
|
||||
// FILE_LOCK=NO — отключает file-lock, который остаётся при принудительном kill JVM
|
||||
// (kubectl rollout restart). Один pod на тенанта — конкурентный доступ исключён.
|
||||
persistenceBlock = `
|
||||
messages-storage {
|
||||
enabled = true
|
||||
uri = "jdbc:h2:/data/elasticmq"
|
||||
uri = "jdbc:h2:/data/elasticmq;FILE_LOCK=NO"
|
||||
}`
|
||||
} else {
|
||||
persistenceBlock = `
|
||||
|
||||
Reference in New Issue
Block a user