Skip to content

Commit 933f94e

Browse files
authored
Merge pull request #180 from FyraLabs/feat/proxy-protocol
feat: proxy protocol support
2 parents 8f74b6d + 163a68f commit 933f94e

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/deployment.rs

Lines changed: 10 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,12 @@ 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.metadata.annotations.as_ref().and_then(|annotations| {
117+
annotations
118+
.get(EXIT_NODE_PROXY_PROTOCOL_LABEL)
119+
.map(String::as_ref)
120+
}) == Some("true");
121+
let target_ip = if proxy_protocol { "RP" } else { "R" };
114122

115123
// We can unwrap safely since Service is guaranteed to have a spec
116124
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)