From 5fe73e6e583dff5951fbd7e65276c63e96276527 Mon Sep 17 00:00:00 2001 From: Steve Wilkerson Date: Wed, 13 Jun 2018 11:05:56 -0500 Subject: [PATCH] Kube-State-Metrics: Change default image used This changes the default image for kube-state-metrics to use the bitnami image instead of the coreos image. This allows us to override the image entrypoint, as the Alpine based image used previously did not easily allow us to do so. Adding this also makes creating a common prometheus exporter deployment template easier, as it reduces the functional differences between exporter charts and templates Change-Id: I6c4aac36f563fcb15f52640bc6f9913b45b4358a --- .../templates/bin/_kube-state-metrics.sh.tpl | 20 +++++++++++++++++++ .../templates/configmap-bin.yaml | 4 +++- .../templates/deployment.yaml | 12 +++++++++++ prometheus-kube-state-metrics/values.yaml | 2 +- 4 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 prometheus-kube-state-metrics/templates/bin/_kube-state-metrics.sh.tpl diff --git a/prometheus-kube-state-metrics/templates/bin/_kube-state-metrics.sh.tpl b/prometheus-kube-state-metrics/templates/bin/_kube-state-metrics.sh.tpl new file mode 100644 index 000000000..6128ec773 --- /dev/null +++ b/prometheus-kube-state-metrics/templates/bin/_kube-state-metrics.sh.tpl @@ -0,0 +1,20 @@ +#!/bin/bash +{{/* +Copyright 2017 The Openstack-Helm Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/}} + +set -ex + +exec kube-state-metrics --port=8080 --telemetry-port=8081 diff --git a/prometheus-kube-state-metrics/templates/configmap-bin.yaml b/prometheus-kube-state-metrics/templates/configmap-bin.yaml index 83217621d..eb274287c 100644 --- a/prometheus-kube-state-metrics/templates/configmap-bin.yaml +++ b/prometheus-kube-state-metrics/templates/configmap-bin.yaml @@ -20,8 +20,10 @@ limitations under the License. apiVersion: v1 kind: ConfigMap metadata: - name: kube-metrics-bin + name: kube-state-metrics-bin data: + kube-state-metrics.sh: | +{{ tuple "bin/_kube-state-metrics.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }} image-repo-sync.sh: | {{- include "helm-toolkit.scripts.image_repo_sync" . | indent 4 }} {{- end }} diff --git a/prometheus-kube-state-metrics/templates/deployment.yaml b/prometheus-kube-state-metrics/templates/deployment.yaml index 98d710b56..b3757b4be 100644 --- a/prometheus-kube-state-metrics/templates/deployment.yaml +++ b/prometheus-kube-state-metrics/templates/deployment.yaml @@ -100,7 +100,19 @@ spec: - name: kube-state-metrics {{ tuple $envAll "kube_state_metrics" | include "helm-toolkit.snippets.image" | indent 10 }} {{ tuple $envAll $envAll.Values.pod.resources.kube_state_metrics | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} + command: + - /tmp/kube-state-metrics.sh ports: - name: metrics containerPort: {{ tuple "kube_state_metrics" "internal" "http" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} + volumeMounts: + - name: kube-state-metrics-bin + mountPath: /tmp/kube-state-metrics.sh + subPath: kube-state-metrics.sh + readOnly: true + volumes: + - name: kube-state-metrics-bin + configMap: + name: kube-state-metrics-bin + defaultMode: 0555 {{- end }} diff --git a/prometheus-kube-state-metrics/values.yaml b/prometheus-kube-state-metrics/values.yaml index 9452a153c..6064b0ba2 100644 --- a/prometheus-kube-state-metrics/values.yaml +++ b/prometheus-kube-state-metrics/values.yaml @@ -18,7 +18,7 @@ images: tags: - kube_state_metrics: quay.io/coreos/kube-state-metrics:v1.2.0 + kube_state_metrics: docker.io/bitnami/kube-state-metrics:1.3.1 dep_check: quay.io/stackanetes/kubernetes-entrypoint:v0.3.1 image_repo_sync: docker.io/docker:17.07.0 pull_policy: IfNotPresent