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

panic: runtime error: invalid memory address or nil pointer dereference on invalid patch #1218

Closed
yujunz opened this issue Jun 20, 2019 · 2 comments

Comments

@yujunz
Copy link
Member

yujunz commented Jun 20, 2019

❯ kustomize build
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x1a907a1]

goroutine 1 [running]:
sigs.k8s.io/kustomize/k8sdeps/transformer/patch.(*transformer).Transform(0xc00027acc0, 0x1ea6340, 0xc000301340, 0x2ab4aa0, 0x101356a)
	/go/src/sigs.k8s.io/kustomize/k8sdeps/transformer/patch/transformer.go:51 +0x341
sigs.k8s.io/kustomize/pkg/transformers.(*multiTransformer).transform(0xc0003e9600, 0x1ea6340, 0xc000301340, 0x1, 0x6)
	/go/src/sigs.k8s.io/kustomize/pkg/transformers/multitransformer.go:60 +0x79
sigs.k8s.io/kustomize/pkg/transformers.(*multiTransformer).Transform(0xc0003e9600, 0x1ea6340, 0xc000301340, 0x6, 0xc0003f1560)
	/go/src/sigs.k8s.io/kustomize/pkg/transformers/multitransformer.go:56 +0x84
sigs.k8s.io/kustomize/pkg/accumulator.(*ResAccumulator).Transform(...)
	/go/src/sigs.k8s.io/kustomize/pkg/accumulator/resaccumulator.go:133
sigs.k8s.io/kustomize/pkg/target.(*KustTarget).runTransformers(0xc000258680, 0xc00022a210, 0x0, 0x0)
	/go/src/sigs.k8s.io/kustomize/pkg/target/kusttarget.go:322 +0x3fb
sigs.k8s.io/kustomize/pkg/target.(*KustTarget).AccumulateTarget(0xc000258680, 0xc000548070, 0xc0000f22b0, 0xc000325c78)
	/go/src/sigs.k8s.io/kustomize/pkg/target/kusttarget.go:241 +0x2b6
sigs.k8s.io/kustomize/pkg/target.(*KustTarget).makeCustomizedResMap(0xc000258680, 0x1, 0xc00000e7a0, 0x1e54f60, 0x2729250, 0xc0002d4b60)
	/go/src/sigs.k8s.io/kustomize/pkg/target/kusttarget.go:126 +0x2f
sigs.k8s.io/kustomize/pkg/target.(*KustTarget).MakeCustomizedResMap(...)
	/go/src/sigs.k8s.io/kustomize/pkg/target/kusttarget.go:117
sigs.k8s.io/kustomize/pkg/commands/build.(*Options).RunBuild(0xc0002f07e0, 0x1e54e20, 0xc0000c2000, 0x1e81e80, 0x2729250, 0x1e97c00, 0x2729250, 0xc00000e7a0, 0x1e54f60, 0x2729250, ...)
	/go/src/sigs.k8s.io/kustomize/pkg/commands/build/build.go:130 +0x145
sigs.k8s.io/kustomize/pkg/commands/build.NewCmdBuild.func1(0xc000119b80, 0x2729250, 0x0, 0x0, 0x0, 0x0)
	/go/src/sigs.k8s.io/kustomize/pkg/commands/build/build.go:80 +0x193
github.com/spf13/cobra.(*Command).execute(0xc000119b80, 0x2729250, 0x0, 0x0, 0xc000119b80, 0x2729250)
	/go/pkg/mod/github.com/spf13/cobra@v0.0.2/command.go:756 +0x465
github.com/spf13/cobra.(*Command).ExecuteC(0xc000118f00, 0x1ac4914, 0xc000325f88, 0xc00009e058)
	/go/pkg/mod/github.com/spf13/cobra@v0.0.2/command.go:846 +0x2ec
github.com/spf13/cobra.(*Command).Execute(...)
	/go/pkg/mod/github.com/spf13/cobra@v0.0.2/command.go:794
main.main()
	/go/src/sigs.k8s.io/kustomize/cmd/kustomize/main.go:13 +0x28

❯ cat patches.yaml
---
apiVersion: v1
kind: Pod
metadata:
  name: foo
spec:
  serviceAccountName: admin
  automountServiceAccountToken: true

❯ cat kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
patches:
- patches.yaml

❯ kustomize version
Version: {KustomizeVersion:2.1.0 GitCommit:af67c893d87c5fb8200f8a3edac7fdafd61ec0bd BuildDate:2019-06-18T22:01:59Z GoOs:darwin GoArch:amd64}
@yujunz yujunz changed the title kustomize v2.1.0 crashes on invalid patch panic: runtime error: invalid memory address or nil pointer dereference on invalid patch Jun 20, 2019
@jbrette
Copy link
Contributor

jbrette commented Jun 20, 2019

Has this been fixed by #1206 ? Looks like a dup of #1203

@yujunz
Copy link
Member Author

yujunz commented Jun 26, 2019

It seems so. Now it is giving an expected error message.

Error: failed to find target for patch ~G_v1_Pod|foo

@yujunz yujunz closed this as completed Jun 26, 2019
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

2 participants