dongjoon-hyun commented on code in PR #830:
URL: 
https://github.com/apache/spark-kubernetes-operator/pull/830#discussion_r4027115427


##########
.github/workflows/build_and_test.yml:
##########
@@ -290,6 +290,22 @@ jobs:
           build-tools/helm/spark-kubernetes-operator/
           minikube docker-env --unset
           helm test spark
+      - name: Validate the deprecated helm key warning
+        if: matrix.test-group == 'configmap-metadata'
+        run: |
+          # `helm template` does not render NOTES.txt, so an install or 
upgrade against a

Review Comment:
   `helm install --dry-run=client` renders `NOTES.txt` without a cluster 
(verified locally with `KUBECONFIG=/dev/null`), so a real cluster is not 
required here. Could we move this check to the `lint` job, next to `Validate 
deprecated helm values are still honored`? That avoids coupling it to the 
unrelated `configmap-metadata` group and avoids applying a NetworkPolicy and 
dynamicConfig RBAC changes to the live release.
   
   ```yaml
         - name: Validate the deprecated helm key warning
           run: |
             notes=$(helm install spark 
build-tools/helm/spark-kubernetes-operator --dry-run=client \
               --set operatorDeployment.networkPolicy.enable=true \
               --set operatorConfiguration.dynamicConfig.enable=true)
             echo "$notes" | grep -q 'operatorDeployment.networkPolicy.enable 
is deprecated'
             echo "$notes" | grep -q 
'operatorConfiguration.dynamicConfig.enable is deprecated'
             if helm install spark build-tools/helm/spark-kubernetes-operator 
--dry-run=client \
               | grep -q 'is deprecated'; then
               echo "Deprecation warning printed without a legacy key"; exit 1
             fi
   ```
   
   If so, please also update the PR description's "a real cluster is the only 
place this is observable".



##########
build-tools/helm/spark-kubernetes-operator/templates/NOTES.txt:
##########
@@ -0,0 +1,31 @@
+{{- /*
+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.
+*/ -}}
+Apache Spark Kubernetes Operator {{ .Chart.AppVersion }} is installed.
+{{- if hasKey .Values.operatorDeployment.networkPolicy "enable" }}

Review Comment:
   nit: `hasKey` fails on a nil map. With `--set 
operatorDeployment.networkPolicy=null`, the install now fails here:
   
   ```
   NOTES.txt:18:21 ... wrong type for value; expected map[string]interface {}; 
got interface {}
   ```
   
   The current chart renders fine with the same input because `_helpers.tpl` 
uses `or $np.enabled $np.enable`. It is an unrealistic input, but it could be 
guarded with `hasKey (.Values.operatorDeployment.networkPolicy | default dict) 
"enable"` (and likewise for `dynamicConfig`).



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to