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

Remove apis that wont work in k8s 1.22 #116

Merged
merged 1 commit into from
Nov 19, 2021
Merged

Conversation

theoriginalgri
Copy link
Contributor

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

  • Chart Version bumped
  • Changes are documented in the README.md

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
Copy link
Contributor

cdaguerre commented Nov 18, 2021

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
Copy link
Contributor Author

@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
Copy link
Owner

rimusz commented Nov 19, 2021

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
Copy link
Contributor

Ok then:

  • Bumped a minor
  • Kept compatible with kube ^1.9
  • Added compatibility with ^1.22
  • Conditionally use policy/v1 if available (starting 1.21), policy/v1beta if not (because it will be dropped in 1.25).

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

@rimusz rimusz merged commit 23972fa into rimusz:master Nov 19, 2021
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.

3 participants