Skip to content

applyconfiguration generator uses a different variable name #1193

Open
@terinjokes

Description

@terinjokes

In #818 support for generating ApplyConfiguration was added via the applyconfiguration generator. However, it uses different variable name (SchemeGroupVersion) than the name generated by kubebuilder (GroupVersion). This results in a build failures out of the box.

# sigs.k8s.io/controller-tools/pkg/applyconfiguration/testdata/cronjob/api/v1/applyconfiguration
api/v1/applyconfiguration/utils.go:19:10: undefined: v1.SchemeGroupVersion

The variable name from kubebuilder is set in the groupversion_info.go template:

https://github.com/kubernetes-sigs/kubebuilder/blob/9932c89b631bb03413afe858c736613c66e07882/pkg/plugins/golang/v4/scaffolds/internal/templates/api/group.go#L68-L69

The variable name in the upstream applyconfiguration-gen is set in the GenerateType implementation:

https://github.com/kubernetes/code-generator/blob/2a635fa63960c0d6fd2461819f261ed8b9115f57/cmd/applyconfiguration-gen/generators/util.go#L127-L130

The fix for users is simple (SchemeGroupVersion = GroupVersion) but it would be nice if the files generated here work out of the box with those from kubebuilder.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions