Skip to content

Commit

Permalink
Merge pull request #2 from vechr/feat/monitoring
Browse files Browse the repository at this point in the history
Feat/monitoring
  • Loading branch information
zulfikar4568 authored Jun 28, 2024
2 parents 2a50a55 + 213bd4a commit 2c3f9c2
Show file tree
Hide file tree
Showing 7 changed files with 156 additions and 220 deletions.
7 changes: 6 additions & 1 deletion helm/charts/vechr-iiot/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,9 @@ dependencies:
- name: postgresql
version: 12.1.6
repository: https://charts.bitnami.com/bitnami
condition: postgresql.enabled
condition: postgresql.enabled

- name: metrics-server
version: 3.11.0
repository: https://kubernetes-sigs.github.io/metrics-server/
condition: metrics-server.enabled
Binary file not shown.
2 changes: 1 addition & 1 deletion helm/charts/vechr-iiot/templates/cert-manager/issuer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ spec:
solvers:
- http01:
ingress:
name: {{.Values.ingresses.name}}
name: {{.Values.ingress.name}}
{{end}}
200 changes: 0 additions & 200 deletions helm/charts/vechr-iiot/templates/metrics-server/components.yaml

This file was deleted.

48 changes: 48 additions & 0 deletions helm/charts/vechr-iiot/templates/microservice/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@
{{$postgrePort := .Values.postgresql.containerPorts.postgresql}}
{{/* >>>>>>>> This is variable for PostgreSQL <<<<<<<<< */}}

{{/* >>>>>>>> This is variable for Monitoring <<<<<<<<< */}}
{{$isMonitoringEnabled := .Values.monitoring.enabled}}
{{$lokiHost := .Values.monitoring.loki.host}}
{{$lokiUsername := .Values.monitoring.loki.username}}
{{$lokiPassword := .Values.monitoring.loki.password}}
{{$otlpHost := .Values.monitoring.otlp.host}}
{{/* >>>>>>>> This is variable for Monitoring <<<<<<<<< */}}

{{$secretNameTLS := .Values.natsSelfSigned.secretName}}
{{range $i, $value := .Values.microservices | default dict}}
{{if $value.enabled}}
Expand Down Expand Up @@ -56,10 +64,50 @@ spec:
- name: http
containerPort: {{$value.externalPort}}
protocol: TCP
- name: metrics
containerPort: 8081
protocol: TCP
livenessProbe:
httpGet:
path: /health
port: {{$value.externalPort}}
initialDelaySeconds: 60
periodSeconds: 20
timeoutSeconds: 10
successThreshold: 1
failureThreshold: 30
readinessProbe:
httpGet:
path: /health
port: {{$value.externalPort}}
initialDelaySeconds: 60
periodSeconds: 20
timeoutSeconds: 10
successThreshold: 1
failureThreshold: 30
startupProbe:
httpGet:
path: /health
port: {{$value.externalPort}}
initialDelaySeconds: 60
periodSeconds: 20
timeoutSeconds: 10
successThreshold: 1
failureThreshold: 30
{{ end }}
imagePullPolicy: {{$value.imagePullPolicy | default "Always"}}
{{ if $value.env}}
env:
{{ if $isMonitoringEnabled }}
- name: LOKI_HOST
value: {{ $lokiHost | default ""}}
- name: LOKI_USERNAME
value: {{ $lokiUsername | default ""}}
- name: LOKI_PASSWORD
value: {{ $lokiPassword | default ""}}
- name: OTLP_HTTP_URL
value: {{ $otlpHost | default ""}}
{{ end }}
- name: NATS_CA
value: "/certificate/ca.crt"
- name: NATS_KEY
Expand Down
34 changes: 34 additions & 0 deletions helm/charts/vechr-iiot/templates/microservice/pod-monitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{{ if .Values.monitoring.enabled }}
{{$namespace := include "vechr.namespace" .}}
---
apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
name: vechr-microservice-pod-monitor
labels:
app.kubernetes.io/component: vechr-microservice
app.kubernetes.io/instance: vechr-microservice-pod-monitor
app.kubernetes.io/name: microservice
app.kubernetes.io/part-of: vechr-iiot
namespace: {{ .Values.monitoring.podMonitor.namespace | default $namespace }}
spec:
selector:
matchLabels:
app.kubernetes.io/component: vechr-microservice
app.kubernetes.io/name: microservice
app.kubernetes.io/part-of: vechr-iiot
{{ if .Values.monitoring.jobLabel }}
jobLabel: {{ .Values.monitoring.jobLabel }}
{{ end }}
{{ if .Values.monitoring.podMonitor.podTargetLabels }}
podTargetLabels:
{{ toYaml .Values.monitoring.podMonitor.podTargetLabels | default list }}
{{ end }}
namespaceSelector:
matchNames:
- {{ include "vechr.namespace" . }}
podMetricsEndpoints:
- interval: 10s
port: metrics

{{ end }}
Loading

0 comments on commit 2c3f9c2

Please sign in to comment.