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

Fix selector for shutting down Pods #7727

Merged
merged 2 commits into from
Sep 30, 2021
Merged

Conversation

rikatz
Copy link
Contributor

@rikatz rikatz commented Sep 30, 2021

What this PR does / why we need it:

Fixes the selector when checking if there are multiple Pods running Ingress.

Per previous code, it used the Pods labels to check if other Pods from the same application were running. This was necessary to not remove the IP from .status field before being sure no other Pod was running and serving.

The labels contained the pod-hash generated by ReplicaSet, but everytime someone does a rollout deployment a new hash was created, turning that selector always false and always removing the IP address from the .status.

This field is used by AWS and other cloud providers as the de-facto IP address/name to be used when publishing a new service on DNS.

We don't still verify yet if the list of Pods is properly running or not. While doing the implementation, it seems that selecting the phase of the Pod can lead into some wrong status reporting, so I decided to leave this field selector out of this PR so far.

EDIT: I have added some fallback, as not everybody is using the recommended labels app.kubernetes.io. The idea is just to drop the auto generated label "pod-template-hash" added by the replicaset or the statefulset

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation only

Which issue/s this PR fixes

fixes #7047

How Has This Been Tested?

Folliwing the script provided in #7047 I could verify that when rolling out deployments, there wasn't a situation anymore when the IP address was removed and re-added. Now there is always an IP address there, unless there are set --replicas=0

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Sep 30, 2021
@k8s-ci-robot
Copy link
Contributor

@rikatz: This issue is currently awaiting triage.

If Ingress contributors determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added needs-kind Indicates a PR lacks a `kind/foo` label and requires one. needs-priority size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Sep 30, 2021
@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 30, 2021
@rikatz rikatz added this to the v1.0.3 milestone Sep 30, 2021
@longwuyuan
Copy link
Contributor

/retest

@rikatz
Copy link
Contributor Author

rikatz commented Sep 30, 2021

@longwuyuan the failure is real, I'm fixing here

Co-authored-by: Jintao Zhang <tao12345666333@163.com>
Copy link
Member

@tao12345666333 tao12345666333 left a comment

Choose a reason for hiding this comment

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

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 30, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: rikatz, tao12345666333

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot merged commit 37ab999 into kubernetes:main Sep 30, 2021
rikatz added a commit to rikatz/ingress-nginx that referenced this pull request Sep 30, 2021
* Fix selector for shutting down Pods

* Add autogenerated labels for daemonset in exception

Co-authored-by: Jintao Zhang <tao12345666333@163.com>

Co-authored-by: Jintao Zhang <tao12345666333@163.com>
k8s-ci-robot pushed a commit that referenced this pull request Sep 30, 2021
* Fix selector for shutting down Pods

* Add autogenerated labels for daemonset in exception

Co-authored-by: Jintao Zhang <tao12345666333@163.com>

Co-authored-by: Jintao Zhang <tao12345666333@163.com>

Co-authored-by: Jintao Zhang <tao12345666333@163.com>
rchshld pushed a commit to joomcode/ingress-nginx that referenced this pull request May 19, 2023
* Fix selector for shutting down Pods

* Add autogenerated labels for daemonset in exception

Co-authored-by: Jintao Zhang <tao12345666333@163.com>

Co-authored-by: Jintao Zhang <tao12345666333@163.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-kind Indicates a PR lacks a `kind/foo` label and requires one. needs-priority needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Flawed logic in ingress controller pod discovery
4 participants