DataDog / helm-charts

Helm charts for Datadog products
Apache License 2.0
346 stars 1.01k forks source link

Way to specify APIVersion in values.yaml #1185

Closed starlightromero closed 1 year ago

starlightromero commented 1 year ago

This issue is similar to #733 and #734

Describe what happened: When using Kustomize, (in my case, with Terraform) there is no way to specify the API version for the CRDs in extendeddaemonset when the value installCRDs is set to true.

I am getting the error:

 no matches for kind "CustomResourceDefinition" in version "apiextensions.k8s.io/v1beta1"

This is because my cluster supports apiextensions.k8s.io/v1

Describe what you expected: extendeddaemonset CRDs should deploy with the correct apiVersions.

Steps to reproduce the issue:

  1. Set up a cluster with Kubernetes version 1.27.0
  2. Using Kustomize, attempt to deploy the extendeddaemonset helm chart. It will fail as the chart will render the v1beta1 components.

Additional environment details (Operating System, Cloud provider, etc):

Client Version: v1.28.2
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: v1.27.4-eks-2d98532
vboulineau commented 1 year ago

Hello @starlightromero,

The issue is that Helm provides auto-detection with Capabilities.APIVersions, which is not filled by default when using helm template (as most 3rd party tools do).

Helm provides the ability to inject content in APIVersions (and KubeVersion) in helm template for this reason (it's supported in the helm_template resources, for instance: https://registry.terraform.io/providers/hashicorp/helm/latest/docs/data-sources/template#api_versions).

I believe it to be a better approach on both sides as you set it once and it works for all Helm charts, without having the need to check all variables names to specify APIVersion for resource X or Y.