Skip to content

Commit

Permalink
Proxy servicemonitor (#6)
Browse files Browse the repository at this point in the history
* proxy - servicemonitor template added

* proxy - healthchecks added
  • Loading branch information
cicdteam authored Jan 18, 2022
1 parent 86477ba commit 8b1df77
Show file tree
Hide file tree
Showing 5 changed files with 92 additions and 2 deletions.
2 changes: 1 addition & 1 deletion charts/zenith-proxy/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: zenith-proxy
description: Zenith Proxy
type: application
version: 1.1.1
version: 1.1.3
appVersion: "0.1.0"
kubeVersion: "^1.18.x-x"
home: https://zenith.tech
Expand Down
8 changes: 7 additions & 1 deletion charts/zenith-proxy/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# zenith-proxy

![Version: 1.1.1](https://img.shields.io/badge/Version-1.1.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) [![Lint and Test Charts](https://github.com/zenithdb/helm-charts/actions/workflows/lint-test.yaml/badge.svg)](https://github.com/zenithdb/helm-charts/actions/workflows/lint-test.yaml)
![Version: 1.1.3](https://img.shields.io/badge/Version-1.1.3-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) [![Lint and Test Charts](https://github.com/zenithdb/helm-charts/actions/workflows/lint-test.yaml/badge.svg)](https://github.com/zenithdb/helm-charts/actions/workflows/lint-test.yaml)

Zenith Proxy

Expand Down Expand Up @@ -36,6 +36,12 @@ Kubernetes: `^1.18.x-x`
| image.repository | string | `"zenithdb/zenith"` | Zenithdb image repository |
| image.tag | string | `"latest"` | Overrides the image tag whose default is the chart appVersion. |
| imagePullSecrets | list | `[]` | Specify docker-registry secret names as an array |
| metrics.enabled | bool | `false` | Enable prometheus metrcis autodiscovery |
| metrics.serviceMonitor.enabled | bool | `false` | Create ServiceMonitor resource |
| metrics.serviceMonitor.interval | string | `"10s"` | Interval in which prometheus scrapes |
| metrics.serviceMonitor.namespace | string | `""` | The namespace in which the ServiceMonitor will be created, if empty then Release.Namespace used |
| metrics.serviceMonitor.scrapeTimeout | string | `"10s"` | Scrape Timeout duration for prometheus |
| metrics.serviceMonitor.selector | object | `{}` | Additional labels to attach (used by Prometheus operator) |
| nameOverride | string | `""` | String to partially override zenith-proxy.fullname template (will maintain the release name) |
| nodeSelector | object | `{}` | Node labels for pod assignment. |
| podAnnotations | object | `{}` | Annotations for zenith-proxy pods |
Expand Down
20 changes: 20 additions & 0 deletions charts/zenith-proxy/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,26 @@ spec:
- name: http
containerPort: 9090
protocol: TCP
startupProbe:
httpGet:
path: /v1/status
port: http
initialDelaySeconds: 10
timeoutSeconds: 5
periodSeconds: 10
failureThreshold: 30
livenessProbe:
httpGet:
path: /v1/status
port: http
periodSeconds: 15
timeoutSeconds: 10
readinessProbe:
httpGet:
path: /v1/status
port: http
periodSeconds: 15
timeoutSeconds: 10
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.nodeSelector }}
Expand Down
32 changes: 32 additions & 0 deletions charts/zenith-proxy/templates/servicemonitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{{- if .Values.metrics.enabled }}
{{- if .Values.metrics.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ include "zenith-proxy.fullname" . }}
labels:
{{- include "zenith-proxy.labels" . | nindent 4 }}
{{- range $key, $value := .Values.metrics.serviceMonitor.selector }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.namespace }}
namespace: {{ .Values.metrics.serviceMonitor.namespace }}
{{- end }}
spec:
selector:
matchLabels:
{{- include "zenith-proxy.selectorLabels" . | nindent 6 }}
endpoints:
- port: metrics
path: /metrics
{{- if .Values.metrics.serviceMonitor.interval }}
interval: {{ .Values.metrics.serviceMonitor.interval }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.scrapeTimeout }}
scrapeTimeout: {{ .Values.metrics.serviceMonitor.scrapeTimeout }}
{{- end }}
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
{{- end }}
{{- end }}
32 changes: 32 additions & 0 deletions charts/zenith-proxy/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,35 @@ tolerations: []

# -- Affinity for pod assignment
affinity: {}

metrics:
# metrics.enabled -- Enable prometheus metrcis autodiscovery
enabled: false
## Prometheus Operator ServiceMonitor configuration
##
serviceMonitor:
# metrics.serviceMonitor.enabled -- Create ServiceMonitor resource
enabled: false

# metrics.serviceMonitor.namespace -- The namespace in which the ServiceMonitor will be created, if empty then Release.Namespace used
namespace: ""

## Interval at which metrics should be scraped.
## ref: https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#endpoint
##
# metrics.serviceMonitor.interval -- Interval in which prometheus scrapes
interval: 10s

## Timeout after which the scrape is ended
## ref: https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#endpoint
##
# metrics.serviceMonitor.scrapeTimeout -- Scrape Timeout duration for prometheus
scrapeTimeout: 10s

## ServiceMonitor selector labels
## ref: https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack#prometheusioscrape
##
# metrics.serviceMonitor.selector -- Additional labels to attach (used by Prometheus operator)
selector: {}
# selector:
# prometheus: zenith

0 comments on commit 8b1df77

Please sign in to comment.