refactor: Enhance health check and load balancing logic in ServiceEditSheet and ServiceRow components, adding support for CNAME records and improving clarity in health check configurations
Build, Test, and Push CFDM Docker Image / test (push) Successful in 3m42s
Build, Test, and Push CFDM Docker Image / build-and-push (push) Successful in 2m13s
Build, Test, and Push CFDM Docker Image / update-wiki (push) Successful in 7s
Build, Test, and Push CFDM Docker Image / create-release (push) Has been skipped
Build, Test, and Push CFDM Docker Image / test (push) Successful in 3m42s
Build, Test, and Push CFDM Docker Image / build-and-push (push) Successful in 2m13s
Build, Test, and Push CFDM Docker Image / update-wiki (push) Successful in 7s
Build, Test, and Push CFDM Docker Image / create-release (push) Has been skipped
This commit is contained in:
@@ -141,6 +141,14 @@ function buildDomainsPayload(bindings: ServiceBindingDraft[]) {
|
||||
? {
|
||||
fqdn: binding.fqdn.trim(),
|
||||
target_cname: binding.target_cname.trim(),
|
||||
lb_mode: binding.lb_mode,
|
||||
health_check_enabled: binding.health.enabled,
|
||||
health_check_type: binding.health.type,
|
||||
health_check_port: binding.health.port,
|
||||
health_check_path: binding.health.path,
|
||||
health_check_expected_status: binding.health.expected_status,
|
||||
health_check_interval_sec: binding.health.interval_sec,
|
||||
health_check_timeout_ms: binding.health.timeout_ms,
|
||||
}
|
||||
: {
|
||||
fqdn: binding.fqdn.trim(),
|
||||
@@ -529,9 +537,12 @@ export function ServiceEditSheet({
|
||||
<AppItemGroup className="gap-2">
|
||||
{bindings.map((binding, index) => {
|
||||
const showLbBlock =
|
||||
binding.record_type === 'A' && binding.target_ips.length > 0
|
||||
(binding.record_type === 'A' && binding.target_ips.length > 0) ||
|
||||
(binding.record_type === 'CNAME' && binding.target_cname.trim().length > 0)
|
||||
const showMeta =
|
||||
binding.target_ips.length > 1 && binding.lb_mode !== 'round_robin'
|
||||
binding.record_type === 'A' &&
|
||||
binding.target_ips.length > 1 &&
|
||||
binding.lb_mode !== 'round_robin'
|
||||
return (
|
||||
<AppItem key={`binding-${index}`} variant="outline">
|
||||
<AppItemContent className="flex flex-col gap-3">
|
||||
@@ -602,9 +613,11 @@ export function ServiceEditSheet({
|
||||
<Accordion defaultValue={[`lb-${index}`]}>
|
||||
<AccordionItem value={`lb-${index}`}>
|
||||
<AccordionTrigger>
|
||||
{binding.target_ips.length > 1
|
||||
? 'Балансировка и Health-check (multi-A)'
|
||||
: 'Health-check'}
|
||||
{binding.record_type === 'CNAME'
|
||||
? 'Health-check'
|
||||
: binding.target_ips.length > 1
|
||||
? 'Балансировка и Health-check (multi-A)'
|
||||
: 'Health-check'}
|
||||
</AccordionTrigger>
|
||||
<AccordionContent>
|
||||
<HealthCheckConfigFields
|
||||
@@ -622,7 +635,10 @@ export function ServiceEditSheet({
|
||||
handleBindingHealthChange(index, next)
|
||||
}
|
||||
lbModeLabel="Режим балансировки"
|
||||
showLbMode={binding.target_ips.length > 1}
|
||||
showLbMode={
|
||||
binding.record_type === 'A' &&
|
||||
binding.target_ips.length > 1
|
||||
}
|
||||
idPrefix={`binding-${index}-health`}
|
||||
/>
|
||||
</AccordionContent>
|
||||
|
||||
@@ -75,7 +75,9 @@ export const ServiceRow = memo(function ServiceRow({
|
||||
const fqdn = serviceDisplayFqdn(service)
|
||||
const allFqdns = (service.domains ?? []).map((d) => bindingToFqdn(d))
|
||||
const healthBindings = (service.domains ?? []).filter(
|
||||
(d) => d.record_type === 'A' && (d.target_ips?.length ?? 0) > 0,
|
||||
(d) =>
|
||||
(d.record_type === 'A' && (d.target_ips?.length ?? 0) > 0) ||
|
||||
(d.record_type === 'CNAME' && Boolean(d.target_cname?.trim())),
|
||||
)
|
||||
|
||||
const style = transform
|
||||
|
||||
Reference in New Issue
Block a user