You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please note that the Consul Template issue tracker is reserved
for bug reports and enhancements. For general usage questions,
please use the Consul mailing list:
upstream exampleservice {
least_conn;
keepalive 16;
#Attempt to fetch the exampleservice servers
{{ifservice"exampleservice"}}
{{rangeservice"exampleservice"}}server {{.Address}}:8443;
{{end}}
{{else}} # upstream stanza must have a server directive
server 127.0.0.1 down;
{{end}}
}
This is a feature request, so what I'd like to be able to do is something like this:
upstream exampleservice {
least_conn;
keepalive 16;
#Attempt to fetch the exampleservice servers
{{ifquery"exampleservice"}}
{{rangequery"exampleservice"}}server {{.Address}}:8443;
{{end}}
{{else}} # upstream stanza must have a server directive
server 127.0.0.1 down;
{{end}}
}
Actual behavior
In the absence of using prepared queries, we are constrained to only having services within a given datacenter with the configuration as it exists. We could define a second section, with a hard coded backup:
upstream exampleservice {
least_conn;
keepalive 16;
#Attempt to fetch the exampleservice servers
{{ifservice"exampleservice"}}
{{rangeservice"exampleservice"}}server {{.Address}}:8443;
{{end}}
{{else}} # upstream stanza must have a server directive
server 127.0.0.1 down;
{{end}}
#Attempt to fetch the backup exampleservice servers
{{ifservice"exampleservice@guse4-poc"}}
{{rangeservice"exampleservice@guse4-poc"}}server {{.Address}}:8443 backup;
{{end}}
{{else}} # upstream stanza must have a server directive
server 127.0.0.1 down;
{{end}}
}
But that gets tricky to maintain, and query seems like the perfect solution for this, if it were an option to iterate over, as service is.
Steps to reproduce
N/A
References
Are there any other GitHub issues (open or closed) that should
be linked here? For example:
N/A
The text was updated successfully, but these errors were encountered:
Please note that the Consul Template issue tracker is reserved
for bug reports and enhancements. For general usage questions,
please use the Consul mailing list:
Consul Template version
Configuration
N/A
Command
Debug output
N/A
Expected behavior
This is a feature request, so what I'd like to be able to do is something like this:
Actual behavior
In the absence of using prepared queries, we are constrained to only having services within a given datacenter with the configuration as it exists. We could define a second section, with a hard coded backup:
But that gets tricky to maintain, and query seems like the perfect solution for this, if it were an option to iterate over, as service is.
Steps to reproduce
N/A
References
Are there any other GitHub issues (open or closed) that should
be linked here? For example:
N/A
The text was updated successfully, but these errors were encountered: