mirror of
https://github.com/psviderski/uncloud.git
synced 2026-08-28 12:03:33 +00:00
feat(compose): add TODO to address deployment idempotency
This commit is contained in:
@@ -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,
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
@@ -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 {
|
||||||
|
|||||||
Reference in New Issue
Block a user