Use helm-toolkit for worker readiness probes

Use helm-toolkit for worker readiness probes.

Change-Id: Ice6c2ff11e007c28093d051c118d733c4e757788
This commit is contained in:
Ritchie, Frank (fr801x) 2023-08-24 20:10:13 -04:00 committed by Alexey
parent f0a24b11a0
commit 3fcc6e0d65
3 changed files with 33 additions and 14 deletions

View File

@ -16,7 +16,7 @@
apiVersion: v1 apiVersion: v1
description: A Helm chart for Shipyard and Airflow description: A Helm chart for Shipyard and Airflow
name: shipyard name: shipyard
version: 0.1.1 version: 0.1.2
keywords: keywords:
- shipyard - shipyard
- airflow - airflow

View File

@ -12,6 +12,21 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
{{- define "airflowLogrotateReadinessProbeTemplate" }}
exec:
command:
- sh
- -c
- |-
set -ex
ps -ef | grep 'sleep 3600' | grep -v 'grep'
{{- end }}
{{- define "airflowWorkerReadinessProbeTemplate" }}
tcpSocket:
port: {{ .Values.network.airflow.worker.port }}
{{- end }}
{{- if .Values.manifests.statefulset_airflow_worker }} {{- if .Values.manifests.statefulset_airflow_worker }}
{{- $envAll := . }} {{- $envAll := . }}
@ -143,6 +158,7 @@ spec:
imagePullPolicy: {{ .Values.images.pull_policy }} imagePullPolicy: {{ .Values.images.pull_policy }}
{{ tuple $envAll $envAll.Values.pod.resources.airflow.worker | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} {{ tuple $envAll $envAll.Values.pod.resources.airflow.worker | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
{{ dict "envAll" $envAll "application" "airflow_worker" "container" "airflow_worker" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }} {{ dict "envAll" $envAll "application" "airflow_worker" "container" "airflow_worker" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }}
{{ dict "envAll" $envAll "component" "airflow_worker" "container" "airflow_worker" "type" "readiness" "probeTemplate" (include "airflowWorkerReadinessProbeTemplate" $envAll | fromYaml) | include "helm-toolkit.snippets.kubernetes_probe" | indent 10 }}
env: env:
- name: AIRFLOW_CONN_AIRFLOWS_OWN_DB - name: AIRFLOW_CONN_AIRFLOWS_OWN_DB
valueFrom: valueFrom:
@ -152,9 +168,6 @@ spec:
ports: ports:
- containerPort: {{ tuple "airflow_worker" "internal" "airflow_worker" $envAll | include "helm-toolkit.endpoints.endpoint_port_lookup" }} - containerPort: {{ tuple "airflow_worker" "internal" "airflow_worker" $envAll | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
args: ["worker"] args: ["worker"]
readinessProbe:
tcpSocket:
port: {{ .Values.network.airflow.worker.port }}
volumeMounts: volumeMounts:
- name: pod-tmp - name: pod-tmp
mountPath: /tmp mountPath: /tmp
@ -177,6 +190,7 @@ spec:
imagePullPolicy: {{ .Values.images.pull_policy }} imagePullPolicy: {{ .Values.images.pull_policy }}
{{ tuple $envAll $envAll.Values.pod.resources.airflow.logrotate | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} {{ tuple $envAll $envAll.Values.pod.resources.airflow.logrotate | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
{{ dict "envAll" $envAll "application" "airflow_worker" "container" "airflow_logrotate" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }} {{ dict "envAll" $envAll "application" "airflow_worker" "container" "airflow_logrotate" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }}
{{ dict "envAll" $envAll "component" "airflow_worker" "container" "airflow_logrotate" "type" "readiness" "probeTemplate" (include "airflowLogrotateReadinessProbeTemplate" $envAll | fromYaml) | include "helm-toolkit.snippets.kubernetes_probe" | indent 10 }}
env: env:
- name: PERCENT_MAX_LOG_FS_USAGE - name: PERCENT_MAX_LOG_FS_USAGE
value: {{ .Values.logrotate.percent_max_log_fs_usage | quote }} value: {{ .Values.logrotate.percent_max_log_fs_usage | quote }}
@ -186,16 +200,6 @@ spec:
value: {{ .Values.conf.airflow.core.base_log_folder }} value: {{ .Values.conf.airflow.core.base_log_folder }}
- name: LOGROTATE_ENABLED - name: LOGROTATE_ENABLED
value: "enabled" value: "enabled"
readinessProbe:
exec:
command:
- sh
- -c
- |-
set -ex
ps -ef | grep 'sleep 3600' | grep -v 'grep'
initialDelaySeconds: 15
periodSeconds: 15
volumeMounts: volumeMounts:
- name: airflow-logs - name: airflow-logs
mountPath: {{ .Values.conf.airflow.core.base_log_folder }} mountPath: {{ .Values.conf.airflow.core.base_log_folder }}

View File

@ -863,6 +863,21 @@ pod:
airflow: airflow:
worker: 2 worker: 2
scheduler: 2 scheduler: 2
probes:
airflow_worker:
airflow_worker:
readiness:
enabled: true
params:
periodSeconds: 15
timeoutSeconds: 10
airflow_logrotate:
readiness:
enabled: true
params:
initialDelaySeconds: 15
periodSeconds: 15
timeoutSeconds: 10
lifecycle: lifecycle:
upgrades: upgrades:
deployments: deployments: