use capital types in probes and lifecycle

This commit is contained in:
Stavros kois
2023-02-13 21:45:18 +02:00
parent 133423a17f
commit 380ebd5f1f
19 changed files with 95 additions and 95 deletions

View File

@@ -30,13 +30,13 @@ workload:
probes:
liveness:
enabled: true
type: http
type: HTTP
port: "{{ .Values.service.main.ports.main.port }}"
readiness:
enabled: true
type: http
type: HTTP
port: "{{ .Values.service.main.ports.main.port }}"
startup:
enabled: true
type: http
type: HTTP
port: "{{ .Values.service.main.ports.main.port }}"

View File

@@ -30,15 +30,15 @@ workload:
probes:
liveness:
enabled: true
type: http
type: HTTP
port: "{{ .Values.service.main.ports.main.port }}"
readiness:
enabled: true
type: http
type: HTTP
port: "{{ .Values.service.main.ports.main.port }}"
startup:
enabled: true
type: http
type: HTTP
port: "{{ .Values.service.main.ports.main.port }}"

View File

@@ -32,13 +32,13 @@ workload:
probes:
liveness:
enabled: true
type: http
type: HTTP
port: "{{ .Values.service.main.ports.main.port }}"
readiness:
enabled: true
type: http
type: HTTP
port: "{{ .Values.service.main.ports.main.port }}"
startup:
enabled: true
type: http
type: HTTP
port: "{{ .Values.service.main.ports.main.port }}"

View File

@@ -30,13 +30,13 @@ workload:
probes:
liveness:
enabled: true
type: http
type: HTTP
port: "{{ .Values.service.main.ports.main.port }}"
readiness:
enabled: true
type: http
type: HTTP
port: "{{ .Values.service.main.ports.main.port }}"
startup:
enabled: true
type: http
type: HTTP
port: "{{ .Values.service.main.ports.main.port }}"

View File

@@ -30,15 +30,15 @@ workload:
probes:
liveness:
enabled: true
type: http
type: HTTP
port: "{{ .Values.service.main.ports.main.port }}"
readiness:
enabled: true
type: http
type: HTTP
port: "{{ .Values.service.main.ports.main.port }}"
startup:
enabled: true
type: http
type: HTTP
port: "{{ .Values.service.main.ports.main.port }}"

View File

@@ -31,13 +31,13 @@ workload:
probes:
liveness:
enabled: true
type: http
type: HTTP
port: "{{ .Values.service.main.ports.main.port }}"
readiness:
enabled: true
type: http
type: HTTP
port: "{{ .Values.service.main.ports.main.port }}"
startup:
enabled: true
type: http
type: HTTP
port: "{{ .Values.service.main.ports.main.port }}"

View File

@@ -29,15 +29,15 @@ workload:
probes:
liveness:
enabled: true
type: http
type: HTTP
port: "{{ .Values.service.main.ports.main.port }}"
readiness:
enabled: true
type: http
type: HTTP
port: "{{ .Values.service.main.ports.main.port }}"
startup:
enabled: true
type: http
type: HTTP
port: "{{ .Values.service.main.ports.main.port }}"
persistence:

View File

@@ -26,15 +26,15 @@ workload:
probes:
liveness:
enabled: true
type: http
type: HTTP
port: "{{ .Values.service.main.ports.main.port }}"
readiness:
enabled: true
type: http
type: HTTP
port: "{{ .Values.service.main.ports.main.port }}"
startup:
enabled: true
type: http
type: HTTP
port: "{{ .Values.service.main.ports.main.port }}"

View File

@@ -30,13 +30,13 @@ workload:
probes:
liveness:
enabled: true
type: http
type: HTTP
port: "{{ .Values.service.main.ports.main.port }}"
readiness:
enabled: true
type: http
type: HTTP
port: "{{ .Values.service.main.ports.main.port }}"
startup:
enabled: true
type: http
type: HTTP
port: "{{ .Values.service.main.ports.main.port }}"

View File

@@ -28,12 +28,12 @@ tests:
enabled: false
lifecycle:
postStart:
type: exec
type: EXEC
command:
- echo
- hello
preStop:
type: http
type: HTTP
port: 80
asserts:
- documentIndex: &deploymentDoc 0
@@ -80,14 +80,14 @@ tests:
probes: *probes
lifecycle:
postStart:
type: https
type: HTTPS
port: "{{ .Values.some_port }}"
host: "{{ .Values.some_host }}"
path: "{{ .Values.some_path }}"
httpHeaders:
key: "{{ .Values.some_value }}"
preStop:
type: exec
type: EXEC
command: "{{ .Values.some_command }}"
asserts:
- documentIndex: &deploymentDoc 0
@@ -178,7 +178,7 @@ tests:
command: []
asserts:
- failedTemplate:
errorMessage: Container - Expected <lifecycle> <type> to be one of [exec, http, https], but got [invalid]
errorMessage: Container - Expected <lifecycle> <type> to be one of [EXEC, HTTP, HTTPS], but got [invalid]
- it: should fail with empty command on exec lifecycle type
set:
@@ -196,11 +196,11 @@ tests:
imageSelector: image
lifecycle:
preStop:
type: exec
type: EXEC
command: []
asserts:
- failedTemplate:
errorMessage: Container - Expected non-empty <lifecycle> <command> on [exec] type
errorMessage: Container - Expected non-empty <lifecycle> <command> on [EXEC] type
- it: should fail with empty port on http lifecycle type
set:
@@ -218,11 +218,11 @@ tests:
imageSelector: image
lifecycle:
preStop:
type: http
type: HTTP
port: ""
asserts:
- failedTemplate:
errorMessage: Container - Expected non-empty <lifecycle> <port> on [http] type
errorMessage: Container - Expected non-empty <lifecycle> <port> on [HTTP] type
- it: should fail with path not starting with / on http lifecycle type
set:
@@ -240,12 +240,12 @@ tests:
imageSelector: image
lifecycle:
preStop:
type: http
type: HTTP
port: 80
path: "api/v1"
asserts:
- failedTemplate:
errorMessage: Container - Expected <lifecycle> <path> to start with a forward slash [/] on <http> type
errorMessage: Container - Expected <lifecycle> <path> to start with a forward slash [/] on <HTTP> type
- it: should fail with empty value on httpHeaders on http lifecycle type
set:
@@ -263,7 +263,7 @@ tests:
imageSelector: image
lifecycle:
preStop:
type: http
type: HTTP
port: 80
httpHeaders:
key: ""

View File

@@ -7,7 +7,7 @@ tests:
some_port: 80
some_path: /healthz
some_command: echo
probe_type: exec
probe_type: EXEC
image: &image
repository: nginx
tag: 1.19.0
@@ -26,12 +26,12 @@ tests:
probes: &probes
liveness:
enabled: true
type: http
type: HTTP
port: "{{ .Values.some_port }}"
path: "{{ .Values.some_path }}"
readiness:
enabled: true
type: tcp
type: TCP
port: 123
startup:
enabled: true
@@ -96,7 +96,7 @@ tests:
probes: &probes
liveness:
enabled: true
type: https
type: HTTPS
port: 443
spec:
initialDelaySeconds: 120
@@ -106,7 +106,7 @@ tests:
failureThreshold: 3
readiness:
enabled: true
type: tcp
type: TCP
port: 443
spec:
initialDelaySeconds: 50
@@ -116,7 +116,7 @@ tests:
failureThreshold: 9
startup:
enabled: true
type: tcp
type: TCP
port: 443
spec:
initialDelaySeconds: 25
@@ -302,7 +302,7 @@ tests:
enabled: false
asserts:
- failedTemplate:
errorMessage: Container - Expected probe type to be one of [http, https, tcp, grpc, exec], but got [invalid]
errorMessage: Container - Expected probe type to be one of [HTTP, HTTPS, TCP, GRPC, EXEC], but got [invalid]
- it: should fail with successThreshold more than 1 on liveness
set:
@@ -321,7 +321,7 @@ tests:
probes:
liveness:
enabled: true
type: http
type: HTTP
port: 8080
spec:
successThreshold: 2
@@ -350,7 +350,7 @@ tests:
probes:
startup:
enabled: true
type: http
type: HTTP
port: 8080
spec:
successThreshold: 2
@@ -379,7 +379,7 @@ tests:
probes:
liveness:
enabled: true
type: http
type: HTTP
port: 8080
spec:
initialDelaySeconds: invalid
@@ -408,7 +408,7 @@ tests:
probes:
liveness:
enabled: true
type: http
type: HTTP
port: 8080
spec:
failureThreshold: invalid
@@ -437,7 +437,7 @@ tests:
probes:
liveness:
enabled: true
type: http
type: HTTP
port: 8080
spec:
successThreshold: invalid
@@ -466,7 +466,7 @@ tests:
probes:
liveness:
enabled: true
type: http
type: HTTP
port: 8080
spec:
timeoutSeconds: invalid
@@ -495,7 +495,7 @@ tests:
probes:
liveness:
enabled: true
type: http
type: HTTP
port: 8080
spec:
periodSeconds: invalid
@@ -524,7 +524,7 @@ tests:
probes:
liveness:
enabled: true
type: exec
type: EXEC
command: []
readiness:
enabled: false
@@ -532,7 +532,7 @@ tests:
enabled: false
asserts:
- failedTemplate:
errorMessage: Container - Expected non-empty <probes> <command> on [exec] type
errorMessage: Container - Expected non-empty <probes> <command> on [EXEC] type
- it: should fail with empty port on grpc type
set:
@@ -551,7 +551,7 @@ tests:
probes:
liveness:
enabled: true
type: grpc
type: GRPC
port: ""
readiness:
enabled: false
@@ -559,7 +559,7 @@ tests:
enabled: false
asserts:
- failedTemplate:
errorMessage: Container - Expected non-empty <probes> <port> on [grpc] type
errorMessage: Container - Expected non-empty <probes> <port> on [GRPC] type
- it: should fail with empty port on tcp type
set:
@@ -578,7 +578,7 @@ tests:
probes:
liveness:
enabled: true
type: tcp
type: TCP
port: ""
readiness:
enabled: false
@@ -586,7 +586,7 @@ tests:
enabled: false
asserts:
- failedTemplate:
errorMessage: Container - Expected non-empty <probes> <port> on [tcp] type
errorMessage: Container - Expected non-empty <probes> <port> on [TCP] type
- it: should fail with empty port on http type
set:
@@ -605,7 +605,7 @@ tests:
probes:
liveness:
enabled: true
type: http
type: HTTP
port: ""
readiness:
enabled: false
@@ -613,7 +613,7 @@ tests:
enabled: false
asserts:
- failedTemplate:
errorMessage: Container - Expected non-empty <probes> <port> on [http] type
errorMessage: Container - Expected non-empty <probes> <port> on [HTTP] type
- it: should fail with invalid path on http type
set:
@@ -632,7 +632,7 @@ tests:
probes:
liveness:
enabled: true
type: http
type: HTTP
port: 8080
path: not-starting-with-slash
readiness:
@@ -641,7 +641,7 @@ tests:
enabled: false
asserts:
- failedTemplate:
errorMessage: Container - Expected <probes> <path> to start with a forward slash [/] on <http> type
errorMessage: Container - Expected <probes> <path> to start with a forward slash [/] on <HTTP> type
- it: should fail with empty value in http headers
set:
@@ -660,7 +660,7 @@ tests:
probes:
liveness:
enabled: true
type: http
type: HTTP
port: not-starting-with-slash
httpHeaders:
key:

View File

@@ -7,12 +7,12 @@ Assume every key bellow has a prefix of `workload.[workload-name].podSpec.contai
| 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) (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) |
| 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) |
---
@@ -36,11 +36,11 @@ workload:
primary: true
lifecycle:
preStop:
type: exec
type: EXEC
command:
- command
postStart:
type: http
type: HTTP
port: 8080
host: localhost
path: /path

View File

@@ -9,11 +9,11 @@ Assume every key bellow has a prefix of `workload.[workload-name].podSpec.contai
| 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].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 |
@@ -43,7 +43,7 @@ workload:
probes:
liveness:
enabled: true
type: https
type: HTTPS
port: 8080
path: /healthz
httpHeaders:
@@ -57,7 +57,7 @@ workload:
successThreshold: 10
readiness:
enabled: true
type: tcp
type: TCP
port: 8080
spec:
initialDelaySeconds: 10
@@ -67,7 +67,7 @@ workload:
successThreshold: 10
startup:
enabled: true
type: exec
type: EXEC
command:
- command1
- command2

View File

@@ -9,7 +9,7 @@ objectData: The object data to be used to render the container.
{{- $objectData := .objectData -}}
{{- $hooks := (list "preStop" "postStart") -}}
{{- $types := (list "exec" "http" "https") -}}
{{- $types := (list "EXEC" "HTTP" "HTTPS") -}}
{{- with $objectData.lifecycle -}}
{{- range $hook, $hookValues := . -}}
{{- if not (mustHas $hook $hooks) -}}
@@ -24,9 +24,9 @@ objectData: The object data to be used to render the container.
{{- fail (printf "Container - Expected <lifecycle> <type> to be one of [%s], but got [%s]" (join ", " $types) $hookValues.type) -}}
{{- end }}
{{ $hook }}:
{{- if eq $hookValues.type "exec" -}}
{{- if eq $hookValues.type "EXEC" -}}
{{- include "ix.v1.common.lib.container.actions.exec" (dict "rootCtx" $rootCtx "objectData" $hookValues "caller" "lifecycle") | trim | nindent 2 -}}
{{- else if mustHas $hookValues.type (list "http" "https") -}}
{{- else if mustHas $hookValues.type (list "HTTP" "HTTPS") -}}
{{- include "ix.v1.common.lib.container.actions.httpGet" (dict "rootCtx" $rootCtx "objectData" $hookValues "caller" "lifecycle") | trim | nindent 2 -}}
{{- end -}}

View File

@@ -9,7 +9,7 @@ objectData: The object data to be used to render the container.
{{- $objectData := .objectData -}}
{{- $probeNames := (list "liveness" "readiness" "startup") -}}
{{- $probeTypes := (list "http" "https" "tcp" "grpc" "exec") -}}
{{- $probeTypes := (list "HTTP" "HTTPS" "TCP" "GRPC" "EXEC") -}}
{{- if not $objectData.probes -}}
{{- fail "Container - Expected non-empty <probes>" -}}
@@ -44,13 +44,13 @@ objectData: The object data to be used to render the container.
{{- fail (printf "Container - Expected probe type to be one of [%s], but got [%s]" (join ", " $probeTypes) $probeType) -}}
{{- end }}
{{ $probeName }}Probe:
{{- if (mustHas $probeType (list "http" "https")) -}}
{{- if (mustHas $probeType (list "HTTP" "HTTPS")) -}}
{{- include "ix.v1.common.lib.container.actions.httpGet" (dict "rootCtx" $rootCtx "objectData" $probe "caller" "probes") | trim | nindent 2 -}}
{{- else if eq $probeType "tcp" -}}
{{- else if eq $probeType "TCP" -}}
{{- include "ix.v1.common.lib.container.actions.tcpSocket" (dict "rootCtx" $rootCtx "objectData" $probe "caller" "probes") | trim | nindent 2 -}}
{{- else if eq $probeType "grpc" -}}
{{- else if eq $probeType "GRPC" -}}
{{- include "ix.v1.common.lib.container.actions.grpc" (dict "rootCtx" $rootCtx "objectData" $probe "caller" "probes") | trim | nindent 2 -}}
{{- else if eq $probeType "exec" -}}
{{- else if eq $probeType "EXEC" -}}
{{- include "ix.v1.common.lib.container.actions.exec" (dict "rootCtx" $rootCtx "objectData" $probe "caller" "probes") | trim | nindent 2 -}}
{{- end -}}

View File

@@ -10,7 +10,7 @@ objectData: The object data to be used to render the container.
{{- $caller := .caller -}}
{{- if not $objectData.command -}}
{{- fail (printf "Container - Expected non-empty <%s> <command> on [exec] type" $caller) -}}
{{- fail (printf "Container - Expected non-empty <%s> <command> on [EXEC] type" $caller) -}}
{{- end }}
exec:
command:

View File

@@ -10,7 +10,7 @@ objectData: The object data to be used to render the container.
{{- $caller := .caller -}}
{{- if not $objectData.port -}}
{{- fail (printf "Container - Expected non-empty <%s> <port> on [grpc] type" $caller) -}}
{{- fail (printf "Container - Expected non-empty <%s> <port> on [GRPC] type" $caller) -}}
{{- end -}}
{{- $port := $objectData.port -}}

View File

@@ -10,12 +10,12 @@ objectData: The object data to be used to render the container.
{{- $caller := .caller -}}
{{- if not $objectData.port -}}
{{- fail (printf "Container - Expected non-empty <%s> <port> on [http] type" $caller) -}}
{{- fail (printf "Container - Expected non-empty <%s> <port> on [HTTP] type" $caller) -}}
{{- end -}}
{{- $port := $objectData.port -}}
{{- $path := "/" -}}
{{- $scheme := "http" -}}
{{- $scheme := "HTTP" -}}
{{- if kindIs "string" $port -}}
{{- $port = tpl $port $rootCtx -}}
@@ -26,7 +26,7 @@ objectData: The object data to be used to render the container.
{{- end -}}
{{- if not (hasPrefix "/" $path) -}}
{{- fail (printf "Container - Expected <%s> <path> to start with a forward slash [/] on <http> type" $caller) -}}
{{- fail (printf "Container - Expected <%s> <path> to start with a forward slash [/] on <HTTP> type" $caller) -}}
{{- end -}}
{{- with $objectData.type -}}
@@ -38,7 +38,7 @@ httpGet:
{{- end }}
port: {{ $port }}
path: {{ $path }}
scheme: {{ $scheme | upper }}
scheme: {{ $scheme }}
{{- with $objectData.httpHeaders }}
httpHeaders:
{{- range $name, $value := . }}

View File

@@ -10,7 +10,7 @@ objectData: The object data to be used to render the container.
{{- $caller := .caller -}}
{{- if not $objectData.port -}}
{{- fail (printf "Container - Expected non-empty <%s> <port> on [tcp] type" $caller) -}}
{{- fail (printf "Container - Expected non-empty <%s> <port> on [TCP] type" $caller) -}}
{{- end -}}
{{- $port := $objectData.port -}}