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

assigning svc CLuster IP when svc is a NodePort #1099

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

hamzabouissi
Copy link

@hamzabouissi hamzabouissi commented Feb 4, 2025

Summary

Related issues

Checklist

  • reference any related issues
  • updated docs
  • updated unit tests
  • updated UPGRADING.md
  • add appropriate tag (improvement / bug / etc)
  • ready for review

@hamzabouissi hamzabouissi requested a review from a team as a code owner February 4, 2025 17:38
@hamzabouissi hamzabouissi requested review from kralicky and removed request for a team February 4, 2025 17:38
@CLAassistant
Copy link

CLAassistant commented Feb 4, 2025

CLA assistant check
All committers have signed the CLA.

@wasaga
Copy link
Collaborator

wasaga commented Feb 6, 2025

I'm not sure this is an allowed behaviour, please see kubernetes/kubernetes#119700

@hamzabouissi
Copy link
Author

hey @wasaga, thanks for your time, so I inspired the implementation from nginx-ingress code
you can see it here: https://github.com/kubernetes/ingress-nginx/blob/23bd743cedfbc0b2da0365af87cbe0a378df4fcd/internal/ingress/status/status.go#L363

because we were wondering why it was working for inrgess-nginx and not for pomerium

Comment on lines +146 to +154
if len(svc.Status.LoadBalancer.Ingress) > 0 {
ingress.Status.LoadBalancer.Ingress = svcLoadBalancerStatusToIngress(svc.Status.LoadBalancer.Ingress)
} else if svc.Spec.Type == corev1.ServiceTypeNodePort {
// Assign ClusterIP for NodePort service
if svc.Spec.ClusterIP != "" {
ingress.Status.LoadBalancer.Ingress = append(ingress.Status.LoadBalancer.Ingress, networkingv1.IngressLoadBalancerIngress{
IP: svc.Spec.ClusterIP,
})
}
Copy link
Collaborator

@wasaga wasaga Feb 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. probably this logic should live in svcLoadBalancerStatusToIngress
  2. the if condition as written would not update the status if we transition from > 0 to 0
  3. please consider adding a unit test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants