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

Warning during add api about missing package #1546

Closed
rhuss opened this issue Jun 11, 2019 · 2 comments · Fixed by #1401
Closed

Warning during add api about missing package #1546

rhuss opened this issue Jun 11, 2019 · 2 comments · Fixed by #1401
Assignees
Labels
triage/support Indicates an issue that is a support question.

Comments

@rhuss
Copy link

rhuss commented Jun 11, 2019

Bug Report

When adding a new api via

operator-sdk add api --api-version=hello.k8spatterns.io/v1alpha1 --kind=Hello

on a freshly created project, I get the following output:

INFO[0000] Generating api version hello.k8spatterns.io/v1alpha1 for kind Hello.
INFO[0002] Created pkg/apis/hello/v1alpha1/hello_types.go
INFO[0002] Created pkg/apis/addtoscheme_hello_v1alpha1.go
INFO[0002] Created pkg/apis/hello/v1alpha1/register.go
INFO[0002] Created pkg/apis/hello/v1alpha1/doc.go
INFO[0002] Created deploy/crds/hello_v1alpha1_hello_cr.yaml
W0611 10:29:21.440169   56433 parse.go:239] Ignoring child directory github.com/k8spatterns/hello-operator/pkg/apis/hello: unable to import "github.com/k8spatterns/hello-operator/pkg/apis/hello": go/build: importGo github.com/k8spatterns/hello-operator/pkg/apis/hello: exit status 1
can't load package: package github.com/k8spatterns/hello-operator/pkg/apis/hello: unknown import path "github.com/k8spatterns/hello-operator/pkg/apis/hello": cannot find module providing package github.com/k8spatterns/hello-operator/pkg/apis/hello

INFO[0013] Created deploy/crds/hello_v1alpha1_hello_crd.yaml
INFO[0018] Running deepcopy code-generation for Custom Resource group versions: [hello:[v1alpha1], ]
INFO[0023] Code-generation complete.
INFO[0025] Running OpenAPI code-generation for Custom Resource group versions: [hello:[v1alpha1], ]
2019/06/11 10:29:38 Code for OpenAPI definitions generated
INFO[0030] Created deploy/crds/hello_v1alpha1_hello_crd.yaml
INFO[0030] Code-generation complete.
INFO[0030] API generation complete.

It looks like it succeeded and the directory pkg/apis/hello has been created eventually:

ls pkg/apis/hello
v1alpha1

However, the warning is a bit disturbing. Also I was wondering why I was ask for my GitHub credentials during the process (looks like a read-write checkout of some GitHub repo)

grafik

Here the full output with --verbose:

operator-sdk add api --api-version=hello.k8spatterns.io/v1alpha1 --kind=Hello --verbose
DEBU[0000] Debug logging is set
INFO[0000] Generating api version hello.k8spatterns.io/v1alpha1 for kind Hello.
INFO[0002] Created pkg/apis/hello/v1alpha1/hello_types.go
INFO[0002] Created pkg/apis/addtoscheme_hello_v1alpha1.go
INFO[0002] Created pkg/apis/hello/v1alpha1/register.go
INFO[0002] Created pkg/apis/hello/v1alpha1/doc.go
INFO[0002] Created deploy/crds/hello_v1alpha1_hello_cr.yaml
W0611 10:36:35.669666   61132 parse.go:239] Ignoring child directory github.com/k8spatterns/hello-operator/pkg/apis/hello: unable to import "github.com/k8spatterns/hello-operator/pkg/apis/hello": go/build: importGo github.com/k8spatterns/hello-operator/pkg/apis/hello: exit status 1
Fetching https://github.com?go-get=1
Parsing meta tags from https://github.com?go-get=1 (status code 200)
can't load package: package github.com/k8spatterns/hello-operator/pkg/apis/hello: unknown import path "github.com/k8spatterns/hello-operator/pkg/apis/hello": cannot find module providing package github.com/k8spatterns/hello-operator/pkg/apis/hello

INFO[0053] Created deploy/crds/hello_v1alpha1_hello_crd.yaml
DEBU[0053] Running []string{"go", "build", "-o", "/Users/roland/Development/go/workspace/src/github.com/k8spatterns/hello-operator/build/_output/bin/client-gen", "./cmd/client-gen"}
DEBU[0054] Running []string{"go", "build", "-o", "/Users/roland/Development/go/workspace/src/github.com/k8spatterns/hello-operator/build/_output/bin/lister-gen", "./cmd/lister-gen"}
DEBU[0055] Running []string{"go", "build", "-o", "/Users/roland/Development/go/workspace/src/github.com/k8spatterns/hello-operator/build/_output/bin/informer-gen", "./cmd/informer-gen"}
DEBU[0056] Running []string{"go", "build", "-o", "/Users/roland/Development/go/workspace/src/github.com/k8spatterns/hello-operator/build/_output/bin/deepcopy-gen", "./cmd/deepcopy-gen"}
INFO[0057] Running deepcopy code-generation for Custom Resource group versions: [hello:[v1alpha1], ]
DEBU[0057] Running []string{"/Users/roland/Development/go/workspace/src/github.com/k8spatterns/hello-operator/build/_output/bin/deepcopy-gen", "--input-dirs", "github.com/k8spatterns/hello-operator/pkg/apis/hello/v1alpha1", "--output-file-base", "zz_generated.deepcopy", "--bounding-dirs", "github.com/k8spatterns/hello-operator/pkg/apis", "--go-header-file", "/var/folders/bh/fw5xsjw531n6crvdz9tgv_380000gn/T/984914475"}
INFO[0063] Code-generation complete.
DEBU[0063] Running []string{"go", "build", "-o", "/Users/roland/Development/go/workspace/src/github.com/k8spatterns/hello-operator/build/_output/bin/openapi-gen", "./cmd/openapi-gen"}
INFO[0064] Running OpenAPI code-generation for Custom Resource group versions: [hello:[v1alpha1], ]
DEBU[0064] Running []string{"/Users/roland/Development/go/workspace/src/github.com/k8spatterns/hello-operator/build/_output/bin/openapi-gen", "--input-dirs", "github.com/k8spatterns/hello-operator/pkg/apis/hello/v1alpha1", "--output-package", "github.com/k8spatterns/hello-operator/pkg/apis/hello/v1alpha1", "--output-file-base", "zz_generated.openapi", "--go-header-file", "/var/folders/bh/fw5xsjw531n6crvdz9tgv_380000gn/T/367750542"}
2019/06/11 10:36:51 Code for OpenAPI definitions generated
INFO[0069] Created deploy/crds/hello_v1alpha1_hello_crd.yaml
INFO[0069] Code-generation complete.
INFO[0069] API generation complete.

Environment

  • operator-sdk version:

operator-sdk version: v0.8.1, commit: 33b3bfe

  • go version:

go version go1.12.5 darwin/amd64

@joelanford
Copy link
Member

The question about the warnings has come up a couple of times. See this PR for details: #1401

I'm not sure about the GitHub credentials dialog, but my guess would be that it happens as part of the compilation of the generator binaries when go build is executed with Go modules enabled. Does the dialog come up around the following lines?

Fetching https://github.com?go-get=1
Parsing meta tags from https://github.com?go-get=1 (status code 200)

@joelanford joelanford self-assigned this Jun 11, 2019
@joelanford joelanford added the triage/support Indicates an issue that is a support question. label Jun 11, 2019
@estroz
Copy link
Member

estroz commented Jun 12, 2019

@rhuss: @joelanford is correct, go/build package parsing causes this error.

This issue relates to #1502. For a temporary fix, try the following before running operator-sdk add api:

$ mkdir -p pkg/apis/hello && echo "package hello" > pkg/apis/hello/stub.go

PR #1401 should fix this once merged.

NicolasT added a commit to scality/metalk8s that referenced this issue Jul 8, 2019
Without such file in place, code-generation using `operator-sdk generate
openapi` tends to fail. This is fixed in later versions of
`operator-sdk`, which generate exactly this file when scaffolding a new
API.

See: operator-framework/operator-sdk#1401
See: operator-framework/operator-sdk#1502
See: operator-framework/operator-sdk#1546
NicolasT added a commit to scality/metalk8s that referenced this issue Jul 8, 2019
Without such file in place, code-generation using `operator-sdk generate
openapi` tends to fail. This is fixed in later versions of
`operator-sdk`, which generate exactly this file when scaffolding a new
API.

See: operator-framework/operator-sdk#1401
See: operator-framework/operator-sdk#1502
See: operator-framework/operator-sdk#1546
NicolasT added a commit to scality/metalk8s that referenced this issue Jul 9, 2019
Without such file in place, code-generation using `operator-sdk generate
openapi` tends to fail. This is fixed in later versions of
`operator-sdk`, which generate exactly this file when scaffolding a new
API.

See: operator-framework/operator-sdk#1401
See: operator-framework/operator-sdk#1502
See: operator-framework/operator-sdk#1546
slaperche-scality pushed a commit to scality/metalk8s that referenced this issue Jul 12, 2019
Without such file in place, code-generation using `operator-sdk generate
openapi` tends to fail. This is fixed in later versions of
`operator-sdk`, which generate exactly this file when scaffolding a new
API.

See: operator-framework/operator-sdk#1401
See: operator-framework/operator-sdk#1502
See: operator-framework/operator-sdk#1546
slaperche-scality pushed a commit to scality/metalk8s that referenced this issue Jul 12, 2019
Without such file in place, code-generation using `operator-sdk generate
openapi` tends to fail. This is fixed in later versions of
`operator-sdk`, which generate exactly this file when scaffolding a new
API.

See: operator-framework/operator-sdk#1401
See: operator-framework/operator-sdk#1502
See: operator-framework/operator-sdk#1546
slaperche-scality pushed a commit to scality/metalk8s that referenced this issue Jul 12, 2019
Without such file in place, code-generation using `operator-sdk generate
openapi` tends to fail. This is fixed in later versions of
`operator-sdk`, which generate exactly this file when scaffolding a new
API.

See: operator-framework/operator-sdk#1401
See: operator-framework/operator-sdk#1502
See: operator-framework/operator-sdk#1546
slaperche-scality pushed a commit to scality/metalk8s that referenced this issue Jul 15, 2019
Without such file in place, code-generation using `operator-sdk generate
openapi` tends to fail. This is fixed in later versions of
`operator-sdk`, which generate exactly this file when scaffolding a new
API.

See: operator-framework/operator-sdk#1401
See: operator-framework/operator-sdk#1502
See: operator-framework/operator-sdk#1546
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage/support Indicates an issue that is a support question.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants