Skip to content

Commit e631fa9

Browse files
Merge pull request #34072 from alex-hunt-materialize/version_gate_readyz_probe
Version-gate the HTTP /api/readyz probe
2 parents 3c32091 + e6a46a4 commit e631fa9

File tree

4 files changed

+47
-17
lines changed

4 files changed

+47
-17
lines changed

bin/ci-builder

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,7 @@ case "$cmd" in
259259
--env PYPI_TOKEN
260260
--env RUST_MIN_STACK
261261
--env MZ_DEV_BUILD_SHA
262+
--env MZ_GHCR
262263
# For Miri with nightly Rust
263264
--env ZOOKEEPER_ADDR
264265
--env KAFKA_ADDRS

ci/nightly/pipeline.template.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2401,9 +2401,11 @@ steps:
24012401
composition: orchestratord
24022402
args: [--action=upgrade, --properties=individual, --runtime=3600, --recreate-cluster]
24032403
ci-builder: stable
2404+
env:
2405+
# Old versions are not on GHCR yet
2406+
MZ_GHCR: 0
24042407
agents:
24052408
queue: hetzner-aarch64-8cpu-16gb
2406-
skip: "https://github.com/MaterializeInc/database-issues/issues/9891"
24072409

24082410
- id: orchestratord-upgrade-combine
24092411
label: "Orchestratord test (upgrade, combine props)"
@@ -2414,9 +2416,11 @@ steps:
24142416
composition: orchestratord
24152417
args: [--action=upgrade, --properties=combine, --runtime=3600, --recreate-cluster]
24162418
ci-builder: stable
2419+
env:
2420+
# Old versions are not on GHCR yet
2421+
MZ_GHCR: 0
24172422
agents:
24182423
queue: hetzner-aarch64-8cpu-16gb
2419-
skip: "https://github.com/MaterializeInc/database-issues/issues/9891"
24202424

24212425
- id: orchestratord-upgrade-chain-individual
24222426
label: "Orchestratord test (upgrade chain, individual props)"
@@ -2427,9 +2431,11 @@ steps:
24272431
composition: orchestratord
24282432
args: [--action=upgrade-chain, --properties=individual, --runtime=3600, --recreate-cluster]
24292433
ci-builder: stable
2434+
env:
2435+
# Old versions are not on GHCR yet
2436+
MZ_GHCR: 0
24302437
agents:
24312438
queue: hetzner-aarch64-8cpu-16gb
2432-
skip: "https://github.com/MaterializeInc/database-issues/issues/9891"
24332439

24342440
- id: orchestratord-upgrade-chain-combine
24352441
label: "Orchestratord test (upgrade chain, combine props)"
@@ -2440,6 +2446,8 @@ steps:
24402446
composition: orchestratord
24412447
args: [--action=upgrade-chain, --properties=combine, --runtime=3600, --recreate-cluster]
24422448
ci-builder: stable
2449+
env:
2450+
# Old versions are not on GHCR yet
2451+
MZ_GHCR: 0
24432452
agents:
24442453
queue: hetzner-aarch64-16cpu-32gb
2445-
skip: "https://github.com/MaterializeInc/database-issues/issues/9891"

src/orchestratord/src/controller/materialize/environmentd.rs

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ use k8s_openapi::{
2121
Capabilities, ConfigMap, ConfigMapVolumeSource, Container, ContainerPort, EnvVar,
2222
EnvVarSource, HTTPGetAction, KeyToPath, PodSecurityContext, PodSpec, PodTemplateSpec,
2323
Probe, SeccompProfile, Secret, SecretKeySelector, SecretVolumeSource, SecurityContext,
24-
Service, ServiceAccount, ServicePort, ServiceSpec, Toleration, Volume, VolumeMount,
24+
Service, ServiceAccount, ServicePort, ServiceSpec, TCPSocketAction, Toleration, Volume,
25+
VolumeMount,
2526
},
2627
networking::v1::{
2728
IPBlock, NetworkPolicy, NetworkPolicyEgressRule, NetworkPolicyIngressRule,
@@ -1312,17 +1313,31 @@ fn create_environmentd_statefulset_object(
13121313
args.extend(extra_args.iter().cloned());
13131314
}
13141315

1315-
let probe = Probe {
1316-
initial_delay_seconds: Some(1),
1317-
failure_threshold: Some(12),
1318-
http_get: Some(HTTPGetAction {
1319-
path: Some("/api/readyz".to_string()),
1320-
port: IntOrString::Int(config.environmentd_internal_http_port.into()),
1321-
host: None,
1322-
scheme: None,
1323-
http_headers: None,
1324-
}),
1325-
..Default::default()
1316+
let probe = if mz.meets_minimum_version(&V147_DEV0) {
1317+
Probe {
1318+
initial_delay_seconds: Some(1),
1319+
failure_threshold: Some(12),
1320+
http_get: Some(HTTPGetAction {
1321+
path: Some("/api/readyz".to_string()),
1322+
port: IntOrString::Int(config.environmentd_internal_http_port.into()),
1323+
host: None,
1324+
scheme: None,
1325+
http_headers: None,
1326+
}),
1327+
..Default::default()
1328+
}
1329+
} else {
1330+
// Older versions, despite having the /api/readyz endpoint,
1331+
// would sometimes never return an HTTP 200 response.
1332+
Probe {
1333+
initial_delay_seconds: Some(1),
1334+
failure_threshold: Some(12),
1335+
tcp_socket: Some(TCPSocketAction {
1336+
host: None,
1337+
port: IntOrString::Int(config.environmentd_sql_port.into()),
1338+
}),
1339+
..Default::default()
1340+
}
13261341
};
13271342

13281343
let security_context = if config.enable_security_context {

test/orchestratord/mzcompose.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
import yaml
3131
from semver.version import Version
3232

33-
from materialize import MZ_ROOT, ci_util, git, spawn
33+
from materialize import MZ_ROOT, ci_util, git, spawn, ui
3434
from materialize.mz_version import MzVersion
3535
from materialize.mzcompose.composition import (
3636
Composition,
@@ -1517,6 +1517,9 @@ def get_mods() -> Iterator[list[Modification]]:
15171517
for mods in mods_it:
15181518
run_scenario([mods], definition)
15191519
elif action == Action.Upgrade:
1520+
assert not ui.env_is_truthy(
1521+
"MZ_GHCR", "1"
1522+
), "Manually set MZ_GHCR=0 as an environment variable for upgrade testing"
15201523
assert args.runtime
15211524
end_time = (
15221525
datetime.datetime.now() + datetime.timedelta(seconds=args.runtime)
@@ -1535,6 +1538,9 @@ def get_mods() -> Iterator[list[Modification]]:
15351538
]
15361539
run_scenario(scenario, definition)
15371540
elif action == Action.UpgradeChain:
1541+
assert not ui.env_is_truthy(
1542+
"MZ_GHCR", "1"
1543+
), "Manually set MZ_GHCR=0 as an environment variable for upgrade testing"
15381544
assert args.runtime
15391545
end_time = (
15401546
datetime.datetime.now() + datetime.timedelta(seconds=args.runtime)

0 commit comments

Comments
 (0)