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 8750d74a51
commit 6fa1a058a6
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

@ -231,7 +231,7 @@ The options below are all specified on the command-line.
Like [`enable_script_checks`](#_enable_script_checks), but only enable them when Like [`enable_script_checks`](#_enable_script_checks), but only enable them when
they are defined in the local configuration files. Script checks defined in HTTP they are defined in the local configuration files. Script checks defined in HTTP
API registrations will still not be allowed. API registrations will still not be allowed.
- `-encrypt` ((#\_encrypt)) - Specifies the secret key to use for encryption - `-encrypt` ((#\_encrypt)) - Specifies the secret key to use for encryption
of Consul network traffic. This key must be 32-bytes that are Base64-encoded. The of Consul network traffic. This key must be 32-bytes that are Base64-encoded. The
@ -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}}"
} }
} }
``` ```