Skip to content

couldn't add a new api for a custom resource kind #2596

@zanoubia

Description

@zanoubia

Bug Report

What did you do?
(ps: sw, pc and chan are note the real used names, the names I worked with have more than 5 char
)
I followed the quick start guide

operator-sdk add api --api-version=sw.pc/v1alpha1 --kind=Chan --verbose

What did you expect to see?
creation of api and crd manifests
What did you see instead? Under which circumstances?
Sometimes I get:

INFO[0000] Generating api version sw.pc/v1alpha1 for kind Chan.
Error: scaffold group file: my-operator/pkg/apis/sw/group.go:6:9: expected 'IDENT', found 'sw'

other times I get:

INFO[0000] Generating api version sw.pc/v1alpha1 for kind Cha.
INFO[0000] Created pkg/apis/sw/v1alpha1/chan_types.go
INFO[0000] Created pkg/apis/addtoscheme_sw_v1alpha1.go
INFO[0000] Created deploy/crds/sw.pwc_v1alpha1_chan_cr.yaml
INFO[0000] Running deepcopy code-generation for Custom Resource group versions: [sw:[v1alpha1], ]
INFO[0013] Code-generation complete.
INFO[0013] Running CRD generator.
-: pkg/apis/sw/group.go:1:1: expected 'package', found 'EOF'
Error: error generating CRDs from APIs in pkg/apis: error generating CRD manifests: error running CRD generator: not all generators ran successfully

and the file group.go is empty
Environment

  • operator-sdk version: "v0.15.2", commit: "ffaf278993c8fcb00c6f527c9f20091eb8dd3352"
  • go version:

go version go1.13.8 darwin/amd64

  • Kubernetes version information:

Client Version: version.Info{Major:"1", Minor:"15", GitVersion:"v1.15.5", GitCommit:"20c265fef0741dd71a66480e35bd69f18351daea", GitTreeState:"clean", BuildDate:"2019-10-15T19:16:51Z", GoVersion:"go1.12.10", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"15", GitVersion:"v1.15.5", GitCommit:"20c265fef0741dd71a66480e35bd69f18351daea", GitTreeState:"clean", BuildDate:"2019-10-15T19:07:57Z", GoVersion:"go1.12.10", Compiler:"gc", Platform:"linux/amd64"}

  • Kubernetes cluster kind: local using docker for mac

  • Are you writing your operator in ansible, helm, or go?
    go

Possible Solution

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    triage/needs-informationIndicates an issue needs more information in order to work on it.triage/supportIndicates an issue that is a support question.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions