Skip to content

Commit 3cddc20

Browse files
committed
chore: add TODO to use PreferSameNode once k8s 1.35 is minimum
1 parent 64f5184 commit 3cddc20

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

rust/operator-binary/src/service.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ pub(crate) fn build_server_role_service(
6363
type_: Some(opa.spec.cluster_config.listener_class.k8s_service_type()),
6464
ports: Some(data_service_ports(opa.spec.cluster_config.tls_enabled())),
6565
selector: Some(service_selector_labels.into()),
66+
// This ensures that products (e.g. Trino) on a node always talk to the OPA pod on the
67+
// same node, avoiding cross-node latency. The downside is that if the local OPA pod is
68+
// unavailable, requests fail instead of falling back to another node.
69+
// TODO: Once our minimum supported Kubernetes version is 1.35, use
70+
// `trafficDistribution: PreferSameNode` instead, which prefers the local node but
71+
// gracefully falls back to other nodes if the local pod is unavailable.
6672
internal_traffic_policy: Some("Local".to_string()),
6773
..ServiceSpec::default()
6874
};

0 commit comments

Comments
 (0)