diff --git a/charts/eth-tx-summary-api/Chart.yaml b/charts/eth-tx-summary-api/Chart.yaml index 95b8d42..961fca1 100644 --- a/charts/eth-tx-summary-api/Chart.yaml +++ b/charts/eth-tx-summary-api/Chart.yaml @@ -15,7 +15,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.1.0 +version: 0.2.0 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to diff --git a/charts/eth-tx-summary-api/templates/deployment.yaml b/charts/eth-tx-summary-api/templates/deployment.yaml index 7346ef3..6d3ef75 100644 --- a/charts/eth-tx-summary-api/templates/deployment.yaml +++ b/charts/eth-tx-summary-api/templates/deployment.yaml @@ -42,6 +42,10 @@ spec: value: {{ .Values.service.port | quote }} - name: DEFAULT_LOG_LEVEL value: {{ .Values.config.logLevel | quote }} + {{- if .Values.metrics.enabled }} + - name: METRICS_PORT + values: {{ .Values.metrics.port | quote }} + {{- end }} envFrom: - secretRef: name: {{ include "eth-tx-summary-api.fullname" . }}-env @@ -49,6 +53,11 @@ spec: - name: http containerPort: {{ .Values.service.port }} protocol: TCP + {{- if .Values.metrics.enabled }} + - name: metrics + containerPort: {{ .Values.metrics.port }} + protocol: TCP + {{- end }} livenessProbe: httpGet: path: /health diff --git a/charts/eth-tx-summary-api/templates/service-monitor.yaml b/charts/eth-tx-summary-api/templates/service-monitor.yaml new file mode 100644 index 0000000..653e24a --- /dev/null +++ b/charts/eth-tx-summary-api/templates/service-monitor.yaml @@ -0,0 +1,19 @@ +{{- if .Values.metrics.prometheus.enabled }} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ include "eth-tx-summary-api.fullname" . }} + labels: + {{- include "eth-tx-summary-api.labels" . | nindent 4 }} +spec: + endpoints: + - scrapeTimeout: 30s + port: metrics + path: /metrics + namespaceSelector: + matchNames: + - {{ .Release.Namespace }} + selector: + matchLabels: + app.kubernetes.io/name: {{ include "eth-tx-summary-api.fullname" . }} +{{- end }} diff --git a/charts/eth-tx-summary-api/templates/service.yaml b/charts/eth-tx-summary-api/templates/service.yaml index 40d0d1a..fda0c5b 100644 --- a/charts/eth-tx-summary-api/templates/service.yaml +++ b/charts/eth-tx-summary-api/templates/service.yaml @@ -11,5 +11,11 @@ spec: targetPort: http protocol: TCP name: http + {{- if .Values.metrics.enabled }} + - port: {{ .Values.metrics.port }} + targetPort: metrics + protocol: TCP + name: metrics + {{- end }} selector: {{- include "eth-tx-summary-api.selectorLabels" . | nindent 4 }} diff --git a/charts/eth-tx-summary-api/values.yaml b/charts/eth-tx-summary-api/values.yaml index 2897d27..055f645 100644 --- a/charts/eth-tx-summary-api/values.yaml +++ b/charts/eth-tx-summary-api/values.yaml @@ -76,6 +76,12 @@ resources: {} # cpu: 100m # memory: 128Mi +metrics: + enabled: false + port: 9105 + prometheus: + enabled: false + # Additional volumes on the output Deployment definition. volumes: [] # - name: foo