feat: rolling deploy strategy for global service, always recreate

This commit is contained in:
Pavel Sviderski
2025-02-13 21:32:08 +10:00
parent b17fd7531f
commit 43f28284f1
8 changed files with 449 additions and 91 deletions
+6
View File
@@ -69,6 +69,12 @@ func (c *Container) ServicePorts() ([]PortSpec, error) {
return ports, nil
}
func (c *Container) ServiceSpec() ServiceSpec {
// TODO: migrate api.Container type to use ContainerJSON to make it possible to construct
// a ServiceSpec from a Container.
return ServiceSpec{}
}
// runningStatusRegex matches the status string of a running container.
// - "Up 3 minutes (healthy)" -> groups: ["Up 3 minutes (healthy)", "healthy"]
// - "Up 5 seconds" -> groups: ["Up 5 seconds", ""]
+5
View File
@@ -4,6 +4,7 @@ import (
"encoding/json"
"fmt"
"github.com/distribution/reference"
"reflect"
"uncloud/internal/machine/api/pb"
)
@@ -37,6 +38,10 @@ func (s *ServiceSpec) Validate() error {
return nil
}
func (s *ServiceSpec) Equals(spec ServiceSpec) bool {
return reflect.DeepEqual(*s, spec)
}
type ContainerSpec struct {
Command []string
Image string