Skip to content

Commit c4be282

Browse files
committed
Revise router template functions
OCP 3.7 PR 12882 refactored the router template functions. This PR documents the changes.
1 parent 3c47ee4 commit c4be282

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

install_config/router/customized_haproxy_router.adoc

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -115,21 +115,24 @@ The *define* action names the file that will contain the processed template.
115115
[cols="2*", options="header"]
116116
|===
117117
|Function | Meaning
118-
|`*endpointsForAlias(alias ServiceAliasConfig, svc ServiceUnit) []Endpoint*` | Returns the list of valid endpoints.
119-
|`*env(variable, default string) string*` | Tries to get the named environment variable from the pod. Returns the second
120-
argument if the variable cannot be read or is empty.
118+
|`*processEndpointsForAlias(alias ServiceAliasConfig, svc ServiceUnit, action string) []Endpoint*` |
119+
Returns the list of valid endpoints. When action is "shuffle", the order of endpoints is randomized.
120+
|`*env(variable, default ...string) string*` | Tries to get the named environment variable from the pod.
121+
If it is not defined or empty, it returns the optional second argument. Otherwise, it returns an empty string.
121122
|`*matchPattern(pattern, s string) bool*` | The first argument is a string that contains the regular
122-
expression, the second argument is the variable to test. Returns a Boolean value indicating whether the regular
123-
expression provided as the first argument matches the string provided as the second argument.
123+
expression, the second argument is the variable to test. Returns a Boolean value indicating whether
124+
the regular expression provided as the first argument matches the string provided as the second argument.
124125
|`*isInteger(s string) bool*` | Determines if a given variable is an integer.
125-
|`*matchValues(s string, allowedValues ...string) bool*` | Compares a given string to a list of allowed strings.
126-
|`*genSubdomainWildcardRegexp(hostname, path string, exactPath bool) string*` | Generates a regular expression matching the
127-
subdomain for hosts (and paths) with a wildcard policy.
128-
|`*generateRouteRegexp(hostname, path string, wildcard bool) string*` | Generates a regular expression matching the route
129-
hosts (and paths). The first argument is the host name, the second is the path,
126+
|`*firstMatch(s string, allowedValues ...string) bool*` | Compares a given string to a list of allowed
127+
strings. Returns first match scanning left to right through the list.
128+
|`*matchValues(s string, allowedValues ...string) bool*` | Compares a given string to a list of allowed
129+
strings. Returns "true" if the string is an allowed value, otherwise returns false.
130+
|`*generateRouteRegexp(hostname, path string, wildcard bool) string*` | Generates a regular expression
131+
matching the route hosts (and paths). The first argument is the host name, the second is the path,
130132
and the third is a wildcard Boolean.
131-
|`*genCertificateHostName(hostname string, wildcard bool) string*` | Generates host name to use for serving/matching
132-
certificates. First argument is the host name and the second is the wildcard Boolean.
133+
|`*genCertificateHostName(hostname string, wildcard bool) string*` | Generates host name to use for
134+
serving/matching certificates. First argument is the host name and the second is the wildcard Boolean.
135+
|`*isTrue(s string) bool*` | Determines if a given variable contains "true".
133136
|===
134137

135138
These functions are provided by the HAProxy template router plug-in.

0 commit comments

Comments
 (0)