diff --git a/cmd/generate_test.go b/cmd/generate_test.go index 99e1be2..d682c10 100644 --- a/cmd/generate_test.go +++ b/cmd/generate_test.go @@ -44,7 +44,7 @@ func TestGenerate(t *testing.T) { map[string]int{ "prometheus-grafana": 125, "grafana": 8552, - "prometheus": 28363, + "prometheus": 29370, }, false, }, diff --git a/testdata/install-helm/component.yaml b/testdata/install-helm/component.yaml index 59187d2..155b903 100644 --- a/testdata/install-helm/component.yaml +++ b/testdata/install-helm/component.yaml @@ -1,13 +1,13 @@ name: prometheus type: helm method: helm -source: https://kubernetes-charts.storage.googleapis.com +source: https://prometheus-community.github.io/helm-charts path: prometheus subcomponents: - name: grafana type: helm method: helm - source: https://kubernetes-charts.storage.googleapis.com + source: https://grafana.github.io/helm-charts path: grafana version: 3.7.0 subcomponents: @@ -21,3 +21,4 @@ subcomponents: method: helm source: https://strimzi.io/charts/ path: strimzi-kafka-operator + diff --git a/testdata/local-charts/prometheus/Chart.yaml b/testdata/local-charts/prometheus/Chart.yaml index d603c70..b091db9 100644 --- a/testdata/local-charts/prometheus/Chart.yaml +++ b/testdata/local-charts/prometheus/Chart.yaml @@ -1,24 +1,24 @@ apiVersion: v1 -name: prometheus -version: 11.1.4 -appVersion: 2.16.0 +appVersion: 2.21.0 description: Prometheus is a monitoring system and time series database. home: https://prometheus.io/ icon: https://raw.githubusercontent.com/prometheus/prometheus.github.io/master/assets/prometheus_logo-cb55bb5c346.png -sources: - - https://github.com/prometheus/alertmanager - - https://github.com/prometheus/prometheus - - https://github.com/prometheus/pushgateway - - https://github.com/prometheus/node_exporter - - https://github.com/kubernetes/kube-state-metrics -dependencies: - - name: kube-state-metrics - version: "2.7.*" - repository: https://kubernetes-charts.storage.googleapis.com/ - condition: kubeStateMetrics.enabled maintainers: - - name: gianrubio - email: gianrubio@gmail.com - - name: zanhsieh - email: zanhsieh@gmail.com -engine: gotpl +- email: gianrubio@gmail.com + name: gianrubio +- email: zanhsieh@gmail.com + name: zanhsieh +- email: miroslav.hadzhiev@gmail.com + name: Xtigyro +- email: monotek23@gmail.com + name: monotek +- email: naseem@transit.app + name: naseemkullah +name: prometheus +sources: +- https://github.com/prometheus/alertmanager +- https://github.com/prometheus/prometheus +- https://github.com/prometheus/pushgateway +- https://github.com/prometheus/node_exporter +- https://github.com/kubernetes/kube-state-metrics +version: 11.16.7 diff --git a/testdata/local-charts/prometheus/OWNERS b/testdata/local-charts/prometheus/OWNERS deleted file mode 100644 index 8e4de5e..0000000 --- a/testdata/local-charts/prometheus/OWNERS +++ /dev/null @@ -1,6 +0,0 @@ -approvers: -- gianrubio -- zanhsieh -reviewers: -- gianrubio -- zanhsieh diff --git a/testdata/local-charts/prometheus/README.md b/testdata/local-charts/prometheus/README.md index a5c81a3..5f8f99d 100644 --- a/testdata/local-charts/prometheus/README.md +++ b/testdata/local-charts/prometheus/README.md @@ -2,399 +2,152 @@ [Prometheus](https://prometheus.io/), a [Cloud Native Computing Foundation](https://cncf.io/) project, is a systems and service monitoring system. It collects metrics from configured targets at given intervals, evaluates rule expressions, displays the results, and can trigger alerts if some condition is observed to be true. -## TL;DR; - -```console -$ helm install stable/prometheus -``` - -## Introduction - This chart bootstraps a [Prometheus](https://prometheus.io/) deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager. ## Prerequisites - Kubernetes 1.3+ with Beta APIs enabled -## Installing the Chart +## Get Repo Info + +```console +helm repo add prometheus-community https://prometheus-community.github.io/helm-charts +helm repo add stable https://charts.helm.sh/stable +helm repo update +``` + +_See [helm repo](https://helm.sh/docs/helm/helm_repo/) for command documentation._ -To install the chart with the release name `my-release`: +## Install Chart ```console -$ helm install --name my-release stable/prometheus +# Helm 3 +$ helm install [RELEASE_NAME] prometheus-community/prometheus + +# Helm 2 +$ helm install --name [RELEASE_NAME] prometheus-community/prometheus ``` -The command deploys Prometheus on the Kubernetes cluster in the default configuration. The [configuration](#configuration) section lists the parameters that can be configured during installation. +_See [configuration](#configuration) below._ + +_See [helm install](https://helm.sh/docs/helm/helm_install/) for command documentation._ + +## Dependencies -> **Tip**: List all releases using `helm list` +By default this chart installs additional, dependent charts: -## Uninstalling the Chart +- [stable/kube-state-metrics](https://github.com/helm/charts/tree/master/stable/kube-state-metrics) -To uninstall/delete the `my-release` deployment: +To disable the dependency during installation, set `kubeStateMetrics.enabled` to `false`. + +_See [helm dependency](https://helm.sh/docs/helm/helm_dependency/) for command documentation._ + +## Uninstall Chart ```console -$ helm delete my-release +# Helm 3 +$ helm uninstall [RELEASE_NAME] + +# Helm 2 +# helm delete --purge [RELEASE_NAME] ``` -The command removes all the Kubernetes components associated with the chart and deletes the release. +This removes all the Kubernetes components associated with the chart and deletes the release. -## Prometheus 2.x +_See [helm uninstall](https://helm.sh/docs/helm/helm_uninstall/) for command documentation._ -Prometheus version 2.x has made changes to alertmanager, storage and recording rules. Check out the migration guide [here](https://prometheus.io/docs/prometheus/2.0/migration/) +## Upgrading Chart -Users of this chart will need to update their alerting rules to the new format before they can upgrade. +```console +# Helm 3 or 2 +$ helm upgrade [RELEASE_NAME] [CHART] --install +``` -## Upgrading from previous chart versions. +_See [helm upgrade](https://helm.sh/docs/helm/helm_upgrade/) for command documentation._ -Version 9.0 adds a new option to enable or disable the Prometheus Server. -This supports the use case of running a Prometheus server in one k8s cluster and scraping exporters in another cluster while using the same chart for each deployment. -To install the server `server.enabled` must be set to `true`. +### To 9.0 + +Version 9.0 adds a new option to enable or disable the Prometheus Server. This supports the use case of running a Prometheus server in one k8s cluster and scraping exporters in another cluster while using the same chart for each deployment. To install the server `server.enabled` must be set to `true`. + +### To 5.0 As of version 5.0, this chart uses Prometheus 2.x. This version of prometheus introduces a new data format and is not compatible with prometheus 1.x. It is recommended to install this as a new release, as updating existing releases will not work. See the [prometheus docs](https://prometheus.io/docs/prometheus/latest/migration/#storage) for instructions on retaining your old data. -### Example migration +Prometheus version 2.x has made changes to alertmanager, storage and recording rules. Check out the migration guide [here](https://prometheus.io/docs/prometheus/2.0/migration/). + +Users of this chart will need to update their alerting rules to the new format before they can upgrade. + +### Example Migration Assuming you have an existing release of the prometheus chart, named `prometheus-old`. In order to update to prometheus 2.x while keeping your old data do the following: 1. Update the `prometheus-old` release. Disable scraping on every component besides the prometheus server, similar to the configuration below: - ``` - alertmanager: - enabled: false - alertmanagerFiles: - alertmanager.yml: "" - kubeStateMetrics: - enabled: false - nodeExporter: - enabled: false - pushgateway: - enabled: false - server: - extraArgs: - storage.local.retention: 720h - serverFiles: - alerts: "" - prometheus.yml: "" - rules: "" - ``` + ```yaml + alertmanager: + enabled: false + alertmanagerFiles: + alertmanager.yml: "" + kubeStateMetrics: + enabled: false + nodeExporter: + enabled: false + pushgateway: + enabled: false + server: + extraArgs: + storage.local.retention: 720h + serverFiles: + alerts: "" + prometheus.yml: "" + rules: "" + ``` 1. Deploy a new release of the chart with version 5.0+ using prometheus 2.x. In the values.yaml set the scrape config as usual, and also add the `prometheus-old` instance as a remote-read target. - ``` - prometheus.yml: - ... - remote_read: - - url: http://prometheus-old/api/v1/read - ... + ```yaml + prometheus.yml: + ... + remote_read: + - url: http://prometheus-old/api/v1/read + ... ``` Old data will be available when you query the new prometheus instance. -## Scraping Pod Metrics via Annotations +## Configuration -This chart uses a default configuration that causes prometheus -to scrape a variety of kubernetes resource types, provided they have the correct annotations. -In this section we describe how to configure pods to be scraped; -for information on how other resource types can be scraped you can -do a `helm template` to get the kubernetes resource definitions, -and then reference the prometheus configuration in the ConfigMap against the prometheus documentation -for [relabel_config](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config) -and [kubernetes_sd_config](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#kubernetes_sd_config). +See [Customizing the Chart Before Installing](https://helm.sh/docs/intro/using_helm/#customizing-the-chart-before-installing). To see all configurable options with detailed comments, visit the chart's [values.yaml](./values.yaml), or run these configuration commands: -In order to get prometheus to scrape pods, you must add annotations to the the pods as below: +```console +# Helm 2 +$ helm inspect values prometheus-community/prometheus +# Helm 3 +$ helm show values prometheus-community/prometheus ``` + +You may similarly use the above configuration commands on each chart [dependency](#dependencies) to see it's configurations. + +### Scraping Pod Metrics via Annotations + +This chart uses a default configuration that causes prometheus to scrape a variety of kubernetes resource types, provided they have the correct annotations. In this section we describe how to configure pods to be scraped; for information on how other resource types can be scraped you can do a `helm template` to get the kubernetes resource definitions, and then reference the prometheus configuration in the ConfigMap against the prometheus documentation for [relabel_config](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config) and [kubernetes_sd_config](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#kubernetes_sd_config). + +In order to get prometheus to scrape pods, you must add annotations to the the pods as below: + +```yaml metadata: annotations: prometheus.io/scrape: "true" prometheus.io/path: /metrics prometheus.io/port: "8080" -spec: -... ``` -You should adjust `prometheus.io/path` based on the URL that your pod serves metrics from. -`prometheus.io/port` should be set to the port that your pod serves metrics from. -Note that the values for `prometheus.io/scrape` and `prometheus.io/port` must be -enclosed in double quotes. +You should adjust `prometheus.io/path` based on the URL that your pod serves metrics from. `prometheus.io/port` should be set to the port that your pod serves metrics from. Note that the values for `prometheus.io/scrape` and `prometheus.io/port` must be enclosed in double quotes. -## Configuration +### Sharing Alerts Between Services -The following table lists the configurable parameters of the Prometheus chart and their default values. - -Parameter | Description | Default ---------- | ----------- | ------- -`alertmanager.enabled` | If true, create alertmanager | `true` -`alertmanager.name` | alertmanager container name | `alertmanager` -`alertmanager.image.repository` | alertmanager container image repository | `prom/alertmanager` -`alertmanager.image.tag` | alertmanager container image tag | `v0.20.0` -`alertmanager.image.pullPolicy` | alertmanager container image pull policy | `IfNotPresent` -`alertmanager.prefixURL` | The prefix slug at which the server can be accessed | `` -`alertmanager.baseURL` | The external url at which the server can be accessed | `"http://localhost:9093"` -`alertmanager.extraArgs` | Additional alertmanager container arguments | `{}` -`alertmanager.extraSecretMounts` | Additional alertmanager Secret mounts | `[]` -`alertmanager.configMapOverrideName` | Prometheus alertmanager ConfigMap override where full-name is `{{.Release.Name}}-{{.Values.alertmanager.configMapOverrideName}}` and setting this value will prevent the default alertmanager ConfigMap from being generated | `""` -`alertmanager.configFromSecret` | The name of a secret in the same kubernetes namespace which contains the Alertmanager config, setting this value will prevent the default alertmanager ConfigMap from being generated | `""` -`alertmanager.configFileName` | The configuration file name to be loaded to alertmanager. Must match the key within configuration loaded from ConfigMap/Secret. | `alertmanager.yml` -`alertmanager.ingress.enabled` | If true, alertmanager Ingress will be created | `false` -`alertmanager.ingress.annotations` | alertmanager Ingress annotations | `{}` -`alertmanager.ingress.extraLabels` | alertmanager Ingress additional labels | `{}` -`alertmanager.ingress.hosts` | alertmanager Ingress hostnames | `[]` -`alertmanager.ingress.extraPaths` | Ingress extra paths to prepend to every alertmanager host configuration. Useful when configuring [custom actions with AWS ALB Ingress Controller](https://kubernetes-sigs.github.io/aws-alb-ingress-controller/guide/ingress/annotation/#actions) | `[]` -`alertmanager.ingress.tls` | alertmanager Ingress TLS configuration (YAML) | `[]` -`alertmanager.nodeSelector` | node labels for alertmanager pod assignment | `{}` -`alertmanager.tolerations` | node taints to tolerate (requires Kubernetes >=1.6) | `[]` -`alertmanager.affinity` | pod affinity | `{}` -`alertmanager.podDisruptionBudget.enabled` | If true, create a PodDisruptionBudget | `false` -`alertmanager.podDisruptionBudget.maxUnavailable` | Maximum unavailable instances in PDB | `1` -`alertmanager.schedulerName` | alertmanager alternate scheduler name | `nil` -`alertmanager.persistentVolume.enabled` | If true, alertmanager will create a Persistent Volume Claim | `true` -`alertmanager.persistentVolume.accessModes` | alertmanager data Persistent Volume access modes | `[ReadWriteOnce]` -`alertmanager.persistentVolume.annotations` | Annotations for alertmanager Persistent Volume Claim | `{}` -`alertmanager.persistentVolume.existingClaim` | alertmanager data Persistent Volume existing claim name | `""` -`alertmanager.persistentVolume.mountPath` | alertmanager data Persistent Volume mount root path | `/data` -`alertmanager.persistentVolume.size` | alertmanager data Persistent Volume size | `2Gi` -`alertmanager.persistentVolume.storageClass` | alertmanager data Persistent Volume Storage Class | `unset` -`alertmanager.persistentVolume.volumeBindingMode` | alertmanager data Persistent Volume Binding Mode | `unset` -`alertmanager.persistentVolume.subPath` | Subdirectory of alertmanager data Persistent Volume to mount | `""` -`alertmanager.podAnnotations` | annotations to be added to alertmanager pods | `{}` -`alertmanager.podLabels` | labels to be added to Prometheus AlertManager pods | `{}` -`alertmanager.podSecurityPolicy.annotations` | Specify pod annotations in the pod security policy | `{}` | -`alertmanager.replicaCount` | desired number of alertmanager pods | `1` -`alertmanager.statefulSet.enabled` | If true, use a statefulset instead of a deployment for pod management | `false` -`alertmanager.statefulSet.podManagementPolicy` | podManagementPolicy of alertmanager pods | `OrderedReady` -`alertmanager.statefulSet.headless.annotations` | annotations for alertmanager headless service | `{}` -`alertmanager.statefulSet.headless.labels` | labels for alertmanager headless service | `{}` -`alertmanager.statefulSet.headless.enableMeshPeer` | If true, enable the mesh peer endpoint for the headless service | `{}` -`alertmanager.statefulSet.headless.servicePort` | alertmanager headless service port | `80` -`alertmanager.priorityClassName` | alertmanager priorityClassName | `nil` -`alertmanager.resources` | alertmanager pod resource requests & limits | `{}` -`alertmanager.securityContext` | Custom [security context](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/) for Alert Manager containers | `{}` -`alertmanager.service.annotations` | annotations for alertmanager service | `{}` -`alertmanager.service.clusterIP` | internal alertmanager cluster service IP | `""` -`alertmanager.service.externalIPs` | alertmanager service external IP addresses | `[]` -`alertmanager.service.loadBalancerIP` | IP address to assign to load balancer (if supported) | `""` -`alertmanager.service.loadBalancerSourceRanges` | list of IP CIDRs allowed access to load balancer (if supported) | `[]` -`alertmanager.service.servicePort` | alertmanager service port | `80` -`alertmanager.service.sessionAffinity` | Session Affinity for alertmanager service, can be `None` or `ClientIP` | `None` -`alertmanager.service.type` | type of alertmanager service to create | `ClusterIP` -`alertmanager.strategy` | Deployment strategy | `{ "type": "RollingUpdate" }` -`alertmanagerFiles.alertmanager.yml` | Prometheus alertmanager configuration | example configuration -`configmapReload.prometheus.enabled` | If false, the configmap-reload container for Prometheus will not be deployed | `true` -`configmapReload.prometheus.name` | configmap-reload container name | `configmap-reload` -`configmapReload.prometheus.image.repository` | configmap-reload container image repository | `jimmidyson/configmap-reload` -`configmapReload.prometheus.image.tag` | configmap-reload container image tag | `v0.3.0` -`configmapReload.prometheus.image.pullPolicy` | configmap-reload container image pull policy | `IfNotPresent` -`configmapReload.prometheus.extraArgs` | Additional configmap-reload container arguments | `{}` -`configmapReload.prometheus.extraVolumeDirs` | Additional configmap-reload volume directories | `{}` -`configmapReload.prometheus.extraConfigmapMounts` | Additional configmap-reload configMap mounts | `[]` -`configmapReload.prometheus.resources` | configmap-reload pod resource requests & limits | `{}` -`configmapReload.alertmanager.enabled` | If false, the configmap-reload container for AlertManager will not be deployed | `true` -`configmapReload.alertmanager.name` | configmap-reload container name | `configmap-reload` -`configmapReload.alertmanager.image.repository` | configmap-reload container image repository | `jimmidyson/configmap-reload` -`configmapReload.alertmanager.image.tag` | configmap-reload container image tag | `v0.3.0` -`configmapReload.alertmanager.image.pullPolicy` | configmap-reload container image pull policy | `IfNotPresent` -`configmapReload.alertmanager.extraArgs` | Additional configmap-reload container arguments | `{}` -`configmapReload.alertmanager.extraVolumeDirs` | Additional configmap-reload volume directories | `{}` -`configmapReload.alertmanager.extraConfigmapMounts` | Additional configmap-reload configMap mounts | `[]` -`configmapReload.alertmanager.resources` | configmap-reload pod resource requests & limits | `{}` -`initChownData.enabled` | If false, don't reset data ownership at startup | true -`initChownData.name` | init-chown-data container name | `init-chown-data` -`initChownData.image.repository` | init-chown-data container image repository | `busybox` -`initChownData.image.tag` | init-chown-data container image tag | `latest` -`initChownData.image.pullPolicy` | init-chown-data container image pull policy | `IfNotPresent` -`initChownData.resources` | init-chown-data pod resource requests & limits | `{}` -`kubeStateMetrics.enabled` | If true, create kube-state-metrics sub-chart, see the [kube-state-metrics chart for configuration options](https://github.com/helm/charts/tree/master/stable/kube-state-metrics) | `true` -`kube-state-metrics` | [kube-state-metrics configuration options](https://github.com/helm/charts/tree/master/stable/kube-state-metrics) | `Same as sub-chart's` -`nodeExporter.enabled` | If true, create node-exporter | `true` -`nodeExporter.name` | node-exporter container name | `node-exporter` -`nodeExporter.image.repository` | node-exporter container image repository| `prom/node-exporter` -`nodeExporter.image.tag` | node-exporter container image tag | `v0.18.1` -`nodeExporter.image.pullPolicy` | node-exporter container image pull policy | `IfNotPresent` -`nodeExporter.extraArgs` | Additional node-exporter container arguments | `{}` -`nodeExporter.extraInitContainers` | Init containers to launch alongside the node-exporter | `[]` -`nodeExporter.extraHostPathMounts` | Additional node-exporter hostPath mounts | `[]` -`nodeExporter.extraConfigmapMounts` | Additional node-exporter configMap mounts | `[]` -`nodeExporter.hostNetwork` | If true, node-exporter pods share the host network namespace | `true` -`nodeExporter.hostPID` | If true, node-exporter pods share the host PID namespace | `true` -`nodeExporter.nodeSelector` | node labels for node-exporter pod assignment | `{}` -`nodeExporter.podAnnotations` | annotations to be added to node-exporter pods | `{}` -`nodeExporter.pod.labels` | labels to be added to node-exporter pods | `{}` -`nodeExporter.podDisruptionBudget.enabled` | If true, create a PodDisruptionBudget | `false` -`nodeExporter.podDisruptionBudget.maxUnavailable` | Maximum unavailable instances in PDB | `1` -`nodeExporter.podSecurityPolicy.annotations` | Specify pod annotations in the pod security policy | `{}` | -`nodeExporter.podSecurityPolicy.enabled` | Specify if a Pod Security Policy for node-exporter must be created | `false` -`nodeExporter.tolerations` | node taints to tolerate (requires Kubernetes >=1.6) | `[]` -`nodeExporter.priorityClassName` | node-exporter priorityClassName | `nil` -`nodeExporter.resources` | node-exporter resource requests and limits (YAML) | `{}` -`nodeExporter.securityContext` | securityContext for containers in pod | `{}` -`nodeExporter.service.annotations` | annotations for node-exporter service | `{prometheus.io/scrape: "true"}` -`nodeExporter.service.clusterIP` | internal node-exporter cluster service IP | `None` -`nodeExporter.service.externalIPs` | node-exporter service external IP addresses | `[]` -`nodeExporter.service.hostPort` | node-exporter service host port | `9100` -`nodeExporter.service.loadBalancerIP` | IP address to assign to load balancer (if supported) | `""` -`nodeExporter.service.loadBalancerSourceRanges` | list of IP CIDRs allowed access to load balancer (if supported) | `[]` -`nodeExporter.service.servicePort` | node-exporter service port | `9100` -`nodeExporter.service.type` | type of node-exporter service to create | `ClusterIP` -`podSecurityPolicy.enabled` | If true, create & use pod security policies resources | `false` -`pushgateway.enabled` | If true, create pushgateway | `true` -`pushgateway.name` | pushgateway container name | `pushgateway` -`pushgateway.image.repository` | pushgateway container image repository | `prom/pushgateway` -`pushgateway.image.tag` | pushgateway container image tag | `v1.0.1` -`pushgateway.image.pullPolicy` | pushgateway container image pull policy | `IfNotPresent` -`pushgateway.extraArgs` | Additional pushgateway container arguments | `{}` -`pushgateway.extraInitContainers` | Init containers to launch alongside the pushgateway | `[]` -`pushgateway.ingress.enabled` | If true, pushgateway Ingress will be created | `false` -`pushgateway.ingress.annotations` | pushgateway Ingress annotations | `{}` -`pushgateway.ingress.hosts` | pushgateway Ingress hostnames | `[]` -`pushgateway.ingress.extraPaths` | Ingress extra paths to prepend to every pushgateway host configuration. Useful when configuring [custom actions with AWS ALB Ingress Controller](https://kubernetes-sigs.github.io/aws-alb-ingress-controller/guide/ingress/annotation/#actions) | `[]` -`pushgateway.ingress.tls` | pushgateway Ingress TLS configuration (YAML) | `[]` -`pushgateway.nodeSelector` | node labels for pushgateway pod assignment | `{}` -`pushgateway.podAnnotations` | annotations to be added to pushgateway pods | `{}` -`pushgateway.podSecurityPolicy.annotations` | Specify pod annotations in the pod security policy | `{}` | -`pushgateway.tolerations` | node taints to tolerate (requires Kubernetes >=1.6) | `[]` -`pushgateway.replicaCount` | desired number of pushgateway pods | `1` -`pushgateway.podDisruptionBudget.enabled` | If true, create a PodDisruptionBudget | `false` -`pushgateway.podDisruptionBudget.maxUnavailable` | Maximum unavailable instances in PDB | `1` -`pushgateway.schedulerName` | pushgateway alternate scheduler name | `nil` -`pushgateway.persistentVolume.enabled` | If true, Prometheus pushgateway will create a Persistent Volume Claim | `false` -`pushgateway.persistentVolume.accessModes` | Prometheus pushgateway data Persistent Volume access modes | `[ReadWriteOnce]` -`pushgateway.persistentVolume.annotations` | Prometheus pushgateway data Persistent Volume annotations | `{}` -`pushgateway.persistentVolume.existingClaim` | Prometheus pushgateway data Persistent Volume existing claim name | `""` -`pushgateway.persistentVolume.mountPath` | Prometheus pushgateway data Persistent Volume mount root path | `/data` -`pushgateway.persistentVolume.size` | Prometheus pushgateway data Persistent Volume size | `2Gi` -`pushgateway.persistentVolume.storageClass` | Prometheus pushgateway data Persistent Volume Storage Class | `unset` -`pushgateway.persistentVolume.volumeBindingMode` | Prometheus pushgateway data Persistent Volume Binding Mode | `unset` -`pushgateway.persistentVolume.subPath` | Subdirectory of Prometheus server data Persistent Volume to mount | `""` -`pushgateway.priorityClassName` | pushgateway priorityClassName | `nil` -`pushgateway.resources` | pushgateway pod resource requests & limits | `{}` -`pushgateway.service.annotations` | annotations for pushgateway service | `{}` -`pushgateway.service.clusterIP` | internal pushgateway cluster service IP | `""` -`pushgateway.service.externalIPs` | pushgateway service external IP addresses | `[]` -`pushgateway.service.loadBalancerIP` | IP address to assign to load balancer (if supported) | `""` -`pushgateway.service.loadBalancerSourceRanges` | list of IP CIDRs allowed access to load balancer (if supported) | `[]` -`pushgateway.service.servicePort` | pushgateway service port | `9091` -`pushgateway.service.type` | type of pushgateway service to create | `ClusterIP` -`pushgateway.strategy` | Deployment strategy | `{ "type": "RollingUpdate" }` -`rbac.create` | If true, create & use RBAC resources | `true` -`server.enabled` | If false, Prometheus server will not be created | `true` -`server.name` | Prometheus server container name | `server` -`server.image.repository` | Prometheus server container image repository | `prom/prometheus` -`server.image.tag` | Prometheus server container image tag | `v2.16.0` -`server.image.pullPolicy` | Prometheus server container image pull policy | `IfNotPresent` -`server.configPath` | Path to a prometheus server config file on the container FS | `/etc/config/prometheus.yml` -`server.global.scrape_interval` | How frequently to scrape targets by default | `1m` -`server.global.scrape_timeout` | How long until a scrape request times out | `10s` -`server.global.evaluation_interval` | How frequently to evaluate rules | `1m` -`server.remoteWrite` | The remote write feature of Prometheus allow transparently sending samples. | `{}` -`server.remoteRead` | The remote read feature of Prometheus allow transparently receiving samples. | `{}` -`server.extraArgs` | Additional Prometheus server container arguments | `{}` -`server.extraFlags` | Additional Prometheus server container flags | `["web.enable-lifecycle"]` -`server.extraInitContainers` | Init containers to launch alongside the server | `[]` -`server.prefixURL` | The prefix slug at which the server can be accessed | `` -`server.baseURL` | The external url at which the server can be accessed | `` -`server.env` | Prometheus server environment variables | `[]` -`server.extraHostPathMounts` | Additional Prometheus server hostPath mounts | `[]` -`server.extraConfigmapMounts` | Additional Prometheus server configMap mounts | `[]` -`server.extraSecretMounts` | Additional Prometheus server Secret mounts | `[]` -`server.extraVolumeMounts` | Additional Prometheus server Volume mounts | `[]` -`server.extraVolumes` | Additional Prometheus server Volumes | `[]` -`server.configMapOverrideName` | Prometheus server ConfigMap override where full-name is `{{.Release.Name}}-{{.Values.server.configMapOverrideName}}` and setting this value will prevent the default server ConfigMap from being generated | `""` -`server.ingress.enabled` | If true, Prometheus server Ingress will be created | `false` -`server.ingress.annotations` | Prometheus server Ingress annotations | `[]` -`server.ingress.extraLabels` | Prometheus server Ingress additional labels | `{}` -`server.ingress.hosts` | Prometheus server Ingress hostnames | `[]` -`server.ingress.extraPaths` | Ingress extra paths to prepend to every Prometheus server host configuration. Useful when configuring [custom actions with AWS ALB Ingress Controller](https://kubernetes-sigs.github.io/aws-alb-ingress-controller/guide/ingress/annotation/#actions) | `[]` -`server.ingress.tls` | Prometheus server Ingress TLS configuration (YAML) | `[]` -`server.nodeSelector` | node labels for Prometheus server pod assignment | `{}` -`server.tolerations` | node taints to tolerate (requires Kubernetes >=1.6) | `[]` -`server.affinity` | pod affinity | `{}` -`server.podDisruptionBudget.enabled` | If true, create a PodDisruptionBudget | `false` -`server.podDisruptionBudget.maxUnavailable` | Maximum unavailable instances in PDB | `1` -`server.priorityClassName` | Prometheus server priorityClassName | `nil` -`server.schedulerName` | Prometheus server alternate scheduler name | `nil` -`server.persistentVolume.enabled` | If true, Prometheus server will create a Persistent Volume Claim | `true` -`server.persistentVolume.accessModes` | Prometheus server data Persistent Volume access modes | `[ReadWriteOnce]` -`server.persistentVolume.annotations` | Prometheus server data Persistent Volume annotations | `{}` -`server.persistentVolume.existingClaim` | Prometheus server data Persistent Volume existing claim name | `""` -`server.persistentVolume.mountPath` | Prometheus server data Persistent Volume mount root path | `/data` -`server.persistentVolume.size` | Prometheus server data Persistent Volume size | `8Gi` -`server.persistentVolume.storageClass` | Prometheus server data Persistent Volume Storage Class | `unset` -`server.persistentVolume.volumeBindingMode` | Prometheus server data Persistent Volume Binding Mode | `unset` -`server.persistentVolume.subPath` | Subdirectory of Prometheus server data Persistent Volume to mount | `""` -`server.emptyDir.sizeLimit` | emptyDir sizeLimit if a Persistent Volume is not used | `""` -`server.podAnnotations` | annotations to be added to Prometheus server pods | `{}` -`server.podLabels` | labels to be added to Prometheus server pods | `{}` -`server.alertmanagers` | Prometheus AlertManager configuration for the Prometheus server | `{}` -`server.deploymentAnnotations` | annotations to be added to Prometheus server deployment | `{}` -`server.podSecurityPolicy.annotations` | Specify pod annotations in the pod security policy | `{}` | -`server.replicaCount` | desired number of Prometheus server pods | `1` -`server.statefulSet.enabled` | If true, use a statefulset instead of a deployment for pod management | `false` -`server.statefulSet.annotations` | annotations to be added to Prometheus server stateful set | `{}` -`server.statefulSet.labels` | labels to be added to Prometheus server stateful set | `{}` -`server.statefulSet.podManagementPolicy` | podManagementPolicy of server pods | `OrderedReady` -`server.statefulSet.headless.annotations` | annotations for Prometheus server headless service | `{}` -`server.statefulSet.headless.labels` | labels for Prometheus server headless service | `{}` -`server.statefulSet.headless.servicePort` | Prometheus server headless service port | `80` -`server.resources` | Prometheus server resource requests and limits | `{}` -`server.verticalAutoscaler.enabled` | If true a VPA object will be created for the controller (either StatefulSet or Deployemnt, based on above configs) | `false` -`server.securityContext` | Custom [security context](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/) for server containers | `{}` -`server.service.annotations` | annotations for Prometheus server service | `{}` -`server.service.clusterIP` | internal Prometheus server cluster service IP | `""` -`server.service.externalIPs` | Prometheus server service external IP addresses | `[]` -`server.service.loadBalancerIP` | IP address to assign to load balancer (if supported) | `""` -`server.service.loadBalancerSourceRanges` | list of IP CIDRs allowed access to load balancer (if supported) | `[]` -`server.service.nodePort` | Port to be used as the service NodePort (ignored if `server.service.type` is not `NodePort`) | `0` -`server.service.servicePort` | Prometheus server service port | `80` -`server.service.sessionAffinity` | Session Affinity for server service, can be `None` or `ClientIP` | `None` -`server.service.type` | type of Prometheus server service to create | `ClusterIP` -`server.service.gRPC.enabled` | If true, open a second port on the service for gRPC | `false` -`server.service.gRPC.servicePort` | Prometheus service gRPC port, (ignored if `server.service.gRPC.enabled` is not `true`) | `10901` -`server.service.gRPC.nodePort` | Port to be used as gRPC nodePort in the prometheus service | `0` -`server.service.statefulsetReplica.enabled` | If true, send the traffic from the service to only one replica of the replicaset | `false` -`server.service.statefulsetReplica.replica` | Which replica to send the traffice to | `0` -`server.hostAliases` | /etc/hosts-entries in container(s) | [] -`server.sidecarContainers` | array of snippets with your sidecar containers for prometheus server | `""` -`server.strategy` | Deployment strategy | `{ "type": "RollingUpdate" }` -`serviceAccounts.alertmanager.create` | If true, create the alertmanager service account | `true` -`serviceAccounts.alertmanager.name` | name of the alertmanager service account to use or create | `{{ prometheus.alertmanager.fullname }}` -`serviceAccounts.alertmanager.annotations` | annotations for the alertmanager service account | `{}` -`serviceAccounts.nodeExporter.create` | If true, create the nodeExporter service account | `true` -`serviceAccounts.nodeExporter.name` | name of the nodeExporter service account to use or create | `{{ prometheus.nodeExporter.fullname }}` -`serviceAccounts.nodeExporter.annotations` | annotations for the nodeExporter service account | `{}` -`serviceAccounts.pushgateway.create` | If true, create the pushgateway service account | `true` -`serviceAccounts.pushgateway.name` | name of the pushgateway service account to use or create | `{{ prometheus.pushgateway.fullname }}` -`serviceAccounts.pushgateway.annotations` | annotations for the pushgateway service account | `{}` -`serviceAccounts.server.create` | If true, create the server service account | `true` -`serviceAccounts.server.name` | name of the server service account to use or create | `{{ prometheus.server.fullname }}` -`serviceAccounts.server.annotations` | annotations for the server service account | `{}` -`server.terminationGracePeriodSeconds` | Prometheus server Pod termination grace period | `300` -`server.retention` | (optional) Prometheus data retention | `"15d"` -`serverFiles.alerts` | (Deprecated) Prometheus server alerts configuration | `{}` -`serverFiles.rules` | (Deprecated) Prometheus server rules configuration | `{}` -`serverFiles.alerting_rules.yml` | Prometheus server alerts configuration | `{}` -`serverFiles.recording_rules.yml` | Prometheus server rules configuration | `{}` -`serverFiles.prometheus.yml` | Prometheus server scrape configuration | example configuration -`extraScrapeConfigs` | Prometheus server additional scrape configuration | "" -`alertRelabelConfigs` | Prometheus server [alert relabeling configs](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#alert_relabel_configs) for H/A prometheus | "" -`networkPolicy.enabled` | Enable NetworkPolicy | `false` | - -Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example, - -```console -$ helm install stable/prometheus --name my-release \ - --set server.terminationGracePeriodSeconds=360 -``` - -Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the chart. For example, - -```console -$ helm install stable/prometheus --name my-release -f values.yaml -``` - -> **Tip**: You can use the default [values.yaml](values.yaml) - -Note that you have multiple yaml files. This is particularly useful when you have alerts belonging to multiple services in the cluster. For example, +Note that when [installing](#install-chart) or [upgrading](#upgrading-chart) you may use multiple values override files. This is particularly useful when you have alerts belonging to multiple services in the cluster. For example, ```yaml # values.yaml @@ -416,10 +169,11 @@ serverFiles: ``` ```console -$ helm install stable/prometheus --name my-release -f values.yaml -f service1-alert.yaml -f service2-alert.yaml +helm install [RELEASE_NAME] prometheus-community/prometheus -f values.yaml -f service1-alert.yaml -f service2-alert.yaml ``` ### RBAC Configuration + Roles and RoleBindings resources will be created automatically for `server` service. To manually setup RBAC you need to set the parameter `rbac.create=false` and specify the service account to be used for each service by setting the parameters: `serviceAccounts.{{ component }}.create` to `false` and `serviceAccounts.{{ component }}.name` to the name of a pre-existing service account. @@ -427,12 +181,14 @@ To manually setup RBAC you need to set the parameter `rbac.create=false` and spe > **Tip**: You can refer to the default `*-clusterrole.yaml` and `*-clusterrolebinding.yaml` files in [templates](templates/) to customize your own. ### ConfigMap Files + AlertManager is configured through [alertmanager.yml](https://prometheus.io/docs/alerting/configuration/). This file (and any others listed in `alertmanagerFiles`) will be mounted into the `alertmanager` pod. Prometheus is configured through [prometheus.yml](https://prometheus.io/docs/operating/configuration/). This file (and any others listed in `serverFiles`) will be mounted into the `server` pod. ### Ingress TLS -If your cluster allows automatic creation/retrieval of TLS certificates (e.g. [kube-lego](https://github.com/jetstack/kube-lego)), please refer to the documentation for that mechanism. + +If your cluster allows automatic creation/retrieval of TLS certificates (e.g. [cert-manager](https://github.com/jetstack/cert-manager)), please refer to the documentation for that mechanism. To manually configure TLS, first create/retrieve a key & certificate pair for the address(es) you wish to protect. Then create a TLS secret in the namespace: @@ -466,12 +222,8 @@ server: ### NetworkPolicy -Enabling Network Policy for Prometheus will secure connections to Alert Manager -and Kube State Metrics by only accepting connections from Prometheus Server. -All inbound connections to Prometheus Server are still allowed. +Enabling Network Policy for Prometheus will secure connections to Alert Manager and Kube State Metrics by only accepting connections from Prometheus Server. All inbound connections to Prometheus Server are still allowed. -To enable network policy for Prometheus, install a networking plugin that -implements the Kubernetes NetworkPolicy spec, and set `networkPolicy.enabled` to true. +To enable network policy for Prometheus, install a networking plugin that implements the Kubernetes NetworkPolicy spec, and set `networkPolicy.enabled` to true. -If NetworkPolicy is enabled for Prometheus' scrape targets, you may also need -to manually create a networkpolicy which allows it. +If NetworkPolicy is enabled for Prometheus' scrape targets, you may also need to manually create a networkpolicy which allows it. diff --git a/testdata/local-charts/prometheus/charts/kube-state-metrics-2.7.2.tgz b/testdata/local-charts/prometheus/charts/kube-state-metrics-2.7.2.tgz deleted file mode 100644 index 75f07e4..0000000 Binary files a/testdata/local-charts/prometheus/charts/kube-state-metrics-2.7.2.tgz and /dev/null differ diff --git a/testdata/local-charts/prometheus/charts/kube-state-metrics/.helmignore b/testdata/local-charts/prometheus/charts/kube-state-metrics/.helmignore new file mode 100644 index 0000000..f0c1319 --- /dev/null +++ b/testdata/local-charts/prometheus/charts/kube-state-metrics/.helmignore @@ -0,0 +1,21 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*~ +# Various IDEs +.project +.idea/ +*.tmproj diff --git a/testdata/local-charts/prometheus/charts/kube-state-metrics/Chart.yaml b/testdata/local-charts/prometheus/charts/kube-state-metrics/Chart.yaml new file mode 100644 index 0000000..7114453 --- /dev/null +++ b/testdata/local-charts/prometheus/charts/kube-state-metrics/Chart.yaml @@ -0,0 +1,20 @@ +apiVersion: v1 +appVersion: 1.9.7 +description: Install kube-state-metrics to generate and expose cluster-level metrics +home: https://github.com/kubernetes/kube-state-metrics/ +keywords: +- metric +- monitoring +- prometheus +- kubernetes +maintainers: +- email: jose@armesto.net + name: fiunchinho +- email: tariq.ibrahim@mulesoft.com + name: tariq1890 +- email: manuel@rueg.eu + name: mrueg +name: kube-state-metrics +sources: +- https://github.com/kubernetes/kube-state-metrics/ +version: 2.8.14 diff --git a/testdata/local-charts/prometheus/charts/kube-state-metrics/OWNERS b/testdata/local-charts/prometheus/charts/kube-state-metrics/OWNERS new file mode 100644 index 0000000..6ffd97d --- /dev/null +++ b/testdata/local-charts/prometheus/charts/kube-state-metrics/OWNERS @@ -0,0 +1,8 @@ +approvers: +- fiunchinho +- tariq1890 +- mrueg +reviewers: +- fiunchinho +- tariq1890 +- mrueg diff --git a/testdata/local-charts/prometheus/charts/kube-state-metrics/README.md b/testdata/local-charts/prometheus/charts/kube-state-metrics/README.md new file mode 100644 index 0000000..8a27b55 --- /dev/null +++ b/testdata/local-charts/prometheus/charts/kube-state-metrics/README.md @@ -0,0 +1,80 @@ +# kube-state-metrics Helm Chart + +* Installs the [kube-state-metrics agent](https://github.com/kubernetes/kube-state-metrics). + +## Installing the Chart + +To install the chart with the release name `my-release`: + +```bash +$ helm install stable/kube-state-metrics +``` + +## Configuration + +| Parameter | Description | Default | +|:---------------------------------------------|:--------------------------------------------------------------------------------------|:-------------------------------------------| +| `image.repository` | The image repository to pull from | `quay.io/coreos/kube-state-metrics` | +| `image.tag` | The image tag to pull from | `v1.9.7` | +| `image.pullPolicy` | Image pull policy | `IfNotPresent` | +| `imagePullSecrets` | List of container registry secrets | `[]` | +| `replicas` | Number of replicas | `1` | +| `autosharding.enabled` | Set to `true` to automatically shard data across `replicas` pods. EXPERIMENTAL | `false` | +| `service.port` | The port of the container | `8080` | +| `service.annotations` | Annotations to be added to the service | `{}` | +| `customLabels` | Custom labels to apply to service, deployment and pods | `{}` | +| `hostNetwork` | Whether or not to use the host network | `false` | +| `prometheusScrape` | Whether or not enable prom scrape | `true` | +| `rbac.create` | If true, create & use RBAC resources | `true` | +| `serviceAccount.create` | If true, create & use serviceAccount | `true` | +| `serviceAccount.name` | If not set & create is true, use template fullname | | +| `serviceAccount.imagePullSecrets` | Specify image pull secrets field | `[]` | +| `serviceAccount.annotations` | Annotations to be added to the serviceAccount | `{}` | +| `podSecurityPolicy.enabled` | If true, create & use PodSecurityPolicy resources. Note that related RBACs are created only if `rbac.enabled` is `true`. | `false` | +| `podSecurityPolicy.annotations` | Specify pod annotations in the pod security policy | `{}` | +| `podSecurityPolicy.additionalVolumes` | Specify allowed volumes in the pod security policy (`secret` is always allowed) | `[]` | +| `securityContext.enabled` | Enable security context | `true` | +| `securityContext.fsGroup` | Group ID for the filesystem | `65534` | +| `securityContext.runAsGroup` | Group ID for the container | `65534` | +| `securityContext.runAsUser` | User ID for the container | `65534` | +| `priorityClassName` | Name of Priority Class to assign pods | `nil` | +| `nodeSelector` | Node labels for pod assignment | `{}` | +| `affinity` | Affinity settings for pod assignment | `{}` | +| `tolerations` | Tolerations for pod assignment | `[]` | +| `podAnnotations` | Annotations to be added to the pod | `{}` | +| `podDisruptionBudget` | Optional PodDisruptionBudget | `{}` | +| `resources` | kube-state-metrics resource requests and limits | `{}` | +| `collectors.certificatesigningrequests` | Enable the certificatesigningrequests collector. | `true` | +| `collectors.configmaps` | Enable the configmaps collector. | `true` | +| `collectors.cronjobs` | Enable the cronjobs collector. | `true` | +| `collectors.daemonsets` | Enable the daemonsets collector. | `true` | +| `collectors.deployments` | Enable the deployments collector. | `true` | +| `collectors.endpoints` | Enable the endpoints collector. | `true` | +| `collectors.horizontalpodautoscalers` | Enable the horizontalpodautoscalers collector. | `true` | +| `collectors.ingresses` | Enable the ingresses collector. | `true` | +| `collectors.jobs` | Enable the jobs collector. | `true` | +| `collectors.limitranges` | Enable the limitranges collector. | `true` | +| `collectors.mutatingwebhookconfigurations` | Enable the mutatingwebhookconfigurations collector. | `true` | +| `collectors.namespaces` | Enable the namespaces collector. | `true` | +| `collectors.networkpolicies` | Enable the networkpolicies collector. | `true` | +| `collectors.nodes` | Enable the nodes collector. | `true` | +| `collectors.persistentvolumeclaims` | Enable the persistentvolumeclaims collector. | `true` | +| `collectors.persistentvolumes` | Enable the persistentvolumes collector. | `true` | +| `collectors.poddisruptionbudgets` | Enable the poddisruptionbudgets collector. | `true` | +| `collectors.pods` | Enable the pods collector. | `true` | +| `collectors.replicasets` | Enable the replicasets collector. | `true` | +| `collectors.replicationcontrollers` | Enable the replicationcontrollers collector. | `true` | +| `collectors.resourcequotas` | Enable the resourcequotas collector. | `true` | +| `collectors.secrets` | Enable the secrets collector. | `true` | +| `collectors.services` | Enable the services collector. | `true` | +| `collectors.statefulsets` | Enable the statefulsets collector. | `true` | +| `collectors.storageclasses` | Enable the storageclasses collector. | `true` | +| `collectors.validatingwebhookconfigurations` | Enable the validatingwebhookconfigurations collector. | `true` | +| `collectors.verticalpodautoscalers` | Enable the verticalpodautoscalers collector. | `true` | +| `collectors.volumeattachments` | Enable the volumeattachments collector. | `true` | +| `prometheus.monitor.enabled` | Set this to `true` to create ServiceMonitor for Prometheus operator | `false` | +| `prometheus.monitor.additionalLabels` | Additional labels that can be used so ServiceMonitor will be discovered by Prometheus | `{}` | +| `prometheus.monitor.namespace` | Namespace where servicemonitor resource should be created | `the same namespace as kube-state-metrics` | +| `prometheus.monitor.honorLabels` | Honor metric labels | `false` | +| `namespaceOverride` | Override the deployment namespace | `""` (`Release.Namespace`) | +| `kubeTargetVersionOverride` | Override the k8s version of the target cluster | `""` | diff --git a/testdata/local-charts/prometheus/charts/kube-state-metrics/templates/NOTES.txt b/testdata/local-charts/prometheus/charts/kube-state-metrics/templates/NOTES.txt new file mode 100644 index 0000000..5a646e0 --- /dev/null +++ b/testdata/local-charts/prometheus/charts/kube-state-metrics/templates/NOTES.txt @@ -0,0 +1,10 @@ +kube-state-metrics is a simple service that listens to the Kubernetes API server and generates metrics about the state of the objects. +The exposed metrics can be found here: +https://github.com/kubernetes/kube-state-metrics/blob/master/docs/README.md#exposed-metrics + +The metrics are exported on the HTTP endpoint /metrics on the listening port. +In your case, {{ template "kube-state-metrics.fullname" . }}.{{ template "kube-state-metrics.namespace" . }}.svc.cluster.local:{{ .Values.service.port }}/metrics + +They are served either as plaintext or protobuf depending on the Accept header. +They are designed to be consumed either by Prometheus itself or by a scraper that is compatible with scraping a Prometheus client endpoint. + diff --git a/testdata/local-charts/prometheus/charts/kube-state-metrics/templates/_helpers.tpl b/testdata/local-charts/prometheus/charts/kube-state-metrics/templates/_helpers.tpl new file mode 100644 index 0000000..6ae0e64 --- /dev/null +++ b/testdata/local-charts/prometheus/charts/kube-state-metrics/templates/_helpers.tpl @@ -0,0 +1,47 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "kube-state-metrics.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "kube-state-metrics.fullname" -}} +{{- if .Values.fullnameOverride -}} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- if contains $name .Release.Name -}} +{{- .Release.Name | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} +{{- end -}} + +{{/* +Create the name of the service account to use +*/}} +{{- define "kube-state-metrics.serviceAccountName" -}} +{{- if .Values.serviceAccount.create -}} + {{ default (include "kube-state-metrics.fullname" .) .Values.serviceAccount.name }} +{{- else -}} + {{ default "default" .Values.serviceAccount.name }} +{{- end -}} +{{- end -}} + +{{/* +Allow the release namespace to be overridden for multi-namespace deployments in combined charts +*/}} +{{- define "kube-state-metrics.namespace" -}} + {{- if .Values.namespaceOverride -}} + {{- .Values.namespaceOverride -}} + {{- else -}} + {{- .Release.Namespace -}} + {{- end -}} +{{- end -}} diff --git a/testdata/local-charts/prometheus/charts/kube-state-metrics/templates/clusterrole.yaml b/testdata/local-charts/prometheus/charts/kube-state-metrics/templates/clusterrole.yaml new file mode 100644 index 0000000..319aec1 --- /dev/null +++ b/testdata/local-charts/prometheus/charts/kube-state-metrics/templates/clusterrole.yaml @@ -0,0 +1,180 @@ +{{- if .Values.rbac.create -}} +apiVersion: rbac.authorization.k8s.io/v1beta1 +kind: ClusterRole +metadata: + labels: + app.kubernetes.io/name: {{ template "kube-state-metrics.name" . }} + helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/instance: {{ .Release.Name }} + name: {{ template "kube-state-metrics.fullname" . }} +rules: +{{ if .Values.collectors.certificatesigningrequests }} +- apiGroups: ["certificates.k8s.io"] + resources: + - certificatesigningrequests + verbs: ["list", "watch"] +{{ end -}} +{{ if .Values.collectors.configmaps }} +- apiGroups: [""] + resources: + - configmaps + verbs: ["list", "watch"] +{{ end -}} +{{ if .Values.collectors.cronjobs }} +- apiGroups: ["batch"] + resources: + - cronjobs + verbs: ["list", "watch"] +{{ end -}} +{{ if .Values.collectors.daemonsets }} +- apiGroups: ["extensions", "apps"] + resources: + - daemonsets + verbs: ["list", "watch"] +{{ end -}} +{{ if .Values.collectors.deployments }} +- apiGroups: ["extensions", "apps"] + resources: + - deployments + verbs: ["list", "watch"] +{{ end -}} +{{ if .Values.collectors.endpoints }} +- apiGroups: [""] + resources: + - endpoints + verbs: ["list", "watch"] +{{ end -}} +{{ if .Values.collectors.horizontalpodautoscalers }} +- apiGroups: ["autoscaling"] + resources: + - horizontalpodautoscalers + verbs: ["list", "watch"] +{{ end -}} +{{ if .Values.collectors.ingresses }} +- apiGroups: ["extensions", "networking.k8s.io"] + resources: + - ingresses + verbs: ["list", "watch"] +{{ end -}} +{{ if .Values.collectors.jobs }} +- apiGroups: ["batch"] + resources: + - jobs + verbs: ["list", "watch"] +{{ end -}} +{{ if .Values.collectors.limitranges }} +- apiGroups: [""] + resources: + - limitranges + verbs: ["list", "watch"] +{{ end -}} +{{ if .Values.collectors.mutatingwebhookconfigurations }} +- apiGroups: ["admissionregistration.k8s.io"] + resources: + - mutatingwebhookconfigurations + verbs: ["list", "watch"] +{{ end -}} +{{ if .Values.collectors.namespaces }} +- apiGroups: [""] + resources: + - namespaces + verbs: ["list", "watch"] +{{ end -}} +{{ if .Values.collectors.networkpolicies }} +- apiGroups: ["networking.k8s.io"] + resources: + - networkpolicies + verbs: ["list", "watch"] +{{ end -}} +{{ if .Values.collectors.nodes }} +- apiGroups: [""] + resources: + - nodes + verbs: ["list", "watch"] +{{ end -}} +{{ if .Values.collectors.persistentvolumeclaims }} +- apiGroups: [""] + resources: + - persistentvolumeclaims + verbs: ["list", "watch"] +{{ end -}} +{{ if .Values.collectors.persistentvolumes }} +- apiGroups: [""] + resources: + - persistentvolumes + verbs: ["list", "watch"] +{{ end -}} +{{ if .Values.collectors.poddisruptionbudgets }} +- apiGroups: ["policy"] + resources: + - poddisruptionbudgets + verbs: ["list", "watch"] +{{ end -}} +{{ if .Values.collectors.pods }} +- apiGroups: [""] + resources: + - pods + verbs: ["list", "watch"] +{{ end -}} +{{ if .Values.collectors.replicasets }} +- apiGroups: ["extensions", "apps"] + resources: + - replicasets + verbs: ["list", "watch"] +{{ end -}} +{{ if .Values.collectors.replicationcontrollers }} +- apiGroups: [""] + resources: + - replicationcontrollers + verbs: ["list", "watch"] +{{ end -}} +{{ if .Values.collectors.resourcequotas }} +- apiGroups: [""] + resources: + - resourcequotas + verbs: ["list", "watch"] +{{ end -}} +{{ if .Values.collectors.secrets }} +- apiGroups: [""] + resources: + - secrets + verbs: ["list", "watch"] +{{ end -}} +{{ if .Values.collectors.services }} +- apiGroups: [""] + resources: + - services + verbs: ["list", "watch"] +{{ end -}} +{{ if .Values.collectors.statefulsets }} +- apiGroups: ["apps"] + resources: + - statefulsets + verbs: ["list", "watch"] +{{ end -}} +{{ if .Values.collectors.storageclasses }} +- apiGroups: ["storage.k8s.io"] + resources: + - storageclasses + verbs: ["list", "watch"] +{{ end -}} +{{ if .Values.collectors.validatingwebhookconfigurations }} +- apiGroups: ["admissionregistration.k8s.io"] + resources: + - validatingwebhookconfigurations + verbs: ["list", "watch"] +{{ end -}} +{{ if .Values.collectors.volumeattachments }} +- apiGroups: ["storage.k8s.io"] + resources: + - volumeattachments + verbs: ["list", "watch"] +{{ end -}} +{{ if .Values.collectors.verticalpodautoscalers }} +- apiGroups: ["autoscaling.k8s.io"] + resources: + - verticalpodautoscalers + verbs: ["list", "watch"] +{{ end -}} +{{- end -}} diff --git a/testdata/local-charts/prometheus/charts/kube-state-metrics/templates/clusterrolebinding.yaml b/testdata/local-charts/prometheus/charts/kube-state-metrics/templates/clusterrolebinding.yaml new file mode 100644 index 0000000..4635985 --- /dev/null +++ b/testdata/local-charts/prometheus/charts/kube-state-metrics/templates/clusterrolebinding.yaml @@ -0,0 +1,19 @@ +{{- if .Values.rbac.create -}} +apiVersion: rbac.authorization.k8s.io/v1beta1 +kind: ClusterRoleBinding +metadata: + labels: + app.kubernetes.io/name: {{ template "kube-state-metrics.name" . }} + helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/instance: {{ .Release.Name }} + name: {{ template "kube-state-metrics.fullname" . }} +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: {{ template "kube-state-metrics.fullname" . }} +subjects: +- kind: ServiceAccount + name: {{ template "kube-state-metrics.fullname" . }} + namespace: {{ template "kube-state-metrics.namespace" . }} +{{- end -}} diff --git a/testdata/local-charts/prometheus/charts/kube-state-metrics/templates/deployment.yaml b/testdata/local-charts/prometheus/charts/kube-state-metrics/templates/deployment.yaml new file mode 100644 index 0000000..9965604 --- /dev/null +++ b/testdata/local-charts/prometheus/charts/kube-state-metrics/templates/deployment.yaml @@ -0,0 +1,191 @@ +apiVersion: apps/v1 +{{- if .Values.autosharding.enabled }} +kind: StatefulSet +{{- else }} +kind: Deployment +{{- end }} +metadata: + name: {{ template "kube-state-metrics.fullname" . }} + namespace: {{ template "kube-state-metrics.namespace" . }} + labels: + app.kubernetes.io/name: {{ template "kube-state-metrics.name" . }} + helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + app.kubernetes.io/instance: "{{ .Release.Name }}" + app.kubernetes.io/managed-by: "{{ .Release.Service }}" +{{- if .Values.customLabels }} +{{ toYaml .Values.customLabels | indent 4 }} +{{- end }} +spec: + selector: + matchLabels: + app.kubernetes.io/name: {{ template "kube-state-metrics.name" . }} + replicas: {{ .Values.replicas }} +{{- if .Values.autosharding.enabled }} + serviceName: {{ template "kube-state-metrics.fullname" . }} + volumeClaimTemplates: [] +{{- end }} + template: + metadata: + labels: + app.kubernetes.io/name: {{ template "kube-state-metrics.name" . }} + app.kubernetes.io/instance: "{{ .Release.Name }}" +{{- if .Values.customLabels }} +{{ toYaml .Values.customLabels | indent 8 }} +{{- end }} +{{- if .Values.podAnnotations }} + annotations: +{{ toYaml .Values.podAnnotations | indent 8 }} +{{- end }} + spec: + hostNetwork: {{ .Values.hostNetwork }} + serviceAccountName: {{ template "kube-state-metrics.serviceAccountName" . }} + {{- if .Values.securityContext.enabled }} + securityContext: + fsGroup: {{ .Values.securityContext.fsGroup }} + runAsGroup: {{ .Values.securityContext.runAsGroup }} + runAsUser: {{ .Values.securityContext.runAsUser }} + {{- end }} + {{- if .Values.priorityClassName }} + priorityClassName: {{ .Values.priorityClassName }} + {{- end }} + containers: + - name: {{ .Chart.Name }} +{{- if .Values.autosharding.enabled }} + env: + - name: POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name + - name: POD_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace +{{- end }} + args: +{{ if .Values.collectors.certificatesigningrequests }} + - --collectors=certificatesigningrequests +{{ end }} +{{ if .Values.collectors.configmaps }} + - --collectors=configmaps +{{ end }} +{{ if .Values.collectors.cronjobs }} + - --collectors=cronjobs +{{ end }} +{{ if .Values.collectors.daemonsets }} + - --collectors=daemonsets +{{ end }} +{{ if .Values.collectors.deployments }} + - --collectors=deployments +{{ end }} +{{ if .Values.collectors.endpoints }} + - --collectors=endpoints +{{ end }} +{{ if .Values.collectors.horizontalpodautoscalers }} + - --collectors=horizontalpodautoscalers +{{ end }} +{{ if .Values.collectors.ingresses }} + - --collectors=ingresses +{{ end }} +{{ if .Values.collectors.jobs }} + - --collectors=jobs +{{ end }} +{{ if .Values.collectors.limitranges }} + - --collectors=limitranges +{{ end }} +{{ if .Values.collectors.mutatingwebhookconfigurations }} + - --collectors=mutatingwebhookconfigurations +{{ end }} +{{ if .Values.collectors.namespaces }} + - --collectors=namespaces +{{ end }} +{{ if .Values.collectors.networkpolicies }} + - --collectors=networkpolicies +{{ end }} +{{ if .Values.collectors.nodes }} + - --collectors=nodes +{{ end }} +{{ if .Values.collectors.persistentvolumeclaims }} + - --collectors=persistentvolumeclaims +{{ end }} +{{ if .Values.collectors.persistentvolumes }} + - --collectors=persistentvolumes +{{ end }} +{{ if .Values.collectors.poddisruptionbudgets }} + - --collectors=poddisruptionbudgets +{{ end }} +{{ if .Values.collectors.pods }} + - --collectors=pods +{{ end }} +{{ if .Values.collectors.replicasets }} + - --collectors=replicasets +{{ end }} +{{ if .Values.collectors.replicationcontrollers }} + - --collectors=replicationcontrollers +{{ end }} +{{ if .Values.collectors.resourcequotas }} + - --collectors=resourcequotas +{{ end }} +{{ if .Values.collectors.secrets }} + - --collectors=secrets +{{ end }} +{{ if .Values.collectors.services }} + - --collectors=services +{{ end }} +{{ if .Values.collectors.statefulsets }} + - --collectors=statefulsets +{{ end }} +{{ if .Values.collectors.storageclasses }} + - --collectors=storageclasses +{{ end }} +{{ if .Values.collectors.validatingwebhookconfigurations }} + - --collectors=validatingwebhookconfigurations +{{ end }} +{{ if .Values.collectors.verticalpodautoscalers }} + - --collectors=verticalpodautoscalers +{{ end }} +{{ if .Values.collectors.volumeattachments }} + - --collectors=volumeattachments +{{ end }} +{{ if .Values.namespace }} + - --namespace={{ .Values.namespace }} +{{ end }} +{{ if .Values.autosharding.enabled }} + - --pod=$(POD_NAME) + - --pod-namespace=$(POD_NAMESPACE) +{{ end }} + imagePullPolicy: {{ .Values.image.pullPolicy }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + ports: + - containerPort: 8080 + livenessProbe: + httpGet: + path: /healthz + port: 8080 + initialDelaySeconds: 5 + timeoutSeconds: 5 + readinessProbe: + httpGet: + path: / + port: 8080 + initialDelaySeconds: 5 + timeoutSeconds: 5 +{{- if .Values.resources }} + resources: +{{ toYaml .Values.resources | indent 10 }} +{{- end }} +{{- if .Values.imagePullSecrets }} + imagePullSecrets: +{{ toYaml .Values.imagePullSecrets | indent 8 }} +{{- end }} +{{- if .Values.affinity }} + affinity: +{{ toYaml .Values.affinity | indent 8 }} +{{- end }} +{{- if .Values.nodeSelector }} + nodeSelector: +{{ toYaml .Values.nodeSelector | indent 8 }} +{{- end }} +{{- if .Values.tolerations }} + tolerations: +{{ toYaml .Values.tolerations | indent 8 }} +{{- end }} diff --git a/testdata/local-charts/prometheus/charts/kube-state-metrics/templates/pdb.yaml b/testdata/local-charts/prometheus/charts/kube-state-metrics/templates/pdb.yaml new file mode 100644 index 0000000..6adb50d --- /dev/null +++ b/testdata/local-charts/prometheus/charts/kube-state-metrics/templates/pdb.yaml @@ -0,0 +1,17 @@ +{{- if .Values.podDisruptionBudget -}} +apiVersion: policy/v1beta1 +kind: PodDisruptionBudget +metadata: + name: {{ template "kube-state-metrics.fullname" . }} + namespace: {{ template "kube-state-metrics.namespace" . }} + labels: + app.kubernetes.io/name: {{ template "kube-state-metrics.name" . }} + helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + app.kubernetes.io/instance: "{{ .Release.Name }}" + app.kubernetes.io/managed-by: "{{ .Release.Service }}" +spec: + selector: + matchLabels: + app.kubernetes.io/name: {{ template "kube-state-metrics.name" . }} +{{ toYaml .Values.podDisruptionBudget | indent 2 }} +{{- end -}} \ No newline at end of file diff --git a/testdata/local-charts/prometheus/charts/kube-state-metrics/templates/podsecuritypolicy.yaml b/testdata/local-charts/prometheus/charts/kube-state-metrics/templates/podsecuritypolicy.yaml new file mode 100644 index 0000000..e822ba0 --- /dev/null +++ b/testdata/local-charts/prometheus/charts/kube-state-metrics/templates/podsecuritypolicy.yaml @@ -0,0 +1,42 @@ +{{- if .Values.podSecurityPolicy.enabled }} +apiVersion: policy/v1beta1 +kind: PodSecurityPolicy +metadata: + name: {{ template "kube-state-metrics.fullname" . }} + labels: + app.kubernetes.io/name: {{ template "kube-state-metrics.name" . }} + helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/instance: {{ .Release.Name }} +{{- if .Values.podSecurityPolicy.annotations }} + annotations: +{{ toYaml .Values.podSecurityPolicy.annotations | indent 4 }} +{{- end }} +spec: + privileged: false + volumes: + - 'secret' +{{- if .Values.podSecurityPolicy.additionalVolumes }} +{{ toYaml .Values.podSecurityPolicy.additionalVolumes | indent 4 }} +{{- end }} + hostNetwork: false + hostIPC: false + hostPID: false + runAsUser: + rule: 'MustRunAsNonRoot' + seLinux: + rule: 'RunAsAny' + supplementalGroups: + rule: 'MustRunAs' + ranges: + # Forbid adding the root group. + - min: 1 + max: 65535 + fsGroup: + rule: 'MustRunAs' + ranges: + # Forbid adding the root group. + - min: 1 + max: 65535 + readOnlyRootFilesystem: false +{{- end }} diff --git a/testdata/local-charts/prometheus/charts/kube-state-metrics/templates/psp-clusterrole.yaml b/testdata/local-charts/prometheus/charts/kube-state-metrics/templates/psp-clusterrole.yaml new file mode 100644 index 0000000..217abc9 --- /dev/null +++ b/testdata/local-charts/prometheus/charts/kube-state-metrics/templates/psp-clusterrole.yaml @@ -0,0 +1,22 @@ +{{- if and .Values.podSecurityPolicy.enabled .Values.rbac.create -}} +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + labels: + app.kubernetes.io/name: {{ template "kube-state-metrics.name" . }} + helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/instance: {{ .Release.Name }} + name: psp-{{ template "kube-state-metrics.fullname" . }} +rules: +{{- $kubeTargetVersion := default .Capabilities.KubeVersion.GitVersion .Values.kubeTargetVersionOverride }} +{{- if semverCompare "> 1.15.0-0" $kubeTargetVersion }} +- apiGroups: ['policy'] +{{- else }} +- apiGroups: ['extensions'] +{{- end }} + resources: ['podsecuritypolicies'] + verbs: ['use'] + resourceNames: + - {{ template "kube-state-metrics.fullname" . }} +{{- end }} diff --git a/testdata/local-charts/prometheus/charts/kube-state-metrics/templates/psp-clusterrolebinding.yaml b/testdata/local-charts/prometheus/charts/kube-state-metrics/templates/psp-clusterrolebinding.yaml new file mode 100644 index 0000000..feb97f2 --- /dev/null +++ b/testdata/local-charts/prometheus/charts/kube-state-metrics/templates/psp-clusterrolebinding.yaml @@ -0,0 +1,19 @@ +{{- if and .Values.podSecurityPolicy.enabled .Values.rbac.create -}} +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + labels: + app.kubernetes.io/name: {{ template "kube-state-metrics.name" . }} + helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/instance: {{ .Release.Name }} + name: psp-{{ template "kube-state-metrics.fullname" . }} +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: psp-{{ template "kube-state-metrics.fullname" . }} +subjects: + - kind: ServiceAccount + name: {{ template "kube-state-metrics.fullname" . }} + namespace: {{ template "kube-state-metrics.namespace" . }} +{{- end }} diff --git a/testdata/local-charts/prometheus/charts/kube-state-metrics/templates/service.yaml b/testdata/local-charts/prometheus/charts/kube-state-metrics/templates/service.yaml new file mode 100644 index 0000000..5dacf52 --- /dev/null +++ b/testdata/local-charts/prometheus/charts/kube-state-metrics/templates/service.yaml @@ -0,0 +1,36 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ template "kube-state-metrics.fullname" . }} + namespace: {{ template "kube-state-metrics.namespace" . }} + labels: + app.kubernetes.io/name: {{ template "kube-state-metrics.name" . }} + helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + app.kubernetes.io/instance: "{{ .Release.Name }}" + app.kubernetes.io/managed-by: "{{ .Release.Service }}" +{{- if .Values.customLabels }} +{{ toYaml .Values.customLabels | indent 4 }} +{{- end }} + annotations: + {{- if .Values.prometheusScrape }} + prometheus.io/scrape: '{{ .Values.prometheusScrape }}' + {{- end }} + {{- if .Values.service.annotations }} + {{- toYaml .Values.service.annotations | nindent 4 }} + {{- end }} +spec: + type: "{{ .Values.service.type }}" + ports: + - name: "http" + protocol: TCP + port: {{ .Values.service.port }} + {{- if .Values.service.nodePort }} + nodePort: {{ .Values.service.nodePort }} + {{- end }} + targetPort: 8080 +{{- if .Values.service.loadBalancerIP }} + loadBalancerIP: "{{ .Values.service.loadBalancerIP }}" +{{- end }} + selector: + app.kubernetes.io/name: {{ template "kube-state-metrics.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} diff --git a/testdata/local-charts/prometheus/charts/kube-state-metrics/templates/serviceaccount.yaml b/testdata/local-charts/prometheus/charts/kube-state-metrics/templates/serviceaccount.yaml new file mode 100644 index 0000000..2e8a1ee --- /dev/null +++ b/testdata/local-charts/prometheus/charts/kube-state-metrics/templates/serviceaccount.yaml @@ -0,0 +1,18 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + labels: + app.kubernetes.io/name: {{ template "kube-state-metrics.name" . }} + helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/instance: {{ .Release.Name }} + name: {{ template "kube-state-metrics.fullname" . }} + namespace: {{ template "kube-state-metrics.namespace" . }} +{{- if .Values.serviceAccount.annotations }} + annotations: +{{ toYaml .Values.serviceAccount.annotations | indent 4 }} +{{- end }} +imagePullSecrets: +{{ toYaml .Values.serviceAccount.imagePullSecrets | indent 2 }} +{{- end -}} diff --git a/testdata/local-charts/prometheus/charts/kube-state-metrics/templates/servicemonitor.yaml b/testdata/local-charts/prometheus/charts/kube-state-metrics/templates/servicemonitor.yaml new file mode 100644 index 0000000..54cde36 --- /dev/null +++ b/testdata/local-charts/prometheus/charts/kube-state-metrics/templates/servicemonitor.yaml @@ -0,0 +1,25 @@ +{{- if .Values.prometheus.monitor.enabled }} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ template "kube-state-metrics.fullname" . }} + namespace: {{ template "kube-state-metrics.namespace" . }} + labels: + app.kubernetes.io/name: {{ template "kube-state-metrics.name" . }} + helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + app.kubernetes.io/instance: "{{ .Release.Name }}" + app.kubernetes.io/managed-by: "{{ .Release.Service }}" + {{- if .Values.prometheus.monitor.additionalLabels }} +{{ toYaml .Values.prometheus.monitor.additionalLabels | indent 4 }} + {{- end }} +spec: + selector: + matchLabels: + app.kubernetes.io/name: {{ template "kube-state-metrics.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + endpoints: + - port: http + {{- if .Values.prometheus.monitor.honorLabels }} + honorLabels: true + {{- end }} +{{- end }} diff --git a/testdata/local-charts/prometheus/charts/kube-state-metrics/templates/stsdiscovery-role.yaml b/testdata/local-charts/prometheus/charts/kube-state-metrics/templates/stsdiscovery-role.yaml new file mode 100644 index 0000000..9770b04 --- /dev/null +++ b/testdata/local-charts/prometheus/charts/kube-state-metrics/templates/stsdiscovery-role.yaml @@ -0,0 +1,29 @@ +{{- if and .Values.autosharding.enabled .Values.rbac.create -}} +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + name: stsdiscovery-{{ template "kube-state-metrics.fullname" . }} + namespace: {{ template "kube-state-metrics.namespace" . }} + labels: + app.kubernetes.io/name: {{ template "kube-state-metrics.name" . }} + helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/instance: {{ .Release.Name }} +rules: +- apiGroups: + - "" + resources: + - pods + verbs: + - get +- apiGroups: + - apps + resourceNames: + - {{ template "kube-state-metrics.fullname" . }} + resources: + - statefulsets + verbs: + - get + - list + - watch +{{- end }} diff --git a/testdata/local-charts/prometheus/charts/kube-state-metrics/templates/stsdiscovery-rolebinding.yaml b/testdata/local-charts/prometheus/charts/kube-state-metrics/templates/stsdiscovery-rolebinding.yaml new file mode 100644 index 0000000..6a2e5bf --- /dev/null +++ b/testdata/local-charts/prometheus/charts/kube-state-metrics/templates/stsdiscovery-rolebinding.yaml @@ -0,0 +1,20 @@ +{{- if and .Values.autosharding.enabled .Values.rbac.create -}} +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: stsdiscovery-{{ template "kube-state-metrics.fullname" . }} + namespace: {{ template "kube-state-metrics.namespace" . }} + labels: + app.kubernetes.io/name: {{ template "kube-state-metrics.name" . }} + helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/instance: {{ .Release.Name }} +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: stsdiscovery-{{ template "kube-state-metrics.fullname" . }} +subjects: + - kind: ServiceAccount + name: {{ template "kube-state-metrics.fullname" . }} + namespace: {{ template "kube-state-metrics.namespace" . }} +{{- end }} diff --git a/testdata/local-charts/prometheus/charts/kube-state-metrics/values.yaml b/testdata/local-charts/prometheus/charts/kube-state-metrics/values.yaml new file mode 100644 index 0000000..92de8e2 --- /dev/null +++ b/testdata/local-charts/prometheus/charts/kube-state-metrics/values.yaml @@ -0,0 +1,155 @@ +# Default values for kube-state-metrics. +prometheusScrape: true +image: + repository: quay.io/coreos/kube-state-metrics + tag: v1.9.7 + pullPolicy: IfNotPresent + +imagePullSecrets: [] +# - name: "image-pull-secret" + +# If set to true, this will deploy kube-state-metrics as a StatefulSet and the data +# will be automatically sharded across <.Values.replicas> pods using the built-in +# autodiscovery feature: https://github.com/kubernetes/kube-state-metrics#automated-sharding +# This is an experimental feature and there are no stability guarantees. +autosharding: + enabled: false + +replicas: 1 + +service: + port: 8080 + # Default to clusterIP for backward compatibility + type: ClusterIP + nodePort: 0 + loadBalancerIP: "" + annotations: {} + +customLabels: {} + +hostNetwork: false + +rbac: + # If true, create & use RBAC resources + create: true + +serviceAccount: + # Specifies whether a ServiceAccount should be created, require rbac true + create: true + # The name of the ServiceAccount to use. + # If not set and create is true, a name is generated using the fullname template + name: + # Reference to one or more secrets to be used when pulling images + # ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ + imagePullSecrets: [] + # ServiceAccount annotations. + # Use case: AWS EKS IAM roles for service accounts + # ref: https://docs.aws.amazon.com/eks/latest/userguide/specify-service-account-role.html + annotations: {} + +prometheus: + monitor: + enabled: false + additionalLabels: {} + namespace: "" + honorLabels: false + +## Specify if a Pod Security Policy for kube-state-metrics must be created +## Ref: https://kubernetes.io/docs/concepts/policy/pod-security-policy/ +## +podSecurityPolicy: + enabled: false + annotations: {} + ## Specify pod annotations + ## Ref: https://kubernetes.io/docs/concepts/policy/pod-security-policy/#apparmor + ## Ref: https://kubernetes.io/docs/concepts/policy/pod-security-policy/#seccomp + ## Ref: https://kubernetes.io/docs/concepts/policy/pod-security-policy/#sysctl + ## + # seccomp.security.alpha.kubernetes.io/allowedProfileNames: '*' + # seccomp.security.alpha.kubernetes.io/defaultProfileName: 'docker/default' + # apparmor.security.beta.kubernetes.io/defaultProfileName: 'runtime/default' + + additionalVolumes: [] + +securityContext: + enabled: true + runAsGroup: 65534 + runAsUser: 65534 + fsGroup: 65534 + +## Node labels for pod assignment +## Ref: https://kubernetes.io/docs/user-guide/node-selection/ +nodeSelector: {} + +## Affinity settings for pod assignment +## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/ +affinity: {} + +## Tolerations for pod assignment +## Ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ +tolerations: [] + +# Annotations to be added to the pod +podAnnotations: {} + +## Assign a PriorityClassName to pods if set +# priorityClassName: "" + +# Ref: https://kubernetes.io/docs/tasks/run-application/configure-pdb/ +podDisruptionBudget: {} + +# Available collectors for kube-state-metrics. By default all available +# collectors are enabled. +collectors: + certificatesigningrequests: true + configmaps: true + cronjobs: true + daemonsets: true + deployments: true + endpoints: true + horizontalpodautoscalers: true + ingresses: true + jobs: true + limitranges: true + mutatingwebhookconfigurations: true + namespaces: true + networkpolicies: true + nodes: true + persistentvolumeclaims: true + persistentvolumes: true + poddisruptionbudgets: true + pods: true + replicasets: true + replicationcontrollers: true + resourcequotas: true + secrets: true + services: true + statefulsets: true + storageclasses: true + validatingwebhookconfigurations: true + verticalpodautoscalers: false + volumeattachments: true + +# Namespace to be enabled for collecting resources. By default all namespaces are collected. +# namespace: "" + +## Override the deployment namespace +## +namespaceOverride: "" + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 64Mi + # requests: + # cpu: 10m + # memory: 32Mi + +## Provide a k8s version to define apiGroups for podSecurityPolicy Cluster Role. +## For example: kubeTargetVersionOverride: 1.14.9 +## +kubeTargetVersionOverride: "" diff --git a/testdata/local-charts/prometheus/requirements.lock b/testdata/local-charts/prometheus/requirements.lock index 32226a9..7420282 100644 --- a/testdata/local-charts/prometheus/requirements.lock +++ b/testdata/local-charts/prometheus/requirements.lock @@ -1,6 +1,6 @@ dependencies: - name: kube-state-metrics - repository: https://kubernetes-charts.storage.googleapis.com/ - version: 2.7.2 -digest: sha256:acccb2876629d5abdfd3820b680b72762c53d92d638e31627029d2f5495c0659 -generated: "2020-04-28T20:11:07.057163311Z" + repository: https://charts.helm.sh/stable/ + version: 2.8.14 +digest: sha256:67c51ddbb467a21d3848cf065afa3dad2c1b5bc0d9d50fc778cc4950ff59e2eb +generated: "2020-10-31T22:24:57.310850353Z" diff --git a/testdata/local-charts/prometheus/requirements.yaml b/testdata/local-charts/prometheus/requirements.yaml new file mode 100644 index 0000000..ce98519 --- /dev/null +++ b/testdata/local-charts/prometheus/requirements.yaml @@ -0,0 +1,7 @@ +dependencies: + + - name: kube-state-metrics + version: "2.8.*" + repository: https://charts.helm.sh/stable/ + condition: kubeStateMetrics.enabled + diff --git a/testdata/local-charts/prometheus/templates/_helpers.tpl b/testdata/local-charts/prometheus/templates/_helpers.tpl index 140550a..d8e5ff3 100644 --- a/testdata/local-charts/prometheus/templates/_helpers.tpl +++ b/testdata/local-charts/prometheus/templates/_helpers.tpl @@ -192,6 +192,16 @@ Return the appropriate apiVersion for podsecuritypolicy. {{- print "policy/v1beta1" -}} {{- end -}} {{- end -}} +{{/* +Return the appropriate apiVersion for rbac. +*/}} +{{- define "rbac.apiVersion" -}} +{{- if .Capabilities.APIVersions.Has "rbac.authorization.k8s.io/v1" }} +{{- print "rbac.authorization.k8s.io/v1" -}} +{{- else -}} +{{- print "rbac.authorization.k8s.io/v1beta1" -}} +{{- end -}} +{{- end -}} {{/* Create the name of the service account to use for the alertmanager component @@ -236,3 +246,14 @@ Create the name of the service account to use for the server component {{ default "default" .Values.serviceAccounts.server.name }} {{- end -}} {{- end -}} + +{{/* +Define the prometheus.namespace template if set with forceNamespace or .Release.Namespace is set +*/}} +{{- define "prometheus.namespace" -}} +{{- if .Values.forceNamespace -}} +{{ printf "namespace: %s" .Values.forceNamespace }} +{{- else -}} +{{ printf "namespace: %s" .Release.Namespace }} +{{- end -}} +{{- end -}} diff --git a/testdata/local-charts/prometheus/templates/alertmanager-clusterrole.yaml b/testdata/local-charts/prometheus/templates/alertmanager/clusterrole.yaml similarity index 69% rename from testdata/local-charts/prometheus/templates/alertmanager-clusterrole.yaml rename to testdata/local-charts/prometheus/templates/alertmanager/clusterrole.yaml index 3cfc133..c732ff4 100644 --- a/testdata/local-charts/prometheus/templates/alertmanager-clusterrole.yaml +++ b/testdata/local-charts/prometheus/templates/alertmanager/clusterrole.yaml @@ -1,5 +1,5 @@ -{{- if and .Values.alertmanager.enabled .Values.rbac.create -}} -apiVersion: rbac.authorization.k8s.io/v1beta1 +{{- if and .Values.alertmanager.enabled .Values.rbac.create .Values.alertmanager.useClusterRole (not .Values.alertmanager.useExistingRole) -}} +apiVersion: {{ template "rbac.apiVersion" . }} kind: ClusterRole metadata: labels: diff --git a/testdata/local-charts/prometheus/templates/alertmanager-clusterrolebinding.yaml b/testdata/local-charts/prometheus/templates/alertmanager/clusterrolebinding.yaml similarity index 56% rename from testdata/local-charts/prometheus/templates/alertmanager-clusterrolebinding.yaml rename to testdata/local-charts/prometheus/templates/alertmanager/clusterrolebinding.yaml index 925afcd..6f13e98 100644 --- a/testdata/local-charts/prometheus/templates/alertmanager-clusterrolebinding.yaml +++ b/testdata/local-charts/prometheus/templates/alertmanager/clusterrolebinding.yaml @@ -1,5 +1,5 @@ -{{- if and .Values.alertmanager.enabled .Values.rbac.create -}} -apiVersion: rbac.authorization.k8s.io/v1beta1 +{{- if and .Values.alertmanager.enabled .Values.rbac.create .Values.alertmanager.useClusterRole -}} +apiVersion: {{ template "rbac.apiVersion" . }} kind: ClusterRoleBinding metadata: labels: @@ -8,9 +8,13 @@ metadata: subjects: - kind: ServiceAccount name: {{ template "prometheus.serviceAccountName.alertmanager" . }} - namespace: {{ .Release.Namespace }} +{{ include "prometheus.namespace" . | indent 4 }} roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole +{{- if (not .Values.alertmanager.useExistingRole) }} name: {{ template "prometheus.alertmanager.fullname" . }} +{{- else }} + name: {{ .Values.alertmanager.useExistingRole }} +{{- end }} {{- end }} diff --git a/testdata/local-charts/prometheus/templates/alertmanager-configmap.yaml b/testdata/local-charts/prometheus/templates/alertmanager/cm.yaml similarity index 92% rename from testdata/local-charts/prometheus/templates/alertmanager-configmap.yaml rename to testdata/local-charts/prometheus/templates/alertmanager/cm.yaml index 6f6efce..cb09bf0 100644 --- a/testdata/local-charts/prometheus/templates/alertmanager-configmap.yaml +++ b/testdata/local-charts/prometheus/templates/alertmanager/cm.yaml @@ -5,6 +5,7 @@ metadata: labels: {{- include "prometheus.alertmanager.labels" . | nindent 4 }} name: {{ template "prometheus.alertmanager.fullname" . }} +{{ include "prometheus.namespace" . | indent 2 }} data: {{- $root := . -}} {{- range $key, $value := .Values.alertmanagerFiles }} diff --git a/testdata/local-charts/prometheus/templates/alertmanager-deployment.yaml b/testdata/local-charts/prometheus/templates/alertmanager/deploy.yaml similarity index 92% rename from testdata/local-charts/prometheus/templates/alertmanager-deployment.yaml rename to testdata/local-charts/prometheus/templates/alertmanager/deploy.yaml index 0afb8f6..22c777f 100644 --- a/testdata/local-charts/prometheus/templates/alertmanager-deployment.yaml +++ b/testdata/local-charts/prometheus/templates/alertmanager/deploy.yaml @@ -2,9 +2,14 @@ apiVersion: {{ template "prometheus.deployment.apiVersion" . }} kind: Deployment metadata: +{{- if .Values.alertmanager.deploymentAnnotations }} + annotations: + {{ toYaml .Values.alertmanager.deploymentAnnotations | nindent 4 }} +{{- end }} labels: {{- include "prometheus.alertmanager.labels" . | nindent 4 }} name: {{ template "prometheus.alertmanager.fullname" . }} +{{ include "prometheus.namespace" . | indent 2 }} spec: selector: matchLabels: @@ -19,7 +24,7 @@ spec: metadata: {{- if .Values.alertmanager.podAnnotations }} annotations: -{{ toYaml .Values.alertmanager.podAnnotations | indent 8 }} + {{ toYaml .Values.alertmanager.podAnnotations | nindent 8 }} {{- end }} labels: {{- include "prometheus.alertmanager.labels" . | nindent 8 }} @@ -139,6 +144,11 @@ spec: persistentVolumeClaim: claimName: {{ if .Values.alertmanager.persistentVolume.existingClaim }}{{ .Values.alertmanager.persistentVolume.existingClaim }}{{- else }}{{ template "prometheus.alertmanager.fullname" . }}{{- end }} {{- else }} - emptyDir: {} + emptyDir: + {{- if .Values.alertmanager.emptyDir.sizeLimit }} + sizeLimit: {{ .Values.alertmanager.emptyDir.sizeLimit }} + {{- else }} + {} + {{- end -}} {{- end -}} {{- end }} diff --git a/testdata/local-charts/prometheus/templates/alertmanager-service-headless.yaml b/testdata/local-charts/prometheus/templates/alertmanager/headless-svc.yaml similarity index 95% rename from testdata/local-charts/prometheus/templates/alertmanager-service-headless.yaml rename to testdata/local-charts/prometheus/templates/alertmanager/headless-svc.yaml index 8d619e8..8c402c4 100644 --- a/testdata/local-charts/prometheus/templates/alertmanager-service-headless.yaml +++ b/testdata/local-charts/prometheus/templates/alertmanager/headless-svc.yaml @@ -12,6 +12,7 @@ metadata: {{ toYaml .Values.alertmanager.statefulSet.headless.labels | indent 4 }} {{- end }} name: {{ template "prometheus.alertmanager.fullname" . }}-headless +{{ include "prometheus.namespace" . | indent 2 }} spec: clusterIP: None ports: diff --git a/testdata/local-charts/prometheus/templates/alertmanager-ingress.yaml b/testdata/local-charts/prometheus/templates/alertmanager/ingress.yaml similarity index 96% rename from testdata/local-charts/prometheus/templates/alertmanager-ingress.yaml rename to testdata/local-charts/prometheus/templates/alertmanager/ingress.yaml index 9883054..b199b70 100644 --- a/testdata/local-charts/prometheus/templates/alertmanager-ingress.yaml +++ b/testdata/local-charts/prometheus/templates/alertmanager/ingress.yaml @@ -20,6 +20,7 @@ metadata: {{ $key }}: {{ $value }} {{- end }} name: {{ template "prometheus.alertmanager.fullname" . }} +{{ include "prometheus.namespace" . | indent 2 }} spec: rules: {{- range .Values.alertmanager.ingress.hosts }} diff --git a/testdata/local-charts/prometheus/templates/alertmanager-networkpolicy.yaml b/testdata/local-charts/prometheus/templates/alertmanager/netpol.yaml similarity index 92% rename from testdata/local-charts/prometheus/templates/alertmanager-networkpolicy.yaml rename to testdata/local-charts/prometheus/templates/alertmanager/netpol.yaml index 0bcbd27..e44ade6 100644 --- a/testdata/local-charts/prometheus/templates/alertmanager-networkpolicy.yaml +++ b/testdata/local-charts/prometheus/templates/alertmanager/netpol.yaml @@ -3,6 +3,7 @@ apiVersion: {{ template "prometheus.networkPolicy.apiVersion" . }} kind: NetworkPolicy metadata: name: {{ template "prometheus.alertmanager.fullname" . }} +{{ include "prometheus.namespace" . | indent 2 }} labels: {{- include "prometheus.alertmanager.labels" . | nindent 4 }} spec: diff --git a/testdata/local-charts/prometheus/templates/alertmanager-pdb.yaml b/testdata/local-charts/prometheus/templates/alertmanager/pdb.yaml similarity index 90% rename from testdata/local-charts/prometheus/templates/alertmanager-pdb.yaml rename to testdata/local-charts/prometheus/templates/alertmanager/pdb.yaml index c38df77..41a92f3 100644 --- a/testdata/local-charts/prometheus/templates/alertmanager-pdb.yaml +++ b/testdata/local-charts/prometheus/templates/alertmanager/pdb.yaml @@ -3,6 +3,7 @@ apiVersion: policy/v1beta1 kind: PodDisruptionBudget metadata: name: {{ template "prometheus.alertmanager.fullname" . }} +{{ include "prometheus.namespace" . | indent 2 }} labels: {{- include "prometheus.alertmanager.labels" . | nindent 4 }} spec: diff --git a/testdata/local-charts/prometheus/templates/alertmanager-podsecuritypolicy.yaml b/testdata/local-charts/prometheus/templates/alertmanager/psp.yaml similarity index 92% rename from testdata/local-charts/prometheus/templates/alertmanager-podsecuritypolicy.yaml rename to testdata/local-charts/prometheus/templates/alertmanager/psp.yaml index 70f8033..64fb130 100644 --- a/testdata/local-charts/prometheus/templates/alertmanager-podsecuritypolicy.yaml +++ b/testdata/local-charts/prometheus/templates/alertmanager/psp.yaml @@ -1,5 +1,4 @@ -{{- if .Values.rbac.create }} -{{- if .Values.podSecurityPolicy.enabled }} +{{- if and .Values.alertmanager.enabled .Values.rbac.create .Values.podSecurityPolicy.enabled }} apiVersion: {{ template "prometheus.podSecurityPolicy.apiVersion" . }} kind: PodSecurityPolicy metadata: @@ -45,4 +44,3 @@ spec: max: 65535 readOnlyRootFilesystem: true {{- end }} -{{- end }} diff --git a/testdata/local-charts/prometheus/templates/alertmanager-pvc.yaml b/testdata/local-charts/prometheus/templates/alertmanager/pvc.yaml similarity index 96% rename from testdata/local-charts/prometheus/templates/alertmanager-pvc.yaml rename to testdata/local-charts/prometheus/templates/alertmanager/pvc.yaml index 400aba5..4fdab16 100644 --- a/testdata/local-charts/prometheus/templates/alertmanager-pvc.yaml +++ b/testdata/local-charts/prometheus/templates/alertmanager/pvc.yaml @@ -11,6 +11,7 @@ metadata: labels: {{- include "prometheus.alertmanager.labels" . | nindent 4 }} name: {{ template "prometheus.alertmanager.fullname" . }} +{{ include "prometheus.namespace" . | indent 2 }} spec: accessModes: {{ toYaml .Values.alertmanager.persistentVolume.accessModes | indent 4 }} diff --git a/testdata/local-charts/prometheus/templates/alertmanager/role.yaml b/testdata/local-charts/prometheus/templates/alertmanager/role.yaml new file mode 100644 index 0000000..ce60eaf --- /dev/null +++ b/testdata/local-charts/prometheus/templates/alertmanager/role.yaml @@ -0,0 +1,24 @@ +{{- if and .Values.alertmanager.enabled .Values.rbac.create (eq .Values.alertmanager.useClusterRole false) (not .Values.alertmanager.useExistingRole) -}} +{{- range $.Values.alertmanager.namespaces }} +apiVersion: {{ template "rbac.apiVersion" . }} +kind: Role +metadata: + labels: + {{- include "prometheus.alertmanager.labels" $ | nindent 4 }} + name: {{ template "prometheus.alertmanager.fullname" $ }} + namespace: {{ . }} +rules: +{{- if $.Values.podSecurityPolicy.enabled }} + - apiGroups: + - extensions + resources: + - podsecuritypolicies + verbs: + - use + resourceNames: + - {{ template "prometheus.alertmanager.fullname" $ }} +{{- else }} + [] +{{- end }} +{{- end }} +{{- end }} diff --git a/testdata/local-charts/prometheus/templates/alertmanager/rolebinding.yaml b/testdata/local-charts/prometheus/templates/alertmanager/rolebinding.yaml new file mode 100644 index 0000000..906d652 --- /dev/null +++ b/testdata/local-charts/prometheus/templates/alertmanager/rolebinding.yaml @@ -0,0 +1,23 @@ +{{- if and .Values.alertmanager.enabled .Values.rbac.create (eq .Values.alertmanager.useClusterRole false) -}} +{{ range $.Values.alertmanager.namespaces }} +apiVersion: {{ template "rbac.apiVersion" . }} +kind: RoleBinding +metadata: + labels: + {{- include "prometheus.alertmanager.labels" $ | nindent 4 }} + name: {{ template "prometheus.alertmanager.fullname" $ }} + namespace: {{ . }} +subjects: + - kind: ServiceAccount + name: {{ template "prometheus.serviceAccountName.alertmanager" $ }} +{{ include "prometheus.namespace" $ | indent 4 }} +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role +{{- if (not $.Values.alertmanager.useExistingRole) }} + name: {{ template "prometheus.alertmanager.fullname" $ }} +{{- else }} + name: {{ $.Values.alertmanager.useExistingRole }} +{{- end }} +{{- end }} +{{ end }} diff --git a/testdata/local-charts/prometheus/templates/alertmanager-service.yaml b/testdata/local-charts/prometheus/templates/alertmanager/service.yaml similarity index 97% rename from testdata/local-charts/prometheus/templates/alertmanager-service.yaml rename to testdata/local-charts/prometheus/templates/alertmanager/service.yaml index 7919643..9edc9ac 100644 --- a/testdata/local-charts/prometheus/templates/alertmanager-service.yaml +++ b/testdata/local-charts/prometheus/templates/alertmanager/service.yaml @@ -12,6 +12,7 @@ metadata: {{ toYaml .Values.alertmanager.service.labels | indent 4 }} {{- end }} name: {{ template "prometheus.alertmanager.fullname" . }} +{{ include "prometheus.namespace" . | indent 2 }} spec: {{- if .Values.alertmanager.service.clusterIP }} clusterIP: {{ .Values.alertmanager.service.clusterIP }} diff --git a/testdata/local-charts/prometheus/templates/alertmanager-serviceaccount.yaml b/testdata/local-charts/prometheus/templates/alertmanager/serviceaccount.yaml similarity index 88% rename from testdata/local-charts/prometheus/templates/alertmanager-serviceaccount.yaml rename to testdata/local-charts/prometheus/templates/alertmanager/serviceaccount.yaml index d23fcb8..a5d996a 100644 --- a/testdata/local-charts/prometheus/templates/alertmanager-serviceaccount.yaml +++ b/testdata/local-charts/prometheus/templates/alertmanager/serviceaccount.yaml @@ -5,6 +5,7 @@ metadata: labels: {{- include "prometheus.alertmanager.labels" . | nindent 4 }} name: {{ template "prometheus.serviceAccountName.alertmanager" . }} +{{ include "prometheus.namespace" . | indent 2 }} annotations: {{ toYaml .Values.serviceAccounts.alertmanager.annotations | indent 4 }} {{- end -}} diff --git a/testdata/local-charts/prometheus/templates/alertmanager-statefulset.yaml b/testdata/local-charts/prometheus/templates/alertmanager/sts.yaml similarity index 84% rename from testdata/local-charts/prometheus/templates/alertmanager-statefulset.yaml rename to testdata/local-charts/prometheus/templates/alertmanager/sts.yaml index 8750e4d..c9a62ca 100644 --- a/testdata/local-charts/prometheus/templates/alertmanager-statefulset.yaml +++ b/testdata/local-charts/prometheus/templates/alertmanager/sts.yaml @@ -2,9 +2,17 @@ apiVersion: apps/v1 kind: StatefulSet metadata: +{{- if .Values.alertmanager.statefulSet.annotations }} + annotations: + {{ toYaml .Values.alertmanager.statefulSet.annotations | nindent 4 }} +{{- end }} labels: {{- include "prometheus.alertmanager.labels" . | nindent 4 }} + {{- if .Values.alertmanager.statefulSet.labels}} + {{ toYaml .Values.alertmanager.statefulSet.labels | nindent 4 }} + {{- end}} name: {{ template "prometheus.alertmanager.fullname" . }} +{{ include "prometheus.namespace" . | indent 2 }} spec: serviceName: {{ template "prometheus.alertmanager.fullname" . }}-headless selector: @@ -16,10 +24,13 @@ spec: metadata: {{- if .Values.alertmanager.podAnnotations }} annotations: -{{ toYaml .Values.alertmanager.podAnnotations | indent 8 }} + {{ toYaml .Values.alertmanager.podAnnotations | nindent 8 }} {{- end }} labels: {{- include "prometheus.alertmanager.labels" . | nindent 8 }} + {{- if .Values.alertmanager.podLabels}} + {{ toYaml .Values.alertmanager.podLabels | nindent 8 }} + {{- end}} spec: {{- if .Values.alertmanager.affinity }} affinity: @@ -55,6 +66,8 @@ spec: {{- range $n := until (.Values.alertmanager.replicaCount | int) }} - --cluster.peer={{ template "prometheus.alertmanager.fullname" $ }}-{{ $n }}.{{ template "prometheus.alertmanager.fullname" $ }}-headless:6783 {{- end }} + {{- else }} + - --cluster.listen-address= {{- end }} {{- range $key, $value := .Values.alertmanager.extraArgs }} - --{{ $key }}={{ $value }} @@ -65,6 +78,9 @@ spec: ports: - containerPort: 9093 + {{- if .Values.alertmanager.statefulSet.headless.enableMeshPeer }} + - containerPort: 6783 + {{- end }} readinessProbe: httpGet: path: {{ .Values.alertmanager.prefixURL }}/#/status @@ -117,8 +133,13 @@ spec: {{- end }} volumes: - name: config-volume + {{- if empty .Values.alertmanager.configFromSecret }} configMap: name: {{ if .Values.alertmanager.configMapOverrideName }}{{ .Release.Name }}-{{ .Values.alertmanager.configMapOverrideName }}{{- else }}{{ template "prometheus.alertmanager.fullname" . }}{{- end }} + {{- else }} + secret: + secretName: {{ .Values.alertmanager.configFromSecret }} + {{- end }} {{- range .Values.alertmanager.extraSecretMounts }} - name: {{ .name }} secret: @@ -147,6 +168,11 @@ spec: {{- end }} {{- else }} - name: storage-volume - emptyDir: {} + emptyDir: + {{- if .Values.alertmanager.emptyDir.sizeLimit }} + sizeLimit: {{ .Values.alertmanager.emptyDir.sizeLimit }} + {{- else }} + {} + {{- end -}} {{- end }} {{- end }} diff --git a/testdata/local-charts/prometheus/templates/node-exporter-daemonset.yaml b/testdata/local-charts/prometheus/templates/node-exporter/daemonset.yaml similarity index 91% rename from testdata/local-charts/prometheus/templates/node-exporter-daemonset.yaml rename to testdata/local-charts/prometheus/templates/node-exporter/daemonset.yaml index aee32da..89a4b95 100644 --- a/testdata/local-charts/prometheus/templates/node-exporter-daemonset.yaml +++ b/testdata/local-charts/prometheus/templates/node-exporter/daemonset.yaml @@ -9,6 +9,7 @@ metadata: labels: {{- include "prometheus.nodeExporter.labels" . | nindent 4 }} name: {{ template "prometheus.nodeExporter.fullname" . }} +{{ include "prometheus.namespace" . | indent 2 }} spec: selector: matchLabels: @@ -44,6 +45,9 @@ spec: args: - --path.procfs=/host/proc - --path.sysfs=/host/sys + {{- if .Values.nodeExporter.hostNetwork }} + - --web.listen-address=:{{ .Values.nodeExporter.service.hostPort }} + {{- end }} {{- range $key, $value := .Values.nodeExporter.extraArgs }} {{- if $value }} - --{{ $key }}={{ $value }} @@ -53,7 +57,11 @@ spec: {{- end }} ports: - name: metrics + {{- if .Values.nodeExporter.hostNetwork }} + containerPort: {{ .Values.nodeExporter.service.hostPort }} + {{- else }} containerPort: 9100 + {{- end }} hostPort: {{ .Values.nodeExporter.service.hostPort }} resources: {{ toYaml .Values.nodeExporter.resources | indent 12 }} diff --git a/testdata/local-charts/prometheus/templates/node-exporter-podsecuritypolicy.yaml b/testdata/local-charts/prometheus/templates/node-exporter/psp.yaml similarity index 91% rename from testdata/local-charts/prometheus/templates/node-exporter-podsecuritypolicy.yaml rename to testdata/local-charts/prometheus/templates/node-exporter/psp.yaml index 825794b..3d22fe0 100644 --- a/testdata/local-charts/prometheus/templates/node-exporter-podsecuritypolicy.yaml +++ b/testdata/local-charts/prometheus/templates/node-exporter/psp.yaml @@ -1,5 +1,4 @@ -{{- if and .Values.nodeExporter.enabled .Values.rbac.create }} -{{- if .Values.podSecurityPolicy.enabled }} +{{- if and .Values.nodeExporter.enabled .Values.rbac.create .Values.podSecurityPolicy.enabled }} apiVersion: {{ template "prometheus.podSecurityPolicy.apiVersion" . }} kind: PodSecurityPolicy metadata: @@ -52,4 +51,3 @@ spec: - min: 1 max: 65535 {{- end }} -{{- end }} diff --git a/testdata/local-charts/prometheus/templates/node-exporter-role.yaml b/testdata/local-charts/prometheus/templates/node-exporter/role.yaml similarity index 84% rename from testdata/local-charts/prometheus/templates/node-exporter-role.yaml rename to testdata/local-charts/prometheus/templates/node-exporter/role.yaml index 49a6874..d8ef3ed 100644 --- a/testdata/local-charts/prometheus/templates/node-exporter-role.yaml +++ b/testdata/local-charts/prometheus/templates/node-exporter/role.yaml @@ -1,12 +1,12 @@ {{- if and .Values.nodeExporter.enabled .Values.rbac.create }} {{- if or (default .Values.nodeExporter.podSecurityPolicy.enabled false) (.Values.podSecurityPolicy.enabled) }} -apiVersion: rbac.authorization.k8s.io/v1beta1 +apiVersion: {{ template "rbac.apiVersion" . }} kind: Role metadata: name: {{ template "prometheus.nodeExporter.fullname" . }} labels: {{- include "prometheus.nodeExporter.labels" . | nindent 4 }} - namespace: {{ .Release.Namespace }} +{{ include "prometheus.namespace" . | indent 2 }} rules: - apiGroups: ['extensions'] resources: ['podsecuritypolicies'] diff --git a/testdata/local-charts/prometheus/templates/node-exporter-rolebinding.yaml b/testdata/local-charts/prometheus/templates/node-exporter/rolebinding.yaml similarity index 77% rename from testdata/local-charts/prometheus/templates/node-exporter-rolebinding.yaml rename to testdata/local-charts/prometheus/templates/node-exporter/rolebinding.yaml index e56e5ff..06914b7 100644 --- a/testdata/local-charts/prometheus/templates/node-exporter-rolebinding.yaml +++ b/testdata/local-charts/prometheus/templates/node-exporter/rolebinding.yaml @@ -1,12 +1,12 @@ {{- if and .Values.nodeExporter.enabled .Values.rbac.create }} {{- if .Values.podSecurityPolicy.enabled }} -apiVersion: rbac.authorization.k8s.io/v1 +apiVersion: {{ template "rbac.apiVersion" . }} kind: RoleBinding metadata: name: {{ template "prometheus.nodeExporter.fullname" . }} labels: {{- include "prometheus.nodeExporter.labels" . | nindent 4 }} - namespace: {{ .Release.Namespace }} +{{ include "prometheus.namespace" . | indent 2 }} roleRef: kind: Role name: {{ template "prometheus.nodeExporter.fullname" . }} @@ -14,6 +14,6 @@ roleRef: subjects: - kind: ServiceAccount name: {{ template "prometheus.serviceAccountName.nodeExporter" . }} - namespace: {{ .Release.Namespace }} +{{ include "prometheus.namespace" . | indent 2 }} {{- end }} {{- end }} diff --git a/testdata/local-charts/prometheus/templates/node-exporter-serviceaccount.yaml b/testdata/local-charts/prometheus/templates/node-exporter/serviceaccount.yaml similarity index 88% rename from testdata/local-charts/prometheus/templates/node-exporter-serviceaccount.yaml rename to testdata/local-charts/prometheus/templates/node-exporter/serviceaccount.yaml index ee4d660..0cf91af 100644 --- a/testdata/local-charts/prometheus/templates/node-exporter-serviceaccount.yaml +++ b/testdata/local-charts/prometheus/templates/node-exporter/serviceaccount.yaml @@ -5,6 +5,7 @@ metadata: labels: {{- include "prometheus.nodeExporter.labels" . | nindent 4 }} name: {{ template "prometheus.serviceAccountName.nodeExporter" . }} +{{ include "prometheus.namespace" . | indent 2 }} annotations: {{ toYaml .Values.serviceAccounts.nodeExporter.annotations | indent 4 }} {{- end -}} diff --git a/testdata/local-charts/prometheus/templates/node-exporter-service.yaml b/testdata/local-charts/prometheus/templates/node-exporter/svc.yaml similarity index 83% rename from testdata/local-charts/prometheus/templates/node-exporter-service.yaml rename to testdata/local-charts/prometheus/templates/node-exporter/svc.yaml index 55c683b..26d1eaa 100644 --- a/testdata/local-charts/prometheus/templates/node-exporter-service.yaml +++ b/testdata/local-charts/prometheus/templates/node-exporter/svc.yaml @@ -12,6 +12,7 @@ metadata: {{ toYaml .Values.nodeExporter.service.labels | indent 4 }} {{- end }} name: {{ template "prometheus.nodeExporter.fullname" . }} +{{ include "prometheus.namespace" . | indent 2 }} spec: {{- if .Values.nodeExporter.service.clusterIP }} clusterIP: {{ .Values.nodeExporter.service.clusterIP }} @@ -31,9 +32,15 @@ spec: {{- end }} ports: - name: metrics + {{- if .Values.nodeExporter.hostNetwork }} + port: {{ .Values.nodeExporter.service.hostPort }} + protocol: TCP + targetPort: {{ .Values.nodeExporter.service.hostPort }} + {{- else }} port: {{ .Values.nodeExporter.service.servicePort }} protocol: TCP targetPort: 9100 + {{- end }} selector: {{- include "prometheus.nodeExporter.matchLabels" . | nindent 4 }} type: "{{ .Values.nodeExporter.service.type }}" diff --git a/testdata/local-charts/prometheus/templates/pushgateway-clusterrole.yaml b/testdata/local-charts/prometheus/templates/pushgateway/clusterrole.yaml similarity index 91% rename from testdata/local-charts/prometheus/templates/pushgateway-clusterrole.yaml rename to testdata/local-charts/prometheus/templates/pushgateway/clusterrole.yaml index f4393c9..76ecf05 100644 --- a/testdata/local-charts/prometheus/templates/pushgateway-clusterrole.yaml +++ b/testdata/local-charts/prometheus/templates/pushgateway/clusterrole.yaml @@ -1,5 +1,5 @@ {{- if and .Values.pushgateway.enabled .Values.rbac.create -}} -apiVersion: rbac.authorization.k8s.io/v1beta1 +apiVersion: {{ template "rbac.apiVersion" . }} kind: ClusterRole metadata: labels: diff --git a/testdata/local-charts/prometheus/templates/pushgateway-clusterrolebinding.yaml b/testdata/local-charts/prometheus/templates/pushgateway/clusterrolebinding.yaml similarity index 83% rename from testdata/local-charts/prometheus/templates/pushgateway-clusterrolebinding.yaml rename to testdata/local-charts/prometheus/templates/pushgateway/clusterrolebinding.yaml index bcbaccb..15770ee 100644 --- a/testdata/local-charts/prometheus/templates/pushgateway-clusterrolebinding.yaml +++ b/testdata/local-charts/prometheus/templates/pushgateway/clusterrolebinding.yaml @@ -1,5 +1,5 @@ {{- if and .Values.pushgateway.enabled .Values.rbac.create -}} -apiVersion: rbac.authorization.k8s.io/v1beta1 +apiVersion: {{ template "rbac.apiVersion" . }} kind: ClusterRoleBinding metadata: labels: @@ -8,7 +8,7 @@ metadata: subjects: - kind: ServiceAccount name: {{ template "prometheus.serviceAccountName.pushgateway" . }} - namespace: {{ .Release.Namespace }} +{{ include "prometheus.namespace" . | indent 4 }} roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole diff --git a/testdata/local-charts/prometheus/templates/pushgateway-deployment.yaml b/testdata/local-charts/prometheus/templates/pushgateway/deploy.yaml similarity index 91% rename from testdata/local-charts/prometheus/templates/pushgateway-deployment.yaml rename to testdata/local-charts/prometheus/templates/pushgateway/deploy.yaml index 8148ef4..114ea4e 100644 --- a/testdata/local-charts/prometheus/templates/pushgateway-deployment.yaml +++ b/testdata/local-charts/prometheus/templates/pushgateway/deploy.yaml @@ -2,9 +2,14 @@ apiVersion: {{ template "prometheus.deployment.apiVersion" . }} kind: Deployment metadata: +{{- if .Values.pushgateway.deploymentAnnotations }} + annotations: + {{ toYaml .Values.pushgateway.deploymentAnnotations | nindent 4 }} +{{- end }} labels: {{- include "prometheus.pushgateway.labels" . | nindent 4 }} name: {{ template "prometheus.pushgateway.fullname" . }} +{{ include "prometheus.namespace" . | indent 2 }} spec: selector: {{- if .Values.schedulerName }} @@ -22,10 +27,13 @@ spec: metadata: {{- if .Values.pushgateway.podAnnotations }} annotations: -{{ toYaml .Values.pushgateway.podAnnotations | indent 8 }} + {{ toYaml .Values.pushgateway.podAnnotations | nindent 8 }} {{- end }} labels: {{- include "prometheus.pushgateway.labels" . | nindent 8 }} + {{- if .Values.pushgateway.podLabels}} + {{ toYaml .Values.pushgateway.podLabels | nindent 8 }} + {{- end}} spec: serviceAccountName: {{ template "prometheus.serviceAccountName.pushgateway" . }} {{- if .Values.pushgateway.extraInitContainers }} diff --git a/testdata/local-charts/prometheus/templates/pushgateway-ingress.yaml b/testdata/local-charts/prometheus/templates/pushgateway/ingress.yaml similarity index 96% rename from testdata/local-charts/prometheus/templates/pushgateway-ingress.yaml rename to testdata/local-charts/prometheus/templates/pushgateway/ingress.yaml index 60c6d74..0c877d5 100644 --- a/testdata/local-charts/prometheus/templates/pushgateway-ingress.yaml +++ b/testdata/local-charts/prometheus/templates/pushgateway/ingress.yaml @@ -17,6 +17,7 @@ metadata: labels: {{- include "prometheus.pushgateway.labels" . | nindent 4 }} name: {{ template "prometheus.pushgateway.fullname" . }} +{{ include "prometheus.namespace" . | indent 2 }} spec: rules: {{- range .Values.pushgateway.ingress.hosts }} diff --git a/testdata/local-charts/prometheus/templates/pushgateway-networkpolicy.yaml b/testdata/local-charts/prometheus/templates/pushgateway/netpol.yaml similarity index 92% rename from testdata/local-charts/prometheus/templates/pushgateway-networkpolicy.yaml rename to testdata/local-charts/prometheus/templates/pushgateway/netpol.yaml index e8f6ab8..c8d1fb3 100644 --- a/testdata/local-charts/prometheus/templates/pushgateway-networkpolicy.yaml +++ b/testdata/local-charts/prometheus/templates/pushgateway/netpol.yaml @@ -3,6 +3,7 @@ apiVersion: {{ template "prometheus.networkPolicy.apiVersion" . }} kind: NetworkPolicy metadata: name: {{ template "prometheus.pushgateway.fullname" . }} +{{ include "prometheus.namespace" . | indent 2 }} labels: {{- include "prometheus.pushgateway.labels" . | nindent 4 }} spec: diff --git a/testdata/local-charts/prometheus/templates/pushgateway-pdb.yaml b/testdata/local-charts/prometheus/templates/pushgateway/pdb.yaml similarity index 89% rename from testdata/local-charts/prometheus/templates/pushgateway-pdb.yaml rename to testdata/local-charts/prometheus/templates/pushgateway/pdb.yaml index e9910a5..50beb48 100644 --- a/testdata/local-charts/prometheus/templates/pushgateway-pdb.yaml +++ b/testdata/local-charts/prometheus/templates/pushgateway/pdb.yaml @@ -3,6 +3,7 @@ apiVersion: policy/v1beta1 kind: PodDisruptionBudget metadata: name: {{ template "prometheus.pushgateway.fullname" . }} +{{ include "prometheus.namespace" . | indent 2 }} labels: {{- include "prometheus.pushgateway.labels" . | nindent 4 }} spec: diff --git a/testdata/local-charts/prometheus/templates/pushgateway-podsecuritypolicy.yaml b/testdata/local-charts/prometheus/templates/pushgateway/psp.yaml similarity index 91% rename from testdata/local-charts/prometheus/templates/pushgateway-podsecuritypolicy.yaml rename to testdata/local-charts/prometheus/templates/pushgateway/psp.yaml index dd3829d..1ca3267 100644 --- a/testdata/local-charts/prometheus/templates/pushgateway-podsecuritypolicy.yaml +++ b/testdata/local-charts/prometheus/templates/pushgateway/psp.yaml @@ -1,5 +1,4 @@ -{{- if .Values.rbac.create }} -{{- if .Values.podSecurityPolicy.enabled }} +{{- if and .Values.pushgateway.enabled .Values.rbac.create .Values.podSecurityPolicy.enabled }} apiVersion: {{ template "prometheus.podSecurityPolicy.apiVersion" . }} kind: PodSecurityPolicy metadata: @@ -41,4 +40,3 @@ spec: max: 65535 readOnlyRootFilesystem: true {{- end }} -{{- end }} diff --git a/testdata/local-charts/prometheus/templates/pushgateway-pvc.yaml b/testdata/local-charts/prometheus/templates/pushgateway/pvc.yaml similarity index 95% rename from testdata/local-charts/prometheus/templates/pushgateway-pvc.yaml rename to testdata/local-charts/prometheus/templates/pushgateway/pvc.yaml index ba16a37..227e7a9 100644 --- a/testdata/local-charts/prometheus/templates/pushgateway-pvc.yaml +++ b/testdata/local-charts/prometheus/templates/pushgateway/pvc.yaml @@ -10,6 +10,7 @@ metadata: labels: {{- include "prometheus.pushgateway.labels" . | nindent 4 }} name: {{ template "prometheus.pushgateway.fullname" . }} +{{ include "prometheus.namespace" . | indent 2 }} spec: accessModes: {{ toYaml .Values.pushgateway.persistentVolume.accessModes | indent 4 }} diff --git a/testdata/local-charts/prometheus/templates/pushgateway-service.yaml b/testdata/local-charts/prometheus/templates/pushgateway/service.yaml similarity index 96% rename from testdata/local-charts/prometheus/templates/pushgateway-service.yaml rename to testdata/local-charts/prometheus/templates/pushgateway/service.yaml index e84771d..f05f17c 100644 --- a/testdata/local-charts/prometheus/templates/pushgateway-service.yaml +++ b/testdata/local-charts/prometheus/templates/pushgateway/service.yaml @@ -12,6 +12,7 @@ metadata: {{ toYaml .Values.pushgateway.service.labels | indent 4}} {{- end }} name: {{ template "prometheus.pushgateway.fullname" . }} +{{ include "prometheus.namespace" . | indent 2 }} spec: {{- if .Values.pushgateway.service.clusterIP }} clusterIP: {{ .Values.pushgateway.service.clusterIP }} diff --git a/testdata/local-charts/prometheus/templates/pushgateway-serviceaccount.yaml b/testdata/local-charts/prometheus/templates/pushgateway/serviceaccount.yaml similarity index 88% rename from testdata/local-charts/prometheus/templates/pushgateway-serviceaccount.yaml rename to testdata/local-charts/prometheus/templates/pushgateway/serviceaccount.yaml index 2049c30..8c0b876 100644 --- a/testdata/local-charts/prometheus/templates/pushgateway-serviceaccount.yaml +++ b/testdata/local-charts/prometheus/templates/pushgateway/serviceaccount.yaml @@ -5,6 +5,7 @@ metadata: labels: {{- include "prometheus.pushgateway.labels" . | nindent 4 }} name: {{ template "prometheus.serviceAccountName.pushgateway" . }} +{{ include "prometheus.namespace" . | indent 2 }} annotations: {{ toYaml .Values.serviceAccounts.pushgateway.annotations | indent 4 }} {{- end -}} diff --git a/testdata/local-charts/prometheus/templates/server-clusterrole.yaml b/testdata/local-charts/prometheus/templates/server/clusterrole.yaml similarity index 81% rename from testdata/local-charts/prometheus/templates/server-clusterrole.yaml rename to testdata/local-charts/prometheus/templates/server/clusterrole.yaml index c0c0585..2520235 100644 --- a/testdata/local-charts/prometheus/templates/server-clusterrole.yaml +++ b/testdata/local-charts/prometheus/templates/server/clusterrole.yaml @@ -1,5 +1,5 @@ -{{- if and .Values.server.enabled .Values.rbac.create -}} -apiVersion: rbac.authorization.k8s.io/v1beta1 +{{- if and .Values.server.enabled .Values.rbac.create (empty .Values.server.useExistingClusterRoleName) -}} +apiVersion: {{ template "rbac.apiVersion" . }} kind: ClusterRole metadata: labels: @@ -33,6 +33,7 @@ rules: - watch - apiGroups: - "extensions" + - "networking.k8s.io" resources: - ingresses/status - ingresses diff --git a/testdata/local-charts/prometheus/templates/server-clusterrolebinding.yaml b/testdata/local-charts/prometheus/templates/server/clusterrolebinding.yaml similarity index 62% rename from testdata/local-charts/prometheus/templates/server-clusterrolebinding.yaml rename to testdata/local-charts/prometheus/templates/server/clusterrolebinding.yaml index 1196ce3..5a79611 100644 --- a/testdata/local-charts/prometheus/templates/server-clusterrolebinding.yaml +++ b/testdata/local-charts/prometheus/templates/server/clusterrolebinding.yaml @@ -1,5 +1,5 @@ -{{- if and .Values.server.enabled .Values.rbac.create -}} -apiVersion: rbac.authorization.k8s.io/v1beta1 +{{- if and .Values.server.enabled .Values.rbac.create (empty .Values.server.namespaces) (empty .Values.server.useExistingClusterRoleName) -}} +apiVersion: {{ template "rbac.apiVersion" . }} kind: ClusterRoleBinding metadata: labels: @@ -8,7 +8,7 @@ metadata: subjects: - kind: ServiceAccount name: {{ template "prometheus.serviceAccountName.server" . }} - namespace: {{ .Release.Namespace }} +{{ include "prometheus.namespace" . | indent 4 }} roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole diff --git a/testdata/local-charts/prometheus/templates/server-configmap.yaml b/testdata/local-charts/prometheus/templates/server/cm.yaml similarity index 98% rename from testdata/local-charts/prometheus/templates/server-configmap.yaml rename to testdata/local-charts/prometheus/templates/server/cm.yaml index ac79fdf..0838bb3 100644 --- a/testdata/local-charts/prometheus/templates/server-configmap.yaml +++ b/testdata/local-charts/prometheus/templates/server/cm.yaml @@ -6,6 +6,7 @@ metadata: labels: {{- include "prometheus.server.labels" . | nindent 4 }} name: {{ template "prometheus.server.fullname" . }} +{{ include "prometheus.namespace" . | indent 2 }} data: {{- $root := . -}} {{- range $key, $value := .Values.serverFiles }} diff --git a/testdata/local-charts/prometheus/templates/server-deployment.yaml b/testdata/local-charts/prometheus/templates/server/deploy.yaml similarity index 96% rename from testdata/local-charts/prometheus/templates/server-deployment.yaml rename to testdata/local-charts/prometheus/templates/server/deploy.yaml index 42e3fc9..bb039ee 100644 --- a/testdata/local-charts/prometheus/templates/server-deployment.yaml +++ b/testdata/local-charts/prometheus/templates/server/deploy.yaml @@ -5,11 +5,12 @@ kind: Deployment metadata: {{- if .Values.server.deploymentAnnotations }} annotations: -{{ toYaml .Values.server.deploymentAnnotations | indent 4 }} + {{ toYaml .Values.server.deploymentAnnotations | nindent 4 }} {{- end }} labels: {{- include "prometheus.server.labels" . | nindent 4 }} name: {{ template "prometheus.server.fullname" . }} +{{ include "prometheus.namespace" . | indent 2 }} spec: selector: matchLabels: @@ -24,7 +25,7 @@ spec: metadata: {{- if .Values.server.podAnnotations }} annotations: -{{ toYaml .Values.server.podAnnotations | indent 8 }} + {{ toYaml .Values.server.podAnnotations | nindent 8 }} {{- end }} labels: {{- include "prometheus.server.labels" . | nindent 8 }} @@ -103,6 +104,7 @@ spec: path: {{ .Values.server.prefixURL }}/-/ready port: 9090 initialDelaySeconds: {{ .Values.server.readinessProbeInitialDelay }} + periodSeconds: {{ .Values.server.readinessProbePeriodSeconds }} timeoutSeconds: {{ .Values.server.readinessProbeTimeout }} failureThreshold: {{ .Values.server.readinessProbeFailureThreshold }} successThreshold: {{ .Values.server.readinessProbeSuccessThreshold }} @@ -111,6 +113,7 @@ spec: path: {{ .Values.server.prefixURL }}/-/healthy port: 9090 initialDelaySeconds: {{ .Values.server.livenessProbeInitialDelay }} + periodSeconds: {{ .Values.server.livenessProbePeriodSeconds }} timeoutSeconds: {{ .Values.server.livenessProbeTimeout }} failureThreshold: {{ .Values.server.livenessProbeFailureThreshold }} successThreshold: {{ .Values.server.livenessProbeSuccessThreshold }} diff --git a/testdata/local-charts/prometheus/templates/server-service-headless.yaml b/testdata/local-charts/prometheus/templates/server/headless-svc.yaml similarity index 65% rename from testdata/local-charts/prometheus/templates/server-service-headless.yaml rename to testdata/local-charts/prometheus/templates/server/headless-svc.yaml index 3edc58c..d519f4e 100644 --- a/testdata/local-charts/prometheus/templates/server-service-headless.yaml +++ b/testdata/local-charts/prometheus/templates/server/headless-svc.yaml @@ -13,6 +13,7 @@ metadata: {{ toYaml .Values.server.statefulSet.headless.labels | indent 4 }} {{- end }} name: {{ template "prometheus.server.fullname" . }}-headless +{{ include "prometheus.namespace" . | indent 2 }} spec: clusterIP: None ports: @@ -20,6 +21,16 @@ spec: port: {{ .Values.server.statefulSet.headless.servicePort }} protocol: TCP targetPort: 9090 + {{- if .Values.server.statefulSet.headless.gRPC.enabled }} + - name: grpc + port: {{ .Values.server.statefulSet.headless.gRPC.servicePort }} + protocol: TCP + targetPort: 10901 + {{- if .Values.server.statefulSet.headless.gRPC.nodePort }} + nodePort: {{ .Values.server.statefulSet.headless.gRPC.nodePort }} + {{- end }} + {{- end }} + selector: {{- include "prometheus.server.matchLabels" . | nindent 4 }} {{- end -}} diff --git a/testdata/local-charts/prometheus/templates/server-ingress.yaml b/testdata/local-charts/prometheus/templates/server/ingress.yaml similarity index 96% rename from testdata/local-charts/prometheus/templates/server-ingress.yaml rename to testdata/local-charts/prometheus/templates/server/ingress.yaml index 16f0a2a..b3a51fa 100644 --- a/testdata/local-charts/prometheus/templates/server-ingress.yaml +++ b/testdata/local-charts/prometheus/templates/server/ingress.yaml @@ -21,6 +21,7 @@ metadata: {{ $key }}: {{ $value }} {{- end }} name: {{ template "prometheus.server.fullname" . }} +{{ include "prometheus.namespace" . | indent 2 }} spec: rules: {{- range .Values.server.ingress.hosts }} diff --git a/testdata/local-charts/prometheus/templates/server-networkpolicy.yaml b/testdata/local-charts/prometheus/templates/server/netpol.yaml similarity index 90% rename from testdata/local-charts/prometheus/templates/server-networkpolicy.yaml rename to testdata/local-charts/prometheus/templates/server/netpol.yaml index 9e10129..c8870e9 100644 --- a/testdata/local-charts/prometheus/templates/server-networkpolicy.yaml +++ b/testdata/local-charts/prometheus/templates/server/netpol.yaml @@ -4,6 +4,7 @@ apiVersion: {{ template "prometheus.networkPolicy.apiVersion" . }} kind: NetworkPolicy metadata: name: {{ template "prometheus.server.fullname" . }} +{{ include "prometheus.namespace" . | indent 2 }} labels: {{- include "prometheus.server.labels" . | nindent 4 }} spec: diff --git a/testdata/local-charts/prometheus/templates/server-pdb.yaml b/testdata/local-charts/prometheus/templates/server/pdb.yaml similarity index 89% rename from testdata/local-charts/prometheus/templates/server-pdb.yaml rename to testdata/local-charts/prometheus/templates/server/pdb.yaml index b2447fd..364cb5b 100644 --- a/testdata/local-charts/prometheus/templates/server-pdb.yaml +++ b/testdata/local-charts/prometheus/templates/server/pdb.yaml @@ -3,6 +3,7 @@ apiVersion: policy/v1beta1 kind: PodDisruptionBudget metadata: name: {{ template "prometheus.server.fullname" . }} +{{ include "prometheus.namespace" . | indent 2 }} labels: {{- include "prometheus.server.labels" . | nindent 4 }} spec: diff --git a/testdata/local-charts/prometheus/templates/server-podsecuritypolicy.yaml b/testdata/local-charts/prometheus/templates/server/psp.yaml similarity index 93% rename from testdata/local-charts/prometheus/templates/server-podsecuritypolicy.yaml rename to testdata/local-charts/prometheus/templates/server/psp.yaml index a0e15a3..e2b885f 100644 --- a/testdata/local-charts/prometheus/templates/server-podsecuritypolicy.yaml +++ b/testdata/local-charts/prometheus/templates/server/psp.yaml @@ -1,5 +1,4 @@ -{{- if .Values.rbac.create }} -{{- if .Values.podSecurityPolicy.enabled }} +{{- if and .Values.server.enabled .Values.rbac.create .Values.podSecurityPolicy.enabled }} apiVersion: {{ template "prometheus.podSecurityPolicy.apiVersion" . }} kind: PodSecurityPolicy metadata: @@ -50,4 +49,3 @@ spec: max: 65535 readOnlyRootFilesystem: false {{- end }} -{{- end }} diff --git a/testdata/local-charts/prometheus/templates/server-pvc.yaml b/testdata/local-charts/prometheus/templates/server/pvc.yaml similarity index 95% rename from testdata/local-charts/prometheus/templates/server-pvc.yaml rename to testdata/local-charts/prometheus/templates/server/pvc.yaml index 9d1cb37..fc40c32 100644 --- a/testdata/local-charts/prometheus/templates/server-pvc.yaml +++ b/testdata/local-charts/prometheus/templates/server/pvc.yaml @@ -12,6 +12,7 @@ metadata: labels: {{- include "prometheus.server.labels" . | nindent 4 }} name: {{ template "prometheus.server.fullname" . }} +{{ include "prometheus.namespace" . | indent 2 }} spec: accessModes: {{ toYaml .Values.server.persistentVolume.accessModes | indent 4 }} diff --git a/testdata/local-charts/prometheus/templates/server/rolebinding.yaml b/testdata/local-charts/prometheus/templates/server/rolebinding.yaml new file mode 100644 index 0000000..93ce3ee --- /dev/null +++ b/testdata/local-charts/prometheus/templates/server/rolebinding.yaml @@ -0,0 +1,20 @@ +{{- if and .Values.server.enabled .Values.rbac.create .Values.server.useExistingClusterRoleName .Values.server.namespaces -}} +{{ range $.Values.server.namespaces -}} +--- +apiVersion: {{ template "rbac.apiVersion" $ }} +kind: RoleBinding +metadata: + labels: + {{- include "prometheus.server.labels" $ | nindent 4 }} + name: {{ template "prometheus.server.fullname" $ }} + namespace: {{ . }} +subjects: + - kind: ServiceAccount + name: {{ template "prometheus.serviceAccountName.server" $ }} +{{ include "prometheus.namespace" $ | indent 4 }} +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: {{ $.Values.server.useExistingClusterRoleName }} +{{ end -}} +{{ end -}} diff --git a/testdata/local-charts/prometheus/templates/server-service.yaml b/testdata/local-charts/prometheus/templates/server/service.yaml similarity index 97% rename from testdata/local-charts/prometheus/templates/server-service.yaml rename to testdata/local-charts/prometheus/templates/server/service.yaml index 6ecfc71..68f9889 100644 --- a/testdata/local-charts/prometheus/templates/server-service.yaml +++ b/testdata/local-charts/prometheus/templates/server/service.yaml @@ -12,6 +12,7 @@ metadata: {{ toYaml .Values.server.service.labels | indent 4 }} {{- end }} name: {{ template "prometheus.server.fullname" . }} +{{ include "prometheus.namespace" . | indent 2 }} spec: {{- if .Values.server.service.clusterIP }} clusterIP: {{ .Values.server.service.clusterIP }} diff --git a/testdata/local-charts/prometheus/templates/server-serviceaccount.yaml b/testdata/local-charts/prometheus/templates/server/serviceaccount.yaml similarity index 87% rename from testdata/local-charts/prometheus/templates/server-serviceaccount.yaml rename to testdata/local-charts/prometheus/templates/server/serviceaccount.yaml index 9ca20b2..9c0502a 100644 --- a/testdata/local-charts/prometheus/templates/server-serviceaccount.yaml +++ b/testdata/local-charts/prometheus/templates/server/serviceaccount.yaml @@ -6,6 +6,7 @@ metadata: labels: {{- include "prometheus.server.labels" . | nindent 4 }} name: {{ template "prometheus.serviceAccountName.server" . }} +{{ include "prometheus.namespace" . | indent 2 }} annotations: {{ toYaml .Values.serviceAccounts.server.annotations | indent 4 }} {{- end }} diff --git a/testdata/local-charts/prometheus/templates/server-statefulset.yaml b/testdata/local-charts/prometheus/templates/server/sts.yaml similarity index 86% rename from testdata/local-charts/prometheus/templates/server-statefulset.yaml rename to testdata/local-charts/prometheus/templates/server/sts.yaml index d027032..cc0bd86 100644 --- a/testdata/local-charts/prometheus/templates/server-statefulset.yaml +++ b/testdata/local-charts/prometheus/templates/server/sts.yaml @@ -5,7 +5,7 @@ kind: StatefulSet metadata: {{- if .Values.server.statefulSet.annotations }} annotations: -{{ toYaml .Values.server.statefulSet.annotations | indent 4 }} + {{ toYaml .Values.server.statefulSet.annotations | nindent 4 }} {{- end }} labels: {{- include "prometheus.server.labels" . | nindent 4 }} @@ -13,6 +13,7 @@ metadata: {{ toYaml .Values.server.statefulSet.labels | nindent 4 }} {{- end}} name: {{ template "prometheus.server.fullname" . }} +{{ include "prometheus.namespace" . | indent 2 }} spec: serviceName: {{ template "prometheus.server.fullname" . }}-headless selector: @@ -24,12 +25,12 @@ spec: metadata: {{- if .Values.server.podAnnotations }} annotations: -{{ toYaml .Values.server.podAnnotations | indent 8 }} + {{ toYaml .Values.server.podAnnotations | nindent 8 }} {{- end }} labels: {{- include "prometheus.server.labels" . | nindent 8 }} - {{- if .Values.server.statefulSet.labels}} - {{ toYaml .Values.server.statefulSet.labels | nindent 8 }} + {{- if .Values.server.podLabels}} + {{ toYaml .Values.server.podLabels | nindent 8 }} {{- end}} spec: {{- if .Values.server.priorityClassName }} @@ -37,8 +38,19 @@ spec: {{- end }} {{- if .Values.server.schedulerName }} schedulerName: "{{ .Values.server.schedulerName }}" +{{- end }} +{{- if semverCompare ">=1.13-0" .Capabilities.KubeVersion.GitVersion }} + {{- if or (.Values.server.enableServiceLinks) (eq (.Values.server.enableServiceLinks | toString) "") }} + enableServiceLinks: true + {{- else }} + enableServiceLinks: false + {{- end }} {{- end }} serviceAccountName: {{ template "prometheus.serviceAccountName.server" . }} + {{- if .Values.server.extraInitContainers }} + initContainers: +{{ toYaml .Values.server.extraInitContainers | indent 8 }} + {{- end }} containers: {{- if .Values.configmapReload.prometheus.enabled }} - name: {{ template "prometheus.name" . }}-{{ .Values.server.name }}-{{ .Values.configmapReload.prometheus.name }} @@ -97,13 +109,19 @@ spec: path: {{ .Values.server.prefixURL }}/-/ready port: 9090 initialDelaySeconds: {{ .Values.server.readinessProbeInitialDelay }} + periodSeconds: {{ .Values.server.readinessProbePeriodSeconds }} timeoutSeconds: {{ .Values.server.readinessProbeTimeout }} + failureThreshold: {{ .Values.server.readinessProbeFailureThreshold }} + successThreshold: {{ .Values.server.readinessProbeSuccessThreshold }} livenessProbe: httpGet: path: {{ .Values.server.prefixURL }}/-/healthy port: 9090 initialDelaySeconds: {{ .Values.server.livenessProbeInitialDelay }} + periodSeconds: {{ .Values.server.livenessProbePeriodSeconds }} timeoutSeconds: {{ .Values.server.livenessProbeTimeout }} + failureThreshold: {{ .Values.server.livenessProbeFailureThreshold }} + successThreshold: {{ .Values.server.livenessProbeSuccessThreshold }} resources: {{ toYaml .Values.server.resources | indent 12 }} volumeMounts: @@ -216,7 +234,12 @@ spec: {{- end }} {{- else }} - name: storage-volume - emptyDir: {} + emptyDir: + {{- if .Values.server.emptyDir.sizeLimit }} + sizeLimit: {{ .Values.server.emptyDir.sizeLimit }} + {{- else }} + {} + {{- end -}} {{- end }} {{- end }} {{- end }} diff --git a/testdata/local-charts/prometheus/templates/server-vpa.yaml b/testdata/local-charts/prometheus/templates/server/vpa.yaml similarity index 94% rename from testdata/local-charts/prometheus/templates/server-vpa.yaml rename to testdata/local-charts/prometheus/templates/server/vpa.yaml index ef3604e..8f55b9b 100644 --- a/testdata/local-charts/prometheus/templates/server-vpa.yaml +++ b/testdata/local-charts/prometheus/templates/server/vpa.yaml @@ -6,6 +6,7 @@ metadata: labels: {{- include "prometheus.server.labels" . | nindent 4 }} name: {{ template "prometheus.server.fullname" . }}-vpa +{{ include "prometheus.namespace" . | indent 2 }} spec: targetRef: {{- if .Values.server.statefulSet.enabled }} diff --git a/testdata/local-charts/prometheus/values.yaml b/testdata/local-charts/prometheus/values.yaml index c16a2f4..fa2f40a 100644 --- a/testdata/local-charts/prometheus/values.yaml +++ b/testdata/local-charts/prometheus/values.yaml @@ -32,6 +32,14 @@ alertmanager: ## enabled: true + ## Use a ClusterRole (and ClusterRoleBinding) + ## - If set to false - we define a Role and RoleBinding in the defined namespaces ONLY + ## This makes alertmanager work - for users who do not have ClusterAdmin privs, but wants alertmanager to operate on their own namespaces, instead of clusterwide. + useClusterRole: true + + ## Set to a rolename to use existing role - skipping role creating - but still doing serviceaccount and rolebinding to the rolename set here. + useExistingRole: false + ## alertmanager container name ## name: alertmanager @@ -40,7 +48,7 @@ alertmanager: ## image: repository: prom/alertmanager - tag: v0.20.0 + tag: v0.21.0 pullPolicy: IfNotPresent ## alertmanager priorityClassName @@ -216,6 +224,11 @@ alertmanager: ## subPath: "" + emptyDir: + ## alertmanager emptyDir volume size limit + ## + sizeLimit: "" + ## Annotations to be added to alertmanager pods ## podAnnotations: {} @@ -247,12 +260,18 @@ alertmanager: ## replicaCount: 1 + ## Annotations to be added to deployment + ## + deploymentAnnotations: {} + statefulSet: ## If true, use a statefulset instead of a deployment for pod management. ## This allows to scale replicas to more than 1 pod ## enabled: false + annotations: {} + labels: {} podManagementPolicy: OrderedReady ## Alertmanager headless service to use for the statefulset @@ -263,7 +282,7 @@ alertmanager: ## Enabling peer mesh service end points for enabling the HA alert manager ## Ref: https://github.com/prometheus/alertmanager/blob/master/README.md - # enableMeshPeer : true + enableMeshPeer: false servicePort: 80 @@ -324,7 +343,7 @@ configmapReload: ## image: repository: jimmidyson/configmap-reload - tag: v0.3.0 + tag: v0.4.0 pullPolicy: IfNotPresent ## Additional configmap-reload container arguments @@ -362,7 +381,7 @@ configmapReload: ## image: repository: jimmidyson/configmap-reload - tag: v0.3.0 + tag: v0.4.0 pullPolicy: IfNotPresent ## Additional configmap-reload container arguments @@ -419,7 +438,7 @@ nodeExporter: ## image: repository: prom/node-exporter - tag: v0.18.1 + tag: v1.0.1 pullPolicy: IfNotPresent ## Specify if a Pod Security Policy for node-exporter must be created @@ -538,6 +557,21 @@ server: ## Prometheus server container name ## enabled: true + + ## Use a ClusterRole (and ClusterRoleBinding) + ## - If set to false - we define a RoleBinding in the defined namespaces ONLY + ## + ## NB: because we need a Role with nonResourceURL's ("/metrics") - you must get someone with Cluster-admin privileges to define this role for you, before running with this setting enabled. + ## This makes prometheus work - for users who do not have ClusterAdmin privs, but wants prometheus to operate on their own namespaces, instead of clusterwide. + ## + ## You MUST also set namespaces to the ones you have access to and want monitored by Prometheus. + ## + # useExistingClusterRoleName: nameofclusterrole + + ## namespaces to monitor (instead of monitoring all - clusterwide). Needed if you want to run without Cluster-admin privileges. + # namespaces: + # - yournamespace + name: server sidecarContainers: @@ -545,19 +579,25 @@ server: ## image: repository: prom/prometheus - tag: v2.16.0 + tag: v2.21.0 pullPolicy: IfNotPresent ## prometheus server priorityClassName ## priorityClassName: "" + ## EnableServiceLinks indicates whether information about services should be injected + ## into pod's environment variables, matching the syntax of Docker links. + ## WARNING: the field is unsupported and will be skipped in K8s prior to v1.13.0. + ## + enableServiceLinks: true + ## The URL prefix at which the container can be accessed. Useful in the case the '-web.external-url' includes a slug ## so that the various internal URLs are still able to access as they are in the default case. ## (Optional) prefixURL: "" - ## External URL which can access alertmanager + ## External URL which can access prometheus ## Maybe same with Ingress host name baseURL: "" @@ -605,10 +645,10 @@ server: evaluation_interval: 1m ## https://prometheus.io/docs/prometheus/latest/configuration/configuration/#remote_write ## - remoteWrite: {} + remoteWrite: [] ## https://prometheus.io/docs/prometheus/latest/configuration/configuration/#remote_read ## - remoteRead: {} + remoteRead: [] ## Additional Prometheus server container arguments ## @@ -786,6 +826,8 @@ server: subPath: "" emptyDir: + ## Prometheus server emptyDir volume size limit + ## sizeLimit: "" ## Annotations to be added to Prometheus server pods @@ -819,6 +861,10 @@ server: ## replicaCount: 1 + ## Annotations to be added to deployment + ## + deploymentAnnotations: {} + statefulSet: ## If true, use a statefulset instead of a deployment for pod management. ## This allows to scale replicas to more than 1 pod @@ -835,15 +881,22 @@ server: annotations: {} labels: {} servicePort: 80 + ## Enable gRPC port on service to allow auto discovery with thanos-querier + gRPC: + enabled: false + servicePort: 10901 + # nodePort: 10901 ## Prometheus server readiness and liveness probe initial delay and timeout ## Ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/ ## readinessProbeInitialDelay: 30 + readinessProbePeriodSeconds: 5 readinessProbeTimeout: 30 readinessProbeFailureThreshold: 3 readinessProbeSuccessThreshold: 1 livenessProbeInitialDelay: 30 + livenessProbePeriodSeconds: 15 livenessProbeTimeout: 30 livenessProbeFailureThreshold: 3 livenessProbeSuccessThreshold: 1 @@ -931,7 +984,7 @@ pushgateway: ## image: repository: prom/pushgateway - tag: v1.0.1 + tag: v1.2.0 pullPolicy: IfNotPresent ## pushgateway priorityClassName @@ -998,6 +1051,10 @@ pushgateway: ## podAnnotations: {} + ## Labels to be added to pushgateway pods + ## + podLabels: {} + ## Specify if a Pod Security Policy for node-exporter must be created ## Ref: https://kubernetes.io/docs/concepts/policy/pod-security-policy/ ## @@ -1014,6 +1071,10 @@ pushgateway: replicaCount: 1 + ## Annotations to be added to deployment + ## + deploymentAnnotations: {} + ## PodDisruptionBudget settings ## ref: https://kubernetes.io/docs/concepts/workloads/pods/disruptions/ ## @@ -1060,7 +1121,6 @@ pushgateway: persistentVolume: ## If true, pushgateway will create/use a Persistent Volume Claim - ## If false, use emptyDir ## enabled: false @@ -1467,6 +1527,9 @@ serverFiles: - source_labels: [__meta_kubernetes_pod_name] action: replace target_label: kubernetes_pod_name + - source_labels: [__meta_kubernetes_pod_phase] + regex: Pending|Succeeded|Failed + action: drop # Example Scrape config for pods which should be scraped slower. An useful example # would be stackriver-exporter which querys an API on every scrape of the pod @@ -1506,6 +1569,9 @@ serverFiles: - source_labels: [__meta_kubernetes_pod_name] action: replace target_label: kubernetes_pod_name + - source_labels: [__meta_kubernetes_pod_phase] + regex: Pending|Succeeded|Failed + action: drop # adds additional scrape configs to prometheus.yml # must be a string so you have to add a | after extraScrapeConfigs: @@ -1538,3 +1604,6 @@ networkPolicy: ## Enable creation of NetworkPolicy resources. ## enabled: false + +# Force namespace of namespaced resources +forceNamespace: null