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

Kustomize 2.1.0 causes SIGSEV #1203

Closed
Guyzeroth opened this issue Jun 19, 2019 · 8 comments
Closed

Kustomize 2.1.0 causes SIGSEV #1203

Guyzeroth opened this issue Jun 19, 2019 · 8 comments
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@Guyzeroth
Copy link

https://github.com/kubernetes-sigs/kustomize/releases/tag/v2.1.0

Rebuilt my CI container to use the '2.1.0' Kustomize. Upon running my kustomize step I got this stack trace.

$ kustomize build ../dev | kubectl apply -f -
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xe8e851]

goroutine 1 [running]:
sigs.k8s.io/kustomize/k8sdeps/transformer/patch.(*transformer).Transform(0xc000515f40, 0x12a2ee0, 0xc0002f78e0, 0x7f3ff2246008, 0x41379a)
	/go/src/sigs.k8s.io/kustomize/k8sdeps/transformer/patch/transformer.go:51 +0x341
sigs.k8s.io/kustomize/pkg/transformers.(*multiTransformer).transform(0xc000271fa0, 0x12a2ee0, 0xc0002f78e0, 0x1, 0x6)
	/go/src/sigs.k8s.io/kustomize/pkg/transformers/multitransformer.go:60 +0x79
sigs.k8s.io/kustomize/pkg/transformers.(*multiTransformer).Transform(0xc000271fa0, 0x12a2ee0, 0xc0002f78e0, 0x6, 0xc00007f440)
	/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(0xc00024ad40, 0xc00033dbc0, 0x0, 0x0)
	/go/src/sigs.k8s.io/kustomize/pkg/target/kusttarget.go:322 +0x3fb
sigs.k8s.io/kustomize/pkg/target.(*KustTarget).AccumulateTarget(0xc00024ad40, 0xc0000e7db0, 0xc0000da210, 0xc000315c78)
	/go/src/sigs.k8s.io/kustomize/pkg/target/kusttarget.go:241 +0x2b6
sigs.k8s.io/kustomize/pkg/target.(*KustTarget).makeCustomizedResMap(0xc00024ad40, 0x1, 0xc00010a5e8, 0x1251e80, 0x1b20538, 0xc000308870)
	/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(0xc00033ca50, 0x1251d40, 0xc0000b6008, 0x127ecc0, 0x1b20538, 0x12947c0, 0x1b20538, 0xc00010a5e8, 0x1251e80, 0x1b20538, ...)
	/go/src/sigs.k8s.io/kustomize/pkg/commands/build/build.go:130 +0x145
sigs.k8s.io/kustomize/pkg/commands/build.NewCmdBuild.func1(0xc0000f3b80, 0xc000308a20, 0x1, 0x1, 0x0, 0x0)
	/go/src/sigs.k8s.io/kustomize/pkg/commands/build/build.go:80 +0x193
github.com/spf13/cobra.(*Command).execute(0xc0000f3b80, 0xc0003089d0, 0x1, 0x1, 0xc0000f3b80, 0xc0003089d0)
	/go/pkg/mod/github.com/spf13/[email protected]/command.go:756 +0x465
github.com/spf13/cobra.(*Command).ExecuteC(0xc0000f2f00, 0xec29d4, 0xc000315f88, 0xc00009c058)
	/go/pkg/mod/github.com/spf13/[email protected]/command.go:846 +0x2ec
github.com/spf13/cobra.(*Command).Execute(...)
	/go/pkg/mod/github.com/spf13/[email protected]/command.go:794
main.main()
	/go/src/sigs.k8s.io/kustomize/cmd/kustomize/main.go:13 +0x28
error: no objects passed to apply

Appears to be a regression from 2.0.3 (This version works )

@jbrette
Copy link
Contributor

jbrette commented Jun 19, 2019

Happened to me two days ago. In my case happened, was because of mismatch in the namespace value for object referred by variable: Temporary fix was: https://github.com/jbrette/kustomize/blob/namespace/k8sdeps/transformer/patch/transformer.go#L49

@Lawouach
Copy link

Lawouach commented Jun 24, 2019

Hello there,

Is there a chanbce for a new release soon with this fix? Right now, I'm finding it hard to figure out how to amend my overlays as the error is not helping.

It's specially quite tricky when you have something like:

bases
   backend
      configmap.yaml
      kustomization.yaml
   frontend
      configmap.yaml
      kustomization.yaml
environments
   dev
      configmap.yaml
      kustomization.yaml
   staging
      configmap.yaml
      kustomization.yaml

Where all the files have the same name and I'm not sure if the patchesStrategicMerge feature supports this. Indeed the doc says:

The names in these (possibly partial) resource files must match names already loaded via the resources field.

That's quite unclear to me what that refers to in a context where bases structure all have the same naming convention.

Thanks!

@rdubya16
Copy link

Also seeing this bug after upgrading 2.1.0

@monopole monopole self-assigned this Jun 26, 2019
@monopole
Copy link
Contributor

nil references unacceptable
can you attach your kustomization file and other inputs?

@rdubya16
Copy link

rdubya16 commented Jun 26, 2019

[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x4a95e41]

goroutine 1 [running]:
sigs.k8s.io/kustomize/k8sdeps/transformer/patch.(*transformer).Transform(0xc000406520, 0x4eb1e20, 0xc00031f8a0, 0x6300008, 0x4015c6a)
	/private/tmp/kustomize-20190619-84776-gxe9x/src/kubernetes-sigs/kustomize/k8sdeps/transformer/patch/transformer.go:51 +0x341
sigs.k8s.io/kustomize/pkg/transformers.(*multiTransformer).transform(0xc000124440, 0x4eb1e20, 0xc00031f8a0, 0x1, 0x6)
	/private/tmp/kustomize-20190619-84776-gxe9x/src/kubernetes-sigs/kustomize/pkg/transformers/multitransformer.go:60 +0x79
sigs.k8s.io/kustomize/pkg/transformers.(*multiTransformer).Transform(0xc000124440, 0x4eb1e20, 0xc00031f8a0, 0x6, 0xc00013d9e0)
	/private/tmp/kustomize-20190619-84776-gxe9x/src/kubernetes-sigs/kustomize/pkg/transformers/multitransformer.go:56 +0x84
sigs.k8s.io/kustomize/pkg/accumulator.(*ResAccumulator).Transform(...)
	/private/tmp/kustomize-20190619-84776-gxe9x/src/kubernetes-sigs/kustomize/pkg/accumulator/resaccumulator.go:133
sigs.k8s.io/kustomize/pkg/target.(*KustTarget).runTransformers(0xc0001272c0, 0xc0002880c0, 0x0, 0x0)
	/private/tmp/kustomize-20190619-84776-gxe9x/src/kubernetes-sigs/kustomize/pkg/target/kusttarget.go:322 +0x3fb
sigs.k8s.io/kustomize/pkg/target.(*KustTarget).AccumulateTarget(0xc0001272c0, 0xc0003ea000, 0xc000134030, 0xc00036bc78)
	/private/tmp/kustomize-20190619-84776-gxe9x/src/kubernetes-sigs/kustomize/pkg/target/kusttarget.go:241 +0x2b6
sigs.k8s.io/kustomize/pkg/target.(*KustTarget).makeCustomizedResMap(0xc0001272c0, 0x1, 0xc0004dc878, 0x4e60780, 0x57414d8, 0xc000374920)
	/private/tmp/kustomize-20190619-84776-gxe9x/src/kubernetes-sigs/kustomize/pkg/target/kusttarget.go:126 +0x2f
sigs.k8s.io/kustomize/pkg/target.(*KustTarget).MakeCustomizedResMap(...)
	/private/tmp/kustomize-20190619-84776-gxe9x/src/kubernetes-sigs/kustomize/pkg/target/kusttarget.go:117
sigs.k8s.io/kustomize/pkg/commands/build.(*Options).RunBuild(0xc000357e00, 0x4e60640, 0xc0000d6000, 0x4e8da80, 0x57414d8, 0x4ea3780, 0x57414d8, 0xc0004dc878, 0x4e60780, 0x57414d8, ...)
	/private/tmp/kustomize-20190619-84776-gxe9x/src/kubernetes-sigs/kustomize/pkg/commands/build/build.go:130 +0x145
sigs.k8s.io/kustomize/pkg/commands/build.NewCmdBuild.func1(0xc00003e280, 0xc00032c1b0, 0x1, 0x1, 0x0, 0x0)
	/private/tmp/kustomize-20190619-84776-gxe9x/src/kubernetes-sigs/kustomize/pkg/commands/build/build.go:80 +0x193
github.com/spf13/cobra.(*Command).execute(0xc00003e280, 0xc00032c170, 0x1, 0x1, 0xc00003e280, 0xc00032c170)
	/private/tmp/kustomize-20190619-84776-gxe9x/pkg/mod/github.com/spf13/[email protected]/command.go:756 +0x465
github.com/spf13/cobra.(*Command).ExecuteC(0xc00014b900, 0x4acbae4, 0xc00036bf88, 0xc0000b0058)
	/private/tmp/kustomize-20190619-84776-gxe9x/pkg/mod/github.com/spf13/[email protected]/command.go:846 +0x2ec
github.com/spf13/cobra.(*Command).Execute(...)
	/private/tmp/kustomize-20190619-84776-gxe9x/pkg/mod/github.com/spf13/[email protected]/command.go:794
main.main()
	/private/tmp/kustomize-20190619-84776-gxe9x/src/kubernetes-sigs/kustomize/cmd/kustomize/main.go:13 +0x28
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
bases:
- ../../base/external-dns
- ../../base/alb-ingress-controller
- ../../base/cluster-autoscaler
- ../../base/sealed-secrets
- ../../base/crm-adapter
resources:
- alb-ingress.yaml
patches:
- crm-adapter.yaml
patchesJson6902:
- target:
    group: extensions
    version: v1beta1
    kind: Deployment
    name: external-dns
  path: external-dns.yaml
- target:
    group: apps
    version: v1
    kind: Deployment
    name: alb-ingress-controller
  path: alb-ingress-controller.yaml
- target:
    group: apps
    version: v1
    kind: Deployment
    name: cluster-autoscaler
  path: cluster-autoscaler.yaml

I rollback to 2.0.3 and it works fine.

@jbrette
Copy link
Contributor

jbrette commented Jun 26, 2019

@rdubya16 Yes looks like the same issue (which has been fixed). This error check was missing: https://github.com/kubernetes-sigs/kustomize/blob/master/k8sdeps/transformer/patch/transformer.go#L48 and the code was crashing at line 51 which is now line 54

Have a close look at your namespace usage. The issue as often been linked to inconsistencies in the namespace value (either in the resources.yaml/patches.yaml or kustomization.yaml) between the resource definition and the patch definition.

@Liujingfang1 Liujingfang1 added the kind/bug Categorizes issue or PR as related to a bug. label Jun 26, 2019
@monopole
Copy link
Contributor

@rdubya16 if willing, please see if the latest release candidate handles your data better. it shouldn't seg sev, but there might be some unhelpful error message to improve on.

@monopole
Copy link
Contributor

Please reopen if still segsev, or the error message needs improvement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

No branches or pull requests

6 participants