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

Changing a Service from type: LoadBalancer to type: ClusterIP doesn't remove status.loadBalancer.ingress[] #9972

Open
dsharp-pivotal opened this issue Dec 15, 2020 · 7 comments
Assignees
Labels
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/bug Categorizes issue or PR as related to a bug. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. long-term-support Long-term support issues that can't be fixed in code priority/backlog Higher priority than priority/awaiting-more-evidence.

Comments

@dsharp-pivotal
Copy link

Steps to reproduce the issue:

  1. minikube start --memory 8192 --cpus 8 --disk-size 80g
  2. minikube tunnel
  3. Create a Service my-svc with type: LoadBalancer
  4. Observe kubectl get service my-svc -o yaml shows status.loadBalancer.ingress[0].ip with the service's clusterIP
  5. kubectl patch service my-svc --type=merge -p "spec: {type: ClusterIP}"

Actual:

status.loadBalancer.ingress[0].ip remains.

Expected:

status.loadBalancer.ingress should be removed.

This would help automated tests that need to work with both minikube and cloud k8s clusters like GKE, that test adding and removing external access on Service.

We took a look at LoadBalancerEmulator, and saw that it has a method cleanupService(). However, it is only called on Services with type: LoadBalancer, and the cleanup methods are only called during shutdown.

Ideally, it seems like PatchServices should reconcile all Services to add or remove status.loadBalancer.ingress as appropriate.

@priyawadhwa priyawadhwa added the kind/support Categorizes issue or PR as a support question. label Dec 23, 2020
@priyawadhwa
Copy link

Hey @dsharp-pivotal thanks for opening this issue. Just to clarify, it seems like your expected outcome depends on changing the functionality of kubectl patch service, is that what you intended?

I'm not very familiar with minikube tunnel but I wonder if there's something we could do there to stop tunneling if a service type is changed from LoadBalancer to something else. That could be enough to test adding/removing external access to a Service.

@dsharp-pivotal
Copy link
Author

Hey @dsharp-pivotal thanks for opening this issue. Just to clarify, it seems like your expected outcome depends on changing the functionality of kubectl patch service, is that what you intended?

kubectl patch is just one way to change the contents of the Service.spec. You could achieve the same results with kubectl edit or kubectl apply. The important bit is changing spec.type from LoadBalancer to ClusterIP. That should result in an observable change in the Service.status.loadBalancer.ingress[].

I'm not very familiar with minikube tunnel but I wonder if there's something we could do there to stop tunneling if a service type is changed from LoadBalancer to something else. That could be enough to test adding/removing external access to a Service.

I don't care terribly much about whether or not the tunnel still works (although indeed ideally the tunnel would stop working). I want to be able to observe, via Service.status, that the Service no longer has an ingress IP.

Please take a look at LoadBalancerEmulator: https://github.com/kubernetes/minikube/blob/master/pkg/minikube/tunnel/loadbalancer_patcher.go

Due to how it's implemented, it will add Service.status.loadBalancer.ingress[].IP to Services with spec.type == LoadBalancer, but it will never remove it if the type is changed away from LoadBalancer.

@ilya-zuyev ilya-zuyev added the help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. label Mar 24, 2021
@ilya-zuyev ilya-zuyev removed the kind/support Categorizes issue or PR as a support question. label May 12, 2021
@spowelljr spowelljr added priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. kind/bug Categorizes issue or PR as related to a bug. long-term-support Long-term support issues that can't be fixed in code and removed triage/long-term-support labels May 17, 2021
@vishjain
Copy link
Contributor

/assign

@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Sep 17, 2021
@dsharp-pivotal
Copy link
Author

/remove-lifecycle stale

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Sep 17, 2021
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Dec 16, 2021
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Jan 15, 2022
@sharifelgamal sharifelgamal added lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. and removed lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. labels Jan 26, 2022
@spowelljr spowelljr added priority/backlog Higher priority than priority/awaiting-more-evidence. and removed priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. labels May 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/bug Categorizes issue or PR as related to a bug. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. long-term-support Long-term support issues that can't be fixed in code priority/backlog Higher priority than priority/awaiting-more-evidence.
Projects
None yet
Development

No branches or pull requests

8 participants