( application: Partial<ApplicationNested>, )
| 536 | }; |
| 537 | |
| 538 | export const generateConfigContainer = ( |
| 539 | application: Partial<ApplicationNested>, |
| 540 | ) => { |
| 541 | const { |
| 542 | healthCheckSwarm, |
| 543 | restartPolicySwarm, |
| 544 | placementSwarm, |
| 545 | updateConfigSwarm, |
| 546 | rollbackConfigSwarm, |
| 547 | modeSwarm, |
| 548 | labelsSwarm, |
| 549 | replicas, |
| 550 | mounts, |
| 551 | networkSwarm, |
| 552 | stopGracePeriodSwarm, |
| 553 | endpointSpecSwarm, |
| 554 | ulimitsSwarm, |
| 555 | } = application; |
| 556 | |
| 557 | const haveMounts = mounts && mounts.length > 0; |
| 558 | |
| 559 | return { |
| 560 | ...(healthCheckSwarm && { |
| 561 | HealthCheck: healthCheckSwarm, |
| 562 | }), |
| 563 | ...(restartPolicySwarm && { |
| 564 | RestartPolicy: restartPolicySwarm, |
| 565 | }), |
| 566 | ...(placementSwarm |
| 567 | ? { |
| 568 | Placement: placementSwarm, |
| 569 | } |
| 570 | : { |
| 571 | // if app have mounts keep manager as constraint |
| 572 | Placement: { |
| 573 | Constraints: haveMounts ? ["node.role==manager"] : [], |
| 574 | }, |
| 575 | }), |
| 576 | ...(labelsSwarm && { |
| 577 | Labels: labelsSwarm, |
| 578 | }), |
| 579 | ...(modeSwarm |
| 580 | ? { |
| 581 | Mode: modeSwarm, |
| 582 | } |
| 583 | : { |
| 584 | // use replicas value if no modeSwarm provided |
| 585 | Mode: { |
| 586 | Replicated: { |
| 587 | Replicas: replicas, |
| 588 | }, |
| 589 | }, |
| 590 | }), |
| 591 | ...(rollbackConfigSwarm |
| 592 | ? { RollbackConfig: rollbackConfigSwarm } |
| 593 | : { |
| 594 | // default rollback config to match update config |
| 595 | RollbackConfig: { |
no outgoing calls
no test coverage detected