This repository has been archived on 2023-04-02. You can view files and clone it, but cannot push or open issues or pull requests.
gitops-tbrnt/monitoring/vendor/github.com/coreos/kube-prometheus/jsonnet/kube-prometheus/lib/image.libsonnet
Tobias Brunner d14fbc6e17
All checks were successful
continuous-integration/drone/push Build is passing
upgrade monitoring stack to latest and greatest
2020-05-04 21:13:34 +02:00

22 lines
513 B
Plaintext

// imageName extracts the image name from a fully qualified image string. eg.
// quay.io/coreos/addon-resizer -> addon-resizer
// grafana/grafana -> grafana
local imageName(image) =
local parts = std.split(image, '/');
local len = std.length(parts);
if len == 3 then
# registry.com/org/image
parts[2]
else if len == 2 then
# org/image
parts[1]
else if len == 1 then
# image, ie. busybox
parts[0]
else
error 'unknown image format: ' + image;
{
imageName:: imageName,
}