-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Revise router template functions #5068
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
Conversation
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.
Impeccable.
/lgtm
argument if the variable cannot be read or is empty. | ||
|`*processEndpointsForAlias(alias ServiceAliasConfig, svc ServiceUnit, action string) []Endpoint*` | | ||
Returns the list of valid endpoints. When action is "shuffle", the order of endpoints is randomized. | ||
|`*env(variable, default ...string) string*` | Tries to get the named environment variable from the pod. |
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.
Here should be *env(variable string, defaults ...string) 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.
changed
subdomain for hosts (and paths) with a wildcard policy. | ||
|`*generateRouteRegexp(hostname, path string, wildcard bool) string*` | Generates a regular expression matching the route | ||
hosts (and paths). The first argument is the host name, the second is the path, | ||
|`*firstMatch(s string, allowedValues ...string) bool*` | Compares a given string to a list of allowed |
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 first argument of firstMatch
is a regular expression.
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.
changed
23bc318
to
c0fd0bb
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.
LGTM
LGTM |
@@ -115,21 +115,25 @@ The *define* action names the file that will contain the processed template. | |||
[cols="2*", options="header"] | |||
|=== | |||
|Function | Meaning | |||
|`*endpointsForAlias(alias ServiceAliasConfig, svc ServiceUnit) []Endpoint*` | Returns the list of valid endpoints. |
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.
Is endpointsForAlias
considered deprecated now?
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.
I don't know. It is not currently used.
|`*processEndpointsForAlias(alias ServiceAliasConfig, svc ServiceUnit, action string) []Endpoint*` | | ||
Returns the list of valid endpoints. When action is "shuffle", the order of endpoints is randomized. | ||
|`*env(variable string, default ...string) string*` | Tries to get the named environment variable from the pod. | ||
If it is not defined or empty, it returns the optional second argument. |
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.
This doesn't describe the behaviour when no second argument is given, or when more than two arguments are given.
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.
Changed. Otherwise it returns the empty string. Other arguments are ignored.
OCP 3.7 PR 12882 refactored the router template functions. This PR documents the changes.
@Miciah I addressed your questions and updated the PR. endpointsForAlias is in the code and there are no comments about it being deprecated. It is not currently used in the haproxy template. There is no telling if any customers are using it. |
@pecameron, thanks! Did you push the new changes? I don't see them yet. Regarding This is probably not the best place to discuss it though; is the matter being tracked anywhere? |
c0fd0bb
to
c4be282
Compare
@Miciah PTAL |
|`*processEndpointsForAlias(alias ServiceAliasConfig, svc ServiceUnit, action string) []Endpoint*` | | ||
Returns the list of valid endpoints. When action is "shuffle", the order of endpoints is randomized. | ||
|`*env(variable, default ...string) string*` | Tries to get the named environment variable from the pod. | ||
If it is not defined or empty, it returns the optional second argument. Otherwise, it returns an empty 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.
What do you think of this? "If the value is empty or not defined and one or more optional arguments are provided, env
returns the first non-empty argument. Otherwise, it returns an empty 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.
@Miciah In practice there are 0 or 1 optional values. The environment variable either has a default or it doesn't.
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.
@pecameron, ah, if we want to avoid documenting (and committing to) allowing more than 2 parameters, that's fine. Never mind!
@bfallonf - PTAL - this is quite old so review accordingly. |
Sorry @pecameron , looks like this one escaped us. I'll merge this and cherry-pick to the right branches, and make a quick followup PR if I need to. Thanks! |
/cherrypick enterprise-3.11 |
@bfallonf: new pull request created: #11350 In response to this:
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. |
/cherrypick enterprise-3.10 |
@bfallonf: new pull request created: #11351 In response to this:
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. |
/cherrypick enterprise-3.9 |
@bfallonf: new pull request created: #11352 In response to this:
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. |
/cherrypick enterprise-3.7 |
@bfallonf: new pull request created: #11353 In response to this:
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. |
OCP 3.7
PR 12882 refactored the router template functions.
This PR documents the changes.