Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read healthcheck "start_interval" in docker compose/stack config #641

Merged
merged 1 commit into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -346,8 +346,7 @@ class DeployConfigReader {
if (networkConfig?.external?.external) {
if (networkConfig?.external?.name) {
return networkConfig.external.name
}
else {
} else {
return networkName
}
}
Expand Down Expand Up @@ -403,10 +402,9 @@ class DeployConfigReader {
if (healthcheck.startPeriod) {
startPeriod = parseDuration(healthcheck.startPeriod).toNanos()
}
// TODO add this one
// if (healthcheck.startInterval) {
// startInterval = parseDuration(healthcheck.startInterval).toNanos()
// }
if (healthcheck.startInterval) {
startInterval = parseDuration(healthcheck.startInterval).toNanos()
}

return new HealthConfig(
healthcheck.test.parts,
Expand Down Expand Up @@ -504,8 +502,7 @@ class DeployConfigReader {
default:
throw new IllegalArgumentException("unknown restart policy: ${restart}")
}
}
else {
} else {
Long delay = null
if (restartPolicy.delay) {
delay = parseDuration(restartPolicy.delay).toNanos()
Expand Down Expand Up @@ -564,8 +561,7 @@ class DeployConfigReader {
if (limits.nanoCpus.contains('/')) {
// TODO
throw new UnsupportedOperationException("not supported, yet")
}
else {
} else {
return new Limit(
(parseDouble(limits.nanoCpus) * nanoMultiplier).longValue(),
parseLong(limits.memory),
Expand All @@ -588,8 +584,7 @@ class DeployConfigReader {
if (reservations.nanoCpus.contains('/')) {
// TODO
throw new UnsupportedOperationException("not supported, yet")
}
else {
} else {
return new ResourceObject(
(parseDouble(reservations.nanoCpus) * nanoMultiplier).longValue(),
parseLong(reservations.memory),
Expand Down Expand Up @@ -653,8 +648,7 @@ class DeployConfigReader {
null,
null)
source = stackVolume.external.name
}
else {
} else {
Map<String, String> labels = stackVolume?.labels?.entries ?: [:]
labels[(ManageStackClient.LabelNamespace)] = namespace
volumeOptions = new MountVolumeOptions(
Expand Down Expand Up @@ -701,8 +695,7 @@ class DeployConfigReader {
MountBindOptions getBindOptions(ServiceVolumeBind bind) {
if (bind?.propagation) {
return new MountBindOptions(MountBindOptions.Propagation.values().find { MountBindOptions.Propagation propagation -> propagation.getValue() == bind.propagation }, null)
}
else {
} else {
return null
}
}
Expand Down Expand Up @@ -760,11 +753,9 @@ class DeployConfigReader {
null,
getLabels(namespace, null)
)
}
else if (network?.external?.external) {
} else if (network?.external?.external) {
externalNetworkNames << (network.external.name ?: internalName)
}
else {
} else {
networkSpec[internalName] = new NetworkCreateRequest(
internalName,
true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -556,14 +556,16 @@ class DeployConfigReaderTest extends Specification {
test: new Command(parts: ["EXEC", "touch", "/foo"]),
timeout: "30s",
interval: "2ms",
retries: 10
retries: 10,
startPeriod: "1s",
startInterval: "500ms",
)) == new HealthConfig(
["EXEC", "touch", "/foo"],
Duration.of(2, ChronoUnit.MILLIS).toNanos().longValue(),
Duration.of(30, ChronoUnit.SECONDS).toNanos().longValue(),
10,
null,
null
Duration.of(1, ChronoUnit.SECONDS).toNanos().longValue(),
Duration.of(500, ChronoUnit.MILLIS).toNanos().longValue()
)
}

Expand Down
Loading