Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated ingress update condition. #1

Merged
merged 2 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion helm/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0
version: 0.1.1

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
5 changes: 4 additions & 1 deletion helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,11 @@ serviceAccount:
# By default it grants all permissions.
permissions:
- apiGroups: [""]
resources: ["services"]
resources: [services]
verbs: [get, list, patch, update, watch]
- apiGroups: [""]
resources: [nodes]
verbs: [get, list, watch]
# - apiGroups: ["apps/v1"]
# resources: ["deployments"]
# verbs: ["get", "list"]
Expand Down
27 changes: 14 additions & 13 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,10 @@ pub async fn reconcile_load_balancer(
.filter(|node| label_filter.check(node.labels()))
.collect::<Vec<_>>();

let node_ip_type = svc
.annotations()
.get(consts::LB_NODE_IP_LABEL_NAME)
.map(String::as_str)
.unwrap_or(consts::DEFAULT_NODE_IP);
let mut node_ip_type = "InternalIP";
if lb.network_name.is_none() {
node_ip_type = "ExternalIP";
}

for node in nodes {
let Some(status) = node.status else {
Expand Down Expand Up @@ -235,22 +234,24 @@ pub async fn reconcile_load_balancer(
let ipv4 = hcloud_lb.public_net.ipv4.ip.flatten();
let dns_ipv6 = hcloud_lb.public_net.ipv6.dns_ptr.flatten();
let ipv6 = hcloud_lb.public_net.ipv6.ip.flatten();
if ipv4.is_some() {
if let Some(ipv4) = &ipv4 {
ingress.push(json!({
"ip": ipv4,
"dns": dns_ipv4,
"ip_mode": "VIP"
}))
}
if ipv6.is_some() && context.config.ipv6_ingress {
ingress.push(json!({
"ip": ipv6,
"dns": dns_ipv6,
"ip_mode": "VIP"
}))
if context.config.ipv6_ingress {
if let Some(ipv6) = &ipv6 {
ingress.push(json!({
"ip": ipv6,
"dns": dns_ipv6,
"ip_mode": "VIP"
}))
}
}

if ipv4.is_some() {
if !ingress.is_empty() {
svc_api
.patch_status(
svc.name_any().as_str(),
Expand Down
Loading