|
|
@ -254,28 +254,32 @@ function ($q, $scope, $transition$, $state, $location, $timeout, $anchorScroll,
|
|
|
|
config.TaskTemplate.Placement.Constraints = ServiceHelper.translateKeyValueToPlacementConstraints(service.ServiceConstraints);
|
|
|
|
config.TaskTemplate.Placement.Constraints = ServiceHelper.translateKeyValueToPlacementConstraints(service.ServiceConstraints);
|
|
|
|
config.TaskTemplate.Placement.Preferences = ServiceHelper.translateKeyValueToPlacementPreferences(service.ServicePreferences);
|
|
|
|
config.TaskTemplate.Placement.Preferences = ServiceHelper.translateKeyValueToPlacementPreferences(service.ServicePreferences);
|
|
|
|
|
|
|
|
|
|
|
|
// Round memory values to 0.125 and convert MB to B
|
|
|
|
if ($scope.hasChanges(service, ['LimitNanoCPUs', 'LimitMemoryBytes', 'ReservationNanoCPUs', 'ReservationMemoryBytes'])) {
|
|
|
|
var memoryLimit = (Math.round(service.LimitMemoryBytes * 8) / 8).toFixed(3);
|
|
|
|
// Round memory values to 0.125 and convert MB to B
|
|
|
|
memoryLimit *= 1024 * 1024;
|
|
|
|
var memoryLimit = (Math.round(service.LimitMemoryBytes * 8) / 8).toFixed(3);
|
|
|
|
var memoryReservation = (Math.round(service.ReservationMemoryBytes * 8) / 8).toFixed(3);
|
|
|
|
memoryLimit *= 1024 * 1024;
|
|
|
|
memoryReservation *= 1024 * 1024;
|
|
|
|
var memoryReservation = (Math.round(service.ReservationMemoryBytes * 8) / 8).toFixed(3);
|
|
|
|
config.TaskTemplate.Resources = {
|
|
|
|
memoryReservation *= 1024 * 1024;
|
|
|
|
Limits: {
|
|
|
|
config.TaskTemplate.Resources = {
|
|
|
|
NanoCPUs: service.LimitNanoCPUs * 1000000000,
|
|
|
|
Limits: {
|
|
|
|
MemoryBytes: memoryLimit
|
|
|
|
NanoCPUs: service.LimitNanoCPUs * 1000000000,
|
|
|
|
},
|
|
|
|
MemoryBytes: memoryLimit
|
|
|
|
Reservations: {
|
|
|
|
},
|
|
|
|
NanoCPUs: service.ReservationNanoCPUs * 1000000000,
|
|
|
|
Reservations: {
|
|
|
|
MemoryBytes: memoryReservation
|
|
|
|
NanoCPUs: service.ReservationNanoCPUs * 1000000000,
|
|
|
|
}
|
|
|
|
MemoryBytes: memoryReservation
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
config.UpdateConfig = {
|
|
|
|
if($scope.hasChanges(service, ['UpdateFailureAction', 'UpdateDelay', 'UpdateParallelism', 'UpdateOrder'])) {
|
|
|
|
Parallelism: service.UpdateParallelism,
|
|
|
|
config.UpdateConfig = {
|
|
|
|
Delay: ServiceHelper.translateHumanDurationToNanos(service.UpdateDelay) || 0,
|
|
|
|
Parallelism: service.UpdateParallelism,
|
|
|
|
FailureAction: service.UpdateFailureAction,
|
|
|
|
Delay: ServiceHelper.translateHumanDurationToNanos(service.UpdateDelay) || 0,
|
|
|
|
Order: service.UpdateOrder
|
|
|
|
FailureAction: service.UpdateFailureAction,
|
|
|
|
};
|
|
|
|
Order: service.UpdateOrder
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ($scope.hasChanges(service, ['RestartCondition', 'RestartDelay', 'RestartMaxAttempts', 'RestartWindow'])){
|
|
|
|
if ($scope.hasChanges(service, ['RestartCondition', 'RestartDelay', 'RestartMaxAttempts', 'RestartWindow'])){
|
|
|
|
config.TaskTemplate.RestartPolicy = {
|
|
|
|
config.TaskTemplate.RestartPolicy = {
|
|
|
|