feat(compose): add TODO to address deployment idempotency

This commit is contained in:
Pavel Sviderski
2025-03-17 20:32:14 +10:00
parent 5bcbfc332d
commit b799b7518e
4 changed files with 8 additions and 0 deletions
+1
View File
@@ -40,6 +40,7 @@ func (cli *Client) CreateContainer(
} }
containerName := fmt.Sprintf("%s-%s", spec.Name, suffix) containerName := fmt.Sprintf("%s-%s", spec.Name, suffix)
// TODO: calculate the spec hash and set it as a label to detect changes in the service spec.
config := &container.Config{ config := &container.Config{
Cmd: spec.Container.Command, Cmd: spec.Container.Command,
Hostname: containerName, Hostname: containerName,
+2
View File
@@ -97,6 +97,8 @@ func (s *RollingStrategy) planReplicated(
// Skip containers that are not running. // Skip containers that are not running.
continue continue
} }
// TODO: determine if the spec has changed by comparing the hashes.
// Refactor all the spec comparison logic below.
cs, err := c.Container.ServiceSpec() cs, err := c.Container.ServiceSpec()
if err == nil { if err == nil {
runningSpecs[c.Container.ID] = cs runningSpecs[c.Container.ID] = cs
+3
View File
@@ -7,6 +7,9 @@ import (
) )
func ServiceSpecFromCompose(name string, service types.ServiceConfig) (api.ServiceSpec, error) { func ServiceSpecFromCompose(name string, service types.ServiceConfig) (api.ServiceSpec, error) {
// TODO: resolve the image to a digest and supported platforms using an image resolver that broadcasts requests
// to all machines in the cluster.
// TODO: configure placement filter based on the supported platforms of the image.
spec := api.ServiceSpec{ spec := api.ServiceSpec{
Container: api.ContainerSpec{ Container: api.ContainerSpec{
Command: service.Command, Command: service.Command,
+2
View File
@@ -15,6 +15,8 @@ service Docker {
rpc ListContainers(ListContainersRequest) returns (ListContainersResponse); rpc ListContainers(ListContainersRequest) returns (ListContainersResponse);
rpc RemoveContainer(RemoveContainerRequest) returns (google.protobuf.Empty); rpc RemoveContainer(RemoveContainerRequest) returns (google.protobuf.Empty);
rpc PullImage(PullImageRequest) returns (stream JSONMessage); rpc PullImage(PullImageRequest) returns (stream JSONMessage);
// TODO: implement InspectImageFromRegistry to resolve image name to digest and supported platforms using
// the configured Docker auth.
} }
message CreateContainerRequest { message CreateContainerRequest {