From ecc808949f6a113a1e55f45b83832c0da71aa465 Mon Sep 17 00:00:00 2001 From: jfavellar90 Date: Thu, 16 Nov 2023 12:29:03 -0500 Subject: [PATCH] feat: using patches instead of patchesStrategicMerge [patchesStrategicMerge](https://kubectl.docs.kubernetes.io/references/kustomize/kustomization/patchesstrategicmerge/) is going to be deprecated in future releases of the Kustomization API. It is replaced by the [patches](https://kubectl.docs.kubernetes.io/references/kustomize/kustomization/patches/) key which is more powerful and allows defining different patch types --- ...123_202154_jhony.avella_kustomize_patches_migration.md | 3 +++ docs/reference/patches.rst | 6 +++--- tutor/templates/kustomization.yml | 8 ++++---- 3 files changed, 10 insertions(+), 7 deletions(-) create mode 100644 changelog.d/20231123_202154_jhony.avella_kustomize_patches_migration.md diff --git a/changelog.d/20231123_202154_jhony.avella_kustomize_patches_migration.md b/changelog.d/20231123_202154_jhony.avella_kustomize_patches_migration.md new file mode 100644 index 0000000000..de853e2c3c --- /dev/null +++ b/changelog.d/20231123_202154_jhony.avella_kustomize_patches_migration.md @@ -0,0 +1,3 @@ +- 💥[Improvement] Replacing "patchesStrategicMerge" key with "patches" key in the main Kustomization file. [patchesStrategicMerge](https://kubectl.docs.kubernetes.io/references/kustomize/kustomization/patchesstrategicmerge/) is going to be deprecated in future releases of the Kustomization API. It is replaced by the [patches](https://kubectl.docs.kubernetes.io/references/kustomize/kustomization/patches/) key which is more powerful and allows defining different patch types. This has the following consequences: + - The patch "kustomization-patches-strategic-merge" was renamed to "kustomization-patches" + - Extra Kustomization patches added via the "kustomization-patches" Tutor patch must respect the format specified [here](https://kubectl.docs.kubernetes.io/references/kustomize/kustomization/patches/). It implies moving old "patchesStrategicMerge" extra patches to the "patches" format. \ No newline at end of file diff --git a/docs/reference/patches.rst b/docs/reference/patches.rst index e581786094..6ae9e5d249 100644 --- a/docs/reference/patches.rst +++ b/docs/reference/patches.rst @@ -138,14 +138,14 @@ File: ``kustomization.yml`` File: ``kustomization.yml`` -.. patch:: kustomization-patches-strategic-merge +.. patch:: kustomization-patches -``kustomization-patches-strategic-merge`` +``kustomization-patches`` ========================================= File: ``kustomization.yml`` -This can be used to add more Kustomization patches that make use of the `strategic merge mechanism `__. +This can be used to add more Kustomization patches. See more details `here `__. .. patch:: kustomization-resources diff --git a/tutor/templates/kustomization.yml b/tutor/templates/kustomization.yml index f29fea1e81..c3c3b6d7ec 100644 --- a/tutor/templates/kustomization.yml +++ b/tutor/templates/kustomization.yml @@ -65,12 +65,12 @@ configMapGenerator: app.kubernetes.io/name: redis {{ patch("kustomization-configmapgenerator") }} -{%- if patch("k8s-override") or patch("kustomization-patches-strategic-merge") %} -patchesStrategicMerge: +{%- if patch("k8s-override") or patch("kustomization-patches") %} +patches: {%- if patch("k8s-override") %} -- k8s/override.yml +- path: k8s/override.yml {%- endif %} -{{ patch("kustomization-patches-strategic-merge") }} +{{ patch("kustomization-patches") }} {%- endif %} {{ patch("kustomization") }}