updated version checker widget to use glance-helper
This commit is contained in:
@@ -929,73 +929,7 @@ data:
|
|||||||
- type: custom-api
|
- type: custom-api
|
||||||
title: Container Versions
|
title: Container Versions
|
||||||
cache: 5m
|
cache: 5m
|
||||||
url: ${PROMETHEUS_URL}/api/v1/query
|
url: http://glance-helper.glance-system.svc.cluster.local:8000/versions
|
||||||
parameters:
|
|
||||||
query: >
|
|
||||||
max by (image, current_version, latest_version) (
|
|
||||||
version_checker_is_latest_version{
|
|
||||||
container_type="container",
|
|
||||||
image!~"(^|.*/)(busybox|redis|alpine|nginx|mariadb|mysql|valkey)$",
|
|
||||||
image!~"^longhornio.*$",
|
|
||||||
image!~"(^|.*/)postgres.*$",
|
|
||||||
image!~"^registry\\.k8s\\.io/ingress-nginx/.*$",
|
|
||||||
current_version!~".*sha256:.*",
|
|
||||||
latest_version!~".*sha256:.*"
|
|
||||||
} == 0
|
|
||||||
)
|
|
||||||
subrequests:
|
|
||||||
up_to_date:
|
|
||||||
url: ${PROMETHEUS_URL}/api/v1/query
|
|
||||||
parameters:
|
|
||||||
query: >
|
|
||||||
count(
|
|
||||||
max by (image) (
|
|
||||||
version_checker_is_latest_version{
|
|
||||||
container_type="container",
|
|
||||||
image!~"(^|.*/)(busybox|redis|alpine|nginx|mariadb|mysql|valkey)$",
|
|
||||||
image!~"^longhornio.*$",
|
|
||||||
image!~"(^|.*/)postgres.*$",
|
|
||||||
image!~"^registry\\.k8s\\.io/ingress-nginx/.*$",
|
|
||||||
current_version!~".*sha256:.*",
|
|
||||||
latest_version!~".*sha256:.*"
|
|
||||||
} == 1
|
|
||||||
)
|
|
||||||
) or vector(0)
|
|
||||||
outdated:
|
|
||||||
url: ${PROMETHEUS_URL}/api/v1/query
|
|
||||||
parameters:
|
|
||||||
query: >
|
|
||||||
count(
|
|
||||||
max by (image) (
|
|
||||||
version_checker_is_latest_version{
|
|
||||||
container_type="container",
|
|
||||||
image!~"(^|.*/)(busybox|redis|alpine|nginx|mariadb|mysql|valkey)$",
|
|
||||||
image!~"^longhornio.*$",
|
|
||||||
image!~"(^|.*/)postgres.*$",
|
|
||||||
image!~"^registry\\.k8s\\.io/ingress-nginx/.*$",
|
|
||||||
current_version!~".*sha256:.*",
|
|
||||||
latest_version!~".*sha256:.*"
|
|
||||||
} == 0
|
|
||||||
)
|
|
||||||
) or vector(0)
|
|
||||||
total:
|
|
||||||
url: ${PROMETHEUS_URL}/api/v1/query
|
|
||||||
parameters:
|
|
||||||
query: >
|
|
||||||
count(
|
|
||||||
max by (image) (
|
|
||||||
version_checker_is_latest_version{
|
|
||||||
container_type="container",
|
|
||||||
image!~"(^|.*/)(busybox|redis|alpine|nginx|mariadb|mysql|valkey)$",
|
|
||||||
image!~"^longhornio.*$",
|
|
||||||
image!~"(^|.*/)postgres.*$",
|
|
||||||
image!~"^registry\\.k8s\\.io/ingress-nginx/.*$",
|
|
||||||
current_version!~".*sha256:.*",
|
|
||||||
latest_version!~".*sha256:.*"
|
|
||||||
}
|
|
||||||
)
|
|
||||||
) or vector(0)
|
|
||||||
|
|
||||||
template: |
|
template: |
|
||||||
<style>
|
<style>
|
||||||
.ver-widget { font-size: 0.9em; }
|
.ver-widget { font-size: 0.9em; }
|
||||||
@@ -1074,10 +1008,10 @@ data:
|
|||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
{{ $upToDate := (.Subrequest "up_to_date").JSON.Float "data.result.0.value.1" }}
|
{{ $upToDate := .JSON.Float "summary.up_to_date" }}
|
||||||
{{ $outdated := (.Subrequest "outdated").JSON.Float "data.result.0.value.1" }}
|
{{ $outdated := .JSON.Float "summary.outdated" }}
|
||||||
{{ $total := (.Subrequest "total").JSON.Float "data.result.0.value.1" }}
|
{{ $total := .JSON.Float "summary.total" }}
|
||||||
{{ $updates := .JSON.Array "data.result" }}
|
{{ $updates := .JSON.Array "outdated" }}
|
||||||
|
|
||||||
<div class="ver-widget">
|
<div class="ver-widget">
|
||||||
{{ if gt $total 0.0 }}
|
{{ if gt $total 0.0 }}
|
||||||
@@ -1099,11 +1033,11 @@ data:
|
|||||||
{{ if gt $outdated 0.0 }}
|
{{ if gt $outdated 0.0 }}
|
||||||
<div class="ver-list">
|
<div class="ver-list">
|
||||||
{{ range $updates }}
|
{{ range $updates }}
|
||||||
<div class="ver-row" title="{{ .String "metric.image" }}">
|
<div class="ver-row" title="{{ .String "image" }}">
|
||||||
<span class="ver-img">{{ trimPrefix "ghcr.io/" (trimPrefix "docker.io/" (trimPrefix "lscr.io/" (trimPrefix "quay.io/" (.String "metric.image")))) }}</span>
|
<span class="ver-img">{{ trimPrefix "ghcr.io/" (trimPrefix "docker.io/" (trimPrefix "lscr.io/" (trimPrefix "quay.io/" (.String "image")))) }}</span>
|
||||||
<span class="ver-cur">{{ .String "metric.current_version" }}</span>
|
<span class="ver-cur">{{ .String "current_version" }}</span>
|
||||||
<span class="ver-arr">→</span>
|
<span class="ver-arr">→</span>
|
||||||
<span class="ver-lat">{{ .String "metric.latest_version" }}</span>
|
<span class="ver-lat">{{ .String "latest_version" }}</span>
|
||||||
</div>
|
</div>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</div>
|
</div>
|
||||||
@@ -1111,7 +1045,7 @@ data:
|
|||||||
<div class="ver-allok">✓ All images up to date!</div>
|
<div class="ver-allok">✓ All images up to date!</div>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ else }}
|
{{ else }}
|
||||||
<div class="ver-nodata">Waiting for version-checker metrics...<br><small>Check back in a few minutes</small></div>
|
<div class="ver-nodata">Waiting for version data...<br><small>Check glance-helper logs</small></div>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user