-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Prepend Envoy resources with CEC namespace and name #21500
Prepend Envoy resources with CEC namespace and name #21500
Conversation
Commit be4fb78fa82352bc3697521887df29ff45e2af43 does not contain "Signed-off-by". Please follow instructions provided in https://docs.cilium.io/en/stable/contributing/development/contributing_guide/#developer-s-certificate-of-origin |
f458fdc
to
eb2b98d
Compare
Commit 826d2f53ebdffe009d2ea8e8ccd167ca9cd94fe2 does not contain "Signed-off-by". Please follow instructions provided in https://docs.cilium.io/en/stable/contributing/development/contributing_guide/#developer-s-certificate-of-origin |
eb2b98d
to
6c475f1
Compare
ad74ecb
to
b24235b
Compare
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.
one minor comment/suggestion on calling GetName() and GetNamespace() directly, the rest looks good to me.
Also, I just want to highlight one thing. While the diff in this PR looks simple, there are a lot of efforts from Fabio on this work 🥇
One more comment I have is to just take a quick on existing docs, and make any update to shorten the names if there is any place we create CiliumEnvoyConfig manually. This could be done in subsequent PR. |
I'm gonna fix the nits. Thank you for the kind words and all the support! |
b24235b
to
a98bdd5
Compare
/test |
/test-1.25-net-next |
FYI, resolving the failures in |
Oh, nice, thank you. |
Avoid specifying the listener name in the ServiceListener. Leaving it empty, Envoy will automatically pick the first one available. Signed-off-by: Fabio Falzoi <fabio.falzoi@isovalent.com>
Simplify the naming of listeners in CEC, removing both CEC namespace and name. This is done to avoid differences between CECs generated by the operator and handcrafted CECs. Signed-off-by: Fabio Falzoi <fabio.falzoi@isovalent.com>
a98bdd5
to
d9abdf3
Compare
/test |
/test-1.16-4.9 |
/test-1.23-5.4 |
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.
@sayboras will this change the CECs names? If yes do we need to worry about upgrades?
pkg/envoy/ciliumenvoyconfig.go
Outdated
// resourceQualifiedName returns the qualified name of an Envoy resource, | ||
// prepending CEC namespace and CEC name to the resource name and using | ||
// "-" as a separator. | ||
// In case of an empty CEC namespace or an empty CEC name, leading separators | ||
// are stripped away. | ||
func resourceQualifiedName(namespace, name, resource string) string { | ||
var sb strings.Builder | ||
|
||
if namespace != "" { | ||
sb.WriteString(namespace) | ||
sb.WriteRune('-') | ||
} | ||
if name != "" { | ||
sb.WriteString(name) | ||
sb.WriteRune('-') | ||
} | ||
sb.WriteString(resource) | ||
|
||
return sb.String() | ||
} |
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.
The resourceQualifiedName
will not work in the case that one resource has the same namespace name as the other resource:
resource-1 namespace: foo
resource-1 name: bar
resource-1 resource: hello
resource-2 namespace:
resource-2 name: foo-bar
resource-2 resource: hello
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.
Ouch. What about using two different separators, like namespace/name-resource
? That should do the trick.
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.
the above example is kind of escaped bug we have before (e.g. in 1.12), I noticed about it a little bit later 1.12 release.
Due to the below comment, changing listener name will cause some packet drop, so we can either:
- keep the same name as 1.12 so that upgrade will work, or
- change separator convention to fix the potential name overlapping bug
d9abdf3
to
59988a7
Compare
Prepend CEC namespace and name to Envoy Listeners and Routes resources. This will avoid name clashing between resources that belong to different namespaces. Signed-off-by: Fabio Falzoi <fabio.falzoi@isovalent.com>
59988a7
to
eaea7f4
Compare
/test |
This PR changes the naming of Envoy Listeners and Routes resources.
To avoid possible name clashing between resources in different namespaces, each Envoy Listener and Route name is prepended with its CEC namespace and name.
This is done while translating the CEC specifications to generate the Envoy config, and not during CEC creation. Thanks to this, a user generated CEC does not need to use the format to be similar to an operator-generated CEC.
Relates #19698 #20655