controlplaneio / kubesec

Security risk analysis for Kubernetes resources
https://kubesec.io
Apache License 2.0
1.22k stars 103 forks source link

Kubesec installation using go get #57

Closed codenio closed 5 years ago

codenio commented 5 years ago

Hi,

Kubesec is awsome. Thanks for this wonderful project :tada:

kubesec installation using go get will be helpful.

For instance

# install using go get
$ go get github.com/.../kubesec

# use it directly
$ Kubesec scan -n kube-system deployment kubernetes-dashboard

Do let me know if this feature is already available

sublimino commented 5 years ago

Hi @aananthraj, thanks for the kind words! The command you want is:

go get -u github.com/controlplaneio/kubesec/cmd/kubesec
codenio commented 5 years ago

facing this error while installing kubesec using go get.

$ go get -u github.com/controlplaneio/kubesec/cmd/kubesec
go: finding github.com/controlplaneio/kubesec/cmd/kubesec latest
go: finding github.com/controlplaneio/kubesec/cmd latest
go: finding github.com/garethr/kubeval/kubeval latest
go: finding github.com/garethr/kubeval latest
go: finding github.com/prometheus/client_golang/prometheus/promhttp latest
go: finding github.com/prometheus/client_golang/prometheus latest
go: downloading github.com/prometheus/client_golang v1.1.0
go: github.com/garethr/kubeval@v0.0.0-20190813191913-ecd0802d181a: parsing go.mod: unexpected module path "github.com/instrumenta/kubeval"
go: error loading module requirements

@sublimino can you help here?

stefanprodan commented 5 years ago

Kubesec doesn’t uses go modules, so you need to run the command inside your GOPATH with GO111MODULE=off

codenio commented 5 years ago

Kubesec doesn’t uses go modules

Thanks @stefanprodan for the response. I managed to find it somehow earlier and proceeded with dep. But there are some issues with dependencies of kubesec.

https://github.com/controlplaneio/kubesec/blob/6c813a2af4fc24f5c087561013c59eab208028b8/pkg/ruler/ruleset.go#L8

https://github.com/controlplaneio/kubesec/blob/6c813a2af4fc24f5c087561013c59eab208028b8/pkg/ruler/ruleset.go#L277

Its like Kubeval went through a breaking change and its stops people from using ruler pkg directly

codenio commented 5 years ago

Do you have plans to export kubesec go packages ? If yes, can you move those pacakges to root location github.com/controlplaneio/kubesec

stefanprodan commented 5 years ago

The pkg dir is a golang convention, you can import any package from that dir in your own project.