Skip to content

Commit

Permalink
tm forum shall check broker health (#238)
Browse files Browse the repository at this point in the history
* tm forum shall check broker health

* don't enable health check by default

* Update helm documentation

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
pulledtim and github-actions[bot] authored Apr 15, 2024
1 parent 05552c4 commit 38a5c64
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 10 deletions.
2 changes: 1 addition & 1 deletion charts/tm-forum-api/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
name: tm-forum-api
version: 0.5.3
version: 0.6.0
appVersion: 0.13.2
kubeVersion: '>= 1.19-0'
home: https://github.com/FIWARE/tmforum-api
Expand Down
12 changes: 8 additions & 4 deletions charts/tm-forum-api/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# tm-forum-api

![Version: 0.5.3](https://img.shields.io/badge/Version-0.5.3-informational?style=flat-square) ![AppVersion: 0.13.2](https://img.shields.io/badge/AppVersion-0.13.2-informational?style=flat-square)
![Version: 0.6.0](https://img.shields.io/badge/Version-0.6.0-informational?style=flat-square) ![AppVersion: 0.13.2](https://img.shields.io/badge/AppVersion-0.13.2-informational?style=flat-square)
A Helm chart for running the FIWARE TMForum-APIs

## Maintainers
Expand Down Expand Up @@ -95,8 +95,8 @@ For all untouched values, the customized deployement will still use the defaults
| autoscaling.metrics | list | `[]` | metrics to react on |
| autoscaling.minReplicas | int | `1` | minimum number of running pods |
| defaultConfig.additionalAnnotations | object | `{}` | additional annotations for the deployment, if required |
| defaultConfig.additionalEnvVars | list | `[]` | a list of additional env vars to be set, check the tm-forum api docu for all available options |
| defaultConfig.additionalLabels | object | `{}` | additional labels for the deployment, if required |
| defaultConfig.additonalEnvVars | list | `[]` | a list of additional env vars to be set, check the tm-forum api docu for all available options |
| defaultConfig.affinity | object | `{}` | affinity template ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity |
| defaultConfig.cache | object | `{"entities":{"expireAfterAccess":"2s","expireAfterWrite":"2s","maximumSize":1000},"subscriptions":{"expireAfterAccess":"14d","expireAfterWrite":"14d","maximumSize":1000}}` | cache config for connecting the broker |
| defaultConfig.cache.entities | object | `{"expireAfterAccess":"2s","expireAfterWrite":"2s","maximumSize":1000}` | entities cache |
Expand All @@ -113,7 +113,7 @@ For all untouched values, the customized deployement will still use the defaults
| defaultConfig.image.pullPolicy | string | `"IfNotPresent"` | pull policy to be used |
| defaultConfig.image.repository | string | `"quay.io/fiware"` | repository to get the container from |
| defaultConfig.image.tag | string | `"0.13.2"` | tag to be used, most of the time the apis will use the same version |
| defaultConfig.livenessProbe.healthPath | string | `"/health"` | path to be used for the health check |
| defaultConfig.livenessProbe.healthPath | string | `"/health/liveness"` | path to be used for the health check |
| defaultConfig.livenessProbe.initialDelaySeconds | int | `30` | |
| defaultConfig.livenessProbe.periodSeconds | int | `10` | |
| defaultConfig.livenessProbe.successThreshold | int | `1` | |
Expand All @@ -130,7 +130,7 @@ For all untouched values, the customized deployement will still use the defaults
| defaultConfig.prometheus.path | string | `"/prometheus"` | path to get the metrics from |
| defaultConfig.readinessProbe.initialDelaySeconds | int | `30` | |
| defaultConfig.readinessProbe.periodSeconds | int | `10` | |
| defaultConfig.readinessProbe.readinessPath | string | `"/health"` | path to be used for the health check |
| defaultConfig.readinessProbe.readinessPath | string | `"/health/readiness"` | path to be used for the health check |
| defaultConfig.readinessProbe.successThreshold | int | `1` | |
| defaultConfig.readinessProbe.timeoutSeconds | int | `30` | |
| defaultConfig.replicaCount | int | `1` | initial number of target replications, can be different if autoscaling is enabled |
Expand All @@ -142,6 +142,10 @@ For all untouched values, the customized deployement will still use the defaults
| defaultConfig.updateStrategy.rollingUpdate.maxUnavailable | int | `0` | number of pods that can be unavailable while updating |
| defaultConfig.updateStrategy.type | string | `"RollingUpdate"` | type of the update |
| fullnameOverride | string | `""` | option to override the fullname config in the _helpers.tpl |
| health.broker.allowedResponseCodes | list | `[200]` | broker health endpoint response codes to be acceptable as 'healthy' |
| health.broker.enabled | bool | `false` | enable including the broker state in the service's health state |
| health.broker.path | string | `"/q/health"` | path to be used for broker health endpoint |
| health.broker.urlOverride | string | `""` | to be set if the broker url differs from defaultConfig.ngsiLd.url |
| ingress.annotations | object | `{}` | annotations to be added to the ingress |
| ingress.className | string | `"nginx"` | class of the ingress controller to handle the ingress |
| ingress.enabled | bool | `false` | should there be an ingress to connect tmforum with the public internet |
Expand Down
15 changes: 14 additions & 1 deletion charts/tm-forum-api/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,20 @@ spec:
- name: MICRONAUT_CACHES_SUBSCRIPTIONS_EXPIRE_AFTER_ACCESS
value: {{ $.Values.defaultConfig.cache.subscriptions.expireAfterAccess | quote}}
{{- end }}

{{- if $.Values.health.broker.enabled }}
- name: MICRONAUT_HTTP_SERVICES_NGSIHEALTH_URL
{{- if $.Values.health.broker.urlOverride }}
value: {{ $.Values.health.broker.urlOverride | quote }}
{{- else }}
value: {{ $.Values.defaultConfig.ngsiLd.url | quote }}
{{- end }}
- name: MICRONAUT_HTTP_SERVICES_NGSIHEALTH_PATH
value: {{ $.Values.health.broker.path | quote }}
- name: ENDPOINTS_HEALTH_BROKER_ENABLED
value: 'true'
- name: ENDPOINTS_HEALTH_BROKER_ALLOWED_RESPONSE_CODES
value: {{ $.Values.health.broker.allowedResponseCodes | quote }}
{{- end }}
{{- if .additionalEnvVars }}
{{- with .additionalEnvVars }}
{{- toYaml . | nindent 12 }}
Expand Down
22 changes: 18 additions & 4 deletions charts/tm-forum-api/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -122,21 +122,21 @@ defaultConfig:
# if one of the values should be overwritten by the individual api, you need to provide all values.
livenessProbe:
# -- path to be used for the health check
healthPath: /health
healthPath: /health/liveness
initialDelaySeconds: 30
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 30
readinessProbe:
# -- path to be used for the health check
readinessPath: /health
readinessPath: /health/readiness
initialDelaySeconds: 30
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 30

# -- a list of additional env vars to be set, check the tm-forum api docu for all available options
additonalEnvVars: []
additionalEnvVars: []

# -- configuration to be used for the image of the container
image:
Expand Down Expand Up @@ -324,4 +324,18 @@ redis:
podSecurityContext:
enabled: false
containerSecurityContext:
enabled: false
enabled: false

## controls the aspects of the health checks
health:
## broker related health checks
broker:
# -- enable including the broker state in the service's health state
enabled: false
# -- path to be used for broker health endpoint
path: "/q/health"
# -- to be set if the broker url differs from defaultConfig.ngsiLd.url
urlOverride: ""
# -- broker health endpoint response codes to be acceptable as 'healthy'
allowedResponseCodes:
- 200

0 comments on commit 38a5c64

Please sign in to comment.