Files
kube-prometheus/jsonnet/kube-prometheus/kube-prometheus-config-mixins.libsonnet
Damien Lespiau 253abe0f96 contrib/kube-prometheus: Introduce a withImageRepository mixin
This mixin replaces all images prefixes by $repository to generate manifests
that will point to an internal registry.
2018-10-16 11:59:31 +01:00

21 lines
665 B
Jsonnet

local l = import 'lib/lib.libsonnet';
// withImageRepository is a mixin that replaces all images prefixes by repository. eg.
// quay.io/coreos/addon-resizer -> $repository/addon-resizer
// grafana/grafana -> grafana $repository/grafana
local withImageRepository(repository) = {
local oldRepos = super._config.imageRepos,
local substituteRepository(image, repository) =
if repository == null then image else repository + '/' + l.imageName(image),
_config+:: {
imageRepos:: {
[field]: substituteRepository(oldRepos[field], repository),
for field in std.objectFields(oldRepos)
}
},
};
{
withImageRepository:: withImageRepository,
}