Skip to content

Commit

Permalink
added optional probes to ocean metric exporter
Browse files Browse the repository at this point in the history
  • Loading branch information
TalShafir committed Mar 6, 2024
1 parent c5f402d commit ca0021d
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 12 deletions.
12 changes: 12 additions & 0 deletions charts/ocean-metric-exporter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,18 @@ helm install my-release spot/ocean-metric-exporter
| oceanController.secretName | Optional | `"spotinst-kubernetes-cluster-controller"` | Secret name. |
| podAnnotations | Optional | `{}` | Pod annotations. Ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ |
| podEnvVariables | Optional | `[]` | Additional environment variables for the exporter container. |
| probes.enabled | Bool | `false` | Whether to include both liveness and readiness probe, this option will ignore the nested enabled booleans. |
| probes.liveness.enabled | Bool | `false` | Whether to include liveness probe, this will be ignored if probes.enabled was set to true. |
| probes.liveness.failureThreshold | Integer | `3` | Liveness probe failure threshold. |
| probes.liveness.initialDelaySeconds | Integer | `15` | Liveness probe initial delay. |
| probes.liveness.periodSeconds | Integer | `10` | Liveness probe period. |
| probes.liveness.timeoutSeconds | Integer | `1` | Liveness probe timeout. |
| probes.readiness.enabled | Bool | `false` | Whether to include readiness probe, this will be ignored if probes.enabled was set to true. |
| probes.readiness.failureThreshold | Integer | `3` | Readiness probe failure threshold. |
| probes.readiness.initialDelaySeconds | Integer | `15` | Readiness probe initial delay. |
| probes.readiness.periodSeconds | Integer | `10` | Readiness probe period. |
| probes.readiness.successThreshold | Integer | `1` | Readiness probe success threshold. |
| probes.readiness.timeoutSeconds | Integer | `1` | Readiness probe timeout. |
| replicaCount | Optional | `1` | Replicas. Ref: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#replicas |
| resources | Optional | `{"limits":{"cpu":"500m","memory":"500Mi"},"requests":{"cpu":"100m","memory":"50Mi"}}` | Resource requests and limits. Ref: http://kubernetes.io/docs/user-guide/compute-resources/ |
| service.create | Optional | `true` | Controls whether a service should be created. |
Expand Down
26 changes: 26 additions & 0 deletions charts/ocean-metric-exporter/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,29 @@ Container command.
{{- printf "[ \"java\", \"-Dspring.profiles.active=prod,default\", \"-jar\", \"/app/app.jar\" ]" -}}
{{- end }}

{{/*
probes.
*/}}
{{- define "ocean-metric-exporter.probes" -}}
{{- if or .Values.probes.liveness.enabled .Values.probes.enabled }}
livenessProbe:
httpGet:
path: /health/liveness
port: exporter
initialDelaySeconds: {{ .Values.probes.liveness.initialDelaySeconds }}
periodSeconds: {{ .Values.probes.liveness.periodSeconds }}
failureThreshold: {{ .Values.probes.liveness.failureThreshold }}
timeoutSeconds: {{ .Values.probes.liveness.timeoutSeconds }}
{{- end}}
{{- if or .Values.probes.readiness.enabled .Values.probes.enabled }}
readinessProbe:
httpGet:
path: /health/readiness
port: exporter
initialDelaySeconds: {{ .Values.probes.readiness.initialDelaySeconds }}
periodSeconds: {{ .Values.probes.readiness.periodSeconds }}
failureThreshold: {{ .Values.probes.readiness.failureThreshold }}
successThreshold: {{ .Values.probes.readiness.successThreshold }}
timeoutSeconds: {{ .Values.probes.readiness.timeoutSeconds }}
{{- end}}
{{- end }}
13 changes: 1 addition & 12 deletions charts/ocean-metric-exporter/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,18 +90,7 @@ spec:
- --deny-labels={{ join "," .Values.metricsConfiguration.denyLabels }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
livenessProbe:
initialDelaySeconds: 10
timeoutSeconds: 10
httpGet:
path: /health/liveness
port: exporter
readinessProbe:
initialDelaySeconds: 10
timeoutSeconds: 10
httpGet:
path: /health/readiness
port: exporter
{{- include "ocean-metric-exporter.probes" . | nindent 8 }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
Expand Down
33 changes: 33 additions & 0 deletions charts/ocean-metric-exporter/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,39 @@ service:
# -- (Optional) Controls whether a service should be created.
create: true

# Probes configuration
probes:
# -- (Bool) Whether to include both liveness and readiness probe, this option will ignore the nested enabled booleans.
enabled: false

# Liveness probe configuration.
liveness:
# -- (Bool) Whether to include liveness probe, this will be ignored if probes.enabled was set to true.
enabled: false
# -- (Integer) Liveness probe initial delay.
initialDelaySeconds: 15
# -- (Integer) Liveness probe period.
periodSeconds: 10
# -- (Integer) Liveness probe failure threshold.
failureThreshold: 3
# -- (Integer) Liveness probe timeout.
timeoutSeconds: 1

# Readiness probe configuration.
readiness:
# -- (Bool) Whether to include readiness probe, this will be ignored if probes.enabled was set to true.
enabled: false
# -- (Integer) Readiness probe initial delay.
initialDelaySeconds: 15
# -- (Integer) Readiness probe period.
periodSeconds: 10
# -- (Integer) Readiness probe failure threshold.
failureThreshold: 3
# -- (Integer) Readiness probe success threshold.
successThreshold: 1
# -- (Integer) Readiness probe timeout.
timeoutSeconds: 1

# -- (Optional) Exporter Metrics Configurations
metricsConfiguration:
# -- (Array[string]) List of Categories to enable - if empty will get no metrics. Additional possible values can be found here: https://docs.spot.io/ocean/tools-and-integrations/prometheus/scrape?id=categories
Expand Down

0 comments on commit ca0021d

Please sign in to comment.