Skip to content

Commit

Permalink
vendor: Pick up the latest cilium/hubble
Browse files Browse the repository at this point in the history
- Adapt to the new option pattern to configure hubble server.
- Pass the daemon context to hubble server and monitor listener.

Signed-off-by: Michi Mutsuzaki <michi@isovalent.com>
  • Loading branch information
michi-covalent authored and joestringer committed Mar 13, 2020
1 parent 7a4e2bf commit a5c0488
Show file tree
Hide file tree
Showing 21 changed files with 390 additions and 727 deletions.
20 changes: 15 additions & 5 deletions daemon/daemon_main.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,11 @@ import (
"github.com/cilium/cilium/pkg/probe"
"github.com/cilium/cilium/pkg/sysctl"
"github.com/cilium/cilium/pkg/version"

hubbleServe "github.com/cilium/hubble/cmd/serve"
hubbleMetrics "github.com/cilium/hubble/pkg/metrics"
"github.com/cilium/hubble/pkg/parser"
hubbleServer "github.com/cilium/hubble/pkg/server"
"github.com/cilium/hubble/pkg/server/serveroption"
"github.com/go-openapi/loads"
gops "github.com/google/gops/agent"
"github.com/jessevdk/go-flags"
Expand Down Expand Up @@ -1585,11 +1586,17 @@ func (d *Daemon) launchHubble() {
logger.WithError(err).Warn("Failed to initialize Hubble")
return
}
s := hubbleServer.NewLocalServer(payloadParser, option.Config.HubbleFlowBufferSize, option.Config.HubbleEventQueueSize, logger)
s, err := hubbleServer.NewLocalServer(payloadParser, logger,
serveroption.WithMaxFlows(option.Config.HubbleFlowBufferSize),
serveroption.WithMonitorBuffer(option.Config.HubbleEventQueueSize))
if err != nil {
logger.WithError(err).Warn("Failed to initialize Hubble")
return
}
go s.Start()
d.monitorAgent.GetMonitor().RegisterNewListener(context.TODO(), hubble.NewHubbleListener(s))
d.monitorAgent.GetMonitor().RegisterNewListener(d.ctx, hubble.NewHubbleListener(s))
logger.WithField("addresses", addresses).Info("Starting Hubble server")
if err := hubbleServe.Serve(logger, addresses, s); err != nil {
if err := hubbleServe.Serve(d.ctx, logger, addresses, s); err != nil {
logger.WithError(err).Warn("Failed to start Hubble server")
return
}
Expand All @@ -1598,6 +1605,9 @@ func (d *Daemon) launchHubble() {
"address": option.Config.HubbleMetricsServer,
"metrics": option.Config.HubbleMetrics,
}).Info("Starting Hubble Metrics server")
hubbleServe.EnableMetrics(log, option.Config.HubbleMetricsServer, option.Config.HubbleMetrics)
if err := hubbleMetrics.EnableMetrics(log, option.Config.HubbleMetricsServer, option.Config.HubbleMetrics); err != nil {
logger.WithError(err).Warn("Failed to initialize Hubble metrics server")
return
}
}
}
5 changes: 1 addition & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,14 @@ require (
github.com/c9s/goprocinfo v0.0.0-20190309065803-0b2ad9ac246b
github.com/cilium/arping v1.0.1-0.20190728065459-c5eaf8d7a710
github.com/cilium/ebpf v0.0.0-20191113100448-d9fb101ca1fb
github.com/cilium/hubble v0.0.0-20200304205543-565cbe60f7fb
github.com/cilium/hubble v0.0.0-20200312104109-daf0d22074cb
github.com/cilium/ipam v0.0.0-20200217195329-a46f8d55f9db
github.com/cilium/proxy v0.0.0-20200309181938-3cf80fe45d03
github.com/containernetworking/cni v0.7.1
github.com/containernetworking/plugins v0.8.2
github.com/davecgh/go-spew v1.1.1
github.com/docker/docker v0.7.3-0.20190327010347-be7ac8be2ae0
github.com/docker/go-connections v0.4.0 // indirect
github.com/docker/libnetwork v0.0.0-20190128195551-d8d4c8cf03d7
github.com/envoyproxy/protoc-gen-validate v0.3.0-java // indirect
github.com/go-openapi/errors v0.19.3
github.com/go-openapi/loads v0.19.5
github.com/go-openapi/runtime v0.19.4
Expand All @@ -42,7 +40,6 @@ require (
github.com/kr/pretty v0.1.0
github.com/mattn/go-shellwords v1.0.5
github.com/miekg/dns v1.0.14
github.com/morikuni/aec v1.0.0 // indirect
github.com/onsi/ginkgo v1.10.1
github.com/onsi/gomega v1.7.0
github.com/optiopay/kafka v0.0.0-00010101000000-000000000000
Expand Down
4 changes: 3 additions & 1 deletion go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,16 @@ github.com/cespare/xxhash/v2 v2.1.0/go.mod h1:dgIUBU3pDso/gPgZ1osOZ0iQf77oPR28Tj
github.com/cilium/arping v1.0.1-0.20190728065459-c5eaf8d7a710 h1:htVjkajqUYy6JmLMGlZYxfZ4urQq7rDvgUfmSJX7fSg=
github.com/cilium/arping v1.0.1-0.20190728065459-c5eaf8d7a710/go.mod h1:ohfPr9hSb4vRsw5UEjCs3OoWD38U0z8EfSgZPbIe/+M=
github.com/cilium/cilium v1.7.0-rc2.0.20200304124244-647a43c7953f/go.mod h1:t5xlCbWzen5MJm3QTM0JUXC43PgaJZVW7rtMHBEwDS8=
github.com/cilium/cilium v1.7.0-rc2.0.20200311180626-711b37ed100c/go.mod h1:DivZYmYP4ZOqCcTP+3eNxuHkQYYeybeB5XdrjeZvyLY=
github.com/cilium/client-go v0.0.0-20200217141255-96fd08586691 h1:WwV9S3lIRzfCt8xndUZ5a0EnKQzRz1/IM/bLOndVhkI=
github.com/cilium/client-go v0.0.0-20200217141255-96fd08586691/go.mod h1:cLXlTMtWHkuK4tD360KpWz2gG2KtdWEr/OT02i3emRQ=
github.com/cilium/dns v1.1.4-0.20190417235132-8e25ec9a0ff3 h1:wenYMyWJ08dgEUUj0Ija8qdK/V9vL3ThAD5sjOYlFlg=
github.com/cilium/dns v1.1.4-0.20190417235132-8e25ec9a0ff3/go.mod h1:cXN7jgo+gsGlNvQ7Vqu2ELdc3f7i7PPgupHqSkLzzBo=
github.com/cilium/ebpf v0.0.0-20191113100448-d9fb101ca1fb h1:bQ0NJ9dAB8vsw7ffajBDX/7Wr64BdLWeJkYY36UkeRY=
github.com/cilium/ebpf v0.0.0-20191113100448-d9fb101ca1fb/go.mod h1:MA5e5Lr8slmEg9bt0VpxxWqJlO4iwu3FBdHUzV7wQVg=
github.com/cilium/hubble v0.0.0-20200304205543-565cbe60f7fb h1:w+NkbBM7QYLT+kazyZXvwZtXya94e/wgXLdp2Th7l00=
github.com/cilium/hubble v0.0.0-20200304205543-565cbe60f7fb/go.mod h1:GYdTLWzzpzgp2ptyEp0LccPotGo4BxPX9SJRGL4pI5c=
github.com/cilium/hubble v0.0.0-20200312104109-daf0d22074cb h1:bMBRFcv57f6X6XL3OWLzTEaaIcOSu9TFakMr4yzChdU=
github.com/cilium/hubble v0.0.0-20200312104109-daf0d22074cb/go.mod h1:KW9XVfDaAw2XnqD4bskTBMBz06syhZvxkNJ+3Bb6fRU=
github.com/cilium/ipam v0.0.0-20200217195329-a46f8d55f9db h1:pW/jw3e14kOrad7wNZRKdnSDRStOcJ02A7uIpTsa5f8=
github.com/cilium/ipam v0.0.0-20200217195329-a46f8d55f9db/go.mod h1:URWgSDyRFKKBgnY4Svj37siCG145nu3qJt6oHlZRdqU=
github.com/cilium/kafka v0.0.0-20180809090225-01ce283b732b h1:+bsFX/WOMIoaayXVyRem1awcpz3icz/HoL8Dxg/m6a4=
Expand Down
7 changes: 6 additions & 1 deletion pkg/hubble/listener_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ package hubble
import (
"testing"

"github.com/cilium/hubble/pkg/server/serveroption"

"github.com/cilium/cilium/pkg/checker"
listener2 "github.com/cilium/cilium/pkg/monitor/agent/listener"
"github.com/cilium/cilium/pkg/monitor/payload"
Expand All @@ -40,7 +42,10 @@ var _ = Suite(&HubbleSuite{})
func (s *HubbleSuite) TestHubbleListener(c *C) {
// Setting maxFlows to 100. This should create the events channel with buffer size set to 1:
// https://github.com/cilium/hubble/blob/04ab72591faca62a305ce0715108876167182e04/pkg/server/local_observer.go#L90
grpcServer := server.NewLocalServer(nil, 100, 1, logrus.NewEntry(logrus.New()))
grpcServer, err := server.NewLocalServer(nil, logrus.NewEntry(logrus.New()),
serveroption.WithMaxFlows(100),
serveroption.WithMonitorBuffer(1))
c.Assert(err, IsNil)
listener := NewHubbleListener(grpcServer)
c.Assert(listener.Version(), Equals, listener2.Version1_2)
pl := payload.Payload{CPU: 1, Lost: 2, Type: 3, Data: []byte{'a', 'b', 'c'}}
Expand Down
227 changes: 27 additions & 200 deletions vendor/github.com/cilium/hubble/api/v1/observer/observer.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a5c0488

Please sign in to comment.