mirror of
https://github.com/psviderski/uncloud.git
synced 2026-08-26 11:03:34 +00:00
feat: Initial support for Compose configs (#116)
This commit is contained in:
@@ -71,6 +71,18 @@ func EvalContainerSpecChange(current api.ServiceSpec, new api.ServiceSpec) Conta
|
||||
}
|
||||
}
|
||||
|
||||
// Compare configs.
|
||||
if len(current.Configs) != len(new.Configs) {
|
||||
return ContainerNeedsRecreate
|
||||
}
|
||||
sortConfigs(current.Configs)
|
||||
sortConfigs(new.Configs)
|
||||
for i := range current.Configs {
|
||||
if !current.Configs[i].Equals(new.Configs[i]) {
|
||||
return ContainerNeedsRecreate
|
||||
}
|
||||
}
|
||||
|
||||
// Check if any mutable properties changed.
|
||||
if !current.Caddy.Equals(new.Caddy) {
|
||||
return ContainerNeedsRecreate
|
||||
@@ -88,3 +100,9 @@ func sortVolumes(volumes []api.VolumeSpec) {
|
||||
return volumes[i].Name < volumes[j].Name
|
||||
})
|
||||
}
|
||||
|
||||
func sortConfigs(configs []api.ConfigSpec) {
|
||||
sort.Slice(configs, func(i, j int) bool {
|
||||
return configs[i].Name < configs[j].Name
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user