add default probes for main and docs

This commit is contained in:
Stavros kois
2023-02-13 18:10:56 +02:00
parent 68a35341e6
commit 56267aef48
4 changed files with 124 additions and 32 deletions
@@ -31,6 +31,7 @@ More keys for `container` can be found below:
- [args](args.md)
- [termination](termination.md)
- [lifecycle](lifecycle.md)
- [probes](probes.md)
---
@@ -3,17 +3,16 @@
Assume every key bellow has a prefix of `workload.[workload-name].podSpec.containers.[container-name]`.
| Key | Type | Required | Helm Template | Default | Description |
| :--------------------------- | :-----------: | :---------------: | :----------------: | :-----: | :---------------------------------------------------------------------------------------- | --- |
| :--------------------------- | :-----------: | :---------------: | :----------------: | :-----: | :---------------------------------------------------------------------------------------- |
| lifecycle | `dict` | ❌ | ❌ | `{}` | Define lifecycle for the container |
| lifecycle.preStop | `dict` | ❌ | ❌ | `{}` | Define preStop lifecycle |
| lifecycle.postStart | `dict` | ❌ | ❌ | `{}` | Define preStop lifecycle |
| lifecycle.[hook].type | `string` | ❌ | ❌ | `""` | Define hook type (exec, http, https) |
| lifecycle.[hook].command | `list/string` | ✅ (On exec type) | ✅ | `""` | Define command(s). If it's single, can be defined as string (Only when exec type is used) | |
| lifecycle.[hook].port | `int` | ✅ (On http type) | ✅ | `""` | Define the port, (Only when http type is used) | |
| lifecycle.[hook].host | `string` | ❌ | ✅ | | Define the host, k8s defaults to POD IP (Only when http type is used) | |
| lifecycle.[hook].path | `string` | ❌ | ✅ | `/` | Define the path (Only when http type is used) | |
| lifecycle.[hook].scheme | `string` | ❌ | ✅ | `HTTP` | Define the scheme (Only when http type is used) | |
| lifecycle.[hook].httpHeaders | `dict` | ❌ | ✅ (On value only) | `{}` | Define the httpHeaders in key-value pairs (Only when http type is used) | |
| lifecycle.[hook].type | `string` | ❌ | ❌ | `""` | Define hook type (exec, http, https) (Used as a scheme in http(s) types) |
| lifecycle.[hook].command | `list/string` | ✅ (On exec type) | ✅ | `""` | Define command(s). If it's single, can be defined as string (Only when exec type is used) |
| lifecycle.[hook].port | `int` | ✅ (On http type) | ✅ | `""` | Define the port, (Only when http(s) type is used) |
| lifecycle.[hook].host | `string` | ❌ | ✅ | | Define the host, k8s defaults to POD IP (Only when http(s) type is used) |
| lifecycle.[hook].path | `string` | ❌ | ✅ | `/` | Define the path (Only when http(s) type is used) |
| lifecycle.[hook].httpHeaders | `dict` | ❌ | ✅ (On value only) | `{}` | Define the httpHeaders in key-value pairs (Only when http(s) type is used) |
---
@@ -45,7 +44,6 @@ workload:
port: 8080
host: localhost
path: /path
scheme: HTTP
httpHeaders:
key: value
```
@@ -0,0 +1,80 @@
# Probes
Assume every key bellow has a prefix of `workload.[workload-name].podSpec.containers.[container-name]`.
| Key | Type | Required | Helm Template | Default | Description |
| :------------------------------------------- | :-----------: | :---------------------------: | :----------------: | :-----------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------- |
| probes | `dict` | ✅ | ❌ | `{}` | Define probes for the container |
| probes.liveness | `dict` | ✅ | ❌ | `{}` | Define the liveness probe |
| probes.readiness | `dict` | ✅ | ❌ | `{}` | Define the readiness probe |
| probes.startup | `dict` | ✅ | ❌ | `{}` | Define the startup probe |
| probes.[probe-name].enabled | `boolean` | ✅ | ❌ | `true` | Enable or disable the probe |
| probes.[probe-name].type | `string` | ❌ | ✅ | `http` | Define probe type (exec, http, https, tcp, grpc) (Used as a scheme in http(s) types) |
| probes.[probe-name].command | `list/string` | ✅ (On exec type) | ✅ | `""` | Define command(s). If it's single, can be defined as string (Only when exec type is used) |
| probes.[probe-name].port | `int` | ✅ (On grpc/tcp/http(s) type) | ✅ | `""` | Define the port, (Only when grpc/tcp/http/https type is used) |
| probes.[probe-name].path | `string` | ❌ | ✅ | `/` | Define the path (Only when https/http type is used) |
| probes.[probe-name].httpHeaders | `dict` | ❌ | ✅ (On value only) | `{}` | Define the httpHeaders in key-value pairs (Only when http/https type is used) |
| probes.[probe-name].spec.initialDelaySeconds | `int` | ❌ | ❌ | `{{ .Values.fallbackDefaults.probeTimeouts.[probe-name].initialDelaySeconds }}` | Define the initialDelaySeconds in seconds |
| probes.[probe-name].spec.periodSeconds | `int` | ❌ | ❌ | `{{ .Values.fallbackDefaults.probeTimeouts.[probe-name].periodSeconds }}` | Define the periodSeconds in seconds |
| probes.[probe-name].spec.timeoutSeconds | `int` | ❌ | ❌ | `{{ .Values.fallbackDefaults.probeTimeouts.[probe-name].timeoutSeconds }}` | Define the timeoutSeconds in seconds |
| probes.[probe-name].spec.failureThreshold | `int` | ❌ | ❌ | `{{ .Values.fallbackDefaults.probeTimeouts.[probe-name].failureThreshold }}` | Define the failureThreshold in seconds |
| probes.[probe-name].spec.successThreshold | `int` | ❌ | ❌ | `{{ .Values.fallbackDefaults.probeTimeouts.[probe-name].successThreshold }}` | Define the successThreshold in seconds |
---
Appears in:
- `.Values.workload.[workload-name].podSpec.containers.[container-name].probes`
---
Examples:
```yaml
workload:
workload-name:
enabled: true
primary: true
podSpec:
containers:
container-name:
enabled: true
primary: true
probes:
liveness:
enabled: true
type: https
port: 8080
path: /healthz
httpHeaders:
key1: value1
key2: value2
spec:
initialDelaySeconds: 10
periodSeconds: 10
timeoutSeconds: 10
failureThreshold: 10
successThreshold: 10
readiness:
enabled: true
type: tcp
port: 8080
spec:
initialDelaySeconds: 10
periodSeconds: 10
timeoutSeconds: 10
failureThreshold: 10
successThreshold: 10
startup:
enabled: true
type: exec
command:
- command1
- command2
spec:
initialDelaySeconds: 10
periodSeconds: 10
timeoutSeconds: 10
failureThreshold: 10
successThreshold: 10
```
+36 -23
View File
@@ -23,6 +23,8 @@ fallbackDefaults:
maxSurge: 1
# -- Default partition (StatefulSet only)
partition: 1
# -- Default probe type
probeType: http
# -- Default Service Protocol
serviceProtocol: TCP
# -- Default Service Type
@@ -38,6 +40,26 @@ fallbackDefaults:
# -- Default PVC/VCT Access Modes
accessModes:
- ReadWriteOnce
# -- Default probe timeouts
probeTimeouts:
liveness:
initialDelaySeconds: 10
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 5
successThreshold: 1
readiness:
initialDelaySeconds: 10
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 5
successThreshold: 2
startup:
initialDelaySeconds: 10
periodSeconds: 5
timeoutSeconds: 2
failureThreshold: 60
successThreshold: 1
# TODO: Docs (for the imageName) convention
# -- Image values
@@ -122,12 +144,25 @@ workload:
primary: true
type: Deployment
podSpec:
# TODO: Currently implementing
containers:
main:
enabled: true
primary: true
imageSelector: image
# TODO: Currently implementing
probes:
liveness:
enabled: true
type: http
port: "{{ .Values.service.main.ports.main.port }}"
readiness:
enabled: true
type: http
port: "{{ .Values.service.main.ports.main.port }}"
startup:
enabled: true
type: http
port: "{{ .Values.service.main.ports.main.port }}"
securityContext:
runAsNonRoot: true
runAsUser: 568
@@ -149,28 +184,6 @@ workload:
requests:
cpu: 100m
memory: 128Mi
probes:
liveness:
enabled: true
type: HTTP
port:
path:
httpHeaders: {}
command: []
readiness:
enabled: true
type: HTTP
port:
path:
httpHeaders: {}
command: []
startup:
enabled: true
type: HTTP
port:
path:
httpHeaders: {}
command: []
initContainers:
init-cont-name:
enabled: false