Unable to create Api | Go Operator | Go issue

649 views
Skip to first unread message

Vaishali Gupta

unread,
Nov 1, 2021, 12:30:30 PM11/1/21
to golang-nuts
Hello Team

getting below error while using below command 
could you please help us what can be done to resolve this issue ?

root@k8sopa1:~/projects/memcached-operator# operator-sdk create api --group cache --version v1alpha1 --kind Memcached --resource --controller
Writing kustomize manifests for you to edit...
Writing scaffold for you to edit...
api/v1alpha1/memcached_types.go
controllers/memcached_controller.go
Update dependencies:
$ go mod tidy
Running make:
$ make generate
go: creating new go.mod: module tmp
go: downloading golang.org/x/sys v0.0.0-20210616094352-59db8d763f22
go get: added sigs.k8s.io/controller-tools v0.7.0
/root/projects/memcached-operator/bin/controller-gen object:headerFile="hack/boilerplate.go.txt" paths="./..."
/usr/local/go/src/net/cgo_linux.go:12:8: no such package located
Error: not all generators ran successfully
run `controller-gen object:headerFile=hack/boilerplate.go.txt paths=./... -w` to see all available markers, or `controller-gen object:headerFile=hack/boilerplate.go.txt paths=./... -h` for usage
Makefile:80: recipe for target 'generate' failed
make: *** [generate] Error 1
Error: failed to create API: unable to run post-scaffold tasks of "base.go.kubebuilder.io/v3": exit status 2
Usage:
  operator-sdk create api [flags]

Examples:
  # Create a frigates API with Group: ship, Version: v1beta1 and Kind: Frigate
  operator-sdk create api --group ship --version v1beta1 --kind Frigate

  # Edit the API Scheme
  nano api/v1beta1/frigate_types.go

  # Edit the Controller
  nano controllers/frigate/frigate_controller.go

  # Edit the Controller Test
  nano controllers/frigate/frigate_controller_test.go

  # Generate the manifests
  make manifests

  # Install CRDs into the Kubernetes cluster using kubectl apply
  make install

  # Regenerate code and run against the Kubernetes cluster configured by ~/.kube/config
  make run


Flags:
      --controller           if set, generate the controller without prompting the user (default true)
      --force                attempt to create resource even if it already exists
      --group string         resource Group
  -h, --help                 help for api
      --kind string          resource Kind
      --make make generate   if true, run make generate after generating files (default true)
      --namespaced           resource is namespaced (default true)
      --plural string        resource irregular plural form
      --resource             if set, generate the resource without prompting the user (default true)
      --version string       resource Version

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

FATA[0088] failed to create API: unable to run post-scaffold tasks of "base.go.kubebuilder.io/v3": exit status 2

Version which i am using 

root@k8sopa1:~/projects/memcached-operator# kubectl version
Client Version: version.Info{Major:"1", Minor:"22", GitVersion:"v1.22.3", GitCommit:"c92036820499fedefec0f847e2054d824aea6cd1", GitTreeState:"clean", BuildDate:"2021-10-27T18:41:28Z", GoVersion:"go1.16.9", Compiler:"gc", Platform:"linux/amd64"}
The connection to the server localhost:8080 was refused - did you specify the right host or port?
root@k8sopa1:~/projects/memcached-operator# git version
git version 2.17.1
root@k8sopa1:~/projects/memcached-operator# docker version
Client: Docker Engine - Community
 Version:           20.10.10
 API version:       1.41
 Go version:        go1.16.9
 Git commit:        b485636
 Built:             Mon Oct 25 07:42:57 2021
 OS/Arch:           linux/amd64
 Context:           default

OS Ubuntu 18.04/ ubuntu 20.04

Connectivity is fine with proxy

root@k8sopa1:~/projects/memcached-operator# ping proxy.golang.org
PING proxy.golang.org (172.217.174.81) 56(84) bytes of data.
64 bytes from bom07s25-in-f17.1e100.net (172.217.174.81): icmp_seq=1 ttl=113 time=26.0 ms
64 bytes from bom07s25-in-f17.1e100.net (172.217.174.81): icmp_seq=2 ttl=113 time=23.4 ms
64 bytes from bom07s25-in-f17.1e100.net (172.217.174.81): icmp_seq=3 ttl=113 time=24.4 ms
64 bytes from bom07s25-in-f17.1e100.net (172.217.174.81): icmp_seq=4 ttl=113 time=23.8 ms
64 bytes from bom07s25-in-f17.1e100.net (172.217.174.81): icmp_seq=5 ttl=113 time=23.0 ms
64 bytes from bom07s25-in-f17.1e100.net (172.217.174.81): icmp_seq=6 ttl=113 time=21.3 ms
^C
--- proxy.golang.org ping statistics ---
6 packets transmitted, 6 received, 0% packet loss, time 5014ms
rtt min/avg/max/mdev = 21.399/23.712/26.056/1.415 ms
root@k8sopa1:~/projects/memcached-operator# nslookup proxy.golang.org
Server:         127.0.0.53
Address:        127.0.0.53#53

Non-authoritative answer:
Address: 172.217.174.81
Address: 2404:6800:4009:815::2011

root@k8sopa1:~/projects/memcached-operator#

root@k8sopa1:~/projects/memcached-operator# echo $GOPROXY

installation guide :- https://sdk.operatorframework.io/docs/installation/

do let me know if anything else is needed from my end 

Thanks & Regrads,
Vaishali Gupta 

Confidentiality Notice and Disclaimer: This email (including any attachments) contains information that may be confidential, privileged and/or copyrighted. If you are not the intended recipient, please notify the sender immediately and destroy this email. Any unauthorized use of the contents of this email in any manner whatsoever, is strictly prohibited. If improper activity is suspected, all available information may be used by the sender for possible disciplinary action, prosecution, civil claim or any remedy or lawful purpose. Email transmission cannot be guaranteed to be secure or error-free, as information could be intercepted, lost, arrive late, or contain viruses. The sender is not liable whatsoever for damage resulting from the opening of this message and/or the use of the information contained in this message and/or attachments. Expressions in this email cannot be treated as opined by the sender company management – they are solely expressed by the sender unless authorized.

Dinesh kumar Ramasamy

unread,
Nov 18, 2021, 1:19:36 PM11/18/21
to golang-nuts
I do see the same issue - No fix yet. 

B K

unread,
Nov 4, 2022, 1:54:31 PM11/4/22
to golang-nuts
Any fix for this yet?

Ian Lance Taylor

unread,
Nov 4, 2022, 1:58:05 PM11/4/22
to B K, golang-nuts
This sounds like a question to ask in a Kubernetes group, not here.  This is a place to ask about the Go language and standard library, not about all programs written in Go.

Ian

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/93a56a68-d215-49a6-8e8f-44257ff72afcn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages