Kustomize: Unknown fields error after `kustomize edit set image`

Created on 4 Sep 2019  路  2Comments  路  Source: kubernetes-sigs/kustomize

Getting following errors after kustomize edit set image
Screen Shot 2019-09-04 at 4 25 20 pm
It happens to any files with configMapGenerator and fieldpath

Example:
Before
```configMapGenerator:

  • name: workflow-controller-parameters
    env: params.env
    generatorOptions:
    disableNameSuffixHash: true
    vars:
  • name: executorImage
    objref:
    kind: ConfigMap
    name: workflow-controller-parameters
    apiVersion: v1
    fieldref:
    fieldpath: data.executorImage

After
```configMapGenerator:
- envs:
  - params.env
  name: workflow-controller-parameters
generatorOptions:
  disableNameSuffixHash: true
vars:
- fieldref:
    fieldPath: data.executorImage
  name: executorImage
  objref:
    apiVersion: v1
    kind: ConfigMap
    name: workflow-controller-parameters
help wanted kinbug

Most helpful comment

@ivanliu1989 This does not look like a bug.
your original file seems to be missing the first line. If you add it back like this:

generatorOptions:
  disableNameSuffixHash: true
configMapGenerator:
- name: workflow-controller-parameters
  env: params.env
vars:
- name: executorImage
  objref:
    kind: ConfigMap
    name: workflow-controller-parameters
    apiVersion: v1
  fieldref:
    fieldpath: data.executorImage

then

kustomize build .

works

2019/09/06 13:22:57 well-defined vars that were never replaced: executorImage
apiVersion: v1
data:
  executorImage: 1.2.3
kind: ConfigMap
metadata:
  name: workflow-controller-parameters

then if you use edit image:

kustomize edit set image node:8.15.0

kustomization.yaml looks like this (not the configmap generator is updated to support more than one file)

generatorOptions:
  disableNameSuffixHash: true
configMapGenerator:
- envs:
  - params.env
  name: workflow-controller-parameters
vars:
- fieldref:
    fieldPath: data.executorImage
  name: executorImage
  objref:
    apiVersion: v1
    kind: ConfigMap
    name: workflow-controller-parameters
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
images:
- name: node
  newTag: 8.15.0

kustomize build still works

kustomize build .
apiVersion: v1
data:
  executorImage: 1.2.3
kind: ConfigMap
metadata:
  name: workflow-controller-parameters

All 2 comments

@ivanliu1989 This does not look like a bug.
your original file seems to be missing the first line. If you add it back like this:

generatorOptions:
  disableNameSuffixHash: true
configMapGenerator:
- name: workflow-controller-parameters
  env: params.env
vars:
- name: executorImage
  objref:
    kind: ConfigMap
    name: workflow-controller-parameters
    apiVersion: v1
  fieldref:
    fieldpath: data.executorImage

then

kustomize build .

works

2019/09/06 13:22:57 well-defined vars that were never replaced: executorImage
apiVersion: v1
data:
  executorImage: 1.2.3
kind: ConfigMap
metadata:
  name: workflow-controller-parameters

then if you use edit image:

kustomize edit set image node:8.15.0

kustomization.yaml looks like this (not the configmap generator is updated to support more than one file)

generatorOptions:
  disableNameSuffixHash: true
configMapGenerator:
- envs:
  - params.env
  name: workflow-controller-parameters
vars:
- fieldref:
    fieldPath: data.executorImage
  name: executorImage
  objref:
    apiVersion: v1
    kind: ConfigMap
    name: workflow-controller-parameters
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
images:
- name: node
  newTag: 8.15.0

kustomize build still works

kustomize build .
apiVersion: v1
data:
  executorImage: 1.2.3
kind: ConfigMap
metadata:
  name: workflow-controller-parameters

Hi jbrette, thanks for your reply. I think you are right, it's actually not a bug from kustomize but from the executable I am using from another tool. Sorry to post it here but really appreciated your help!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sidps picture sidps  路  5Comments

wuestkamp picture wuestkamp  路  3Comments

lionelvillard picture lionelvillard  路  4Comments

Liujingfang1 picture Liujingfang1  路  4Comments

bugbuilder picture bugbuilder  路  3Comments