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

External loaded generators add KustTarget to PluginHelpers #3

Open
wants to merge 2 commits into
base: chore/convert_resources_to_ResourceGenerator
Choose a base branch
from

Conversation

LittleChimera
Copy link

Hi @koba1t,

I was testing your PR but had some issues when ResourceGenerator was loaded as "externalGenerator". It would result in null pointer panic because external generators do not have kt in PluginHelper.

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x18 pc=0x1050f6b28]

goroutine 1 [running]:
sigs.k8s.io/kustomize/api/resmap.(*PluginHelpers).AccumulateResource(0x14000474a40, {0x14000478248, 0x7})
        /Users/lukaskugor/projects/github.com/kustomize/api/resmap/resmap.go:87 +0xe8
sigs.k8s.io/kustomize/api/internal/builtins.(*ResourceGeneratorPlugin).Generate(0x0?)
        /Users/lukaskugor/projects/github.com/kustomize/api/internal/builtins/ResourceGenerator.go:29 +0x2c
sigs.k8s.io/kustomize/api/internal/target.(*KustTarget).runGenerators(0x140000aceb0, 0x14000099f40)
        /Users/lukaskugor/projects/github.com/kustomize/api/internal/target/kusttarget.go:287 +0x20c
sigs.k8s.io/kustomize/api/internal/target.(*KustTarget).accumulateTarget(0x140000aceb0, 0x14000099f40)
        /Users/lukaskugor/projects/github.com/kustomize/api/internal/target/kusttarget.go:228 +0x240
sigs.k8s.io/kustomize/api/internal/target.(*KustTarget).AccumulateTarget(0x140000aceb0)
        /Users/lukaskugor/projects/github.com/kustomize/api/internal/target/kusttarget.go:203 +0xec
sigs.k8s.io/kustomize/api/internal/target.(*KustTarget).makeCustomizedResMap(0x140000aceb0)
        /Users/lukaskugor/projects/github.com/kustomize/api/internal/target/kusttarget.go:135 +0x68
sigs.k8s.io/kustomize/api/internal/target.(*KustTarget).MakeCustomizedResMap(...)
        /Users/lukaskugor/projects/github.com/kustomize/api/internal/target/kusttarget.go:126
sigs.k8s.io/kustomize/api/krusty.(*Kustomizer).Run(0x1400035fcc8, {0x105464f00, 0x105a5d0c8}, {0x16b37f270, 0x13})
        /Users/lukaskugor/projects/github.com/kustomize/api/krusty/kustomizer.go:91 +0x2a4
sigs.k8s.io/kustomize/kustomize/v5/commands/build.NewCmdBuild.func1(0x140000eb808, {0x14000230e70?, 0x4?, 0x105179ad4?})
        /Users/lukaskugor/projects/github.com/kustomize/kustomize/commands/build/build.go:84 +0x15c
github.com/spf13/cobra.(*Command).execute(0x140000eb808, {0x14000230e30, 0x1, 0x1})
        /Users/lukaskugor/go/pkg/mod/github.com/spf13/[email protected]/command.go:940 +0x654
github.com/spf13/cobra.(*Command).ExecuteC(0x140000eb208)
        /Users/lukaskugor/go/pkg/mod/github.com/spf13/[email protected]/command.go:1068 +0x320
github.com/spf13/cobra.(*Command).Execute(0x105953f28?)
        /Users/lukaskugor/go/pkg/mod/github.com/spf13/[email protected]/command.go:992 +0x1c
main.main()
        /Users/lukaskugor/projects/github.com/kustomize/kustomize/main.go:14 +0x20

Most basic example:

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
  - |-
    apiVersion: builtin
    kind: ResourceGenerator
    metadata:
      name: myMap
    resource: cm.yaml

Please feel free to reach out if you'd like any help with this stuff. I'm looking to use at least some portions of Composition API to test out some new Kustomize layouts for a larger repo.

@LittleChimera
Copy link
Author

LittleChimera commented Sep 7, 2024

I also merged master if you want to use it

LittleChimera#2

@LittleChimera LittleChimera force-pushed the chore/convert_resources_to_ResourceGenerator branch 2 times, most recently from 92483cc to f8427e7 Compare September 8, 2024 14:27
@koba1t
Copy link
Owner

koba1t commented Sep 8, 2024

Hi @LittleChimera!

I regret to inform you that due to current time constraints and commitments, I find myself unable to continue working on the aforementioned Pull Request at this time. I apologize for any inconvenience this may cause.
If it aligns with your schedule and interests, I was wondering if you might be willing to take over this Pull Request?

@LittleChimera
Copy link
Author

Hi @LittleChimera!

I regret to inform you that due to current time constraints and commitments, I find myself unable to continue working on the aforementioned Pull Request at this time. I apologize for any inconvenience this may cause. If it aligns with your schedule and interests, I was wondering if you might be willing to take over this Pull Request?

I'd be happy to!

It is not quite clear to me what else is missing. I read through the discussion so far and it seems like we're still missing some tests (and possibly implementation) for those vars and crds. if you could make a list what else is missing, it would make it much easier for me to get it done.

@koba1t
Copy link
Owner

koba1t commented Sep 15, 2024

@LittleChimera

I'd be happy to!

I am very grateful for your contribution!

I read through the discussion so far and it seems like we're still missing some tests (and possibly implementation) for those vars and crds.

In my memory, that is only a few fields which has an effect on a wider area, like vars and crds.
Otherwise, we will need to pass the tests associated with the resources that are currently present.

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

Successfully merging this pull request may close these issues.

2 participants