Skip to content

Commit

Permalink
add exception to egress policy for port 8080 (#924)
Browse files Browse the repository at this point in the history
  • Loading branch information
nhudson authored Aug 20, 2024
1 parent 8d1513d commit ec42853
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tembo-operator/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tembo-operator/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "controller"
description = "Tembo Operator for Postgres"
version = "0.49.6"
version = "0.49.7"
edition = "2021"
default-run = "controller"
license = "Apache-2.0"
Expand Down
40 changes: 40 additions & 0 deletions tembo-operator/src/network_policies.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,46 @@ pub async fn reconcile_network_policies(client: Client, namespace: &str) -> Resu

apply_network_policy(namespace, &np_api, allow_proxy_to_access_tembo_ai_gateway).await?;

let allow_proxy_to_access_tembo_ai_gateway_internal_lb = serde_json::json!({
"apiVersion": "networking.k8s.io/v1",
"kind": "NetworkPolicy",
"metadata": {
"name": "allow-proxy-to-access-tembo-ai-gateway-internal-lb",
"namespace": format!("{namespace}"),
},
"spec": {
"podSelector": {
"matchLabels": {
"app": format!("{}-ai-proxy", namespace)
}
},
"policyTypes": ["Egress"],
"egress": [
{
"ports": [
{
"port": 8080,
"protocol": "TCP"
}
],
"to": [
{
"ipBlock": {
"cidr": "10.0.0.0/8"
}
}
]
}
]
}
});

apply_network_policy(
namespace,
&np_api,
allow_proxy_to_access_tembo_ai_gateway_internal_lb,
)
.await?;
Ok(())
}

Expand Down

0 comments on commit ec42853

Please sign in to comment.