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

can't resolve tutorial.kubebuilder.io #1614

Closed
BlueShells opened this issue Jul 28, 2020 · 2 comments
Closed

can't resolve tutorial.kubebuilder.io #1614

BlueShells opened this issue Jul 28, 2020 · 2 comments

Comments

@BlueShells
Copy link

BlueShells commented Jul 28, 2020

Hi I am trying to follow the https://book.kubebuilder.io/cronjob-tutorial/controller-implementation.html
to create a cronjob operator

but when I try to add the controller part , the import part failed , because of this line

batch "tutorial.kubebuilder.io/project/api/v1"

more detail :

cannot find module providing package tutorial.kubebuilder.io/project/api/v1: unrecognized import path "tutorial.kubebuilder.io/project/api": https fetch: Get "https://tutorial.kubebuilder.io/project/api?go-get=1": dial tcp: lookup tutorial.kubebuilder.io: no such hostgo

seems this import is my cronjob project its own , how can I resolve this ?

and my version is

kubebuilder version Version: version.Version{KubeBuilderVersion:"2.3.1", KubernetesVendor:"1.16.4", GitCommit:"8b53abeb4280186e494b726edf8f54ca7aa64a49", BuildDate:"2020-03-26T16:42:00Z", GoOs:"unknown", GoArch:"unknown"}

@BlueShells
Copy link
Author

this seems to be caused by this

`cat go.mod
module tutorial.kubebuilder.io/project

go 1.13

require (
github.com/go-logr/logr v0.1.0
github.com/onsi/ginkgo v1.11.0
github.com/onsi/gomega v1.8.1
github.com/robfig/cron v1.2.0
k8s.io/api v0.17.2
k8s.io/apimachinery v0.17.2
k8s.io/client-go v0.17.2
sigs.k8s.io/controller-runtime v0.5.0
)`

the module must be tutorial.kubebuilder.io/project, but this part is not in the doc , please update the doc so other people will not run into this issue

@qingfengfenga
Copy link

Change

# cat go.mod
// module example.com/m/v2
module tutorial.kubebuilder.io/project

go 1.18

require (
        k8s.io/apimachinery v0.24.2
        k8s.io/client-go v0.24.2
        sigs.k8s.io/controller-runtime v0.12.2
)

require (
        cloud.google.com/go v0.81.0 // indirect
        github.com/Azure/go-autorest v14.2.0+incompatible // indirect
        github.com/Azure/go-autorest/autorest v0.11.18 // indirect

......

Report errors

# kubebuilder create webhook --group batch --version v1 --kind CronJob --defaulting --programmatic-validation --force
Writing kustomize manifests for you to edit...
Writing scaffold for you to edit...
api/v1/cronjob_webhook.go
Update dependencies:
$ go mod tidy
go: finding module for package github.com/robfig/cron
go: finding module for package example.com/m/v2/api/v1
go: found github.com/robfig/cron in github.com/robfig/cron v1.2.0
go: finding module for package example.com/m/v2/api/v1
tutorial.kubebuilder.io/project/controllers tested by
        tutorial.kubebuilder.io/project/controllers.test imports
        example.com/m/v2/api/v1: cannot find module providing package example.com/m/v2/api/v1: module example.com/m/v2/api: reading https://goproxy.cn/example.com/m/v2/api/@v/list: 404 Not Found
        server response: not found: example.com/m/v2/api@latest: unrecognized import path "example.com/m/v2/api": reading https://example.com/m/v2/api?go-get=1: 404 Not Found
Error: failed to create webhook: unable to run post-scaffold tasks of "base.go.kubebuilder.io/v3": exit status 1
Usage:
  kubebuilder create webhook [flags]

Examples:
  # Create defaulting and validating webhooks for Group: ship, Version: v1beta1
  # and Kind: Frigate
  kubebuilder create webhook --group ship --version v1beta1 --kind Frigate --defaulting --programmatic-validation

  # Create conversion webhook for Group: ship, Version: v1beta1
  # and Kind: Frigate
  kubebuilder create webhook --group ship --version v1beta1 --kind Frigate --conversion


Flags:
      --conversion                if set, scaffold the conversion webhook
      --defaulting                if set, scaffold the defaulting webhook
      --force                     attempt to create resource even if it already exists
      --group string              resource Group
  -h, --help                      help for webhook
      --kind string               resource Kind
      --plural string             resource irregular plural form
      --programmatic-validation   if set, scaffold the validating webhook
      --version string            resource Version

Global Flags:
      --plugins strings   plugin keys to be used for this subcommand execution

2022/09/05 18:12:22 failed to create webhook: unable to run post-scaffold tasks of "base.go.kubebuilder.io/v3": exit status 1
root@PennWang:/mnt/e/Me/test/tutorial#

Do I need to modify all ` module example.com/m/v2 '

image

Version(Win11 WLS 2)

# kubebuilder version
Version: main.version{KubeBuilderVersion:"3.6.0", KubernetesVendor:"1.24.1", GitCommit:"f20414648f1851ae97997f4a5f8eb4329f450f6d", BuildDate:"2022-08-03T11:47:17Z", GoOs:"linux", GoArch:"amd64"}
root@PennWang:/mnt/e/Me/test/tutorial#
root@PennWang:/mnt/e/Me/test/tutorial# go version
go version go1.18.1 linux/amd64
root@PennWang:/mnt/e/Me/test/tutorial#

@qingfengfenga qingfengfenga mentioned this issue Sep 6, 2022
6 tasks
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

No branches or pull requests

2 participants