Merge pull request #1072 from dgrisonnet/platform-patch
Allow configuring the platform used directly instead of having to use a patch
This commit is contained in:
@@ -9,6 +9,8 @@ local prometheusAdapter = import './components/prometheus-adapter.libsonnet';
|
||||
local prometheusOperator = import './components/prometheus-operator.libsonnet';
|
||||
local prometheus = import './components/prometheus.libsonnet';
|
||||
|
||||
local platformPatch = import './platforms/platforms.libsonnet';
|
||||
|
||||
{
|
||||
// using `values` as this is similar to helm
|
||||
values:: {
|
||||
@@ -104,6 +106,7 @@ local prometheus = import './components/prometheus.libsonnet';
|
||||
kubePrometheus: {
|
||||
namespace: $.values.common.namespace,
|
||||
mixin+: { ruleLabels: $.values.common.ruleLabels },
|
||||
platform: null,
|
||||
},
|
||||
},
|
||||
|
||||
@@ -125,4 +128,4 @@ local prometheus = import './components/prometheus.libsonnet';
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
} + platformPatch
|
||||
|
||||
3
jsonnet/kube-prometheus/platforms/README.md
Normal file
3
jsonnet/kube-prometheus/platforms/README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# Adding a new platform specific configuration
|
||||
|
||||
Adding a new platform specific configuration requires to update the [README](../../../README.md#cluster-creation-tools) and the [platforms.jsonnet](./platform.jsonnet) file by adding the platform to the list of existing ones. This allow the new platform to be discoverable and easily configurable by the users.
|
||||
41
jsonnet/kube-prometheus/platforms/platforms.libsonnet
Normal file
41
jsonnet/kube-prometheus/platforms/platforms.libsonnet
Normal file
@@ -0,0 +1,41 @@
|
||||
local platforms = {
|
||||
aws: import './aws.libsonnet',
|
||||
bootkube: import './bootkube.libsonnet',
|
||||
gke: import './gke.libsonnet',
|
||||
eks: import './eks.libsonnet',
|
||||
kops: import './kops.libsonnet',
|
||||
kops_coredns: (import './kops.libsonnet') + (import './kops-coredns.libsonnet'),
|
||||
kubeadm: import './kubeadm.libsonnet',
|
||||
kubespray: import './kubespray.libsonnet',
|
||||
};
|
||||
|
||||
// platformPatch returns the platform specific patch associated to the given
|
||||
// platform.
|
||||
local platformPatch(p) = if p != null && std.objectHas(platforms, p) then platforms[p] else {};
|
||||
|
||||
{
|
||||
// initialize the object to prevent "Indexed object has no field" lint errors
|
||||
local p = {
|
||||
alertmanager: {},
|
||||
blackboxExporter: {},
|
||||
grafana: {},
|
||||
kubeStateMetrics: {},
|
||||
nodeExporter: {},
|
||||
prometheus: {},
|
||||
prometheusAdapter: {},
|
||||
prometheusOperator: {},
|
||||
kubernetesControlPlane: {},
|
||||
kubePrometheus: {},
|
||||
} + platformPatch($.values.kubePrometheus.platform),
|
||||
|
||||
alertmanager+: p.alertmanager,
|
||||
blackboxExporter+: p.blackboxExporter,
|
||||
grafana+: p.grafana,
|
||||
kubeStateMetrics+: p.kubeStateMetrics,
|
||||
nodeExporter+: p.nodeExporter,
|
||||
prometheus+: p.prometheus,
|
||||
prometheusAdapter+: p.prometheusAdapter,
|
||||
prometheusOperator+: p.prometheusOperator,
|
||||
kubernetesControlPlane+: p.kubernetesControlPlane,
|
||||
kubePrometheus+: p.kubePrometheus,
|
||||
}
|
||||
Reference in New Issue
Block a user