Skip to content

Not able to run after cloning #2

Description

@swapanshridhar

Reached here from your MEDIUM article : https://medium.com/@trstringer/create-kubernetes-controllers-for-core-and-custom-resources-62fc35ad64a3

Started following README instructions, but 'go run *.go' gives me dependencies error.

MacBook$ pwd /Users/xxx/testing_operators
MacBook$ git clone https://github.com/trstringer/k8s-controller-core-resource
MacBook$ cd k8s-controller-core-resource
MacBook$ ls
Gopkg.lock    Gopkg.toml    README.md     controller.go handler.go    main.go


MacBook$ go run *.go

controller.go:7:2: cannot find package "github.com/Sirupsen/logrus" in any of:
	/usr/local/opt/go/libexec/src/github.com/Sirupsen/logrus (from $GOROOT)
	/Users/xxx/go_space/src/github.com/Sirupsen/logrus (from $GOPATH)
handler.go:5:2: cannot find package "k8s.io/api/core/v1" in any of:
	/usr/local/opt/go/libexec/src/k8s.io/api/core/v1 (from $GOROOT)
	/Users/xxx/go_space/src/k8s.io/api/core/v1 (from $GOPATH)
main.go:10:2: cannot find package "k8s.io/apimachinery/pkg/apis/meta/v1" in any of:
	/usr/local/opt/go/libexec/src/k8s.io/apimachinery/pkg/apis/meta/v1 (from $GOROOT)
	/Users/xxx/go_space/src/k8s.io/apimachinery/pkg/apis/meta/v1 (from $GOPATH)
main.go:11:2: cannot find package "k8s.io/apimachinery/pkg/runtime" in any of:
	/usr/local/opt/go/libexec/src/k8s.io/apimachinery/pkg/runtime (from $GOROOT)
	/Users/xxx/go_space/src/k8s.io/apimachinery/pkg/runtime (from $GOPATH)
controller.go:8:2: cannot find package "k8s.io/apimachinery/pkg/util/runtime" in any of:
	/usr/local/opt/go/libexec/src/k8s.io/apimachinery/pkg/util/runtime (from $GOROOT)
	/Users/xxx/go_space/src/k8s.io/apimachinery/pkg/util/runtime (from $GOPATH)
controller.go:9:2: cannot find package "k8s.io/apimachinery/pkg/util/wait" in any of:
	/usr/local/opt/go/libexec/src/k8s.io/apimachinery/pkg/util/wait (from $GOROOT)
	/Users/xxx/go_space/src/k8s.io/apimachinery/pkg/util/wait (from $GOPATH)
main.go:12:2: cannot find package "k8s.io/apimachinery/pkg/watch" in any of:
	/usr/local/opt/go/libexec/src/k8s.io/apimachinery/pkg/watch (from $GOROOT)
	/Users/xxx/go_space/src/k8s.io/apimachinery/pkg/watch (from $GOPATH)
controller.go:10:2: cannot find package "k8s.io/client-go/kubernetes" in any of:
	/usr/local/opt/go/libexec/src/k8s.io/client-go/kubernetes (from $GOROOT)
	/Users/xxx/go_space/src/k8s.io/client-go/kubernetes (from $GOPATH)
controller.go:11:2: cannot find package "k8s.io/client-go/tools/cache" in any of:
	/usr/local/opt/go/libexec/src/k8s.io/client-go/tools/cache (from $GOROOT)
	/Users/xxx/go_space/src/k8s.io/client-go/tools/cache (from $GOPATH)
main.go:15:2: cannot find package "k8s.io/client-go/tools/clientcmd" in any of:
	/usr/local/opt/go/libexec/src/k8s.io/client-go/tools/clientcmd (from $GOROOT)
	/Users/xxx/go_space/src/k8s.io/client-go/tools/clientcmd (from $GOPATH)
controller.go:12:2: cannot find package "k8s.io/client-go/util/workqueue" in any of:
	/usr/local/opt/go/libexec/src/k8s.io/client-go/util/workqueue (from $GOROOT)
	/Users/xxx/go_space/src/k8s.io/client-go/util/workqueue (from $GOPATH)

I am new to GO and k8s.

I have installed GO :

MacBook$ echo $GOPATH
/Users/xxx/go_space
MacBook$ echo $GOROOT
/usr/local/opt/go/libexec
MacBook$ GOBIN
/Users/xxx/go_space/bin

Setup:

Running a 3 node Vagrant Ubuntu cluster, and using Macbook CLI to issue commands to my vagrant cluster, and communication is wired up from ~/.kube/config

MacBook$ kubectl get nodes
NAME         STATUS   ROLES    AGE     VERSION
k8s-head     Ready    master   2d14h   v1.13.3
k8s-node-1   Ready    <none>   2d14h   v1.13.3
k8s-node-2   Ready    <none>   2d14h   v1.13.3

@trstringer
Any inputs on it ? Do we need some dependency file for it, which can install things ?
Or I need to run the code from head Node ?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions