Commit 4e60bf8e authored by galal-hussein's avatar galal-hussein Committed by Alena Prokharchyk
Browse files

Restart components if binds changed

parent 6d36c9a7
No related merge requests found
Showing with 4 additions and 3 deletions
+4 -3
......@@ -64,7 +64,7 @@ func DoRunContainer(ctx context.Context, dClient *client.Client, imageCfg *conta
}
}
logrus.Debugf("[%s] Container [%s] is already running on host [%s]", plane, containerName, hostname)
isUpgradable, err := IsContainerUpgradable(ctx, dClient, imageCfg, containerName, hostname, plane)
isUpgradable, err := IsContainerUpgradable(ctx, dClient, imageCfg, hostCfg, containerName, hostname, plane)
if err != nil {
return err
}
......@@ -299,7 +299,7 @@ func WaitForContainer(ctx context.Context, dClient *client.Client, hostname stri
return 0, nil
}
func IsContainerUpgradable(ctx context.Context, dClient *client.Client, imageCfg *container.Config, containerName string, hostname string, plane string) (bool, error) {
func IsContainerUpgradable(ctx context.Context, dClient *client.Client, imageCfg *container.Config, hostCfg *container.HostConfig, containerName string, hostname string, plane string) (bool, error) {
logrus.Debugf("[%s] Checking if container [%s] is eligible for upgrade on host [%s]", plane, containerName, hostname)
// this should be moved to a higher layer.
......@@ -310,7 +310,8 @@ func IsContainerUpgradable(ctx context.Context, dClient *client.Client, imageCfg
if containerInspect.Config.Image != imageCfg.Image ||
!sliceEqualsIgnoreOrder(containerInspect.Config.Entrypoint, imageCfg.Entrypoint) ||
!sliceEqualsIgnoreOrder(containerInspect.Config.Cmd, imageCfg.Cmd) ||
!isContainerRKEEnvChanged(containerInspect.Config.Env, imageCfg.Env) {
!isContainerRKEEnvChanged(containerInspect.Config.Env, imageCfg.Env) ||
!sliceEqualsIgnoreOrder(containerInspect.HostConfig.Binds, hostCfg.Binds) {
logrus.Debugf("[%s] Container [%s] is eligible for upgrade on host [%s]", plane, containerName, hostname)
return true, nil
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment