Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: json: unknown field "envs" when building the example in docs #1069

Closed
yujunz opened this issue May 13, 2019 · 10 comments
Closed

Error: json: unknown field "envs" when building the example in docs #1069

yujunz opened this issue May 13, 2019 · 10 comments

Comments

@yujunz
Copy link
Member

yujunz commented May 13, 2019

It seems caused by the secretGenerator.

~/go/src/sigs.k8s.io/kustomize/ master
❯ kustomize build docs
Error: json: unknown field "envs"

❯ kustomize version
Version: {KustomizeVersion:v2.0.3 GitCommit:a6f65144121d1955266b0cd836ce954c04122dc8 BuildDate:2019-03-18T22:15:21+00:00 GoOs:darwin GoArch:amd64}

The error will disappear if we modify envs to env, e.g.

secretGenerator:
- name: env_file_secret
  # paths to files with k=v pairs, one pair per line.
  env: env.txt
  type: Opaque

Is there a change in the spec recently?

@Liujingfang1
Copy link
Contributor

@yujunz Yes, the env is changed to envs recently in #1041.

@kissgyorgy
Copy link

Note if you are using kubectl 1.15.3, it's still env and not a list as shown above.

@anarcher
Copy link

Does this change have Backward compatibility? I think this should be considered.

@brannondorsey
Copy link
Contributor

It looks like the Kustomize docs still refer to the old env property: https://kubectl.docs.kubernetes.io/pages/reference/kustomize.html#secretgenerator

@cee-dub
Copy link

cee-dub commented Apr 14, 2020

Just got caught by Error: json: unknown field "env" and was lucky to find this issue. Using envs: worked.

@brandonkrull
Copy link

brandonkrull commented Aug 14, 2020

env -> envs also applies to configMapGenerators (kubectl v1.18, kustomize v3.8.1)

@hermanbanken
Copy link

Relates to #2205 and #2506

@ThePlenkov
Copy link

ThePlenkov commented Mar 18, 2021

I'm from 2021. The issue is still there =)

 kubectl version
Client Version: version.Info{Major:"1", Minor:"20", GitVersion:"v1.20.5", GitCommit:"6b1d87acf3c8253c123756b9e61dac642678305f", GitTreeState:"clean", BuildDate:"2021-03-18T01:10:43Z", GoVersion:"go1.15.8", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"17+", GitVersion:"v1.17.7-booking.0", GitCommit:"0e833c879e7cc643f6fb25ee0f1b9460f4745004", GitTreeState:"clean", BuildDate:"2020-06-26T15:02:42Z", GoVersion:"go1.14.4", Compiler:"gc", Platform:"linux/amd64"}  
kubectl apply -k .
error: json: unknown field "envs"

but..

kustomize version
{Version:kustomize/v4.0.5 GitCommit:9e8e7a7fe99ec9fbf801463e8607928322fc5245 BuildDate:2021-03-08T20:53:03Z GoOs:linux GoArch:amd64}
kustomize build |  kubectl apply -f -
secret/service-api-env configured

@natasha41575
Copy link
Contributor

natasha41575 commented Mar 18, 2021

@ThePlenkov The version of kustomize in kubectl is still not up to date - it's on v2.0.3. We VERY recently reintegrated the latest version of kustomize into kubectl. In the next release of kubectl (which is coming soon), kubectl apply -k will use kustomize v4.0.5.

shraderdm added a commit to shraderdm/rancher-demo that referenced this issue Jul 9, 2021
Also, previous comment was incorrect. Updated as of kubectl v1.18 and kustomize v3.8.1.

kubernetes-sigs/kustomize#1069
@weltonrodrigo
Copy link

weltonrodrigo commented Mar 10, 2022

Guys, this is not a rant, but it's SO frustrating using kubectl -k because of those small incompatibilities. No to mention the VERY unexpected behaviour of kubectl kustomize being dependent of cluster version.

In one moment I'm in a context where envs exists and in another Error: json: unknown field "envs".

If kustomize is a manifest building tools, this is very unexpected and using it for two years now, totally unknow to me.

Anyway. Thanks for this great software. Keep up the good work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests