Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update PodDisruptionBudget api version to get rid of warning message #494

Merged
merged 1 commit into from
Dec 23, 2021
Merged

Update PodDisruptionBudget api version to get rid of warning message #494

merged 1 commit into from
Dec 23, 2021

Conversation

wangshu3000
Copy link
Contributor

What this PR does / why we need it:

Update PodDisruptionBudget api version from policy/v1beta1 to policy/v1, to get rid of the warning message, the v1beta1 is deprecated in v1.21+, unavailable in v1.25+;

Which issue this PR fixes

(optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close that issue when PR gets merged)

Special notes for your reviewer:

Checklist

[Place an '[x]' (no spaces) in all applicable fields. Please remove unrelated fields.]

  • Documentation has been updated with helm-docs (run: .github/helm-docs.sh)
  • Chart Version bumped
  • CHANGELOG.md has been updated
  • Variables are documented in the README.md

@wangshu3000 wangshu3000 requested a review from a team as a code owner December 23, 2021 01:16
Copy link
Collaborator

@clamoriniere clamoriniere left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @wangshu3000

Thanks for this contribution, everything looks good

@clamoriniere clamoriniere merged commit 79bca8f into DataDog:main Dec 23, 2021
@rslinckx
Copy link

We are using helm to install datadog into our cluster, but we use the helm template feature (part of a gitops setup). As such we are limited in what kind of capabilities the helm command will accurately report, as it does not query the live cluster.

There is an easy way to add capabilities via a command line flag, but there is currently no way to remove capabilities from the default list, which is built-in to helm based on their current k8s library version.

In this case with the latest helm 3 release, the policy/v1 capability seems baked in, and I see no way to disable the capability. As such the helm chart will render a policy/v1 PodDisruptionBudget, which isn't available in my 1.19 cluster.

Would you be open to adding a more explicit flag to select the version of the disruptionbudget to be used in values.yaml ?

@clamoriniere
Copy link
Collaborator

Hi @rslinckx
You can set the kubernetes api-server version when running “helm template”

helm template --kube-version 1.19.0 -f values.yaml datadog/datadog

We are using this option to validate our template against several kubernetes versions see:

helm dep up "${CHART_DIR}" && helm template --kube-version "${KUBERNETES_VERSION#v}" --values "${CHART_DIR}"/ci/kubeval.yaml "${CHART_DIR}" | ./kubeval --strict --ignore-missing-schemas --kubernetes-version "${KUBERNETES_VERSION#v}" --schema-location "${SCHEMA_LOCATION}"

Please let us know if it solves your issue?

Else we can discuss how we can provide an option in the values.yaml to for a specific version.

@rslinckx
Copy link

rslinckx commented Dec 24, 2021

We are actually running this with helm 3.7.2:

helm template --api-versions apps/v1 --api-versions apiextensions.k8s.io/v1/CustomResourceDefinition --kube-version 1.19 "$chartName" . --namespace "$chartNamespace" --include-crds --no-hooks

but it generates policy/v1 PodDisruptionBudget instead of the expected policy/v1beta1 as 1.19 does not have v1 yet.

I think this is due to helm having some kind of hard-coded k8s versions list based on the version they build against?

I see the CI here uses helm 3.6.3, maybe that's why it worked ? 3.7 updated their internal package to k8s 1.22, where in 3.6 they used k8s 1.21, although it seems v1 was marked as stable in 1.21 already, so not sure this is it...

@clamoriniere
Copy link
Collaborator

Hello again @rslinckx
I was able to reproduce your issue too. And I found several open issue on other helm charts reporting the same issue with policy/v1 (argoproj/argo-cd#7291, cortexproject/cortex-helm-chart#277, elastic/helm-charts#1454)

I have created this PR #498 to be more restrictive and fix the issue with helm template

@rslinckx
Copy link

Thanks a lot !

@mscanlon72
Copy link

I am using EKS v1.21 and I still see the warning messages using the latest charts (datadog-2.28.13). Any information on why that would be the case?

@wangshu3000
Copy link
Contributor Author

@mscanlon72
Did you see the warning when running
kubectl get PodDisruptionBudget
or saw the warning when deploying the chart?
I think you may still see a warning when you run kubectl get PodDisruptionBudget.
Kubernetes 1.21 still support policy/v1beta1, it'll be removed after 1.25.

@mscanlon72
Copy link

This is what I see when I run that command:

No resources found in datadog namespace.

@mscanlon72
Copy link

Setting createPodDisruptionBudget to true creates the PDB, but the warnings still persist in the logs and are very frequent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Avoid deprecated API versions on YAML definitions for Kubernetes 1.21
4 participants