Logging configuration was completely ignore when deploy a compose file
to swarm. This fixes it.
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
| ... | ... |
@@ -19,3 +19,9 @@ type Annotations struct {
|
| 19 | 19 |
Name string `json:",omitempty"` |
| 20 | 20 |
Labels map[string]string `json:",omitempty"` |
| 21 | 21 |
} |
| 22 |
+ |
|
| 23 |
+// Driver represents a driver (network, logging). |
|
| 24 |
+type Driver struct {
|
|
| 25 |
+ Name string `json:",omitempty"` |
|
| 26 |
+ Options map[string]string `json:",omitempty"` |
|
| 27 |
+} |
| ... | ... |
@@ -109,9 +109,3 @@ type IPAMConfig struct {
|
| 109 | 109 |
Range string `json:",omitempty"` |
| 110 | 110 |
Gateway string `json:",omitempty"` |
| 111 | 111 |
} |
| 112 |
- |
|
| 113 |
-// Driver represents a network driver. |
|
| 114 |
-type Driver struct {
|
|
| 115 |
- Name string `json:",omitempty"` |
|
| 116 |
- Options map[string]string `json:",omitempty"` |
|
| 117 |
-} |
| ... | ... |
@@ -567,6 +567,14 @@ func convertService( |
| 567 | 567 |
return swarm.ServiceSpec{}, err
|
| 568 | 568 |
} |
| 569 | 569 |
|
| 570 |
+ var logDriver *swarm.Driver |
|
| 571 |
+ if service.Logging != nil {
|
|
| 572 |
+ logDriver = &swarm.Driver{
|
|
| 573 |
+ Name: service.Logging.Driver, |
|
| 574 |
+ Options: service.Logging.Options, |
|
| 575 |
+ } |
|
| 576 |
+ } |
|
| 577 |
+ |
|
| 570 | 578 |
serviceSpec := swarm.ServiceSpec{
|
| 571 | 579 |
Annotations: swarm.Annotations{
|
| 572 | 580 |
Name: name, |
| ... | ... |
@@ -589,6 +597,7 @@ func convertService( |
| 589 | 589 |
TTY: service.Tty, |
| 590 | 590 |
OpenStdin: service.StdinOpen, |
| 591 | 591 |
}, |
| 592 |
+ LogDriver: logDriver, |
|
| 592 | 593 |
Resources: resources, |
| 593 | 594 |
RestartPolicy: restartPolicy, |
| 594 | 595 |
Placement: &swarm.Placement{
|