-
Notifications
You must be signed in to change notification settings - Fork 303
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
Long namespace/ingress names cause collisions with auto-created resources on GKE #537
Comments
Thanks for the bug report. Will try to fix this problem. The key is to maintain backward compatibility. |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
/lifecycle frozen |
Add toleration of long name to certain degree: #650 |
Closing the issue since it was addressed in the PR above! |
Changes in #650 do not actually solve this issue completely. It is still possible for GCLB name and backend name (Network Endpoint Group) to collide if the namespace name + ingress name are too long, especially between two clusters with similar names, because the cluster name is at the end and gets truncated first. LB: https://github.com/kubernetes/ingress-gce/blob/master/pkg/utils/namer.go#L340 The UID also commonly gets truncated, which increases the chance of UID collisions. I like that the cluster/namespace/ingress names are in these GCLB names, because it makes them easier to identify when debugging, but the whole name-generation scheme needs to be redesigned to better guarantee uniqueness. |
Let me summarize the current naming problem per GCE Loadbalancer resource:
The name will be truncated to 63 characters (max length of GCE resource name). When the namespace and name long (55 chars). The GCE resource name will lose uniqueness across multiple ingresses within the same cluster or across multiple clusters. (e.g. if the namespace length is 63 characters, then everything after 63 characters will be truncated. If there is another ingress with the same namespace prefix in the same cluster or another cluster. There will be GCE resource naming collision) In addition, the current GC logic will leak resources with long name (because cluster uid is truncated, hence GC does not recognize the resource as managed by itself)
Naming collision may happen if short cluster uid, namespace, name and port are all the same across clusters. This is mostly due to the problem #2 when user modified the cluster uid and make the short cluster uid (8 character prefix of the cluster uid) the same.
Firewall
Instance Group
Backend Service:
Requirements for fixes
Standing planFixing problem #1: Fixing problem #2 & #3 : |
So @skmatti,
|
There is no restriction on lengths of namespace and name. Namespace and Name are trimmed evenly until their combined length is 36 in case of overflows. |
The 8-char-hash is a hash of the full un-trimmed name, right? |
Yes, that's right. |
The trimmed parts of the name are for human consumption only. The hash should be always unique (modulo actual hash collisions, which should be a low probability event). |
Perfect. That’s what we needed. |
I noticed this after creating one ingress that worked fine, then creating another ingress which caused the first ingress to behave incorrectly (default backend 404, etc).
As far as I can tell, at least these resources and annotations are added to the ingress by GKE:
If my namespace was called
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
(32 chars) and my ingress was namedxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
, I'd see resources with names like:k8s-um-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-xxxxxxxxxxxxx0
This is fine if there's only one ingress, but since my other ingress also started with the same set of characters, there would be a collision. I've looked at the resources/annotations it creates when using shorter names, and I notice that it means to append some random characters at the end. Here, it looks like I'm hitting the 64 character limit before it gets to that random string.
Maybe removing the 64 character limit or adding documentation about how these names are generated would help with this. It took me a while to look into this annotation as the root of my issues.
NOTE: This is the file that contains the naming logic https://github.com/kubernetes/ingress-gce/blob/master/pkg/utils/namer.go
The text was updated successfully, but these errors were encountered: