mirror of
https://github.com/truenas/charts.git
synced 2026-06-16 06:58:45 +08:00
move check
This commit is contained in:
@@ -19,6 +19,13 @@ tests:
|
||||
enabled: true
|
||||
primary: true
|
||||
imageSelector: image
|
||||
probes: &probes
|
||||
liveness:
|
||||
enabled: false
|
||||
readiness:
|
||||
enabled: false
|
||||
startup:
|
||||
enabled: false
|
||||
lifecycle:
|
||||
postStart:
|
||||
type: exec
|
||||
@@ -57,7 +64,6 @@ tests:
|
||||
some_command: ./some_command
|
||||
some_port: 80
|
||||
some_host: some_host
|
||||
some_scheme: HTTPS
|
||||
some_path: /api/v1
|
||||
some_value: 123
|
||||
workload:
|
||||
@@ -71,12 +77,12 @@ tests:
|
||||
enabled: true
|
||||
primary: true
|
||||
imageSelector: image
|
||||
probes: *probes
|
||||
lifecycle:
|
||||
postStart:
|
||||
type: http
|
||||
type: https
|
||||
port: "{{ .Values.some_port }}"
|
||||
host: "{{ .Values.some_host }}"
|
||||
scheme: "{{ .Values.some_scheme }}"
|
||||
path: "{{ .Values.some_path }}"
|
||||
httpHeaders:
|
||||
key: "{{ .Values.some_value }}"
|
||||
@@ -123,6 +129,7 @@ tests:
|
||||
container-name1:
|
||||
enabled: true
|
||||
primary: true
|
||||
probes: *probes
|
||||
imageSelector: image
|
||||
lifecycle:
|
||||
invalid: {}
|
||||
@@ -171,7 +178,7 @@ tests:
|
||||
command: []
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Container - Expected <lifecycle> <type> to be one of [exec, http], 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:
|
||||
@@ -238,7 +245,7 @@ tests:
|
||||
path: "api/v1"
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Container - Expected <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:
|
||||
|
||||
@@ -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") -}}
|
||||
{{- $types := (list "exec" "http" "https") -}}
|
||||
{{- with $objectData.lifecycle -}}
|
||||
{{- range $hook, $hookValues := . -}}
|
||||
{{- if not (mustHas $hook $hooks) -}}
|
||||
@@ -29,11 +29,8 @@ objectData: The object data to be used to render the container.
|
||||
{{- fail "Container - Expected non-empty <lifecycle> <command> on [exec] type" -}}
|
||||
{{- end }}
|
||||
{{- include "ix.v1.common.lib.container.actions.exec" (dict "rootCtx" $rootCtx "objectData" $hookValues) | trim | nindent 2 }}
|
||||
{{- else if eq $hookValues.type "http" }}
|
||||
{{- if not $hookValues.port -}}
|
||||
{{- fail "Container - Expected non-empty <lifecycle> <port> on [http] type" -}}
|
||||
{{- end }}
|
||||
{{- include "ix.v1.common.lib.container.actions.httpGet" (dict "rootCtx" $rootCtx "objectData" $hookValues) | trim | nindent 2 }}
|
||||
{{- 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 -}}
|
||||
|
||||
{{- end -}}
|
||||
|
||||
@@ -1,12 +1,17 @@
|
||||
{{/* Returns exec action */}}
|
||||
{{/* Call this template:
|
||||
{{ include "ix.v1.common.lib.container.actions.exec" (dict "rootCtx" $ "objectData" $objectData) }}
|
||||
{{ include "ix.v1.common.lib.container.actions.exec" (dict "rootCtx" $ "objectData" $objectData "caller" $caller) }}
|
||||
rootCtx: The root context of the chart.
|
||||
objectData: The object data to be used to render the container.
|
||||
*/}}
|
||||
{{- define "ix.v1.common.lib.container.actions.exec" -}}
|
||||
{{- $rootCtx := .rootCtx -}}
|
||||
{{- $objectData := .objectData }}
|
||||
{{- $objectData := .objectData -}}
|
||||
{{- $caller := .caller -}}
|
||||
|
||||
{{- if not $objectData.command -}}
|
||||
{{- fail (printf "Container - Expected non-empty <%s> <command> on [exec] type" $caller) -}}
|
||||
{{- end }}
|
||||
exec:
|
||||
command:
|
||||
{{- include "ix.v1.common.lib.container.command" (dict "rootCtx" $rootCtx "objectData" $objectData) | trim | nindent 4}}
|
||||
|
||||
Reference in New Issue
Block a user