This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
{{/* Returns exec action */}}
|
||||
{{/* Call this template:
|
||||
{{ include "tc.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 "tc.v1.common.lib.container.actions.exec" -}}
|
||||
{{- $rootCtx := .rootCtx -}}
|
||||
{{- $objectData := .objectData -}}
|
||||
{{- $caller := .caller -}}
|
||||
|
||||
{{- if not $objectData.command -}}
|
||||
{{- fail (printf "Container - Expected non-empty <%s> <command> on [exec] type" $caller) -}}
|
||||
{{- end }}
|
||||
exec:
|
||||
command:
|
||||
{{- include "tc.v1.common.lib.container.command" (dict "rootCtx" $rootCtx "objectData" $objectData) | trim | nindent 4}}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,23 @@
|
||||
{{/* Returns grpc action */}}
|
||||
{{/* Call this template:
|
||||
{{ include "tc.v1.common.lib.container.actions.tcpSocket" (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 "tc.v1.common.lib.container.actions.grpc" -}}
|
||||
{{- $rootCtx := .rootCtx -}}
|
||||
{{- $objectData := .objectData -}}
|
||||
{{- $caller := .caller -}}
|
||||
|
||||
{{- if not $objectData.port -}}
|
||||
{{- fail (printf "Container - Expected non-empty <%s> <port> on [grpc] type" $caller) -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $port := $objectData.port -}}
|
||||
|
||||
{{- if kindIs "string" $port -}}
|
||||
{{- $port = tpl $port $rootCtx -}}
|
||||
{{- end }}
|
||||
grpc:
|
||||
port: {{ $port }}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,53 @@
|
||||
{{/* Returns httpGet action */}}
|
||||
{{/* Call this template:
|
||||
{{ include "tc.v1.common.lib.container.actions.httpGet" (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 "tc.v1.common.lib.container.actions.httpGet" -}}
|
||||
{{- $rootCtx := .rootCtx -}}
|
||||
{{- $objectData := .objectData -}}
|
||||
{{- $caller := .caller -}}
|
||||
|
||||
{{- if not $objectData.port -}}
|
||||
{{- fail (printf "Container - Expected non-empty <%s> <port> on [http] type" $caller) -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $port := $objectData.port -}}
|
||||
{{- $path := "/" -}}
|
||||
{{- $scheme := "http" -}}
|
||||
|
||||
{{- if kindIs "string" $port -}}
|
||||
{{- $port = tpl $port $rootCtx -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- with $objectData.path -}}
|
||||
{{- $path = tpl . $rootCtx -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if not (hasPrefix "/" $path) -}}
|
||||
{{- fail (printf "Container - Expected <%s> <path> to start with a forward slash [/] on <http> type" $caller) -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- with $objectData.type -}}
|
||||
{{- $scheme = tpl . $rootCtx -}}
|
||||
{{- end }}
|
||||
httpGet:
|
||||
{{- with $objectData.host }}
|
||||
host: {{ tpl . $rootCtx }}
|
||||
{{- end }}
|
||||
port: {{ $port }}
|
||||
path: {{ $path }}
|
||||
scheme: {{ $scheme | upper }}
|
||||
{{- with $objectData.httpHeaders }}
|
||||
httpHeaders:
|
||||
{{- range $name, $value := . }}
|
||||
{{- if not $value -}}
|
||||
{{- fail "Container - Expected non-empty <value> on <httpHeaders>" -}}
|
||||
{{- end }}
|
||||
- name: {{ $name }}
|
||||
value: {{ tpl (toString $value) $rootCtx | quote }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,23 @@
|
||||
{{/* Returns tcpSocket action */}}
|
||||
{{/* Call this template:
|
||||
{{ include "tc.v1.common.lib.container.actions.tcpSocket" (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 "tc.v1.common.lib.container.actions.tcpSocket" -}}
|
||||
{{- $rootCtx := .rootCtx -}}
|
||||
{{- $objectData := .objectData -}}
|
||||
{{- $caller := .caller -}}
|
||||
|
||||
{{- if not $objectData.port -}}
|
||||
{{- fail (printf "Container - Expected non-empty <%s> <port> on [tcp] type" $caller) -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $port := $objectData.port -}}
|
||||
|
||||
{{- if kindIs "string" $port -}}
|
||||
{{- $port = tpl $port $rootCtx -}}
|
||||
{{- end }}
|
||||
tcpSocket:
|
||||
port: {{ $port }}
|
||||
{{- end -}}
|
||||
Reference in New Issue
Block a user