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

use k8s 1.27 style patches based on current k8s version not target version #4848

Merged
merged 1 commit into from
Sep 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion scripts/common/yaml.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,15 @@ function insert_patches_strategic_merge() {
local kustomization_file="$1"
local patch_file="$2"

# we care about the current kubernetes version here, not the target version - this function can be called from pre-init addons
local kubeletVersion=
kubeletVersion="$(kubelet_version)"
semverParse "$kubeletVersion"
local kubeletMinor="$minor"

# Kubernetes 1.27 uses kustomize v5 which dropped support for old, legacy style patches
# See: https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG/CHANGELOG-1.27.md#changelog-since-v1270
if [ "$KUBERNETES_TARGET_VERSION_MINOR" -ge "27" ]; then
if [ "$kubeletMinor" -ge "27" ]; then
if [[ $kustomization_file =~ "prometheus" ]] || [[ $kustomization_file =~ "rook" ]]; then
# TODO: multi-doc patches is not currently supported in kustomize v5
# continue using the deprecated 'patchesStrategicMerge' field until this is fixed
Expand Down