Repository: pantsbuild/pants

Issue:
Helm charts should include CRDS
**Is your feature request related to a problem? Please describe.**
Current implementation of `helm_chart` ignores any files placed in the `crds/` folder of the given chart which is the default location.

**Describe the solution you'd like**
Include all YAML files present in the `crds` folder at the chart sources root.

**Describe alternatives you've considered**
N/A

**Additional context**
N/A



Discussion:

Resolving patch:
diff --git a/src/python/pants/backend/helm/target_types.py b/src/python/pants/backend/helm/target_types.py
--- a/src/python/pants/backend/helm/target_types.py
+++ b/src/python/pants/backend/helm/target_types.py
@@ -94,7 +94,15 @@ class HelmChartMetaSourceField(SingleSourceField):
 
 
 class HelmChartSourcesField(MultipleSourcesField):
-    default = ("values.yaml", "templates/*.yaml", "templates/*.tpl")
+    default = (
+        "values.yaml",
+        "values.yml",
+        "templates/*.yaml",
+        "templates/*.yml",
+        "templates/*.tpl",
+        "crds/*.yaml",
+        "crds/*.yml",
+    )
     expected_file_extensions = (".yaml", ".yml", ".tpl")
 
 
diff --git a/src/python/pants/backend/helm/testutil.py b/src/python/pants/backend/helm/testutil.py
--- a/src/python/pants/backend/helm/testutil.py
+++ b/src/python/pants/backend/helm/testutil.py
@@ -184,6 +184,74 @@ def gen_chart_file(
   """
 )
 
+K8S_CRD_FILE = dedent(
+    """\
+  apiVersion: apiextensions.k8s.io/v1
+  kind: CustomResourceDefinition
+  metadata:
+  # name must match the spec fields below, and be in the form: <plural>.<group>
+  name: myplatforms.contoso.com
+  spec:
+  # group name to use for REST API: /apis/<group>/<version>
+  group: contoso.com
+  names:
+    # plural name to be used in the URL: /apis/<group>/<version>/<plural>
+    plural: myplatforms
+    # singular name to be used as an alias on the CLI and for display
+    singular: myplatform
+    # kind is normally the CamelCased singular type. Your resource manifests use this.
+    kind: MyPlatform
+    # shortNames allow shorter string to match your resource on the CLI
+    shortNames:
+    - myp
+  # either Namespaced or Cluster
+  scope: Namespaced
+  versions:
+    - name: v1alpha1
+      # Each version can be enabled/disabled by Served flag.
+      served: true
+      # One and only one version must be marked as the storage version.
+      storage: true
+      schema:
+        openAPIV3Schema:
+          type: object
+          properties:
+            spec:
+              type: object
+              properties:
+                appId:
+                  type: string
+                language:
+                  type: string
+                  enum:
+                  - csharp
+                  - python
+                  - go
+                os:
+                  type: string
+                  enum:
+                  - windows
+                  - linux
+                instanceSize:
+                  type: string
+                  enum:
+                    - small
+                    - medium
+                    - large
+                environmentType:
+                  type: string
+                  enum:
+                  - dev
+                  - test
+                  - prod
+                replicas:
+                  type: integer
+                  minimum: 1
+              required: ["appId", "language", "environmentType"]
+          required: ["spec"]
+  """
+)
+
 HELM_TEMPLATE_HELPERS_FILE = dedent(
     """\
   {{- define "fullname" -}}


Test patch:
diff --git a/src/python/pants/backend/helm/util_rules/sources_test.py b/src/python/pants/backend/helm/util_rules/sources_test.py
--- a/src/python/pants/backend/helm/util_rules/sources_test.py
+++ b/src/python/pants/backend/helm/util_rules/sources_test.py
@@ -13,6 +13,7 @@
     HELM_CHART_FILE,
     HELM_TEMPLATE_HELPERS_FILE,
     HELM_VALUES_FILE,
+    K8S_CRD_FILE,
     K8S_SERVICE_FILE,
 )
 from pants.backend.helm.util_rules import sources
@@ -48,6 +49,7 @@ def test_source_templates_are_always_included(rule_runner: RuleRunner) -> None:
             ),
             "Chart.yaml": HELM_CHART_FILE,
             "values.yaml": HELM_VALUES_FILE,
+            "crds/foo.yml": K8S_CRD_FILE,
             "templates/_helpers.tpl": HELM_TEMPLATE_HELPERS_FILE,
             "templates/service.yaml": K8S_SERVICE_FILE,
             "resource.xml": "",
@@ -67,6 +69,7 @@ def test_source_templates_are_always_included(rule_runner: RuleRunner) -> None:
     )
 
     assert source_files.snapshot.files == (
+        "crds/foo.yml",
         "templates/_helpers.tpl",
         "templates/service.yaml",
         "values.yaml",