This document describes the steps needed to perform in order to confidently add support for a new Kubernetes minor version.
⚠️ Typically, once a minor Kubernetes versionvX.Yis supported by Gardener, then all patch versionsvX.Y.Zare also automatically supported without any required action. This is because patch versions do not introduce any new feature or API changes, so there is nothing that needs to be adapted ingardener/gardenercode.
The Kubernetes community release a new minor version roughly every 4 months. Please refer to the official documentation about their release cycles for any additional information.
Shortly before a new release, an "umbrella" issue should be opened which is used to collect the required adaptations and to track the work items.
For example, #5102 can be used as a template for the issue description.
As you can see, the task of supporting a new Kubernetes version also includes the provider extensions maintained in the gardener GitHub organization and is not restricted to gardener/gardener only.
Generally, the work items can be split into two groups: The first group contains tasks specific to the changes in the given Kubernetes release, the second group contains Kubernetes release-independent tasks.
ℹ️ Upgrading the
k8s.io/*andsigs.k8s.io/controller-runtimeGolang dependencies is typically tracked and worked on separately (see e.g. #4772 or #5282).
Most new minor Kubernetes releases incorporate API changes, deprecations, or new features.
The community announces them via their change logs.
In order to derive the release-specific tasks, the respective change log for the new version vX.Y has to be read and understood (for example, the changelog for v1.24).
As already mentioned, typical changes to watch out for are:
- API version promotions or deprecations
- Feature gate promotions or deprecations
- CLI flag changes for Kubernetes components
- New default values in resources
- New available fields in resources
- New features potentially relevant for the Gardener system
- Changes of labels or annotations Gardener relies on
- ...
Obviously, this requires a certain experience and understanding of the Gardener project so that all "relevant changes" can be identified.
While reading the change log, add the tasks (along with the respective PR in kubernetes/kubernetes to the umbrella issue).
ℹ️ Some of the changes might be specific to certain cloud providers. Pay attention to those as well and add related tasks to the issue.
The following paragraphs describe recurring tasks that need to be performed for each new release.
The gardener/hyperkube repository is used to release container images consisting of the kubectl and kubelet binaries.
There is a CI/CD job that runs periodically and releases a new hyperkube image when there is a new Kubernetes release. Before proceeding with the next steps, make sure that a new hyperkube image is released for the corresponding new Kubernetes minor version. Make sure that container image is present in GCR.
- Allow instantiation of a Kubernetes client for the new minor version and update the
README.md: - Maintain the Kubernetes feature gates used for validation of
Shootresources:- The feature gates are maintained in this file.
- To maintain this list for new Kubernetes versions, run
hack/compare-k8s-feature-gates.sh <old-version> <new-version>(e.g.hack/compare-k8s-feature-gates.sh v1.22 v1.23). - It will present 3 lists of feature gates: those added and those removed in
<new-version>compared to<old-version>and feature gates that got locked to default in<new-version>. - Add all added feature gates to the map with
<new-version>asAddedInVersionand noRemovedInVersion. - For any removed feature gates, add
<new-version>asRemovedInVersionto the already existing feature gate in the map. - For feature gates locked to default, add
<new-version>asLockedToDefaultInVersionto the already existing feature gate in the map. - See this example commit.
- Maintain the Kubernetes
kube-apiserveradmission plugins used for validation ofShootresources:- The admission plugins are maintained in this file.
- To maintain this list for new Kubernetes versions, run
hack/compare-k8s-admission-plugins.sh <old-version> <new-version>(e.g.hack/compare-k8s-admission-plugins.sh 1.24 1.25). - It will present 2 lists of admission plugins: those added and those removed in
<new-version>compared to<old-version>. - Add all added admission plugins to the
admissionPluginsVersionRangesmap with<new-version>asAddedInVersionand noRemovedInVersion. - For any removed admission plugins, add
<new-version>asRemovedInVersionto the already existing admission plugin in the map. - Flag any admission plugins that are required (plugins that must not be disabled in the
Shootspec) by setting theRequiredboolean variable to true for the admission plugin in the map. - Flag any admission plugins that are forbidden by setting the
Forbiddenboolean variable to true for the admission plugin in the map.
- Maintain the
ServiceAccountnames for the controllers part ofkube-controller-manager:- The names are maintained in this file.
- To maintain this list for new Kubernetes versions, run
hack/compare-k8s-controllers.sh <old-version> <new-version>(e.g.hack/compare-k8s-controllers.sh 1.22 1.23). - It will present 2 lists of controllers: those added and those removed in
<new-version>compared to<old-version>. - Double check whether such
ServiceAccountindeed appears in thekube-systemnamespace when creating a cluster with<new-version>. Note that it sometimes might be hidden behind a default-off feature gate. You can create a local cluster with the new version using the local provider. - If it appears, add all added controllers to the list based on the Kubernetes version (example).
- For any removed controllers, add them only to the Kubernetes version if it is low enough.
- Maintain the names of controllers used for workerless Shoots, here after carefully evaluating whether they are needed if there are no workers.
- Maintain copies of the
DaemonSetcontroller's scheduling logic:gardener-resource-manager'sNodecontroller uses a copy of parts of theDaemonSetcontroller's logic for determining whether a specificNodeshould run a daemon pod of a givenDaemonSet: see this file.- Check the referenced upstream files for changes to the
DaemonSetcontroller's logic and adapt our copies accordingly. This might include introducing version-specific checks in our codebase to handle different shoot cluster versions.
- Maintain version specific defaulting logic in shoot admission plugin:
- Sometimes default values for shoots are intentionally changed with the introduction of a new Kubernetes version.
- The final Kubernetes version for a shoot is determined in the Shoot Validator Admission Plugin.
- Any defaulting logic that depends on the version should be placed in this admission plugin (example).
- Ensure that maintenance-controller is able to auto-update shoots to the new Kubernetes version. Changes to the shoot spec required for the Kubernetes update should be enforced in such cases (examples).
- Bump the used Kubernetes version for local e2e test.
- See this example commit.
Work on all the tasks you have collected and validate them using the local provider. Execute the e2e tests and if everything looks good, then go ahead and file the PR (example PR). Generally, it is great if you add the PRs also to the umbrella issue so that they can be tracked more easily.
After the PR in gardener/gardener for the support of the new version has been merged, you can go ahead and work on the provider extensions.
Actually, you can already start even if the PR is not yet merged and use the branch of your fork.
- Revendor the
github.com/gardener/gardenerdependency in the extension and update theREADME.md. - Work on release-specific tasks related to this provider.
Some of the cloud providers are not yet using upstream cloud-controller-manager images.
Instead, we build and maintain them ourselves:
- https://github.com/gardener/cloud-provider-aws
- https://github.com/gardener/cloud-provider-azure (since
v1.23, we use the upstream image) - https://github.com/gardener/cloud-provider-gcp
Until we switch to upstream images, you need to revendor the Kubernetes dependencies and release a new image. The required steps are as follows:
- Checkout the
legacy-cloud-providerbranch of the respective repository - Bump the versions in the
Dockerfile(example commit). - Update the
VERSIONtovX.Y.Z-devwhereZis the latest available Kubernetes patch version for thevX.Yminor version. - Update the
k8s.io/*dependencies in thego.modfile tovX.Y.Zand rungo mod vendorandgo mod tidy(example commit). - Checkout a new
release-vX.Ybranch and release it (example)
As you are already on it, it is great if you also bump the
k8s.io/*dependencies for the last three minor releases as well. In this case, you need to checkout therelease-vX.{Y-{1,2,3}}branches and only perform the last three steps (example branch, example commit).
Now you need to update the new releases in the charts/images.yaml of the respective provider extension so that they are used (see this example commit for reference).
Again, work on all the tasks you have collected. This time, you cannot use the local provider for validation but should create real clusters on the various infrastructures. Typically, the following validations should be performed:
- Create new clusters with versions <
vX.Y - Create new clusters with version =
vX.Y - Upgrade old clusters from version
vX.{Y-1}to versionvX.Y - Delete clusters with versions <
vX.Y - Delete clusters with version =
vX.Y
If everything looks good, then go ahead and file the PR (example PR). Generally, it is again great if you add the PRs also to the umbrella issue so that they can be tracked more easily.