kustomization:在多个 volumeMounts 中打补丁
kustomization: patch in multiple volumeMounts
我正在尝试将 (patchJSON6922) 多个 volumeMounts 修补到基础 kustomization。但是,当我修补多个 volumeMounts 时,我会出错。这是我的配置:
kustomization.yaml
commonLabels:
app: my-app
imageTags:
- name: my-app
newName: localhost/my-app
newTag: latest
bases:
- app
patchesJson6902:
- target:
group: apps
version: v1
kind: Deployment
name: my-app
path: create_volume_one.yaml
- target:
group: apps
version: v1
kind: Deployment
name: my-app
path: create_volume_two.yaml
create_volume_one.yaml
- op: add
path: /spec/template/spec/containers/0/volumeMounts
value:
name: volumeOne
mountPath: /data/one
create_volume_two.yaml
- op: add
path: /spec/template/spec/containers/0/volumeMounts/-
value:
name: volumeTwo
mountPath: /data/two
当我 运行 说 kustomization 时,我收到以下错误:
$> kubectl kustomize .
Error: found conflict between different patches
&resource.Resource{Kunstructured:(*kunstruct.UnstructAdapter)(0xc000010058), options:(*types.GenArgs)(0xc00038eb00)} doesn't deep equal &resource.Resource{Kunstructured:(*kunstruct.UnstructAdapter)(0xc0000c6038), options:(*types.GenArgs)(0xc00038eb00)}
Examples:
# Use the current working directory
kubectl kustomize .
# Use some shared configuration directory
kubectl kustomize /home/configuration/production
# Use a URL
kubectl kustomize github.com/kubernetes-sigs/kustomize.git/examples/helloWorld?ref=v1.0.6
Usage:
kubectl kustomize <dir> [flags] [options]
Use "kubectl options" for a list of global command-line options (applies to all commands).
found conflict between different patches
&resource.Resource{Kunstructured:(*kunstruct.UnstructAdapter)(0xc000010058), options:(*types.GenArgs)(0xc00038eb00)} doesn't deep equal &resource.Resource{Kunstructured:(*kunstruct.UnstructAdapter)(0xc0000c6038), options:(*types.GenArgs)(0xc00038eb00)}
我尝试了各种路径(在 volumeMounts
之后有和没有 -
但无济于事)。
当我注释掉 create_volume_two.yaml 部分时,一切正常。所以我想知道我需要做什么才能正确附加到 volumeMounts
。
如有任何帮助,我们将不胜感激。谢谢,
显然,kustomize
(2.0.3) 的 kubectl
版本是旧的,不支持附加到项目。使用最新的 kustomize (3.1.0) 解决了我的问题。
我正在尝试将 (patchJSON6922) 多个 volumeMounts 修补到基础 kustomization。但是,当我修补多个 volumeMounts 时,我会出错。这是我的配置:
kustomization.yaml
commonLabels:
app: my-app
imageTags:
- name: my-app
newName: localhost/my-app
newTag: latest
bases:
- app
patchesJson6902:
- target:
group: apps
version: v1
kind: Deployment
name: my-app
path: create_volume_one.yaml
- target:
group: apps
version: v1
kind: Deployment
name: my-app
path: create_volume_two.yaml
create_volume_one.yaml
- op: add
path: /spec/template/spec/containers/0/volumeMounts
value:
name: volumeOne
mountPath: /data/one
create_volume_two.yaml
- op: add
path: /spec/template/spec/containers/0/volumeMounts/-
value:
name: volumeTwo
mountPath: /data/two
当我 运行 说 kustomization 时,我收到以下错误:
$> kubectl kustomize .
Error: found conflict between different patches
&resource.Resource{Kunstructured:(*kunstruct.UnstructAdapter)(0xc000010058), options:(*types.GenArgs)(0xc00038eb00)} doesn't deep equal &resource.Resource{Kunstructured:(*kunstruct.UnstructAdapter)(0xc0000c6038), options:(*types.GenArgs)(0xc00038eb00)}
Examples:
# Use the current working directory
kubectl kustomize .
# Use some shared configuration directory
kubectl kustomize /home/configuration/production
# Use a URL
kubectl kustomize github.com/kubernetes-sigs/kustomize.git/examples/helloWorld?ref=v1.0.6
Usage:
kubectl kustomize <dir> [flags] [options]
Use "kubectl options" for a list of global command-line options (applies to all commands).
found conflict between different patches
&resource.Resource{Kunstructured:(*kunstruct.UnstructAdapter)(0xc000010058), options:(*types.GenArgs)(0xc00038eb00)} doesn't deep equal &resource.Resource{Kunstructured:(*kunstruct.UnstructAdapter)(0xc0000c6038), options:(*types.GenArgs)(0xc00038eb00)}
我尝试了各种路径(在 volumeMounts
之后有和没有 -
但无济于事)。
当我注释掉 create_volume_two.yaml 部分时,一切正常。所以我想知道我需要做什么才能正确附加到 volumeMounts
。
如有任何帮助,我们将不胜感激。谢谢,
显然,kustomize
(2.0.3) 的 kubectl
版本是旧的,不支持附加到项目。使用最新的 kustomize (3.1.0) 解决了我的问题。