Unable to create Api | Go Operator

682 views
Skip to first unread message

Vaishali Gupta

unread,
Oct 26, 2021, 10:19:28 AM10/26/21
to Operator Framework
Hello Team ,

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

```
root@k8sopa1:~/hss-operator# operator-sdk create api --group cache --version v1alpha1 --kind Hss --resource --controller
Writing kustomize manifests for you to edit...
Writing scaffold for you to edit...
api/v1alpha1/hss_types.go
controllers/hss_controller.go
Update dependencies:
$ go mod tidy
Running make:
$ make generate
go: creating new go.mod: module tmp
make: *** [Makefile:125: controller-gen] 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

  # 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)
      --crd-version string   version of CustomResourceDefinition to scaffold. Options: [v1, v1beta1] (default "v1")
      --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[0001] failed to create API: unable to run post-scaffold tasks of "base.go.kubebuilder.io/v3": exit status 2
```

versions available on system

```
root@k8sopa1:~/hss-operator# go version
go version go1.16.9 linux/amd64
root@k8sopa1:~/hss-operator# docker version
Client:
 Version:           20.10.8
 API version:       1.41
 Go version:        go1.16.6
 Git commit:        3967b7d28e
 Built:             Wed Aug  4 21:24:10 2021
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server:
 Engine:
  Version:          20.10.8
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.16.6
  Git commit:       75249d8
  Built:            Wed Aug  4 21:26:30 2021
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.4.9
  GitCommit:        e25210fe30a0a703442421b0f60afac609f950a3
 runc:
  Version:          1.0.1
  GitCommit:
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
root@k8sopa1:~/hss-operator# kubectl version
Client Version: version.Info{Major:"1", Minor:"22", GitVersion:"v1.22.2", GitCommit:"8b5a19147530eaac9476b0ab82980b4088bbc1b2", GitTreeState:"clean", BuildDate:"2021-09-16T02:43:21Z", GoVersion:"go1.16.7", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.5+k3s2", GitCommit:"724ef700bab896ff252a75e2be996d5f4ff1b842", GitTreeState:"clean", BuildDate:"2021-10-05T19:59:14Z", GoVersion:"go1.16.8", Compiler:"gc", Platform:"linux/amd64"}
root@k8sopa1:~/hss-operator# git version
git version 2.25.1
root@k8sopa1:~/hss-operator# operator-sdk version
operator-sdk version: "v1.13.1", commit: "1659ab58a073999463e6dcdf18bdc359a315e091", kubernetes version: "1.21", go version: "go1.16.8", GOOS: "linux", GOARCH: "amd64"
root@k8sopa1:~/hss-operator#

```

Thanks & Regards,
Vaishali Gupta

David Lanouette

unread,
Oct 26, 2021, 10:41:12 AM10/26/21
to Vaishali Gupta, Operator Framework
Hi Vaishali

dial tcp: lookup proxy.golang.org: Temporary failure in name resolution

This looks like it might be a temporary network issue while trying to download controller-gen.  

Can you try manually running go get: sigs.k8s.io/controller-tools/cmd/control...@v0.6.1 on your computer?



David Lanouette

Principal Engineer - IT Platform Team

Remote, NC

mobile: 919-610-6656




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.

--
You received this message because you are subscribed to the Google Groups "Operator Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to operator-framew...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/operator-framework/b615f890-75de-44c7-bbdd-da0110630b9cn%40googlegroups.com.

Vaishali Gupta

unread,
Oct 26, 2021, 10:49:47 AM10/26/21
to Operator Framework

David Lanouette

unread,
Oct 26, 2021, 11:00:37 AM10/26/21
to Vaishali Gupta, Operator Framework
So, your real issue is trying to download controller-gen.  It seems like you may not be able to reach the go proxy server.

What do you get if you try to run nslookup?



David Lanouette

Principal Engineer - IT Platform Team

Remote, NC

mobile: 919-610-6656



Vaishali Gupta

unread,
Oct 26, 2021, 11:07:58 AM10/26/21
to Operator Framework
Hello David,

Getting below message

root@k8sopa1:/home/vagrant# nslookup proxy.golang.org
Server:         127.0.0.53
Address:        127.0.0.53#53

** server can't find proxy.golang.org: SERVFAIL

Vaishali Gupta

unread,
Oct 26, 2021, 11:30:45 AM10/26/21
to Operator Framework

below is the out put of dig

root@k8sopa1:/home/vagrant# dig proxy.golang.org

; <<>> DiG 9.16.1-Ubuntu <<>> proxy.golang.org
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 40165
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;proxy.golang.org.              IN      A

;; Query time: 0 msec
;; SERVER: 127.0.0.53#53(127.0.0.53)
;; WHEN: Tue Oct 26 15:29:39 UTC 2021
;; MSG SIZE  rcvd: 45

root@k8sopa1:/home/vagrant# dig +trace proxy.golang.org

; <<>> DiG 9.16.1-Ubuntu <<>> +trace proxy.golang.org
;; global options: +cmd
;; Received 51 bytes from 127.0.0.53#53(127.0.0.53) in 0 ms

root@k8sopa1:/home/vagrant#

David Lanouette

unread,
Oct 26, 2021, 11:53:07 AM10/26/21
to Vaishali Gupta, Operator Framework
The proxy is definitely up, so it seems like it's an issue on your end.  Sorry we can't help further.

One additional thing I noticed:  It looks like you may be running the commands in a VM.  (your home directory is /home/vagrant).  You may want to double check your network configuration on the VM, and try running it on a "real" machine.

Good luck.


David Lanouette

Principal Engineer - IT Platform Team

Remote, NC

mobile: 919-610-6656



Vaishali Gupta

unread,
Oct 26, 2021, 11:57:38 AM10/26/21
to Operator Framework
Added the Ip into etc/hosts
but still facing same error with create api
root@k8sopa2:~/hss-operator# ping https://proxy.golang.org/
ping: https://proxy.golang.org/: Name or service not known
root@k8sopa2:~/hss-operator# ping proxy.golang.org
PING proxy.golang.org (142.250.196.177) 56(84) bytes of data.
64 bytes from proxy.golang.org (142.250.196.177): icmp_seq=1 ttl=113 time=46.8 ms
64 bytes from proxy.golang.org (142.250.196.177): icmp_seq=2 ttl=113 time=45.7 ms
64 bytes from proxy.golang.org (142.250.196.177): icmp_seq=3 ttl=113 time=47.8 ms
64 bytes from proxy.golang.org (142.250.196.177): icmp_seq=4 ttl=113 time=47.6 ms
64 bytes from proxy.golang.org (142.250.196.177): icmp_seq=5 ttl=113 time=45.7 ms
64 bytes from proxy.golang.org (142.250.196.177): icmp_seq=6 ttl=113 time=47.7 ms
64 bytes from proxy.golang.org (142.250.196.177): icmp_seq=7 ttl=113 time=47.7 ms
64 bytes from proxy.golang.org (142.250.196.177): icmp_seq=8 ttl=113 time=45.7 ms
64 bytes from proxy.golang.org (142.250.196.177): icmp_seq=9 ttl=113 time=47.4 ms
64 bytes from proxy.golang.org (142.250.196.177): icmp_seq=10 ttl=113 time=47.2 ms
^C64 bytes from proxy.golang.org (142.250.196.177): icmp_seq=11 ttl=113 time=47.3 ms
^C
--- proxy.golang.org ping statistics ---
11 packets transmitted, 11 received, 0% packet loss, time 10424ms
rtt min/avg/max/mdev = 45.668/46.953/47.846/0.818 ms
root@k8sopa2:~/hss-operator# ^C
root@k8sopa2:~/hss-operator# ^C
root@k8sopa2:~/hss-operator# nslookup proxy.golang.org
Server:         127.0.0.53
Address:        127.0.0.53#53

Non-authoritative answer:
Address: 142.250.196.177

root@k8sopa2:~/hss-operator#

David Lanouette

unread,
Oct 26, 2021, 1:21:26 PM10/26/21
to Vaishali Gupta, Operator Framework
Ping does not use TLS, so ping https://proxy.golang.org/ would never work as expected.

Can you open the website https://proxy.golang.org/?

You can test if you can connect to the host over TLS with this command:
openssl s_client -connect proxy.golang.org:443





David Lanouette

Principal Engineer - IT Platform Team

Remote, NC

mobile: 919-610-6656



Reply all
Reply to author
Forward
0 new messages