ui: Add `Service.Partition` as available variable for dashboard urls (#11654)

This commit is contained in:
John Cowen 2021-12-01 11:05:57 +00:00 committed by GitHub
parent bda64f98b3
commit b5c8af4580
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 10 additions and 2 deletions

3
.changelog/11654.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note:feature
ui: Include `Service.Partition` into available variables for `dashboard_url_templates`
```

View File

@ -193,6 +193,7 @@ as |items item dc|}}
Service=(hash Service=(hash
Name=item.Service.Service Name=item.Service.Service
Namespace=(or item.Service.Namespace '') Namespace=(or item.Service.Namespace '')
Partition=(or item.Service.Partition '')
) )
) )
}} }}

View File

@ -109,6 +109,7 @@ as |nspace dc items topology|}}
Service=(hash Service=(hash
Name=items.firstObject.Name Name=items.firstObject.Name
Namespace=(or items.firstObject.Namespace '') Namespace=(or items.firstObject.Namespace '')
Partition=(or items.firstObject.Partition '')
) )
) )
}} }}

View File

@ -2191,6 +2191,8 @@ bind_addr = "{{ GetPrivateInterfaces | include \"network\" \"10.0.0.0/8\" | attr
- `{{Service.Name}}` - Replaced with the current service's name. - `{{Service.Name}}` - Replaced with the current service's name.
- `{{Service.Namespace}}` - Replaced with the current service's namespace or empty if namespaces are not enabled. - `{{Service.Namespace}}` - Replaced with the current service's namespace or empty if namespaces are not enabled.
- `{{Service.Partition}}` - Replaced with the current service's admin
partition or empty if admin partitions are not enabled.
- `{{Datacenter}}` - Replaced with the current service's datacenter. - `{{Datacenter}}` - Replaced with the current service's datacenter.
- `ui_dir` - **This field is deprecated in Consul 1.9.0. See the [`ui_config.dir`](#ui_config_dir) field instead.** - `ui_dir` - **This field is deprecated in Consul 1.9.0. See the [`ui_config.dir`](#ui_config_dir) field instead.**

View File

@ -104,7 +104,8 @@ ui_config {
dashboard_url_templates { dashboard_url_templates {
service = "https://grafana.example.com/d/lDlaj-NGz/ service = "https://grafana.example.com/d/lDlaj-NGz/
service-overview?orgId=1&var-service={{Service.Name}}& service-overview?orgId=1&var-service={{Service.Name}}&
var-namespace={{Service.Namespace}}&var-dc={{Datacenter}}" var-namespace={{Service.Namespace}}&
var-partition={{Service.Partition}}&var-dc={{Datacenter}}"
} }
} }
``` ```