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 equals comparsion returing False if both objects have nil Targets or Services. #1365

Merged
merged 1 commit into from
Sep 14, 2017

Conversation

Dirbaio
Copy link
Contributor

@Dirbaio Dirbaio commented Sep 14, 2017

How to reproduce

  • Deploy an nginx ingress controller
  • Create an ingress with the Kubernetes service:
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  annotations:
    ingress.kubernetes.io/secure-backends: "true"
    kubernetes.io/ingress.allow-http: "false"
    kubernetes.io/ingress.class: nginx
  name: kubernetes
  namespace: default
spec:
  rules:
  - host: example.com
    http:
      paths:
      - backend:
          serviceName: kubernetes
          servicePort: 443
        path: /
  tls:
  - hosts:
    - example.com
    secretName: tls-example-com
  • Watch the ingress controller reload nginx over and over again, even if nothing changes

Why this happens

The Kubernetes service has nil in the address Target, unlike regular services. There's a bug in Endpoint.Equals() that returns false incorrectly if both endpoints have nil. This PR fixes it.

While looking at the other Equals functions, I noticed the same bug with Services in two places. I fixed them too, but I haven't checked if there is also a situation that can also cause endless reloads..

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Sep 14, 2017
@k8s-reviewable
Copy link

This change is Reviewable

@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Sep 14, 2017
@coveralls
Copy link

Coverage Status

Coverage increased (+0.02%) to 44.216% when pulling 94b28a9 on Dirbaio:master into 62aa9a4 on kubernetes:master.

@aledbf
Copy link
Member

aledbf commented Sep 14, 2017

/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 14, 2017
@aledbf
Copy link
Member

aledbf commented Sep 14, 2017

@Dirbaio thanks!

@aledbf aledbf merged commit 9126ec4 into kubernetes:master Sep 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants