diff --git a/examples/breakfast.md b/examples/breakfast.md index d39237082..25e4f2264 100644 --- a/examples/breakfast.md +++ b/examples/breakfast.md @@ -73,8 +73,8 @@ commonLabels: who: alice resources: - ../../base -patchesStrategicMerge: -- temperature.yaml +patches: +- path: temperature.yaml EOF cat <$DEMO_HOME/breakfast/overlays/alice/temperature.yaml @@ -96,8 +96,8 @@ commonLabels: who: bob resources: - ../../base -patchesStrategicMerge: -- topping.yaml +patches: +- path: topping.yaml EOF cat <$DEMO_HOME/breakfast/overlays/bob/topping.yaml diff --git a/examples/components.md b/examples/components.md index acc112461..ac0046972 100644 --- a/examples/components.md +++ b/examples/components.md @@ -127,8 +127,8 @@ secretGenerator: - site_key.txt - secret_key.txt -patchesStrategicMerge: - - configmap.yaml +patches: + - path: configmap.yaml patchesJson6902: - target: @@ -225,8 +225,8 @@ secretGenerator: files: - dbpass.txt -patchesStrategicMerge: - - configmap.yaml +patches: + - path: configmap.yaml patchesJson6902: - target: @@ -326,8 +326,8 @@ secretGenerator: - site_key.txt - secret_key.txt -patchesStrategicMerge: - - configmap.yaml +patches: + - path: configmap.yaml patchesJson6902: - target: @@ -536,8 +536,8 @@ secretGenerator: files: - dbpass.txt -patchesStrategicMerge: - - configmap.yaml +patches: + - path: configmap.yaml patchesJson6902: - target: @@ -592,8 +592,8 @@ secretGenerator: files: - ldappass.txt -patchesStrategicMerge: - - configmap.yaml +patches: + - path: configmap.yaml patchesJson6902: - target: diff --git a/examples/configGeneration.md b/examples/configGeneration.md index 13f112cc5..6c307d96b 100644 --- a/examples/configGeneration.md +++ b/examples/configGeneration.md @@ -72,8 +72,8 @@ commonAnnotations: note: Hello, I am staging! resources: - ../../base -patchesStrategicMerge: -- map.yaml +patches: + - path: map.yaml EOF cat <$OVERLAYS/staging/map.yaml diff --git a/examples/helloWorld/README.md b/examples/helloWorld/README.md index 171aa6469..ac0611e56 100644 --- a/examples/helloWorld/README.md +++ b/examples/helloWorld/README.md @@ -150,8 +150,8 @@ commonAnnotations: note: Hello, I am staging! resources: - ../../base -patchesStrategicMerge: -- map.yaml +patches: +- path: map.yaml EOF ``` @@ -191,8 +191,8 @@ commonAnnotations: note: Hello, I am production! resources: - ../../base -patchesStrategicMerge: -- deployment.yaml +patches: +- path: deployment.yaml EOF ``` diff --git a/examples/inlinePatch.md b/examples/inlinePatch.md index b0e713e82..7bdff92d5 100644 --- a/examples/inlinePatch.md +++ b/examples/inlinePatch.md @@ -44,9 +44,9 @@ EOF ``` -## Inline Patch for PatchesStrategicMerge +## Inline Patch -Create an overlay and add an inline patch in `patchesStrategicMerge` field to the kustomization file +Create an overlay and add an inline patch in the `patches` field to the kustomization file to change the image from `nginx` to `nginx:latest`. @@ -57,18 +57,18 @@ cat <$SMP_OVERLAY/kustomization.yaml resources: - ../base -patchesStrategicMerge: -- |- - apiVersion: apps/v1 - kind: Deployment - metadata: - name: deploy - spec: - template: - spec: - containers: - - name: nginx - image: nginx:latest +patches: +- patch: |- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: deploy + spec: + template: + spec: + containers: + - name: nginx + image: nginx:latest EOF ``` @@ -110,18 +110,18 @@ cat <$SMP_OVERLAY/kustomization.yaml resources: - ../base -patchesStrategicMerge: -- |- - apiVersion: apps/v1 - kind: Deployment - metadata: - name: deploy - spec: - template: - spec: - containers: - - name: nginx - $patch: delete +patches: +- patch: |- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: deploy + spec: + template: + spec: + containers: + - name: nginx + $patch: delete EOF ``` diff --git a/examples/ldap/overlays/production/kustomization.yaml b/examples/ldap/overlays/production/kustomization.yaml index ff80528de..87e1a591c 100644 --- a/examples/ldap/overlays/production/kustomization.yaml +++ b/examples/ldap/overlays/production/kustomization.yaml @@ -1,5 +1,5 @@ resources: - ../../base -patchesStrategicMerge: - - deployment.yaml +patches: + - path: deployment.yaml namePrefix: production- diff --git a/examples/ldap/overlays/staging/kustomization.yaml b/examples/ldap/overlays/staging/kustomization.yaml index 0e944dbe7..7f9833b0f 100644 --- a/examples/ldap/overlays/staging/kustomization.yaml +++ b/examples/ldap/overlays/staging/kustomization.yaml @@ -1,7 +1,7 @@ resources: - ../../base -patchesStrategicMerge: - - deployment.yaml +patches: + - path: deployment.yaml namePrefix: staging- configMapGenerator: - name: env-config diff --git a/examples/mySql/README.md b/examples/mySql/README.md index 55c8e4305..159a03001 100644 --- a/examples/mySql/README.md +++ b/examples/mySql/README.md @@ -150,7 +150,7 @@ Off the shelf MySQL uses `emptyDir` type volume, which gets wiped away if the MySQL Pod is recreated, and that is certainly not desirable for production environment. So we want to use Persistent Disk in -production. kustomize lets you apply `patchesStrategicMerge` to the +production. kustomize lets you apply `patches` to the resources. @@ -176,8 +176,8 @@ Add the patch file to `kustomization.yaml`: ``` cat <<'EOF' >> $DEMO_HOME/kustomization.yaml -patchesStrategicMerge: -- persistent-disk.yaml +patches: +- path: persistent-disk.yaml EOF ``` @@ -190,7 +190,7 @@ Lets break this down: in deployment.yaml - Then we added `persistent-disk.yaml` to list of - `patchesStrategicMerge` in `kustomization.yaml`. `kustomize build` + `patches` in `kustomization.yaml`. `kustomize build` will apply this patch to the deployment resource with the name `mysql` as defined in the patch. diff --git a/examples/wordpress/README.md b/examples/wordpress/README.md index 16e7f2db2..fd7e0f74d 100644 --- a/examples/wordpress/README.md +++ b/examples/wordpress/README.md @@ -55,8 +55,8 @@ resources: - wordpress - mysql namePrefix: demo- -patchesStrategicMerge: -- patch.yaml +patches: +- path: patch.yaml EOF ``` diff --git a/examples/wordpress/kustomization.yaml b/examples/wordpress/kustomization.yaml index 292fd8c2f..847dc8565 100644 --- a/examples/wordpress/kustomization.yaml +++ b/examples/wordpress/kustomization.yaml @@ -1,8 +1,8 @@ resources: - wordpress - mysql -patchesStrategicMerge: -- patch.yaml +patches: +- path: patch.yaml namePrefix: demo- vars: diff --git a/examples/zh/breakfast.md b/examples/zh/breakfast.md index 6d456ccbe..8906892c6 100644 --- a/examples/zh/breakfast.md +++ b/examples/zh/breakfast.md @@ -67,8 +67,8 @@ commonLabels: who: alice resources: - ../../base -patchesStrategicMerge: -- temperature.yaml +patches: +- path: temperature.yaml EOF cat <$DEMO_HOME/breakfast/overlays/alice/temperature.yaml @@ -90,8 +90,8 @@ commonLabels: who: bob resources: - ../../base -patchesStrategicMerge: -- topping.yaml +patches: +- path: topping.yaml EOF cat <$DEMO_HOME/breakfast/overlays/bob/topping.yaml diff --git a/examples/zh/configGeneration.md b/examples/zh/configGeneration.md index 661be162c..6e56c6a78 100644 --- a/examples/zh/configGeneration.md +++ b/examples/zh/configGeneration.md @@ -77,8 +77,8 @@ commonAnnotations: note: Hello, I am staging! resources: - ../../base -patchesStrategicMerge: -- map.yaml +patches: +- path: map.yaml EOF cat <$OVERLAYS/staging/map.yaml diff --git a/examples/zh/helloWorld.md b/examples/zh/helloWorld.md index 2113c2822..3ce6b24e9 100644 --- a/examples/zh/helloWorld.md +++ b/examples/zh/helloWorld.md @@ -138,8 +138,8 @@ commonAnnotations: note: Hello, I am staging! resources: - ../../base -patchesStrategicMerge: -- map.yaml +patches: +- path: map.yaml EOF ``` @@ -177,8 +177,8 @@ commonAnnotations: note: Hello, I am production! resources: - ../../base -patchesStrategicMerge: -- deployment.yaml +patches: +- path: deployment.yaml EOF ``` diff --git a/examples/zh/mysql.md b/examples/zh/mysql.md index 292e800cf..e5814c30c 100644 --- a/examples/zh/mysql.md +++ b/examples/zh/mysql.md @@ -128,7 +128,7 @@ sed -i.bak 's/app: helloworld/app: prod/' \ ### 存储定制 -现成的 MySQL 使用 `emptyDir` 类型的 volume,如果 MySQL Pod 被重新部署,则该类型的 volume 将会消失,这是不能应用于生产环境的,因此在生产环境中我们需要使用持久化磁盘。在 kustomize 中可以使用`patchesStrategicMerge` 来应用资源。 +现成的 MySQL 使用 `emptyDir` 类型的 volume,如果 MySQL Pod 被重新部署,则该类型的 volume 将会消失,这是不能应用于生产环境的,因此在生产环境中我们需要使用持久化磁盘。在 kustomize 中可以使用`patches` 来应用资源。 ``` @@ -153,15 +153,15 @@ EOF ``` cat <<'EOF' >> $DEMO_HOME/kustomization.yaml -patchesStrategicMerge: -- persistent-disk.yaml +patches: +- path: persistent-disk.yaml EOF ``` `mysql-persistent-storage` 必须存在一个持久化磁盘才能使其成功运行,分为两步: 1. 创建一个名为 `persistent-disk.yaml` 的 YAML 文件,用于修改 deployment.yaml 的定义。 -2. 在 `kustomization.yaml` 中添加 `persistent-disk.yaml` 到 `patchesStrategicMerge` 列表中。运行 `kustomize build` 将 patch 应用于 Deployment 资源。 +2. 在 `kustomization.yaml` 中添加 `persistent-disk.yaml` 到 `patches` 列表中。运行 `kustomize build` 将 patch 应用于 Deployment 资源。 现在就可以将完整的配置输出并在集群中部署(将结果通过管道输出给 `kubectl apply`),在生产环境创建MySQL 应用。 diff --git a/examples/zh/vars.md b/examples/zh/vars.md index e2fb207fa..9282c2907 100644 --- a/examples/zh/vars.md +++ b/examples/zh/vars.md @@ -54,8 +54,8 @@ resources: - wordpress - mysql namePrefix: demo- -patchesStrategicMerge: -- patch.yaml +patches: +- path: patch.yaml EOF ```