kubernetes Helm. node.lifecycle的值来自何处

vs91vp4v  于 2023-08-03  发布在  Kubernetes
关注(0)|答案(1)|浏览(124)

我正在研究 selenium 网格 Helm 图,我试图了解.node.lifecycle是从哪里来的,我没有看到它在values.yaml文件。这是一些如何Map到chrome/firefox/edge节点?
https://github.com/SeleniumHQ/docker-selenium/blob/trunk/charts/selenium-grid/templates/_helpers.tpl#L201C63-L201C63
{{ $lifecycle := tpl (toYaml (default (dict) .node.lifecycle)) $ }}
完整区块:

{{/*
Get the lifecycle of the pod. When KEDA is activated and the lifecycle is used for a pod of a
deployment preStop hook to deregister from the selenium hub.
*/}}
{{- define "seleniumGrid.lifecycle" }}
{{ $lifecycle := tpl (toYaml (default (dict) .node.lifecycle)) $ }}
{{- if and (eq .Values.autoscaling.scalingType "deployment") (eq (include "seleniumGrid.useKEDA" .) "true") -}}
{{ $lifecycle = merge ($lifecycle | fromYaml ) .Values.autoscaling.deregisterLifecycle | toYaml }}
{{- end -}}
{{ if and $lifecycle (ne $lifecycle "{}") -}}
lifecycle: {{ $lifecycle | nindent 2 }}
{{- end -}}
{{- end -}}

字符串

bejyjqdl

bejyjqdl1#

是的,.node就是chromeNode等等。其来自在每个scaledJob.yml中定义的$podScope,例如在firefox-node-scaledjob.yaml中:

{{- $podScope := deepCopy . -}}
{{- $_ := set $podScope "name" "selenium-firefox-node" -}}
{{- $_ =  set $podScope "node" .Values.firefoxNode  -}}
{{- include "seleniumGrid.podTemplate" $podScope | nindent 4 }}

字符串
因此,当它调用seleniumGrid.podTemplate时,它将$podScope发送到_helpers.tpl,变量seleniumGrid.podTemplate经常使用它(每次你看到.node)。

相关问题