1

我正在尝试将(patchJSON6922)多个volumeMounts修补到基本kustomization。但是,当我修补多个 volumeMounts 时,会出现错误。这是我的配置:

自定义.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正确追加。

任何帮助将不胜感激。谢谢,

4

1 回答 1

2

显然,(2.0.3)的kubectl版本kustomize是旧的,不支持附加到项目。使用最新的 kustomize (3.1.0) 解决了我的问题。

于 2019-09-12T20:59:29.503 回答