rimusz / charts

Helm Charts for Kubernetes
MIT License
90 stars 70 forks source link

Remove apis that wont work in k8s 1.22 #116

Closed theoriginalgri closed 2 years ago

theoriginalgri commented 2 years ago

What this PR does / why we need it: Removes deprecated api usage which is removed in 1.22. New APIs available from 1.8 on. See also https://kubernetes.io/docs/reference/using-api/deprecation-guide/#rbac-resources-v122

Checklist

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

This is not my code. I've just seen @cdaguerre already did the changes I was going to make but did not create a pull request to this repo.

cdaguerre commented 2 years ago

thanks for opening @theoriginalgri In fact I didn't open the PR because I wasn't sure of the version bump to make.

@rimusz From the link above, this means that this chart will no longer be compatible with kube versions below 1.21 (at least if pod disruption budgets are created which is only the case when configured with more than 1 replica).

RBAC resources The rbac.authorization.k8s.io/v1beta1 API version of ClusterRole, ClusterRoleBinding, Role, and RoleBinding is no longer served as of v1.22.

  • Migrate manifests and API clients to use the rbac.authorization.k8s.io/v1 API version, available since v1.8.
  • All existing persisted objects are accessible via the new APIs
  • No notable changes

PodDisruptionBudget The policy/v1beta1 API version of PodDisruptionBudget will no longer be served in v1.25.

  • Migrate manifests and API clients to use the policy/v1 API version, available since v1.21.
  • All existing persisted objects are accessible via the new API
  • Notable changes in policy/v1:
    • an empty spec.selector ({}) written to a policy/v1 PodDisruptionBudget selects all pods in the namespace (in policy/v1beta1 an empty spec.selector selected no pods). An unset spec.selector selects no pods in either API version.

What is the versioning strategy in terms of Kubernetes version compatibility? Is this a major, minor or patch and how should the upgrade guide be amended?

theoriginalgri commented 2 years ago

@cdaguerre Since the README.md states "Kubernetes versions older than 1.9 are not supported by this chart.", it's probably better to just update RBAC to not increase this to 1.21?

rimusz commented 2 years ago

thanks for opening @theoriginalgri In fact I didn't open the PR because I wasn't sure of the version bump to make.

@rimusz From the link above, this means that this chart will no longer be compatible with kube versions below 1.21 (at least if pod disruption budgets are created which is only the case when configured with more than 1 replica).

RBAC resources The rbac.authorization.k8s.io/v1beta1 API version of ClusterRole, ClusterRoleBinding, Role, and RoleBinding is no longer served as of v1.22.

  • Migrate manifests and API clients to use the rbac.authorization.k8s.io/v1 API version, available since v1.8.
  • All existing persisted objects are accessible via the new APIs
  • No notable changes

PodDisruptionBudget The policy/v1beta1 API version of PodDisruptionBudget will no longer be served in v1.25.

  • Migrate manifests and API clients to use the policy/v1 API version, available since v1.21.
  • All existing persisted objects are accessible via the new API
  • Notable changes in policy/v1:

    • an empty spec.selector ({}) written to a policy/v1 PodDisruptionBudget selects all pods in the namespace (in policy/v1beta1 an empty spec.selector selected no pods). An unset spec.selector selects no pods in either API version.

What is the versioning strategy in terms of Kubernetes version compatibility? Is this a major, minor or patch and how should the upgrade guide be amended?

@cdaguerre minor version bump is fine.

Also as not everyone is on 1.22+ I suggest to add to PDB and RBAC templates something like this:

{{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" }}
apiVersion: networking.k8s.io/v1
{{- else if .Capabilities.APIVersions.Has "networking.k8s.io/v1beta1" }}
apiVersion: networking.k8s.io/v1beta1
{{- else }}
apiVersion: extensions/v1beta1
{{- end }}

As the chart needs to be backwards compatible.

cdaguerre commented 2 years ago

Ok then:

@rimusz I didn't add the condition for RBAC because the stable api version is available since Kubernetes 1.8 and the readme states that this chart is not compatible with kube versions below 1.9.