Skip to content
This repository was archived by the owner on Nov 16, 2020. It is now read-only.

Commit 46a7f73

Browse files
authored
Set restart policy to always in function and event driver containers (#779)
Setting `always` policy ensures containers are restarted after OVA is rebooted. Tested on Fusion, after reboot function and event drivers are up and working properly
1 parent edfe8fa commit 46a7f73

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

pkg/event-manager/drivers/docker_backend.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,11 @@ func (d *dockerBackend) Deploy(ctx context.Context, driver *entities.Driver) err
118118
},
119119
}
120120

121-
hostConfig := &container.HostConfig{}
121+
hostConfig := &container.HostConfig{
122+
RestartPolicy: container.RestartPolicy{
123+
Name: "always",
124+
},
125+
}
122126

123127
if driver.Expose {
124128
config.ExposedPorts = nat.PortSet{

pkg/functions/docker/driver.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ func (d *Driver) Create(ctx context.Context, f *functions.Function) error {
9898
}, &container.HostConfig{
9999
NetworkMode: "bridge",
100100
PortBindings: nat.PortMap{functionAPIPort: []nat.PortBinding{{HostPort: "0"}}},
101+
RestartPolicy: container.RestartPolicy{
102+
Name: "always",
103+
},
101104
}, nil, containerName)
102105
if err != nil {
103106
return errors.Wrapf(err, "error creating container %s", containerName)

0 commit comments

Comments
 (0)