Miretpl commented on code in PR #59068:
URL: https://github.com/apache/airflow/pull/59068#discussion_r2599422737


##########
chart/templates/triggerer/triggerer-poddisruptionbudget.yaml:
##########
@@ -0,0 +1,46 @@
+{{/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/}}
+
+################################
+## Airflow Triggerer PodDisruptionBudget
+#################################
+{{- if .Values.triggerer.enabled }}
+{{- if .Values.triggerer.podDisruptionBudget.enabled }}

Review Comment:
   ```suggestion
   {{- if and .Values.triggerer.enabled 
.Values.triggerer.podDisruptionBudget.enabled }}
   ```



##########
chart/templates/triggerer/triggerer-poddisruptionbudget.yaml:
##########
@@ -0,0 +1,46 @@
+{{/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/}}
+
+################################
+## Airflow Triggerer PodDisruptionBudget
+#################################
+{{- if .Values.triggerer.enabled }}
+{{- if .Values.triggerer.podDisruptionBudget.enabled }}
+apiVersion: policy/v1
+kind: PodDisruptionBudget
+metadata:
+  name: {{ include "airflow.fullname" . }}-triggerer-pdb
+  labels:
+    tier: airflow
+    component: triggerer
+    release: {{ .Release.Name }}
+    chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
+    heritage: {{ .Release.Service }}
+    {{- if or (.Values.labels) (.Values.triggerer.labels) }}

Review Comment:
   ```suggestion
       {{- if or .Values.labels .Values.triggerer.labels }}
   ```



##########
helm-tests/tests/helm_tests/airflow_core/test_pdb_worker.py:
##########
@@ -0,0 +1,64 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+from __future__ import annotations
+
+import jmespath
+from chart_utils.helm_template_generator import render_chart
+
+
+class TestWorkerPdb:
+    """Tests Worker PDB."""
+
+    def test_should_pass_validation_with_just_pdb_enabled_v1(self):
+        render_chart(
+            values={"workers": {"podDisruptionBudget": {"enabled": True}}},
+            show_only=["templates/workers/worker-poddisruptionbudget.yaml"],
+        )  # checks that no validation exception is raised
+
+    def test_should_pass_validation_with_just_pdb_enabled_v1beta1(self):
+        render_chart(
+            values={"workers": {"podDisruptionBudget": {"enabled": True}}},
+            show_only=["templates/workers/worker-poddisruptionbudget.yaml"],
+            kubernetes_version="1.16.0",

Review Comment:
   Same as above, we do not support Kubernetes in 1.16 version



##########
helm-tests/tests/helm_tests/airflow_core/test_pdb_triggerer.py:
##########
@@ -0,0 +1,64 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+from __future__ import annotations
+
+import jmespath
+from chart_utils.helm_template_generator import render_chart
+
+
+class TestTriggererPdb:
+    """Tests Triggerer PDB."""
+
+    def test_should_pass_validation_with_just_pdb_enabled_v1(self):
+        render_chart(
+            values={"triggerer": {"podDisruptionBudget": {"enabled": True}}},
+            
show_only=["templates/triggerer/triggerer-poddisruptionbudget.yaml"],
+        )  # checks that no validation exception is raised
+
+    def test_should_pass_validation_with_just_pdb_enabled_v1beta1(self):
+        render_chart(
+            values={"triggerer": {"podDisruptionBudget": {"enabled": True}}},
+            
show_only=["templates/triggerer/triggerer-poddisruptionbudget.yaml"],
+            kubernetes_version="1.16.0",

Review Comment:
   According to the documentation, the Helm Chart supports Kubernetes clusters 
1.30+, so I would say that this test should not be necessary



##########
chart/templates/workers/worker-poddisruptionbudget.yaml:
##########
@@ -0,0 +1,44 @@
+{{/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/}}
+
+################################
+## Airflow Worker PodDisruptionBudget
+#################################
+{{- if .Values.workers.podDisruptionBudget.enabled }}
+apiVersion: policy/v1
+kind: PodDisruptionBudget
+metadata:
+  name: {{ include "airflow.fullname" . }}-worker-pdb
+  labels:
+    tier: airflow
+    component: worker
+    release: {{ .Release.Name }}
+    chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
+    heritage: {{ .Release.Service }}
+    {{- if or (.Values.labels) (.Values.workers.labels) }}

Review Comment:
   ```suggestion
       {{- if or .Values.labels .Values.workers.labels }}
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to