Skip to content

Commit

Permalink
Make the Prometheus ConfigMap write-once (#272)
Browse files Browse the repository at this point in the history
* Eliminate the need for configmap reloader

* Fixed the path
  • Loading branch information
pboothe authored and nkinkade committed Sep 4, 2019
1 parent c7f2b03 commit ca4b4d1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 38 deletions.
16 changes: 9 additions & 7 deletions config/prometheus.jsonnet
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
local cmutil = import 'configmap.jsonnet';

local data = {
'rules.yml': importstr 'prometheus/rules.yml',
'prometheus.yml': importstr 'prometheus/prometheus.yml',
};

{
kind: 'ConfigMap',
apiVersion: 'v1',
metadata: {
name: 'prometheus-config',
},
data: {
'rules.yml': importstr 'prometheus/rules.yml',
'prometheus.yml': importstr 'prometheus/prometheus.yml',
},
metadata: cmutil.metadata('prometheus-config', data),
data: data,
}
34 changes: 3 additions & 31 deletions k8s/deployments/prometheus.jsonnet
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
local prometheusConfig = import '../../config/prometheus.jsonnet';

{
apiVersion: 'apps/v1',
kind: 'Deployment',
Expand Down Expand Up @@ -60,36 +62,6 @@
},
],
},
{
args: [
'-webhook-url',
'http://localhost:9090/-/reload',
'-volume-dir',
'/etc/prometheus',
],
// Check
// https://hub.docker.com/r/jimmidyson/configmap-reload/tags/
// for the current stable version.
image: 'jimmidyson/configmap-reload:v0.2.2',
name: 'configmap-reload',
resources: {
limits: {
cpu: '200m',
memory: '400Mi',
},
requests: {
cpu: '200m',
memory: '400Mi',
},
},
volumeMounts: [
// Mount the prometheus config volume so we can watch it for changes.
{
mountPath: '/etc/prometheus',
name: 'prometheus-config',
},
],
},
],
// TODO: use native k8s service entry points, if possible.
hostNetwork: true,
Expand All @@ -101,7 +73,7 @@
volumes: [
{
configMap: {
name: 'prometheus-config',
name: prometheusConfig.metadata.name,
},
name: 'prometheus-config',
},
Expand Down

0 comments on commit ca4b4d1

Please sign in to comment.