Skip to content

Commit

Permalink
use k8s 1.27 style patches based on current k8s version not target ve…
Browse files Browse the repository at this point in the history
…rsion (#4848)
  • Loading branch information
laverya authored Sep 27, 2023
1 parent 72fc6f5 commit 380fae3
Showing 1 changed file with 7 additions and 1 deletion.
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

0 comments on commit 380fae3

Please sign in to comment.