diff --git a/stable/prometheus-adapter/Chart.yaml b/stable/prometheus-adapter/Chart.yaml index cc3cccf83b..4532289401 100644 --- a/stable/prometheus-adapter/Chart.yaml +++ b/stable/prometheus-adapter/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v1 name: prometheus-adapter -version: 1.1.0 +version: 1.2.0 appVersion: v0.5.0 description: A Helm chart for k8s prometheus adapter home: https://github.com/DirectXMan12/k8s-prometheus-adapter diff --git a/stable/prometheus-adapter/README.md b/stable/prometheus-adapter/README.md index e0b262b3fc..46edfd1911 100644 --- a/stable/prometheus-adapter/README.md +++ b/stable/prometheus-adapter/README.md @@ -22,8 +22,10 @@ To use the chart, ensure the `prometheus.url` and `prometheus.port` are configur The Prometheus Adapter can serve three different [metrics APIs](https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#support-for-metrics-apis): -* `/apis/custom.metrics.k8s.io/v1beta1` -Can be enabled using values file as such: +### Custom Metrics + +Enabling this option will cause custom metrics to be served at `/apis/custom.metrics.k8s.io/v1beta1`. Enabled by default when `rules.default` is true, but can be customized by populating `rules.custom`: + ``` rules: custom: @@ -36,8 +38,10 @@ rules: metricsQuery: sum(<<.Series>>{<<.LabelMatchers>>}) by (<<.GroupBy>>) ``` -* `/apis/external.metrics.k8s.io/v1beta1` -Can be enabled using values file as such: +### External Metrics + +Enabling this option will cause external metrics to be served at `/apis/external.metrics.k8s.io/v1beta1`. Can be enabled by populating `rules.external`: + ``` rules: external: @@ -50,8 +54,10 @@ rules: metricsQuery: sum(<<.Series>>{<<.LabelMatchers>>}) by (<<.GroupBy>>) ``` -* `/apis/metrics.k8s.io/v1beta1` -Can be enabled using values file as such, using the configuration below will allow you to use pod CPU and Memory utilization for [Horizontal Pod Autoscalers](https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/), as well as the `kubectl top` command: +### Resource Metrics + +Enabling this option will cause resource metrics to be served at `/apis/metrics.k8s.io/v1beta1`. Resource metrics will allow pod CPU and Memory metrics to be used in [Horizontal Pod Autoscalers](https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/) as well as the `kubectl top` command. Can be enabled by populating `rules.resource`: + ``` rules: resource: @@ -82,7 +88,7 @@ rules: window: 3m ``` -**NOTE:** setting a value for `resource:` will also deploy the `v1beta1.metrics.k8s.io` `APIService`, providing the same functionality as the [metrics-server](https://github.com/helm/charts/tree/master/stable/metrics-server), and as such it is not possible to deploy both in the same cluster. +**NOTE:** Setting a value for `rules.resource` will also deploy the resource metrics API service, providing the same functionality as [metrics-server](https://github.com/helm/charts/tree/master/stable/metrics-server). As such it is not possible to deploy them both in the same cluster. ## Uninstalling the Chart @@ -108,6 +114,7 @@ The following table lists the configurable parameters of the Prometheus Adapter | `logLevel` | Log level | `4` | | `metricsRelistInterval` | Interval at which to re-list the set of all available metrics from Prometheus | `1m` | | `nodeSelector` | Node labels for pod assignment | `{}` | +| `priorityClassName` | Pod priority | `` | | `prometheus.url` | Url of where we can find the Prometheus service | `http://prometheus.default.svc` | | `prometheus.port` | Port of where we can find the Prometheus service, zero to omit this option | `9090` | | `rbac.create` | If true, create & use RBAC resources | `true` | diff --git a/stable/prometheus-adapter/templates/custom-metrics-apiserver-deployment.yaml b/stable/prometheus-adapter/templates/custom-metrics-apiserver-deployment.yaml index bc55c4b711..ea123b3384 100644 --- a/stable/prometheus-adapter/templates/custom-metrics-apiserver-deployment.yaml +++ b/stable/prometheus-adapter/templates/custom-metrics-apiserver-deployment.yaml @@ -32,10 +32,10 @@ spec: args: - /adapter - --secure-port=6443 -{{- if .Values.tls.enable }} + {{- if .Values.tls.enable }} - --tls-cert-file=/var/run/serving-cert/tls.crt - --tls-private-key-file=/var/run/serving-cert/tls.key -{{- end }} + {{- end }} - --cert-dir=/tmp/cert - --logtostderr=true - --prometheus-url={{ .Values.prometheus.url }}{{ if .Values.prometheus.port }}:{{ .Values.prometheus.port }}{{end}} @@ -57,10 +57,10 @@ spec: port: https scheme: HTTPS initialDelaySeconds: 30 -{{- if .Values.resources }} + {{- if .Values.resources }} resources: -{{ toYaml .Values.resources | indent 10 }} -{{- end }} + {{- toYaml .Values.resources | nindent 10 }} + {{- end }} securityContext: allowPrivilegeEscalation: false capabilities: @@ -74,41 +74,32 @@ spec: readOnly: true - mountPath: /tmp name: tmp -{{- if .Values.tls.enable }} + {{- if .Values.tls.enable }} - mountPath: /var/run/serving-cert name: volume-serving-cert readOnly: true -{{- end }} - {{- with .Values.nodeSelector }} + {{- end }} nodeSelector: -{{ toYaml . | indent 8 }} - {{- end }} - {{- with .Values.affinity }} + {{- toYaml .Values.nodeSelector | nindent 8 }} affinity: -{{ toYaml . | indent 8 }} - {{- end }} - {{- with .Values.tolerations }} + {{- toYaml .Values.affinity | nindent 8 }} + priorityClassName: {{ .Values.priorityClassName }} tolerations: -{{ toYaml . | indent 8 }} - {{- end }} -{{- if .Values.image.pullSecrets }} + {{- toYaml .Values.tolerations | nindent 8 }} + {{- if .Values.image.pullSecrets }} imagePullSecrets: -{{- range .Values.image.pullSecrets }} + {{- range .Values.image.pullSecrets }} - name: {{ . }} -{{- end }} -{{- end }} + {{- end }} + {{- end }} volumes: - name: config configMap: - {{- if .Values.rules.existing }} - name: {{ .Values.rules.existing }} - {{- else }} - name: {{ template "k8s-prometheus-adapter.fullname" . }} - {{- end }} + name: {{ .Values.rules.existing | default (include "k8s-prometheus-adapter.fullname" . ) }} - name: tmp emptyDir: {} -{{- if .Values.tls.enable }} + {{- if .Values.tls.enable }} - name: volume-serving-cert secret: secretName: {{ template "k8s-prometheus-adapter.fullname" . }} -{{- end }} + {{- end }} diff --git a/stable/prometheus-adapter/values.yaml b/stable/prometheus-adapter/values.yaml index 251d3a3931..79942e4623 100644 --- a/stable/prometheus-adapter/values.yaml +++ b/stable/prometheus-adapter/values.yaml @@ -12,6 +12,8 @@ metricsRelistInterval: 1m nodeSelector: {} +priorityClassName: "" + # Url to access prometheus prometheus: url: http://prometheus.default.svc