Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kuma-cp: add a Monitoring Assignment Discovery Service (MADS) server #531

Merged
merged 2 commits into from
Jan 10, 2020

Conversation

yskopets
Copy link
Contributor

@yskopets yskopets commented Jan 8, 2020

Summary

  • add a Monitoring Assignment Discovery Service (MADS) server

@yskopets yskopets requested a review from a team January 8, 2020 13:58
@yskopets yskopets force-pushed the feature/mads-server branch from 3ad7015 to 5781ef6 Compare January 8, 2020 14:23
// Monitoring Assignment Discovery Service (MADS) server configuration.
type MonitoringAssignmentServerConfig struct {
// Port of a gRPC server that serves Monitoring Assignment Discovery Service (MADS).
GrpcPort int `yaml:"grpcPort" envconfig:"kuma_observability_monitoring_assignment_server_grpc_port"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

env name should mirror the yaml path. YAML path right now is monitoringAssignmentServer.grpcPort.
Please also update loader_test.go file with overrides, defaults and test for /config

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

return time.NewTicker(1 * time.Second)
},
OnTick: func() error {
madsServerLog.V(1).Info("on tick")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we log for what node and stream id the timer is ticking?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

return util_xds.NewWatchdogCallbacks(func(node *envoy_core.Node, _ int64) (util_watchdog.Watchdog, error) {
return &util_watchdog.SimpleWatchdog{
NewTicker: func() *time.Ticker {
return time.NewTicker(1 * time.Second)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make this configurable? It's an easy way to improve performance of the Control Plane. Example - change 1s to 10s, 10x less operation to execute with more latency for applying policies which is not crucial here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

# Monitoring Assignment Discovery Service (MADS) server configuration
monitoringAssignmentServer:
# Port of a gRPC server that serves Monitoring Assignment Discovery Service (MADS).
grpcPort: 5676
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add ENV: comment?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

}

// Generates a snapshot of xDS resources for a given node.
type Snapshotter interface {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about SnapshotGenerator?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

envoy_server "github.com/envoyproxy/go-control-plane/pkg/server"
)

type Server interface {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see this code is very similar to SDS. Can we somehow avoid duplication? Of course, if it doesn't make sense then don't do it. Then please at least provide link on which code this implementation is based on.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't want to invest time into this generalisation right now

}

func (r *reconciler) Reconcile(node *envoy_core.Node) error {
new, err := r.snapshotter.Snapshot(node)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't we call Snapshot#Consistent somewhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

}
id := r.hasher.ID(node)
old, _ := r.cache.GetSnapshot(id)
r.versioner.Version(new, old)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about concurrency of this method? Hasher will always return the same version. Every node has one goroutine for processing so there will be multiple goroutines operating on the same snapshot setting the version. Is it ok?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new is always a fresh object.
Anyway, Versioner has been changed to facilitate immutable Snapshots.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was mostly concerned about versioning of the snapshot, but since we compare it for previous snapshot, it should be fine.

@yskopets yskopets force-pushed the feature/generic-xds-stream-watchdog branch from b58f1b1 to 863b8d7 Compare January 10, 2020 11:15
@yskopets yskopets force-pushed the feature/mads-server branch from 5781ef6 to c11f6a3 Compare January 10, 2020 12:09
@yskopets
Copy link
Contributor Author

@jakubdyszkiewicz Please take another look

@yskopets yskopets force-pushed the feature/generic-xds-stream-watchdog branch from 863b8d7 to 8bf29a7 Compare January 10, 2020 16:34
@yskopets yskopets changed the base branch from feature/generic-xds-stream-watchdog to master January 10, 2020 16:36
@yskopets yskopets force-pushed the feature/mads-server branch from c11f6a3 to e6fa93b Compare January 10, 2020 16:37
@yskopets yskopets merged commit e2529c9 into master Jan 10, 2020
@devadvocado devadvocado deleted the feature/mads-server branch March 30, 2020 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants