diff --git a/charts/k8s-image-availability-exporter/Chart.yaml b/charts/k8s-image-availability-exporter/Chart.yaml index 01a8205..2f643c0 100644 --- a/charts/k8s-image-availability-exporter/Chart.yaml +++ b/charts/k8s-image-availability-exporter/Chart.yaml @@ -2,5 +2,8 @@ apiVersion: v1 appVersion: "v0.5.1" description: Application for monitoring the cluster workloads image presence in a container registry. name: k8s-image-availability-exporter -version: "0.8.0" +version: "0.9.0" kubeVersion: ">=1.14.0-0" +maintainers: +- name: nabokihms + email: max.nabokih@gmail.com diff --git a/charts/k8s-image-availability-exporter/README.md b/charts/k8s-image-availability-exporter/README.md index acc23bf..d06e0e2 100644 --- a/charts/k8s-image-availability-exporter/README.md +++ b/charts/k8s-image-availability-exporter/README.md @@ -1,6 +1,6 @@ # k8s-image-availability-exporter -![Version: 0.8.0](https://img.shields.io/badge/Version-0.8.0-informational?style=flat-square) ![AppVersion: v0.5.1](https://img.shields.io/badge/AppVersion-v0.5.1-informational?style=flat-square) +![Version: 0.9.0](https://img.shields.io/badge/Version-0.9.0-informational?style=flat-square) ![AppVersion: v0.5.1](https://img.shields.io/badge/AppVersion-v0.5.1-informational?style=flat-square) Application for monitoring the cluster workloads image presence in a container registry. @@ -12,6 +12,12 @@ Kubernetes: `>=1.14.0-0` This chart bootstraps a [k8s-image-availability-exporter](https://github.com/flant/k8s-image-availability-exporter) deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager. +## Maintainers + +| Name | Email | Url | +| ---- | ------ | --- | +| nabokihms | | | + ## Values | Key | Type | Default | Description | @@ -34,8 +40,18 @@ This chart bootstraps a [k8s-image-availability-exporter](https://github.com/fla | podDisruptionBudget.maxUnavailable | int/percentage | `nil` | Number or percentage of pods that can be unavailable. | | priorityClassName | string | `""` | Specify a priority class name to set [pod priority](https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption/#pod-priority). | | resources | object | No requests or limits. | Container resource [requests and limits](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/). See the [API reference](https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#resources) for details. | -| serviceMonitor.enabled | bool | `false` | Create [Prometheus Operator](https://github.com/coreos/prometheus-operator) serviceMonitor resource | -| serviceMonitor.interval | string | `"15s"` | Scrape interval for serviceMonitor | +| serviceMonitor.enabled | bool | `false` | Enable Prometheus ServiceMonitor. See the [documentation](https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/design.md#servicemonitor) and the [API reference](https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#servicemonitor) for details. | +| serviceMonitor.namespace | string | Release namespace. | Namespace where the ServiceMonitor resource should be deployed. | +| serviceMonitor.interval | duration | `"15s"` | Prometheus scrape interval. | +| serviceMonitor.scrapeTimeout | duration | `nil` | Prometheus scrape timeout. | +| serviceMonitor.labels | object | `{}` | Labels to be added to the ServiceMonitor. # ref: https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#prometheusspec | +| serviceMonitor.annotations | object | `{}` | Annotations to be added to the ServiceMonitor. # ref: https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#prometheusspec | +| serviceMonitor.scheme | string | `""` | HTTP scheme to use for scraping. Can be used with `tlsConfig` for example if using istio mTLS. | +| serviceMonitor.path | string | `"/metrics"` | HTTP path to scrape for metrics. | +| serviceMonitor.tlsConfig | object | `{}` | TLS configuration to use when scraping the endpoint. For example if using istio mTLS. # Of type: https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#tlsconfig | +| serviceMonitor.honorLabels | bool | `false` | HonorLabels chooses the metric's labels on collisions with target labels. | +| serviceMonitor.metricRelabelings | list | `[]` | Prometheus scrape metric relabel configs to apply to samples before ingestion. # [Metric Relabeling](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#metric_relabel_configs) | +| serviceMonitor.relabelings | list | `[]` | Relabel configs to apply to samples before ingestion. # [Relabeling](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config) | | prometheusRule.enabled | bool | `false` | Create [Prometheus Operator](https://github.com/coreos/prometheus-operator) prometheusRule resource | | prometheusRule.defaultGroupsEnabled | bool | `true` | Setup default alerts (works only if prometheusRule.enabled is set to true) | | prometheusRule.additionalGroups | list | `[]` | Additional PrometheusRule groups | diff --git a/charts/k8s-image-availability-exporter/templates/deployment.yaml b/charts/k8s-image-availability-exporter/templates/deployment.yaml index f3d99aa..f69e682 100644 --- a/charts/k8s-image-availability-exporter/templates/deployment.yaml +++ b/charts/k8s-image-availability-exporter/templates/deployment.yaml @@ -45,10 +45,10 @@ spec: ports: - containerPort: 8080 name: http - image: {{ .Values.k8sImageAvailabilityExporter.image.repository }}:{{ .Values.image.tag | default (printf "v%s" .Chart.AppVersion) }}" + image: {{ .Values.k8sImageAvailabilityExporter.image.repository }}:{{ .Values.k8sImageAvailabilityExporter.image.tag | default (printf "v%s" .Chart.AppVersion) }}" imagePullPolicy: {{ .Values.k8sImageAvailabilityExporter.image.imagePullPolicy }} securityContext: - {{ - toYaml .Values.securityContext | nindent 12 }} + {{- toYaml .Values.securityContext | nindent 12 }} livenessProbe: httpGet: path: /healthz diff --git a/charts/k8s-image-availability-exporter/templates/service-monitor.yaml b/charts/k8s-image-availability-exporter/templates/service-monitor.yaml index 7829fb1..2546bdf 100644 --- a/charts/k8s-image-availability-exporter/templates/service-monitor.yaml +++ b/charts/k8s-image-availability-exporter/templates/service-monitor.yaml @@ -2,14 +2,52 @@ apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: + {{- with .Values.serviceMonitor.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} name: {{ template "k8s-image-availability-exporter.fullname" . }} + namespace: {{ . }} + {{- end }} labels: - app: {{ template "k8s-image-availability-exporter.fullname" . }} + app: {{ template "k8s-image-availability-exporter.fullname" . }} {{- with .Values.serviceMonitor.namespace }} + {{- with .Values.serviceMonitor.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} spec: + endpoints: + - port: http + {{- with .Values.serviceMonitor.interval }} + interval: {{ . }} + {{- end }} + {{- with .Values.serviceMonitor.scheme }} + scheme: {{ . }} + {{- end }} + {{- with .Values.serviceMonitor.bearerTokenFile }} + bearerTokenFile: {{ . }} + {{- end }} + {{- with .Values.serviceMonitor.tlsConfig }} + tlsConfig: + {{- toYaml .| nindent 6 }} + {{- end }} + {{- with .Values.serviceMonitor.scrapeTimeout }} + scrapeTimeout: {{ . }} + {{- end }} + path: {{ .Values.serviceMonitor.path }} + honorLabels: {{ .Values.serviceMonitor.honorLabels }} + {{- with .Values.serviceMonitor.metricRelabelings }} + metricRelabelings: + {{- tpl (toYaml . | nindent 6) $ }} + {{- end }} + {{- with .Values.serviceMonitor.relabelings }} + relabelings: + {{- toYaml . | nindent 6 }} + {{- end }} + jobLabel: {{ template "k8s-image-availability-exporter.fullname" . }} selector: matchLabels: app: {{ template "k8s-image-availability-exporter.fullname" . }} - endpoints: - - port: http - interval: {{ .Values.serviceMonitor.interval }} + namespaceSelector: + matchNames: + - {{ .Release.Namespace }} {{- end }} diff --git a/charts/k8s-image-availability-exporter/values.yaml b/charts/k8s-image-availability-exporter/values.yaml index 14a74a0..555a1f7 100644 --- a/charts/k8s-image-availability-exporter/values.yaml +++ b/charts/k8s-image-availability-exporter/values.yaml @@ -83,11 +83,62 @@ resources: {} # memory: 128Mi serviceMonitor: - # -- Create [Prometheus Operator](https://github.com/coreos/prometheus-operator) serviceMonitor resource + # -- Enable Prometheus ServiceMonitor. + # See the [documentation](https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/design.md#servicemonitor) and the [API reference](https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#servicemonitor) for details. enabled: false - # -- Scrape interval for serviceMonitor + + # -- Namespace where the ServiceMonitor resource should be deployed. + # @default -- Release namespace. + namespace: "" + + # -- (duration) Prometheus scrape interval. interval: 15s + # -- (duration) Prometheus scrape timeout. + scrapeTimeout: + + # -- Labels to be added to the ServiceMonitor. + ## ref: https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#prometheusspec + labels: {} + + # -- Annotations to be added to the ServiceMonitor. + ## ref: https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#prometheusspec + annotations: {} + + # -- HTTP scheme to use for scraping. + # Can be used with `tlsConfig` for example if using istio mTLS. + scheme: "" + + # -- HTTP path to scrape for metrics. + path: /metrics + + # -- TLS configuration to use when scraping the endpoint. + # For example if using istio mTLS. + ## Of type: https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#tlsconfig + tlsConfig: {} + + # -- HonorLabels chooses the metric's labels on collisions with target labels. + honorLabels: false + + # -- Prometheus scrape metric relabel configs + # to apply to samples before ingestion. + ## [Metric Relabeling](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#metric_relabel_configs) + metricRelabelings: [] + # - action: keep + # regex: 'kube_(daemonset|deployment|pod|namespace|node|statefulset).+' + # sourceLabels: [__name__] + + # -- Relabel configs to apply + # to samples before ingestion. + ## [Relabeling](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config) + relabelings: [] + # - sourceLabels: [__meta_kubernetes_pod_node_name] + # separator: ; + # regex: ^(.*)$ + # targetLabel: nodename + # replacement: $1 + # action: replace + prometheusRule: # -- Create [Prometheus Operator](https://github.com/coreos/prometheus-operator) prometheusRule resource enabled: false