jiangzho commented on code in PR #279:
URL: 
https://github.com/apache/spark-kubernetes-operator/pull/279#discussion_r2193556074


##########
spark-operator-api/src/main/resources/finalize-generated-crd.sh:
##########
@@ -23,5 +23,15 @@
 SCRIPT_PATH=$(cd "$(dirname "$0")"; pwd)
 for f in $(ls 
${SCRIPT_PATH}/../../../build/classes/java/main/META-INF/fabric8/*.spark.apache.org-v1.yml);
 do
   yq -i '.spec.versions[0] += ({"additionalPrinterColumns": [{"jsonPath": 
".status.currentState.currentStateSummary", "name": "Current State", "type": 
"string"}, {"jsonPath": ".metadata.creationTimestamp", "name": "Age", "type": 
"date"}]})' $f
+  filename=$(basename "$f")
+  
template_file_path="${SCRIPT_PATH}/../../../../build-tools/crd-templates/${filename}"
+  
target_dir="${SCRIPT_PATH}/../../../../build-tools/helm/spark-kubernetes-operator/crds"
+  mkdir -p "${target_dir}"
+  target_file_path="${target_dir}/${filename}"
+  yq eval-all '
+    select(fileIndex == 1) as $source
+    | select(fileIndex == 0)
+    | .spec.versions += [$source.spec.versions[0]]

Review Comment:
   The intention was to:
   
   * keep old CRD version(s) that do not need new features in a template file, 
and
   * append new version at the end of the template, then move the full 
generated YAML to the proper location of the chart.
   
   As we still want supporting v1alpha1 & v1beta1, I can remove them from the 
template. In the next commit we can do
   
   * keep a template file that includes an empty list of versions
     - deprecated version(s) can be move to it in future
   * keep a list of supported versions, generate latest YAML for them, then 
apply them to the template. 
   
   How does this sound ?



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