-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
kubernetes: sort and uniq TLS secrets #4307
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This was referenced Dec 17, 2018
coufalja
reviewed
Dec 18, 2018
coufalja
reviewed
Dec 18, 2018
ldez
approved these changes
Dec 18, 2018
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
juliens
approved these changes
Dec 20, 2018
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
dtomcej
reviewed
Dec 20, 2018
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
dtomcej
approved these changes
Dec 20, 2018
traefiker
force-pushed
the
fix-k8s-tls
branch
from
December 20, 2018 15:24
9908f73
to
070339d
Compare
traefiker
force-pushed
the
fix-k8s-tls
branch
from
December 20, 2018 18:50
070339d
to
025c354
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
This PR sorts and de-dups the set of TLS certs that come from Kubernetes Ingress objects. When not sorted consistently, Traefik believes the config has changed and unnecessarily reloads the server configuration.
Fixes #4187. Note that the issue is simply 2+ Ingress-referenced TLS certs which just happens to be common when using wildcards. Wildcards are not the actual issue.
Fixes #4245.
Motivation
Fixing a bug. 😄
More
Additional Notes
Background: Kubernetes returns the list of Ingress objects in varied order. Traefik processes the frontends and backends according to named keys (a standard dict/hash), which avoids any ordering issue.
In contrast, Traefik looks up the TLS secrets and simply appends them to an array. Because the Ingresses vary in order, so does the array of TLS secrets. This only applies to TLS certs referenced as part of an Ingress, since it's all local to the Kubernetes provider.
Further, if a given secret is referenced by more than one Ingress (typical when using wildcard or SAN certs), the cert is appended to the TLS array multiple times. This results in unnecessary warnings "Into EntryPoint https, try to add certificate for domains which already have this certificate ...".
This PR sorts and de-dups the TLS certs by the Secret name. To accommodate configurations where Ingresses have different entrypoint lists, it also merges (and sorts) those.
It has been tested on our staging server which has a rather complex set of Ingresses. So far, all unnecessary reloads are gone.