Skip to content

Commit 71be81a

Browse files
committed
feat: proxy protocol support
1 parent 8f74b6d commit 71be81a

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

src/deployment.rs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
//! Chisel pod deployment
22
3-
use crate::{error::ReconcileError, ops::ExitNode};
3+
use crate::{
4+
error::ReconcileError,
5+
ops::{ExitNode, EXIT_NODE_PROXY_PROTOCOL_LABEL},
6+
};
47
use color_eyre::Result;
58
use k8s_openapi::{
69
api::{
@@ -110,7 +113,15 @@ pub fn generate_tunnel_args(svc: &Service) -> Result<Vec<String>, ReconcileError
110113
// .flatten()
111114
// .unwrap_or_else(|| "R".to_string());
112115

113-
let target_ip = "R";
116+
let proxy_protocol = svc
117+
.metadata
118+
.annotations
119+
.as_ref()
120+
.map_or(false, |annotations| {
121+
annotations.get(EXIT_NODE_PROXY_PROTOCOL_LABEL) == Some(&"true".to_string())
122+
});
123+
124+
let target_ip = if proxy_protocol { "RP" } else { "R" };
114125

115126
// We can unwrap safely since Service is guaranteed to have a spec
116127
let ports = svc

src/ops.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ use tracing::debug;
1414

1515
pub const EXIT_NODE_NAME_LABEL: &str = "chisel-operator.io/exit-node-name";
1616
pub const EXIT_NODE_PROVISIONER_LABEL: &str = "chisel-operator.io/exit-node-provisioner";
17+
pub const EXIT_NODE_PROXY_PROTOCOL_LABEL: &str = "chisel-operator.io/proxy-protocol";
1718

1819
pub fn parse_provisioner_label_value<'a>(
1920
default_namespace: &'a str,

0 commit comments

Comments
 (0)