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


##########
chart/newsfragments/73016.bugfix.rst:
##########
@@ -0,0 +1 @@
+Hash only ``data`` and ``stringData`` in the ``checksum/*`` pod annotations, 
instead of each rendered ConfigMap and Secret in full, so that 
``helm.sh/chart`` in their labels no longer moves the checksums and restarts 
every component on a chart version bump whose configuration is unchanged

Review Comment:
   According to the latest changes 
(https://github.com/apache/airflow/blob/main/contributing-docs/18_contribution_workflow.rst#newsfragments),
 we use only significant newsfragments.



##########
chart/templates/_helpers.yaml:
##########
@@ -1219,3 +1219,12 @@ Usage:
           path: namespace
   {{- end }}
 {{- end -}}
+
+{{/*
+ Compute a ConfigMap or Secret checksum from its data only, for the checksum/* 
pod annotations.
+ The full manifest carries the helm.sh/chart label, which changes on every 
chart version bump and
+ would restart every Airflow component on upgrade even when no configuration 
changed.

Review Comment:
   ```suggestion
    Compute a ConfigMap or Secret checksum from its data only, for the 
checksum/* pod annotations.
    The full manifest carries labels, which may change on every chart 
deployment and
    would restart every Airflow component on upgrade even when no configuration 
changes.
   ```



##########
chart/tests/helm_tests/airflow_aux/test_config_checksums.py:
##########
@@ -0,0 +1,82 @@
+# 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
+
+from chart_utils.helm_template_generator import render_chart
+
+# The checksum/* annotations exist so that a configuration change restarts the 
component that
+# reads it. Hashing the whole rendered manifest also pulled in 
metadata.labels, which carry
+# helm.sh/chart, so the checksums moved on a chart version bump and every 
component restarted
+# even though nothing it reads had changed.
+
+# A label added through the `labels` value lands in the same metadata.labels 
block as
+# chart: "airflow-<version>", so it stands in for the chart version, which is 
not settable
+# through values.
+#

Review Comment:
   ```suggestion
   ```
   I think it is pretty natural to reload only on a config change. We do not 
rather need a justification for this change living in the code.



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