Skip to content

Commit

Permalink
feat: enhance health probe configuration
Browse files Browse the repository at this point in the history
On-behalf-of: @SAP angel.kafazov@sap.com
Signed-off-by: Angel Kafazov <akafazov@cst-bg.net>
  • Loading branch information
akafazov committed Nov 27, 2024
1 parent 4e0b905 commit 7d43342
Show file tree
Hide file tree
Showing 25 changed files with 315 additions and 60 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ This repository contains public helm charts for the OpenMFP project.
## Taskfile
It uses Taskfile and task command to local dev tooling. The following tasks are available: `lint, helmtest, test, update, validate, vulnerability, helm-docs`.

## Updating charts
If a chart is changed, it could be dependency of other chart or its dependencies must be updated. To do it, run `task update`.

## Helm-docs
Using https://github.com/norwoodj/helm-docs to generate charts documentation. Documentation can be updated by running `task helm-docs` command.

Expand Down
2 changes: 1 addition & 1 deletion Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: '3'
vars:
LOCAL_BIN: bin
CHARTS:
sh: "ls charts/ | sed 's/^/charts\\//g' | paste -sd ',' -"
sh: "ls -d charts/*/ | paste -sd ',' -"
tasks:
## Setup
setup:kube-lint:
Expand Down
2 changes: 2 additions & 0 deletions charts/README.md.gotmpl → charts/_templates.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

{{ template "chart.valuesHeader" . }}

Default configuration parameters, which can be overriden either globally or on a chart level are documented in [common/README.md](../common/README.md).

{{ template "chart.valuesTable" . }}

{{ template "helm-docs.versionFooter" . }}
16 changes: 16 additions & 0 deletions charts/account-operator-crds/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# account-operator-crds

A Helm chart for Kubernetes

![Version: 0.1.5](https://img.shields.io/badge/Version-0.1.5-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.16.0](https://img.shields.io/badge/AppVersion-1.16.0-informational?style=flat-square)

## Additional Information

## Values

Default configuration parameters, which can be overriden either globally or on a chart level are documented in [common/README.md](../common/README.md).

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| kcp.enabled | bool | `false` | |

# account-operator-crds

![Version: 0.1.5](https://img.shields.io/badge/Version-0.1.5-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.16.0](https://img.shields.io/badge/AppVersion-1.16.0-informational?style=flat-square)

A Helm chart for Kubernetes
Expand Down
50 changes: 48 additions & 2 deletions charts/account-operator/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,53 @@
# account-operator

A Helm chart for Kubernetes

![Version: 0.4.20](https://img.shields.io/badge/Version-0.4.20-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.106.0](https://img.shields.io/badge/AppVersion-0.106.0-informational?style=flat-square)

## Additional Information

## Requirements

| Repository | Name | Version |
|------------|------|---------|
| file://../account-operator-crds | account-operator-crds | 0.1.5 |
| file://../common | common | 0.1.5 |

## Values

Default configuration parameters, which can be overriden either globally or on a chart level are documented in [common/README.md](../common/README.md).

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| crds.enabled | bool | `true` | |
| deployment.resources.limits.cpuOverride | string | `"260m"` | |
| deployment.resources.limits.memoryOverride | string | `"512Mi"` | |
| deployment.resources.requests.cpuOverride | string | `"150m"` | |
| deployment.resources.requests.memoryOverride | string | `"128Mi"` | |
| deployment.revisionHistoryLimit | int | `3` | |
| deployment.specTemplate.annotations | object | `{}` | |
| deployment.specTemplate.labels | object | `{}` | |
| image.name | string | `"ghcr.io/openmfp/account-operator"` | |
| image.tag | string | `"latest"` | |
| kcp.enabled | bool | `false` | |
| kcp.virtualWorkspaceUrl | string | `""` | |
| kubeconfigSecret | string | `""` | |
| logLevel | string | `"warn"` | |
| security.mountServiceAccountToken | bool | `false` | |
| subroutines.extension.enabled | bool | `true` | |
| subroutines.extensionReady.enabled | bool | `true` | |
| subroutines.fga.creatorRelation | string | `"owner"` | |
| subroutines.fga.enabled | bool | `true` | |
| subroutines.fga.grpcAddr | string | `""` | |
| subroutines.fga.objectType | string | `"account"` | |
| subroutines.fga.parentRelation | string | `"parent"` | |
| subroutines.fga.rootNamespace | string | `"openmfp-root"` | |
| subroutines.namespace.enabled | bool | `true` | |
| webhooks.certDir | string | `"/certs"` | |
| webhooks.enabled | bool | `false` | |

# account-operator

![Version: 0.4.20](https://img.shields.io/badge/Version-0.4.20-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.106.0](https://img.shields.io/badge/AppVersion-0.106.0-informational?style=flat-square)

A Helm chart for Kubernetes
Expand All @@ -23,14 +71,12 @@ A Helm chart for Kubernetes
| deployment.revisionHistoryLimit | int | `3` | |
| deployment.specTemplate.annotations | object | `{}` | |
| deployment.specTemplate.labels | object | `{}` | |
| health.port | int | `8081` | |
| image.name | string | `"ghcr.io/openmfp/account-operator"` | |
| image.tag | string | `"latest"` | |
| kcp.enabled | bool | `false` | |
| kcp.virtualWorkspaceUrl | string | `""` | |
| kubeconfigSecret | string | `""` | |
| logLevel | string | `"warn"` | |
| metrics.port | int | `8080` | |
| security.mountServiceAccountToken | bool | `false` | |
| subroutines.extension.enabled | bool | `true` | |
| subroutines.extensionReady.enabled | bool | `true` | |
Expand Down
Binary file modified charts/account-operator/charts/account-operator-crds-0.1.5.tgz
Binary file not shown.
Binary file modified charts/account-operator/charts/common-0.1.5.tgz
Binary file not shown.
2 changes: 1 addition & 1 deletion charts/account-operator/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ spec:
- operator
- --leader-elect
- --log-level={{ .Values.logLevel }}
- "--health-probe-bind-address=:{{ .Values.health.port }}"
- '--health-probe-bind-address=:{{ include "common.getKeyValue" (dict "Values" .Values "key" "health.port") }}'
image: {{ .Values.image.name }}:{{ .Chart.AppVersion }}
name: manager
{{ include "common.security" . | nindent 10 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ operator match the snapshot:
httpGet:
path: /readyz
port: 8081
initialDelaySeconds: 45
initialDelaySeconds: 5
periodSeconds: 10
resources:
limits:
Expand All @@ -362,7 +362,7 @@ operator match the snapshot:
startupProbe:
failureThreshold: 30
httpGet:
path: /healthz
path: /readyz
port: 8081
periodSeconds: 10
volumeMounts: null
Expand Down Expand Up @@ -724,7 +724,7 @@ operator match the snapshot (with kubeconfigSecret):
httpGet:
path: /readyz
port: 8081
initialDelaySeconds: 45
initialDelaySeconds: 5
periodSeconds: 10
resources:
limits:
Expand All @@ -742,7 +742,7 @@ operator match the snapshot (with kubeconfigSecret):
startupProbe:
failureThreshold: 30
httpGet:
path: /healthz
path: /readyz
port: 8081
periodSeconds: 10
volumeMounts:
Expand Down
10 changes: 8 additions & 2 deletions charts/account-operator/tests/deployment_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ release:
tests:
- it: operator match the snapshot
set:
# health:
# portOverride: 8080
deployment:
resources:
limits:
Expand All @@ -24,10 +26,14 @@ tests:
- it: operator match the snapshot with webhook enabled
set:
health:
port: 8081
# portOverride: 8081
liveness:
path: "/healthz"
pathOverride: "/healthz"
# failureThreshold: 1
startup:
pathOverride: "/healthz"
readiness:
initialDelaySecondsOverride: 45
webhooks:
enabled: true
certDir: /certs
Expand Down
28 changes: 0 additions & 28 deletions charts/account-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,34 +14,6 @@ webhooks:
enabled: false
certDir: /certs

# The health probe configuration
## @param health.port The port for the health probe
## @param health.periodSeconds The period in seconds for performing the probe
## @param health.readiness.path The path for the readiness probe
## @param health.readiness.initialDelaySeconds The initial delay in seconds before starting the readiness probe
## @param health.readiness.periodSeconds The period in seconds for performing the readiness probe
## @param health.liveness.path The path for the liveness probe
## @param health.liveness.failureThreshold The failure threshold for the liveness probe
## @param health.startup.path The path for the startup probe
## @param health.startup.failureThreshold The failure threshold for the startup probe
health:
port: 8081
# periodSeconds: 10
# readiness:
# path: "/readyz"
# initialDelaySeconds: 5
# periodSeconds: 10
# liveness:
# path: "/healthz"
# failureThreshold: 1
# startup:
# path: "/readyz"
# failureThreshold: 30

# The metrics configuration
## @param metrics.port The port for the metrics
metrics:
port: 8080

# The deployment configuration
## @param deployment.specTemplate.annotations The annotations to add to the deployment template
Expand Down
18 changes: 17 additions & 1 deletion charts/common/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,27 @@ Example
| defaults.deployment.resources.limits | object | `{"cpu":"100m","memory":"512Mi"}` | cpu and memory limits for the deployment |
| defaults.deployment.resources.requests | object | `{"cpu":"40m","memory":"50Mi"}` | cpu and memory requests for the deployment |
| defaults.deployment.strategy | string | `"RollingUpdate"` | deployment strategy |
| defaults.health.liveness | object | `{"failureThreshold":1,"path":"/healthz"}` | liveness probe parameters |
| defaults.health.periodSeconds | int | `10` | health period |
| defaults.health.port | int | `8081` | health port |
| defaults.health.readiness | object | `{"initialDelaySeconds":5,"path":"/readyz","periodSeconds":10}` | readiness probe parameters |
| defaults.health.startup | object | `{"failureThreshold":30,"path":"/readyz"}` | startup probe parameters |
| defaults.imagePullPolicy | string | `"Always"` | imagePullPolicy is the policy to use when pulling images for all charts |
| defaults.imagePullSecret | string | `"github"` | imagePullSecret is the name of the secret that holds the docker registry credentials |
| defaults.metrics.port | int | `8080` | metrics port |

# common

A Helm chart for Kubernetes

![Version: 0.1.5](https://img.shields.io/badge/Version-0.1.5-informational?style=flat-square) ![Type: library](https://img.shields.io/badge/Type-library-informational?style=flat-square)

A Helm chart for Kubernetes
## Additional Information

## Values

Default configuration parameters, which can be overriden either globally or on a chart level are documented in [common/README.md](../common/README.md).

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| defaults.certManager.enabled | bool | `false` | toggle to enable/disable cert-manager |
Expand All @@ -52,6 +62,12 @@ A Helm chart for Kubernetes
| defaults.deployment.resources.limits | object | `{"cpu":"100m","memory":"512Mi"}` | cpu and memory limits for the deployment |
| defaults.deployment.resources.requests | object | `{"cpu":"40m","memory":"50Mi"}` | cpu and memory requests for the deployment |
| defaults.deployment.strategy | string | `"RollingUpdate"` | deployment strategy |
| defaults.health.liveness | object | `{"failureThreshold":1,"path":"/healthz"}` | liveness probe parameters |
| defaults.health.periodSeconds | int | `10` | health period |
| defaults.health.port | int | `8081` | health port |
| defaults.health.readiness | object | `{"initialDelaySeconds":5,"path":"/readyz","periodSeconds":10}` | readiness probe parameters |
| defaults.health.startup | object | `{"failureThreshold":30,"path":"/readyz"}` | startup probe parameters |
| defaults.imagePullPolicy | string | `"Always"` | imagePullPolicy is the policy to use when pulling images for all charts |
| defaults.imagePullSecret | string | `"github"` | imagePullSecret is the name of the secret that holds the docker registry credentials |
| defaults.metrics.port | int | `8080` | metrics port |

28 changes: 14 additions & 14 deletions charts/common/templates/_deploymentHelpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -90,22 +90,22 @@ ports:
{{- define "common.operatorHealthAndReadyness" }}
livenessProbe:
httpGet:
path: {{ ((.Values.health).liveness).path | default "/healthz" }}
port: {{ (.Values.health).port | default 3389 }}
failureThreshold: {{ ((.Values.health).liveness).failureThreshold | default 1 }}
periodSeconds: {{ (.Values.health).periodSeconds | default 10 }}
path: {{ include "common.getKeyValue" (dict "Values" .Values "key" "health.liveness.path") }}
port: {{ include "common.getKeyValue" (dict "Values" .Values "key" "health.port") }}
failureThreshold: {{ include "common.getKeyValue" (dict "Values" .Values "key" "health.liveness.failureThreshold") }}
periodSeconds: {{ include "common.getKeyValue" (dict "Values" .Values "key" "health.periodSeconds") }}
startupProbe:
httpGet:
path: {{ ((.Values.health).startup).path | default "/healthz" }}
port: {{ (.Values.health).port | default 3389 }}
failureThreshold: {{ ((.Values.health).startup).failureThreshold | default 30 }}
periodSeconds: {{ (.Values.health).periodSeconds | default 10 }}
path: {{ include "common.getKeyValue" (dict "Values" .Values "key" "health.startup.path") }}
port: {{ include "common.getKeyValue" (dict "Values" .Values "key" "health.port") }}
failureThreshold: {{ include "common.getKeyValue" (dict "Values" .Values "key" "health.startup.failureThreshold") }}
periodSeconds: {{ include "common.getKeyValue" (dict "Values" .Values "key" "health.periodSeconds") }}
readinessProbe:
httpGet:
path: {{ ((.Values.health).readiness).path | default "/readyz" }}
port: {{ (.Values.health).port | default 3389 }}
initialDelaySeconds: {{ ((.Values.health).readiness).initialDelaySeconds | default 45 }}
periodSeconds: {{ (.Values.health).periodSeconds | default 10 }}
path: {{ include "common.getKeyValue" (dict "Values" .Values "key" "health.readiness.path") }}
port: {{ include "common.getKeyValue" (dict "Values" .Values "key" "health.port") }}
initialDelaySeconds: {{ include "common.getKeyValue" (dict "Values" .Values "key" "health.readiness.initialDelaySeconds") }}
periodSeconds: {{ include "common.getKeyValue" (dict "Values" .Values "key" "health.periodSeconds") }}
{{- end }}
{{- define "common.security" -}}
securityContext:
Expand All @@ -124,9 +124,9 @@ automountServiceAccountToken: {{ not (eq (.Values.security).mountServiceAccountT
{{- end }}
{{- define "common.PortsMetricsHealth" -}}
- name: metrics
containerPort: {{ ((.Values).metrics).port | default 2112 }}
containerPort: {{ include "common.getKeyValue" (dict "Values" .Values "key" "metrics.port") }}
protocol: TCP
- name: health-port
containerPort: {{ (.Values.health).port | default 3389 }}
containerPort: {{ include "common.getKeyValue" (dict "Values" .Values "key" "health.port") }}
protocol: TCP
{{- end -}}
24 changes: 24 additions & 0 deletions charts/common/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,27 @@ defaults:
maxUnavailable: 0
# -- deployment strategy
strategy: RollingUpdate


Check failure on line 30 in charts/common/values.yaml

View workflow job for this annotation

GitHub Actions / pipeline / testChart / lint

30:1 [trailing-spaces] trailing spaces

Check failure on line 30 in charts/common/values.yaml

View workflow job for this annotation

GitHub Actions / pipeline / testChart / lint

30:1 [trailing-spaces] trailing spaces

Check failure on line 30 in charts/common/values.yaml

View workflow job for this annotation

GitHub Actions / pipeline / testChart / lint

30:1 [trailing-spaces] trailing spaces

Check failure on line 30 in charts/common/values.yaml

View workflow job for this annotation

GitHub Actions / pipeline / testChart / lint

30:1 [trailing-spaces] trailing spaces

Check failure on line 30 in charts/common/values.yaml

View workflow job for this annotation

GitHub Actions / pipeline / testChart / lint

30:1 [trailing-spaces] trailing spaces

Check failure on line 30 in charts/common/values.yaml

View workflow job for this annotation

GitHub Actions / pipeline / testChart / lint

30:1 [trailing-spaces] trailing spaces

Check failure on line 30 in charts/common/values.yaml

View workflow job for this annotation

GitHub Actions / pipeline / testChart / lint

30:1 [trailing-spaces] trailing spaces

Check failure on line 30 in charts/common/values.yaml

View workflow job for this annotation

GitHub Actions / pipeline / testChart / lint

30:1 [trailing-spaces] trailing spaces

Check failure on line 30 in charts/common/values.yaml

View workflow job for this annotation

GitHub Actions / pipeline / testChart / lint

30:1 [trailing-spaces] trailing spaces
health:
# -- health port
port: 8081
# -- health period
periodSeconds: 10
# -- readiness probe parameters
readiness:
path: "/readyz"
initialDelaySeconds: 5
periodSeconds: 10
# -- liveness probe parameters
liveness:
path: "/healthz"
failureThreshold: 1
# -- startup probe parameters
startup:
path: "/readyz"
failureThreshold: 30

metrics:
# -- metrics port
port: 8080
32 changes: 32 additions & 0 deletions charts/example-content/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,37 @@
# example-content

Helm Chart for the openmfp Portal

![Version: 0.110.4](https://img.shields.io/badge/Version-0.110.4-informational?style=flat-square) ![AppVersion: 0.123.0](https://img.shields.io/badge/AppVersion-0.123.0-informational?style=flat-square)

## Additional Information

## Requirements

| Repository | Name | Version |
|------------|------|---------|
| oci://ghcr.io/openmfp/helm-charts | common | 0.1.4 |

## Values

Default configuration parameters, which can be overriden either globally or on a chart level are documented in [common/README.md](../common/README.md).

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| deployment.maxSurge | int | `5` | |
| deployment.maxUnavailable | int | `0` | |
| image.name | string | `"ghcr.io/openmfp/example-content"` | |
| image.pullPolicy | string | `"IfNotPresent"` | |
| image.pullSecret | string | `"github"` | |
| istio.enabled | bool | `true` | |
| istio.gateway.name | string | `"gateway"` | |
| istio.virtualService.hosts[0] | string | `"your-host.com"` | |
| istio.virtualService.matchers[0].match[0].uri.exact | string | `"/ui/example-content"` | |
| istio.virtualService.matchers[0].match[1].uri.prefix | string | `"/ui/example-content/"` | |
| port | int | `8080` | |

# example-content

![Version: 0.110.4](https://img.shields.io/badge/Version-0.110.4-informational?style=flat-square) ![AppVersion: 0.123.0](https://img.shields.io/badge/AppVersion-0.123.0-informational?style=flat-square)

Helm Chart for the openmfp Portal
Expand Down
Loading

0 comments on commit 7d43342

Please sign in to comment.