Skip to content

Commit

Permalink
Fix memory plugin build
Browse files Browse the repository at this point in the history
easyjson does not work with main packages. Workaround changing the
package name as suggested in mailru/easyjson#236

Some code has been moved from skydive to graffity: common.Getter

Clean and update gomod:
k8s deps should be added with replace, kubernetes/kubernetes#79384
Same problem with networkservicemesh
viper is not being used
add skydive as dep, not local replace

Once compiled it fails to run with skydive because problems with the Go
plugin framework.
The error is: plugin was built with a different version of package golang.org/x/sys/unix

golang/go#20481
golang/go#27751

Tested adding to the skydive.yml config file:
plugin:
  plugins_dir: /home/adrian/go/src/github.com/skydive-project/skydive-plugins/memory
  topology:
    probes: memory
  • Loading branch information
adrianlzt committed May 19, 2020
1 parent bd73132 commit a74c547
Show file tree
Hide file tree
Showing 7 changed files with 916 additions and 271 deletions.
3 changes: 3 additions & 0 deletions memory/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
memory.so
memory_easyjson.go
memory_gendecoder.go
13 changes: 11 additions & 2 deletions memory/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,17 @@ export GO111MODULE?=on
include $(abspath ../.mk/easyjson.mk)
include $(abspath ../.mk/gendecoder.mk)

memory.so: genlocalfiles
memory.so: clean easyjson_issue_236 genlocalfiles
sed -i 's/^package mainissue236$$/package main/' *.go
go build -buildmode=plugin ./...

.PHONY: genlocalfiles
# Does not work with main package
# https://github.com/mailru/easyjson/issues/236
easyjson_issue_236:
sed -i 's/^package main$$/package mainissue236/' *.go

clean:
rm -f memory_easyjson.go memory_gendecoder.go

.PHONY: genlocalfiles easyjson_issue_236 clean
genlocalfiles: .gendecoder .easyjson
61 changes: 52 additions & 9 deletions memory/go.mod
Original file line number Diff line number Diff line change
@@ -1,15 +1,58 @@
module github.com/skydive-project/skydive-plugins
module github.com/skydive-project/skydive-plugins/memory

go 1.14

require (
github.com/mailru/easyjson v0.7.0
github.com/shirou/gopsutil v0.0.0-20180111024713-6a368fb7cd12
github.com/skydive-project/skydive v0.0.0-20191009170754-872a2c0bfd34
github.com/spf13/viper v1.4.0
github.com/juju/clock v0.0.0-20190205081909-9c5c9712527c // indirect
github.com/juju/errors v0.0.0-20190806202954-0232dcc7464d // indirect
github.com/juju/retry v0.0.0-20180821225755-9058e192b216 // indirect
github.com/juju/testing v0.0.0-20190723135506-ce30eb24acd2 // indirect
github.com/juju/utils v0.0.0-20180820210520-bf9cc5bdd62d // indirect
github.com/juju/version v0.0.0-20180108022336-b64dbd566305 // indirect
github.com/mailru/easyjson v0.7.1
github.com/networkservicemesh/networkservicemesh v0.1.0 // indirect
github.com/shirou/gopsutil v2.18.12+incompatible
github.com/skydive-project/skydive v0.26.1-0.20200514162914-4521c89fa0ac
golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9 // indirect
golang.org/x/tools v0.0.0-20200519015757-0d0afa43d58a // indirect
)

replace (
github.com/skydive-project/skydive => /home/safchain/code/gocode/src/github.com/skydive-project/skydive
github.com/spf13/viper v1.4.0 => github.com/lebauce/viper v0.0.0-20190903114911-3b7a98e30843
golang.org/x/sys => golang.org/x/sys v0.0.0-20190412213103-97732733099d
golang.org/x/tools => golang.org/x/tools v0.0.0-20190925230517-ea99b82c7b93
// Solve: github.com/census-instrumentation/opencensus-proto@v0.1.0-0.20181214143942-ba49f56771b8: invalid pseudo-version: version before v0.1.0 would have negative patch number
github.com/census-instrumentation/opencensus-proto v0.1.0-0.20181214143942-ba49f56771b8 => github.com/census-instrumentation/opencensus-proto v0.0.3-0.20181214143942-ba49f56771b8

// https://github.com/networkservicemesh/networkservicemesh/issues/2157
github.com/networkservicemesh/networkservicemesh => github.com/networkservicemesh/networkservicemesh v0.0.0-20191017074247-aa5815869b2c
github.com/networkservicemesh/networkservicemesh/controlplane => github.com/networkservicemesh/networkservicemesh/controlplane v0.0.0-20191017074247-aa5815869b2c
github.com/networkservicemesh/networkservicemesh/controlplane/api => github.com/networkservicemesh/networkservicemesh/controlplane/api v0.0.0-20191017074247-aa5815869b2c
github.com/networkservicemesh/networkservicemesh/dataplane => github.com/networkservicemesh/networkservicemesh/dataplane v0.0.0-20191017074247-aa5815869b2c
github.com/networkservicemesh/networkservicemesh/dataplane/api => github.com/networkservicemesh/networkservicemesh/dataplane/api v0.0.0-20191017074247-aa5815869b2c
github.com/networkservicemesh/networkservicemesh/k8s => github.com/networkservicemesh/networkservicemesh/k8s v0.0.0-20191017074247-aa5815869b2c
github.com/networkservicemesh/networkservicemesh/k8s/api => github.com/networkservicemesh/networkservicemesh/k8s/api v0.0.0-20191017074247-aa5815869b2c
github.com/networkservicemesh/networkservicemesh/pkg => github.com/networkservicemesh/networkservicemesh/pkg v0.0.0-20191017074247-aa5815869b2c
github.com/networkservicemesh/networkservicemesh/sdk => github.com/networkservicemesh/networkservicemesh/sdk v0.0.0-20191017074247-aa5815869b2c
github.com/networkservicemesh/networkservicemesh/utils => github.com/networkservicemesh/networkservicemesh/utils v0.0.0-20191017074247-aa5815869b2c

// https://github.com/kubernetes/kubernetes/issues/79384
k8s.io/api => k8s.io/api v0.16.9
k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.16.9
k8s.io/apimachinery => k8s.io/apimachinery v0.16.9
k8s.io/apiserver => k8s.io/apiserver v0.16.9
k8s.io/cli-runtime => k8s.io/cli-runtime v0.16.9
k8s.io/client-go => k8s.io/client-go v0.16.9
k8s.io/cloud-provider => k8s.io/cloud-provider v0.16.9
k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.16.9
k8s.io/code-generator => k8s.io/code-generator v0.16.9
k8s.io/component-base => k8s.io/component-base v0.16.9
k8s.io/cri-api => k8s.io/cri-api v0.16.9
k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.16.9
k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.16.9
k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.16.9
k8s.io/kube-proxy => k8s.io/kube-proxy v0.16.9
k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.16.9
k8s.io/kubectl => k8s.io/kubectl v0.16.9
k8s.io/kubelet => k8s.io/kubelet v0.16.9
k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.16.9
k8s.io/metrics => k8s.io/metrics v0.16.9
k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.16.9
)
Loading

0 comments on commit a74c547

Please sign in to comment.