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


##########
chart/values.schema.json:
##########
@@ -10840,6 +10840,14 @@
                     ],
                     "default": 1,
                     "x-docsSection": "Kubernetes"
+                },
+                "ttlSecondsAfterFinished": {
+                    "description": "The number of seconds after a finished Job 
is eligible to be automatically deleted (requires Kubernetes 1.23+).",

Review Comment:
   ```suggestion
                       "description": "The number of seconds after a finished 
Job is eligible to be automatically deleted.",
   ```
   We support Kubernetes 1.30+ in the chart.



##########
chart/values.yaml:
##########
@@ -3903,6 +3903,9 @@ databaseCleanup:
   # When set, overwrite the default k8s number of successful and failed 
CronJob executions that are saved.
   failedJobsHistoryLimit: 1
   successfulJobsHistoryLimit: 1
+  # Time to live (in seconds) for Jobs created by this CronJob after they 
finish.
+  # Requires Kubernetes with the TTL controller for finished resources enabled 
(Kubernetes 1.21+ recommended).
+  ttlSecondsAfterFinished: ~

Review Comment:
   ```suggestion
     successfulJobsHistoryLimit: 1
   
     # Time to live (in seconds) for Jobs created by this CronJob after they 
finish.
     ttlSecondsAfterFinished: ~
   ```



##########
helm-tests/tests/helm_tests/airflow_aux/test_database_cleanup.py:
##########
@@ -507,3 +507,28 @@ def test_overridden_automount_service_account_token(self):
             
show_only=["templates/database-cleanup/database-cleanup-serviceaccount.yaml"],
         )
         assert jmespath.search("automountServiceAccountToken", docs[0]) is 
False
+
+    @pytest.mark.parametrize(
+        ("ttl_value", "expected_rendered"),
+        [
+            (300, 300),
+            (0, 0),
+            (None, None),
+        ],
+    )
+    def test_ttl_seconds_after_finished_rendering(self, ttl_value, 
expected_rendered):
+        values = {"databaseCleanup": {"enabled": True}}
+        if ttl_value is not None:
+            values["databaseCleanup"]["ttlSecondsAfterFinished"] = ttl_value
+
+        docs = render_chart(
+            values=values,
+            
show_only=["templates/database-cleanup/database-cleanup-cronjob.yaml"],
+        )
+
+        actual_ttl = 
jmespath.search("spec.jobTemplate.spec.ttlSecondsAfterFinished", docs[0])
+
+        if expected_rendered is not None:
+            assert actual_ttl == expected_rendered
+        else:
+            assert "ttlSecondsAfterFinished" not in 
docs[0]["spec"]["jobTemplate"]["spec"]

Review Comment:
   Could we separate this test to two tests:
   1. first for testing not setting the value (so default behaviour)
   2. second for testing different values
   ?



-- 
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