From ce72e0c1720af821b916ac1ad0d0781f28962bd4 Mon Sep 17 00:00:00 2001 From: Pierre Gimalac Date: Mon, 18 Nov 2024 14:04:32 +0100 Subject: [PATCH 01/10] feat: add proto definition for remote-autodiscovery --- pkg/proto/datadog/api/v1/api.proto | 9 + .../datadog/autodiscovery/autodiscovery.proto | 39 ++ pkg/proto/pbgo/core/api.pb.go | 356 +++++++----- pkg/proto/pbgo/core/api.pb.gw.go | 56 ++ pkg/proto/pbgo/core/autodiscovery.pb.go | 522 ++++++++++++++++++ pkg/proto/pbgo/mocks/core/api_mockgen.pb.go | 276 +++++++++ tasks/go.py | 1 + 7 files changed, 1122 insertions(+), 137 deletions(-) create mode 100644 pkg/proto/datadog/autodiscovery/autodiscovery.proto create mode 100644 pkg/proto/pbgo/core/autodiscovery.pb.go diff --git a/pkg/proto/datadog/api/v1/api.proto b/pkg/proto/datadog/api/v1/api.proto index f6c16ff4cc45e..1ffbfa02aa562 100644 --- a/pkg/proto/datadog/api/v1/api.proto +++ b/pkg/proto/datadog/api/v1/api.proto @@ -6,6 +6,7 @@ import "datadog/model/v1/model.proto"; import "datadog/remoteagent/remoteagent.proto"; import "datadog/remoteconfig/remoteconfig.proto"; import "datadog/workloadmeta/workloadmeta.proto"; +import "datadog/autodiscovery/autodiscovery.proto"; import "google/api/annotations.proto"; import "google/protobuf/empty.proto"; @@ -153,6 +154,14 @@ service AgentSecure { body: "*" }; }; + + // Subscribes to autodiscovery config updates + rpc AutodiscoveryStreamConfig(google.protobuf.Empty) returns (stream datadog.autodiscovery.AutodiscoveryStreamResponse) { + option (google.api.http) = { + post: "/v1/grpc/autodiscovery/stream_configs" + body: "*" + }; + }; } // Service exposed by remote agents to allow querying by the Core Agent. diff --git a/pkg/proto/datadog/autodiscovery/autodiscovery.proto b/pkg/proto/datadog/autodiscovery/autodiscovery.proto new file mode 100644 index 0000000000000..5835110f6eaf3 --- /dev/null +++ b/pkg/proto/datadog/autodiscovery/autodiscovery.proto @@ -0,0 +1,39 @@ +syntax = "proto3"; + +package datadog.autodiscovery; + +option go_package = "pkg/proto/pbgo/core"; // golang\ + + +message KubeNamespacedName { + string name = 1; + string namespace = 2; +} + +message AdvancedADIdentifier { + KubeNamespacedName kubeService = 1; + KubeNamespacedName kubeEndpoints = 2; +} + +message Config { + string name = 1; + repeated bytes instances = 2; + bytes initConfig = 3; + bytes metricConfig = 4; + bytes logsConfig = 5; + repeated string adIdentifiers = 6; + repeated AdvancedADIdentifier advancedAdIdentifiers = 7; + string provider = 8; + string serviceId = 9; + string taggerEntity = 10; + bool clusterCheck = 11; + string nodeName = 12; + string source = 13; + bool ignoreAutodiscoveryTags = 14; + bool metricsExcluded = 15; + bool logsExcluded = 16; +} + +message AutodiscoveryStreamResponse { + repeated Config configs = 1; +} diff --git a/pkg/proto/pbgo/core/api.pb.go b/pkg/proto/pbgo/core/api.pb.go index 87ed4b2b3620e..6e23a0ef0f9c2 100644 --- a/pkg/proto/pbgo/core/api.pb.go +++ b/pkg/proto/pbgo/core/api.pb.go @@ -40,128 +40,141 @@ var file_datadog_api_v1_api_proto_rawDesc = []byte{ 0x69, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x27, 0x64, 0x61, 0x74, 0x61, 0x64, 0x6f, 0x67, 0x2f, 0x77, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, 0x61, 0x64, 0x6d, 0x65, 0x74, 0x61, 0x2f, 0x77, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, 0x61, 0x64, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, - 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, - 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0x71, 0x0a, 0x05, - 0x41, 0x67, 0x65, 0x6e, 0x74, 0x12, 0x68, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, - 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x21, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x64, 0x6f, 0x67, 0x2e, 0x6d, - 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x6f, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x64, 0x6f, - 0x67, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x6f, 0x73, 0x74, 0x6e, - 0x61, 0x6d, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x15, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0f, - 0x12, 0x0d, 0x2f, 0x76, 0x31, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x68, 0x6f, 0x73, 0x74, 0x32, - 0xe2, 0x0b, 0x0a, 0x0b, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x63, 0x75, 0x72, 0x65, 0x12, - 0x8f, 0x01, 0x0a, 0x14, 0x54, 0x61, 0x67, 0x67, 0x65, 0x72, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, - 0x45, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x23, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x64, + 0x6f, 0x1a, 0x29, 0x64, 0x61, 0x74, 0x61, 0x64, 0x6f, 0x67, 0x2f, 0x61, 0x75, 0x74, 0x6f, 0x64, + 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2f, 0x61, 0x75, 0x74, 0x6f, 0x64, 0x69, 0x73, + 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, + 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0x71, 0x0a, 0x05, 0x41, 0x67, 0x65, 0x6e, 0x74, + 0x12, 0x68, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65, 0x12, + 0x21, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x64, 0x6f, 0x67, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, + 0x76, 0x31, 0x2e, 0x48, 0x6f, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x64, 0x6f, 0x67, 0x2e, 0x6d, 0x6f, 0x64, + 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x6f, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65, 0x52, 0x65, + 0x70, 0x6c, 0x79, 0x22, 0x15, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0f, 0x12, 0x0d, 0x2f, 0x76, 0x31, + 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x68, 0x6f, 0x73, 0x74, 0x32, 0x80, 0x0d, 0x0a, 0x0b, 0x41, + 0x67, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x63, 0x75, 0x72, 0x65, 0x12, 0x8f, 0x01, 0x0a, 0x14, 0x54, + 0x61, 0x67, 0x67, 0x65, 0x72, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x45, 0x6e, 0x74, 0x69, 0x74, + 0x69, 0x65, 0x73, 0x12, 0x23, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x64, 0x6f, 0x67, 0x2e, 0x6d, 0x6f, + 0x64, 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x54, 0x61, 0x67, + 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x64, 0x6f, 0x67, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x74, 0x72, 0x65, - 0x61, 0x6d, 0x54, 0x61, 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, + 0x61, 0x6d, 0x54, 0x61, 0x67, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2a, + 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x24, 0x3a, 0x01, 0x2a, 0x22, 0x1f, 0x2f, 0x76, 0x31, 0x2f, 0x67, + 0x72, 0x70, 0x63, 0x2f, 0x74, 0x61, 0x67, 0x67, 0x65, 0x72, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, + 0x6d, 0x5f, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x30, 0x01, 0x12, 0x89, 0x01, 0x0a, + 0x11, 0x54, 0x61, 0x67, 0x67, 0x65, 0x72, 0x46, 0x65, 0x74, 0x63, 0x68, 0x45, 0x6e, 0x74, 0x69, + 0x74, 0x79, 0x12, 0x24, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x64, 0x6f, 0x67, 0x2e, 0x6d, 0x6f, 0x64, + 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x65, 0x74, 0x63, 0x68, 0x45, 0x6e, 0x74, 0x69, 0x74, + 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x64, + 0x6f, 0x67, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x65, 0x74, 0x63, + 0x68, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x27, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x21, 0x3a, 0x01, 0x2a, 0x22, 0x1c, 0x2f, 0x76, 0x31, 0x2f, + 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x61, 0x67, 0x67, 0x65, 0x72, 0x2f, 0x66, 0x65, 0x74, 0x63, + 0x68, 0x5f, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x12, 0x9b, 0x01, 0x0a, 0x17, 0x44, 0x6f, 0x67, + 0x73, 0x74, 0x61, 0x74, 0x73, 0x64, 0x43, 0x61, 0x70, 0x74, 0x75, 0x72, 0x65, 0x54, 0x72, 0x69, + 0x67, 0x67, 0x65, 0x72, 0x12, 0x27, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x64, 0x6f, 0x67, 0x2e, 0x6d, + 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x61, 0x70, 0x74, 0x75, 0x72, 0x65, 0x54, + 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x64, 0x6f, 0x67, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x76, 0x31, - 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x54, 0x61, 0x67, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x2a, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x24, 0x3a, 0x01, 0x2a, 0x22, 0x1f, - 0x2f, 0x76, 0x31, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x61, 0x67, 0x67, 0x65, 0x72, 0x2f, - 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x5f, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x30, - 0x01, 0x12, 0x89, 0x01, 0x0a, 0x11, 0x54, 0x61, 0x67, 0x67, 0x65, 0x72, 0x46, 0x65, 0x74, 0x63, - 0x68, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x12, 0x24, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x64, 0x6f, - 0x67, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x65, 0x74, 0x63, 0x68, - 0x45, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, - 0x64, 0x61, 0x74, 0x61, 0x64, 0x6f, 0x67, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x76, 0x31, - 0x2e, 0x46, 0x65, 0x74, 0x63, 0x68, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x27, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x21, 0x3a, 0x01, 0x2a, 0x22, - 0x1c, 0x2f, 0x76, 0x31, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x61, 0x67, 0x67, 0x65, 0x72, - 0x2f, 0x66, 0x65, 0x74, 0x63, 0x68, 0x5f, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x12, 0x9b, 0x01, - 0x0a, 0x17, 0x44, 0x6f, 0x67, 0x73, 0x74, 0x61, 0x74, 0x73, 0x64, 0x43, 0x61, 0x70, 0x74, 0x75, - 0x72, 0x65, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x12, 0x27, 0x2e, 0x64, 0x61, 0x74, 0x61, - 0x64, 0x6f, 0x67, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x61, 0x70, - 0x74, 0x75, 0x72, 0x65, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x64, 0x6f, 0x67, 0x2e, 0x6d, 0x6f, 0x64, - 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x61, 0x70, 0x74, 0x75, 0x72, 0x65, 0x54, 0x72, 0x69, - 0x67, 0x67, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2d, 0x82, 0xd3, - 0xe4, 0x93, 0x02, 0x27, 0x3a, 0x01, 0x2a, 0x22, 0x22, 0x2f, 0x76, 0x31, 0x2f, 0x67, 0x72, 0x70, - 0x63, 0x2f, 0x64, 0x6f, 0x67, 0x73, 0x74, 0x61, 0x74, 0x73, 0x64, 0x2f, 0x63, 0x61, 0x70, 0x74, - 0x75, 0x72, 0x65, 0x2f, 0x74, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x12, 0x8c, 0x01, 0x0a, 0x17, - 0x44, 0x6f, 0x67, 0x73, 0x74, 0x61, 0x74, 0x73, 0x64, 0x53, 0x65, 0x74, 0x54, 0x61, 0x67, 0x67, - 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x1d, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x64, 0x6f, - 0x67, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x61, 0x67, 0x67, 0x65, - 0x72, 0x53, 0x74, 0x61, 0x74, 0x65, 0x1a, 0x25, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x64, 0x6f, 0x67, - 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x61, 0x67, 0x67, 0x65, 0x72, - 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2b, 0x82, - 0xd3, 0xe4, 0x93, 0x02, 0x25, 0x3a, 0x01, 0x2a, 0x22, 0x20, 0x2f, 0x76, 0x31, 0x2f, 0x67, 0x72, - 0x70, 0x63, 0x2f, 0x64, 0x6f, 0x67, 0x73, 0x74, 0x61, 0x74, 0x73, 0x64, 0x2f, 0x63, 0x61, 0x70, - 0x74, 0x75, 0x72, 0x65, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x8f, 0x01, 0x0a, 0x10, 0x43, - 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x12, - 0x27, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x64, 0x6f, 0x67, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x2e, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x64, + 0x2e, 0x43, 0x61, 0x70, 0x74, 0x75, 0x72, 0x65, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x27, 0x3a, + 0x01, 0x2a, 0x22, 0x22, 0x2f, 0x76, 0x31, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x64, 0x6f, 0x67, + 0x73, 0x74, 0x61, 0x74, 0x73, 0x64, 0x2f, 0x63, 0x61, 0x70, 0x74, 0x75, 0x72, 0x65, 0x2f, 0x74, + 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x12, 0x8c, 0x01, 0x0a, 0x17, 0x44, 0x6f, 0x67, 0x73, 0x74, + 0x61, 0x74, 0x73, 0x64, 0x53, 0x65, 0x74, 0x54, 0x61, 0x67, 0x67, 0x65, 0x72, 0x53, 0x74, 0x61, + 0x74, 0x65, 0x12, 0x1d, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x64, 0x6f, 0x67, 0x2e, 0x6d, 0x6f, 0x64, + 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x61, 0x67, 0x67, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, + 0x65, 0x1a, 0x25, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x64, 0x6f, 0x67, 0x2e, 0x6d, 0x6f, 0x64, 0x65, + 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x61, 0x67, 0x67, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x65, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x25, + 0x3a, 0x01, 0x2a, 0x22, 0x20, 0x2f, 0x76, 0x31, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x64, 0x6f, + 0x67, 0x73, 0x74, 0x61, 0x74, 0x73, 0x64, 0x2f, 0x63, 0x61, 0x70, 0x74, 0x75, 0x72, 0x65, 0x2f, + 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x8f, 0x01, 0x0a, 0x10, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, + 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x12, 0x27, 0x2e, 0x64, 0x61, 0x74, + 0x61, 0x64, 0x6f, 0x67, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x43, 0x6c, 0x69, 0x65, + 0x6e, 0x74, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x64, 0x6f, 0x67, 0x2e, 0x63, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x47, 0x65, 0x74, 0x43, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x28, 0x82, + 0xd3, 0xe4, 0x93, 0x02, 0x22, 0x3a, 0x01, 0x2a, 0x22, 0x1d, 0x2f, 0x76, 0x31, 0x2f, 0x67, 0x72, + 0x70, 0x63, 0x2f, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, + 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x12, 0x78, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x43, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, + 0x79, 0x1a, 0x26, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x64, 0x6f, 0x67, 0x2e, 0x63, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, + 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x26, 0x82, 0xd3, 0xe4, 0x93, 0x02, + 0x20, 0x3a, 0x01, 0x2a, 0x22, 0x1b, 0x2f, 0x76, 0x31, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x72, + 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x73, 0x74, 0x61, 0x74, + 0x65, 0x12, 0x94, 0x01, 0x0a, 0x12, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x47, 0x65, 0x74, 0x43, + 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x48, 0x41, 0x12, 0x27, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x64, 0x6f, 0x67, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, - 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x28, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x22, 0x3a, 0x01, 0x2a, 0x22, 0x1d, 0x2f, - 0x76, 0x31, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x63, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x12, 0x78, 0x0a, 0x0e, - 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x16, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x26, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x64, 0x6f, 0x67, - 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, - 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x26, - 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x20, 0x3a, 0x01, 0x2a, 0x22, 0x1b, 0x2f, 0x76, 0x31, 0x2f, 0x67, - 0x72, 0x70, 0x63, 0x2f, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x2f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x94, 0x01, 0x0a, 0x12, 0x43, 0x6c, 0x69, 0x65, 0x6e, - 0x74, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x48, 0x41, 0x12, 0x27, 0x2e, - 0x64, 0x61, 0x74, 0x61, 0x64, 0x6f, 0x67, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x43, - 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x64, 0x6f, 0x67, - 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x47, 0x65, - 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0x2b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x25, 0x3a, 0x01, 0x2a, 0x22, 0x20, 0x2f, 0x76, 0x31, - 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x63, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x5f, 0x68, 0x61, 0x12, 0x7d, 0x0a, - 0x10, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x53, 0x74, 0x61, 0x74, 0x65, 0x48, - 0x41, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x26, 0x2e, 0x64, 0x61, 0x74, 0x61, - 0x64, 0x6f, 0x67, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x74, - 0x61, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x29, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x23, 0x3a, 0x01, 0x2a, 0x22, 0x1e, 0x2f, 0x76, - 0x31, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x63, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x5f, 0x68, 0x61, 0x12, 0xb3, 0x01, 0x0a, - 0x1a, 0x57, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, 0x61, 0x64, 0x6d, 0x65, 0x74, 0x61, 0x53, 0x74, 0x72, - 0x65, 0x61, 0x6d, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x2f, 0x2e, 0x64, 0x61, - 0x74, 0x61, 0x64, 0x6f, 0x67, 0x2e, 0x77, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, 0x61, 0x64, 0x6d, 0x65, - 0x74, 0x61, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, 0x61, 0x64, 0x6d, 0x65, 0x74, 0x61, 0x53, - 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 0x2e, 0x64, - 0x61, 0x74, 0x61, 0x64, 0x6f, 0x67, 0x2e, 0x77, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, 0x61, 0x64, 0x6d, - 0x65, 0x74, 0x61, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, 0x61, 0x64, 0x6d, 0x65, 0x74, 0x61, - 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x30, - 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2a, 0x3a, 0x01, 0x2a, 0x22, 0x25, 0x2f, 0x76, 0x31, 0x2f, 0x67, - 0x72, 0x70, 0x63, 0x2f, 0x77, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, 0x61, 0x64, 0x6d, 0x65, 0x74, 0x61, - 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x5f, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, - 0x30, 0x01, 0x12, 0xaf, 0x01, 0x0a, 0x13, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, - 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x12, 0x2f, 0x2e, 0x64, 0x61, 0x74, + 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x28, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x64, 0x6f, 0x67, 0x2e, 0x63, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x2e, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2b, 0x82, 0xd3, 0xe4, + 0x93, 0x02, 0x25, 0x3a, 0x01, 0x2a, 0x22, 0x20, 0x2f, 0x76, 0x31, 0x2f, 0x67, 0x72, 0x70, 0x63, + 0x2f, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x63, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x73, 0x5f, 0x68, 0x61, 0x12, 0x7d, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x43, + 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x53, 0x74, 0x61, 0x74, 0x65, 0x48, 0x41, 0x12, 0x16, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, + 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x26, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x64, 0x6f, 0x67, 0x2e, 0x63, + 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x43, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x29, 0x82, 0xd3, + 0xe4, 0x93, 0x02, 0x23, 0x3a, 0x01, 0x2a, 0x22, 0x1e, 0x2f, 0x76, 0x31, 0x2f, 0x67, 0x72, 0x70, + 0x63, 0x2f, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x73, + 0x74, 0x61, 0x74, 0x65, 0x5f, 0x68, 0x61, 0x12, 0xb3, 0x01, 0x0a, 0x1a, 0x57, 0x6f, 0x72, 0x6b, + 0x6c, 0x6f, 0x61, 0x64, 0x6d, 0x65, 0x74, 0x61, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x45, 0x6e, + 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x2f, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x64, 0x6f, 0x67, + 0x2e, 0x77, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, 0x61, 0x64, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x57, 0x6f, + 0x72, 0x6b, 0x6c, 0x6f, 0x61, 0x64, 0x6d, 0x65, 0x74, 0x61, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x64, 0x6f, + 0x67, 0x2e, 0x77, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, 0x61, 0x64, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x57, + 0x6f, 0x72, 0x6b, 0x6c, 0x6f, 0x61, 0x64, 0x6d, 0x65, 0x74, 0x61, 0x53, 0x74, 0x72, 0x65, 0x61, + 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x30, 0x82, 0xd3, 0xe4, 0x93, 0x02, + 0x2a, 0x3a, 0x01, 0x2a, 0x22, 0x25, 0x2f, 0x76, 0x31, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x77, + 0x6f, 0x72, 0x6b, 0x6c, 0x6f, 0x61, 0x64, 0x6d, 0x65, 0x74, 0x61, 0x2f, 0x73, 0x74, 0x72, 0x65, + 0x61, 0x6d, 0x5f, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x30, 0x01, 0x12, 0xaf, 0x01, + 0x0a, 0x13, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, + 0x41, 0x67, 0x65, 0x6e, 0x74, 0x12, 0x2f, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x64, 0x6f, 0x67, 0x2e, + 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2e, 0x52, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x64, 0x6f, 0x67, + 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2e, 0x52, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x41, 0x67, 0x65, 0x6e, 0x74, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x35, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2f, + 0x3a, 0x01, 0x2a, 0x22, 0x2a, 0x2f, 0x76, 0x31, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x72, 0x65, + 0x6d, 0x6f, 0x74, 0x65, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x65, 0x72, 0x5f, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x5f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x12, + 0x9b, 0x01, 0x0a, 0x19, 0x41, 0x75, 0x74, 0x6f, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, + 0x79, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x16, 0x2e, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, + 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x32, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x64, 0x6f, 0x67, 0x2e, + 0x61, 0x75, 0x74, 0x6f, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x41, 0x75, + 0x74, 0x6f, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x53, 0x74, 0x72, 0x65, 0x61, + 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x30, 0x82, 0xd3, 0xe4, 0x93, 0x02, + 0x2a, 0x3a, 0x01, 0x2a, 0x22, 0x25, 0x2f, 0x76, 0x31, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x61, + 0x75, 0x74, 0x6f, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2f, 0x73, 0x74, 0x72, + 0x65, 0x61, 0x6d, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x30, 0x01, 0x32, 0xe6, 0x01, + 0x0a, 0x0b, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x12, 0x6f, 0x0a, + 0x10, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, + 0x73, 0x12, 0x2c, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x64, 0x6f, 0x67, 0x2e, 0x72, 0x65, 0x6d, 0x6f, + 0x74, 0x65, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x2d, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x64, 0x6f, 0x67, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, + 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x44, + 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x66, + 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x46, 0x6c, 0x61, 0x72, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x12, + 0x29, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x64, 0x6f, 0x67, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, + 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x46, 0x6c, 0x61, 0x72, 0x65, 0x46, 0x69, + 0x6c, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2a, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x64, 0x6f, 0x67, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x61, 0x67, 0x65, 0x6e, 0x74, - 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x41, - 0x67, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 0x2e, 0x64, 0x61, - 0x74, 0x61, 0x64, 0x6f, 0x67, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x61, 0x67, 0x65, 0x6e, - 0x74, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, - 0x41, 0x67, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x35, 0x82, - 0xd3, 0xe4, 0x93, 0x02, 0x2f, 0x3a, 0x01, 0x2a, 0x22, 0x2a, 0x2f, 0x76, 0x31, 0x2f, 0x67, 0x72, - 0x70, 0x63, 0x2f, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2f, 0x72, - 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x5f, 0x61, - 0x67, 0x65, 0x6e, 0x74, 0x32, 0xe6, 0x01, 0x0a, 0x0b, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x41, - 0x67, 0x65, 0x6e, 0x74, 0x12, 0x6f, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x12, 0x2c, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x64, - 0x6f, 0x67, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2e, 0x47, - 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2d, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x64, 0x6f, 0x67, - 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2e, 0x47, 0x65, 0x74, - 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x66, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x46, 0x6c, 0x61, 0x72, - 0x65, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x12, 0x29, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x64, 0x6f, 0x67, - 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2e, 0x47, 0x65, 0x74, - 0x46, 0x6c, 0x61, 0x72, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x2a, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x64, 0x6f, 0x67, 0x2e, 0x72, 0x65, 0x6d, 0x6f, - 0x74, 0x65, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x46, 0x6c, 0x61, 0x72, 0x65, - 0x46, 0x69, 0x6c, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x15, 0x5a, - 0x13, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x62, 0x67, 0x6f, 0x2f, - 0x63, 0x6f, 0x72, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x2e, 0x47, 0x65, 0x74, 0x46, 0x6c, 0x61, 0x72, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x15, 0x5a, 0x13, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x62, 0x67, 0x6f, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var file_datadog_api_v1_api_proto_goTypes = []interface{}{ @@ -185,8 +198,9 @@ var file_datadog_api_v1_api_proto_goTypes = []interface{}{ (*GetStateConfigResponse)(nil), // 17: datadog.config.GetStateConfigResponse (*WorkloadmetaStreamResponse)(nil), // 18: datadog.workloadmeta.WorkloadmetaStreamResponse (*RegisterRemoteAgentResponse)(nil), // 19: datadog.remoteagent.RegisterRemoteAgentResponse - (*GetStatusDetailsResponse)(nil), // 20: datadog.remoteagent.GetStatusDetailsResponse - (*GetFlareFilesResponse)(nil), // 21: datadog.remoteagent.GetFlareFilesResponse + (*AutodiscoveryStreamResponse)(nil), // 20: datadog.autodiscovery.AutodiscoveryStreamResponse + (*GetStatusDetailsResponse)(nil), // 21: datadog.remoteagent.GetStatusDetailsResponse + (*GetFlareFilesResponse)(nil), // 22: datadog.remoteagent.GetFlareFilesResponse } var file_datadog_api_v1_api_proto_depIdxs = []int32{ 0, // 0: datadog.api.v1.Agent.GetHostname:input_type -> datadog.model.v1.HostnameRequest @@ -200,23 +214,25 @@ var file_datadog_api_v1_api_proto_depIdxs = []int32{ 6, // 8: datadog.api.v1.AgentSecure.GetConfigStateHA:input_type -> google.protobuf.Empty 7, // 9: datadog.api.v1.AgentSecure.WorkloadmetaStreamEntities:input_type -> datadog.workloadmeta.WorkloadmetaStreamRequest 8, // 10: datadog.api.v1.AgentSecure.RegisterRemoteAgent:input_type -> datadog.remoteagent.RegisterRemoteAgentRequest - 9, // 11: datadog.api.v1.RemoteAgent.GetStatusDetails:input_type -> datadog.remoteagent.GetStatusDetailsRequest - 10, // 12: datadog.api.v1.RemoteAgent.GetFlareFiles:input_type -> datadog.remoteagent.GetFlareFilesRequest - 11, // 13: datadog.api.v1.Agent.GetHostname:output_type -> datadog.model.v1.HostnameReply - 12, // 14: datadog.api.v1.AgentSecure.TaggerStreamEntities:output_type -> datadog.model.v1.StreamTagsResponse - 13, // 15: datadog.api.v1.AgentSecure.TaggerFetchEntity:output_type -> datadog.model.v1.FetchEntityResponse - 14, // 16: datadog.api.v1.AgentSecure.DogstatsdCaptureTrigger:output_type -> datadog.model.v1.CaptureTriggerResponse - 15, // 17: datadog.api.v1.AgentSecure.DogstatsdSetTaggerState:output_type -> datadog.model.v1.TaggerStateResponse - 16, // 18: datadog.api.v1.AgentSecure.ClientGetConfigs:output_type -> datadog.config.ClientGetConfigsResponse - 17, // 19: datadog.api.v1.AgentSecure.GetConfigState:output_type -> datadog.config.GetStateConfigResponse - 16, // 20: datadog.api.v1.AgentSecure.ClientGetConfigsHA:output_type -> datadog.config.ClientGetConfigsResponse - 17, // 21: datadog.api.v1.AgentSecure.GetConfigStateHA:output_type -> datadog.config.GetStateConfigResponse - 18, // 22: datadog.api.v1.AgentSecure.WorkloadmetaStreamEntities:output_type -> datadog.workloadmeta.WorkloadmetaStreamResponse - 19, // 23: datadog.api.v1.AgentSecure.RegisterRemoteAgent:output_type -> datadog.remoteagent.RegisterRemoteAgentResponse - 20, // 24: datadog.api.v1.RemoteAgent.GetStatusDetails:output_type -> datadog.remoteagent.GetStatusDetailsResponse - 21, // 25: datadog.api.v1.RemoteAgent.GetFlareFiles:output_type -> datadog.remoteagent.GetFlareFilesResponse - 13, // [13:26] is the sub-list for method output_type - 0, // [0:13] is the sub-list for method input_type + 6, // 11: datadog.api.v1.AgentSecure.AutodiscoveryStreamConfig:input_type -> google.protobuf.Empty + 9, // 12: datadog.api.v1.RemoteAgent.GetStatusDetails:input_type -> datadog.remoteagent.GetStatusDetailsRequest + 10, // 13: datadog.api.v1.RemoteAgent.GetFlareFiles:input_type -> datadog.remoteagent.GetFlareFilesRequest + 11, // 14: datadog.api.v1.Agent.GetHostname:output_type -> datadog.model.v1.HostnameReply + 12, // 15: datadog.api.v1.AgentSecure.TaggerStreamEntities:output_type -> datadog.model.v1.StreamTagsResponse + 13, // 16: datadog.api.v1.AgentSecure.TaggerFetchEntity:output_type -> datadog.model.v1.FetchEntityResponse + 14, // 17: datadog.api.v1.AgentSecure.DogstatsdCaptureTrigger:output_type -> datadog.model.v1.CaptureTriggerResponse + 15, // 18: datadog.api.v1.AgentSecure.DogstatsdSetTaggerState:output_type -> datadog.model.v1.TaggerStateResponse + 16, // 19: datadog.api.v1.AgentSecure.ClientGetConfigs:output_type -> datadog.config.ClientGetConfigsResponse + 17, // 20: datadog.api.v1.AgentSecure.GetConfigState:output_type -> datadog.config.GetStateConfigResponse + 16, // 21: datadog.api.v1.AgentSecure.ClientGetConfigsHA:output_type -> datadog.config.ClientGetConfigsResponse + 17, // 22: datadog.api.v1.AgentSecure.GetConfigStateHA:output_type -> datadog.config.GetStateConfigResponse + 18, // 23: datadog.api.v1.AgentSecure.WorkloadmetaStreamEntities:output_type -> datadog.workloadmeta.WorkloadmetaStreamResponse + 19, // 24: datadog.api.v1.AgentSecure.RegisterRemoteAgent:output_type -> datadog.remoteagent.RegisterRemoteAgentResponse + 20, // 25: datadog.api.v1.AgentSecure.AutodiscoveryStreamConfig:output_type -> datadog.autodiscovery.AutodiscoveryStreamResponse + 21, // 26: datadog.api.v1.RemoteAgent.GetStatusDetails:output_type -> datadog.remoteagent.GetStatusDetailsResponse + 22, // 27: datadog.api.v1.RemoteAgent.GetFlareFiles:output_type -> datadog.remoteagent.GetFlareFilesResponse + 14, // [14:28] is the sub-list for method output_type + 0, // [0:14] is the sub-list for method input_type 0, // [0:0] is the sub-list for extension type_name 0, // [0:0] is the sub-list for extension extendee 0, // [0:0] is the sub-list for field type_name @@ -231,6 +247,7 @@ func file_datadog_api_v1_api_proto_init() { file_datadog_remoteagent_remoteagent_proto_init() file_datadog_remoteconfig_remoteconfig_proto_init() file_datadog_workloadmeta_workloadmeta_proto_init() + file_datadog_autodiscovery_autodiscovery_proto_init() type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ @@ -416,6 +433,8 @@ type AgentSecureClient interface { WorkloadmetaStreamEntities(ctx context.Context, in *WorkloadmetaStreamRequest, opts ...grpc.CallOption) (AgentSecure_WorkloadmetaStreamEntitiesClient, error) // Registers a remote agent. RegisterRemoteAgent(ctx context.Context, in *RegisterRemoteAgentRequest, opts ...grpc.CallOption) (*RegisterRemoteAgentResponse, error) + // Subscribes to autodiscovery config updates + AutodiscoveryStreamConfig(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (AgentSecure_AutodiscoveryStreamConfigClient, error) } type agentSecureClient struct { @@ -562,6 +581,38 @@ func (c *agentSecureClient) RegisterRemoteAgent(ctx context.Context, in *Registe return out, nil } +func (c *agentSecureClient) AutodiscoveryStreamConfig(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (AgentSecure_AutodiscoveryStreamConfigClient, error) { + stream, err := c.cc.NewStream(ctx, &_AgentSecure_serviceDesc.Streams[2], "/datadog.api.v1.AgentSecure/AutodiscoveryStreamConfig", opts...) + if err != nil { + return nil, err + } + x := &agentSecureAutodiscoveryStreamConfigClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type AgentSecure_AutodiscoveryStreamConfigClient interface { + Recv() (*AutodiscoveryStreamResponse, error) + grpc.ClientStream +} + +type agentSecureAutodiscoveryStreamConfigClient struct { + grpc.ClientStream +} + +func (x *agentSecureAutodiscoveryStreamConfigClient) Recv() (*AutodiscoveryStreamResponse, error) { + m := new(AutodiscoveryStreamResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + // AgentSecureServer is the server API for AgentSecure service. type AgentSecureServer interface { // subscribes to added, removed, or changed entities in the Tagger @@ -644,6 +695,8 @@ type AgentSecureServer interface { WorkloadmetaStreamEntities(*WorkloadmetaStreamRequest, AgentSecure_WorkloadmetaStreamEntitiesServer) error // Registers a remote agent. RegisterRemoteAgent(context.Context, *RegisterRemoteAgentRequest) (*RegisterRemoteAgentResponse, error) + // Subscribes to autodiscovery config updates + AutodiscoveryStreamConfig(*empty.Empty, AgentSecure_AutodiscoveryStreamConfigServer) error } // UnimplementedAgentSecureServer can be embedded to have forward compatible implementations. @@ -680,6 +733,9 @@ func (*UnimplementedAgentSecureServer) WorkloadmetaStreamEntities(*WorkloadmetaS func (*UnimplementedAgentSecureServer) RegisterRemoteAgent(context.Context, *RegisterRemoteAgentRequest) (*RegisterRemoteAgentResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method RegisterRemoteAgent not implemented") } +func (*UnimplementedAgentSecureServer) AutodiscoveryStreamConfig(*empty.Empty, AgentSecure_AutodiscoveryStreamConfigServer) error { + return status.Errorf(codes.Unimplemented, "method AutodiscoveryStreamConfig not implemented") +} func RegisterAgentSecureServer(s *grpc.Server, srv AgentSecureServer) { s.RegisterService(&_AgentSecure_serviceDesc, srv) @@ -871,6 +927,27 @@ func _AgentSecure_RegisterRemoteAgent_Handler(srv interface{}, ctx context.Conte return interceptor(ctx, in, info, handler) } +func _AgentSecure_AutodiscoveryStreamConfig_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(empty.Empty) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(AgentSecureServer).AutodiscoveryStreamConfig(m, &agentSecureAutodiscoveryStreamConfigServer{stream}) +} + +type AgentSecure_AutodiscoveryStreamConfigServer interface { + Send(*AutodiscoveryStreamResponse) error + grpc.ServerStream +} + +type agentSecureAutodiscoveryStreamConfigServer struct { + grpc.ServerStream +} + +func (x *agentSecureAutodiscoveryStreamConfigServer) Send(m *AutodiscoveryStreamResponse) error { + return x.ServerStream.SendMsg(m) +} + var _AgentSecure_serviceDesc = grpc.ServiceDesc{ ServiceName: "datadog.api.v1.AgentSecure", HandlerType: (*AgentSecureServer)(nil), @@ -919,6 +996,11 @@ var _AgentSecure_serviceDesc = grpc.ServiceDesc{ Handler: _AgentSecure_WorkloadmetaStreamEntities_Handler, ServerStreams: true, }, + { + StreamName: "AutodiscoveryStreamConfig", + Handler: _AgentSecure_AutodiscoveryStreamConfig_Handler, + ServerStreams: true, + }, }, Metadata: "datadog/api/v1/api.proto", } diff --git a/pkg/proto/pbgo/core/api.pb.gw.go b/pkg/proto/pbgo/core/api.pb.gw.go index fb843e96988c3..4ff263f83d888 100644 --- a/pkg/proto/pbgo/core/api.pb.gw.go +++ b/pkg/proto/pbgo/core/api.pb.gw.go @@ -372,6 +372,31 @@ func local_request_AgentSecure_RegisterRemoteAgent_0(ctx context.Context, marsha } +func request_AgentSecure_AutodiscoveryStreamConfig_0(ctx context.Context, marshaler runtime.Marshaler, client AgentSecureClient, req *http.Request, pathParams map[string]string) (AgentSecure_AutodiscoveryStreamConfigClient, runtime.ServerMetadata, error) { + var protoReq empty.Empty + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + stream, err := client.AutodiscoveryStreamConfig(ctx, &protoReq) + if err != nil { + return nil, metadata, err + } + header, err := stream.Header() + if err != nil { + return nil, metadata, err + } + metadata.HeaderMD = header + return stream, metadata, nil + +} + // RegisterAgentHandlerServer registers the http handlers for service Agent to "mux". // UnaryRPC :call AgentServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -579,6 +604,13 @@ func RegisterAgentSecureHandlerServer(ctx context.Context, mux *runtime.ServeMux }) + mux.Handle("POST", pattern_AgentSecure_AutodiscoveryStreamConfig_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + err := status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") + _, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + }) + return nil } @@ -889,6 +921,26 @@ func RegisterAgentSecureHandlerClient(ctx context.Context, mux *runtime.ServeMux }) + mux.Handle("POST", pattern_AgentSecure_AutodiscoveryStreamConfig_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_AgentSecure_AutodiscoveryStreamConfig_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_AgentSecure_AutodiscoveryStreamConfig_0(ctx, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -912,6 +964,8 @@ var ( pattern_AgentSecure_WorkloadmetaStreamEntities_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v1", "grpc", "workloadmeta", "stream_entities"}, "", runtime.AssumeColonVerbOpt(true))) pattern_AgentSecure_RegisterRemoteAgent_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v1", "grpc", "remoteagent", "register_remote_agent"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_AgentSecure_AutodiscoveryStreamConfig_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v1", "grpc", "autodiscovery", "stream_configs"}, "", runtime.AssumeColonVerbOpt(true))) ) var ( @@ -934,4 +988,6 @@ var ( forward_AgentSecure_WorkloadmetaStreamEntities_0 = runtime.ForwardResponseStream forward_AgentSecure_RegisterRemoteAgent_0 = runtime.ForwardResponseMessage + + forward_AgentSecure_AutodiscoveryStreamConfig_0 = runtime.ForwardResponseStream ) diff --git a/pkg/proto/pbgo/core/autodiscovery.pb.go b/pkg/proto/pbgo/core/autodiscovery.pb.go new file mode 100644 index 0000000000000..2064fbf351031 --- /dev/null +++ b/pkg/proto/pbgo/core/autodiscovery.pb.go @@ -0,0 +1,522 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.34.0 +// protoc v5.26.1 +// source: datadog/autodiscovery/autodiscovery.proto + +package core + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type KubeNamespacedName struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Namespace string `protobuf:"bytes,2,opt,name=namespace,proto3" json:"namespace,omitempty"` +} + +func (x *KubeNamespacedName) Reset() { + *x = KubeNamespacedName{} + if protoimpl.UnsafeEnabled { + mi := &file_datadog_autodiscovery_autodiscovery_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *KubeNamespacedName) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KubeNamespacedName) ProtoMessage() {} + +func (x *KubeNamespacedName) ProtoReflect() protoreflect.Message { + mi := &file_datadog_autodiscovery_autodiscovery_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KubeNamespacedName.ProtoReflect.Descriptor instead. +func (*KubeNamespacedName) Descriptor() ([]byte, []int) { + return file_datadog_autodiscovery_autodiscovery_proto_rawDescGZIP(), []int{0} +} + +func (x *KubeNamespacedName) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *KubeNamespacedName) GetNamespace() string { + if x != nil { + return x.Namespace + } + return "" +} + +type AdvancedADIdentifier struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + KubeService *KubeNamespacedName `protobuf:"bytes,1,opt,name=kubeService,proto3" json:"kubeService,omitempty"` + KubeEndpoints *KubeNamespacedName `protobuf:"bytes,2,opt,name=kubeEndpoints,proto3" json:"kubeEndpoints,omitempty"` +} + +func (x *AdvancedADIdentifier) Reset() { + *x = AdvancedADIdentifier{} + if protoimpl.UnsafeEnabled { + mi := &file_datadog_autodiscovery_autodiscovery_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AdvancedADIdentifier) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AdvancedADIdentifier) ProtoMessage() {} + +func (x *AdvancedADIdentifier) ProtoReflect() protoreflect.Message { + mi := &file_datadog_autodiscovery_autodiscovery_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AdvancedADIdentifier.ProtoReflect.Descriptor instead. +func (*AdvancedADIdentifier) Descriptor() ([]byte, []int) { + return file_datadog_autodiscovery_autodiscovery_proto_rawDescGZIP(), []int{1} +} + +func (x *AdvancedADIdentifier) GetKubeService() *KubeNamespacedName { + if x != nil { + return x.KubeService + } + return nil +} + +func (x *AdvancedADIdentifier) GetKubeEndpoints() *KubeNamespacedName { + if x != nil { + return x.KubeEndpoints + } + return nil +} + +type Config struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Instances [][]byte `protobuf:"bytes,2,rep,name=instances,proto3" json:"instances,omitempty"` + InitConfig []byte `protobuf:"bytes,3,opt,name=initConfig,proto3" json:"initConfig,omitempty"` + MetricConfig []byte `protobuf:"bytes,4,opt,name=metricConfig,proto3" json:"metricConfig,omitempty"` + LogsConfig []byte `protobuf:"bytes,5,opt,name=logsConfig,proto3" json:"logsConfig,omitempty"` + AdIdentifiers []string `protobuf:"bytes,6,rep,name=adIdentifiers,proto3" json:"adIdentifiers,omitempty"` + AdvancedAdIdentifiers []*AdvancedADIdentifier `protobuf:"bytes,7,rep,name=advancedAdIdentifiers,proto3" json:"advancedAdIdentifiers,omitempty"` + Provider string `protobuf:"bytes,8,opt,name=provider,proto3" json:"provider,omitempty"` + ServiceId string `protobuf:"bytes,9,opt,name=serviceId,proto3" json:"serviceId,omitempty"` + TaggerEntity string `protobuf:"bytes,10,opt,name=taggerEntity,proto3" json:"taggerEntity,omitempty"` + ClusterCheck bool `protobuf:"varint,11,opt,name=clusterCheck,proto3" json:"clusterCheck,omitempty"` + NodeName string `protobuf:"bytes,12,opt,name=nodeName,proto3" json:"nodeName,omitempty"` + Source string `protobuf:"bytes,13,opt,name=source,proto3" json:"source,omitempty"` + IgnoreAutodiscoveryTags bool `protobuf:"varint,14,opt,name=ignoreAutodiscoveryTags,proto3" json:"ignoreAutodiscoveryTags,omitempty"` + MetricsExcluded bool `protobuf:"varint,15,opt,name=metricsExcluded,proto3" json:"metricsExcluded,omitempty"` + LogsExcluded bool `protobuf:"varint,16,opt,name=logsExcluded,proto3" json:"logsExcluded,omitempty"` +} + +func (x *Config) Reset() { + *x = Config{} + if protoimpl.UnsafeEnabled { + mi := &file_datadog_autodiscovery_autodiscovery_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Config) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Config) ProtoMessage() {} + +func (x *Config) ProtoReflect() protoreflect.Message { + mi := &file_datadog_autodiscovery_autodiscovery_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Config.ProtoReflect.Descriptor instead. +func (*Config) Descriptor() ([]byte, []int) { + return file_datadog_autodiscovery_autodiscovery_proto_rawDescGZIP(), []int{2} +} + +func (x *Config) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Config) GetInstances() [][]byte { + if x != nil { + return x.Instances + } + return nil +} + +func (x *Config) GetInitConfig() []byte { + if x != nil { + return x.InitConfig + } + return nil +} + +func (x *Config) GetMetricConfig() []byte { + if x != nil { + return x.MetricConfig + } + return nil +} + +func (x *Config) GetLogsConfig() []byte { + if x != nil { + return x.LogsConfig + } + return nil +} + +func (x *Config) GetAdIdentifiers() []string { + if x != nil { + return x.AdIdentifiers + } + return nil +} + +func (x *Config) GetAdvancedAdIdentifiers() []*AdvancedADIdentifier { + if x != nil { + return x.AdvancedAdIdentifiers + } + return nil +} + +func (x *Config) GetProvider() string { + if x != nil { + return x.Provider + } + return "" +} + +func (x *Config) GetServiceId() string { + if x != nil { + return x.ServiceId + } + return "" +} + +func (x *Config) GetTaggerEntity() string { + if x != nil { + return x.TaggerEntity + } + return "" +} + +func (x *Config) GetClusterCheck() bool { + if x != nil { + return x.ClusterCheck + } + return false +} + +func (x *Config) GetNodeName() string { + if x != nil { + return x.NodeName + } + return "" +} + +func (x *Config) GetSource() string { + if x != nil { + return x.Source + } + return "" +} + +func (x *Config) GetIgnoreAutodiscoveryTags() bool { + if x != nil { + return x.IgnoreAutodiscoveryTags + } + return false +} + +func (x *Config) GetMetricsExcluded() bool { + if x != nil { + return x.MetricsExcluded + } + return false +} + +func (x *Config) GetLogsExcluded() bool { + if x != nil { + return x.LogsExcluded + } + return false +} + +type AutodiscoveryStreamResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Configs []*Config `protobuf:"bytes,1,rep,name=configs,proto3" json:"configs,omitempty"` +} + +func (x *AutodiscoveryStreamResponse) Reset() { + *x = AutodiscoveryStreamResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_datadog_autodiscovery_autodiscovery_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AutodiscoveryStreamResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AutodiscoveryStreamResponse) ProtoMessage() {} + +func (x *AutodiscoveryStreamResponse) ProtoReflect() protoreflect.Message { + mi := &file_datadog_autodiscovery_autodiscovery_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AutodiscoveryStreamResponse.ProtoReflect.Descriptor instead. +func (*AutodiscoveryStreamResponse) Descriptor() ([]byte, []int) { + return file_datadog_autodiscovery_autodiscovery_proto_rawDescGZIP(), []int{3} +} + +func (x *AutodiscoveryStreamResponse) GetConfigs() []*Config { + if x != nil { + return x.Configs + } + return nil +} + +var File_datadog_autodiscovery_autodiscovery_proto protoreflect.FileDescriptor + +var file_datadog_autodiscovery_autodiscovery_proto_rawDesc = []byte{ + 0x0a, 0x29, 0x64, 0x61, 0x74, 0x61, 0x64, 0x6f, 0x67, 0x2f, 0x61, 0x75, 0x74, 0x6f, 0x64, 0x69, + 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2f, 0x61, 0x75, 0x74, 0x6f, 0x64, 0x69, 0x73, 0x63, + 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x15, 0x64, 0x61, 0x74, + 0x61, 0x64, 0x6f, 0x67, 0x2e, 0x61, 0x75, 0x74, 0x6f, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, + 0x72, 0x79, 0x22, 0x46, 0x0a, 0x12, 0x4b, 0x75, 0x62, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, + 0x61, 0x63, 0x65, 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, + 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x22, 0xb4, 0x01, 0x0a, 0x14, 0x41, + 0x64, 0x76, 0x61, 0x6e, 0x63, 0x65, 0x64, 0x41, 0x44, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, + 0x69, 0x65, 0x72, 0x12, 0x4b, 0x0a, 0x0b, 0x6b, 0x75, 0x62, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x64, + 0x6f, 0x67, 0x2e, 0x61, 0x75, 0x74, 0x6f, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, + 0x2e, 0x4b, 0x75, 0x62, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x64, 0x4e, + 0x61, 0x6d, 0x65, 0x52, 0x0b, 0x6b, 0x75, 0x62, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x12, 0x4f, 0x0a, 0x0d, 0x6b, 0x75, 0x62, 0x65, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, + 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x64, 0x6f, + 0x67, 0x2e, 0x61, 0x75, 0x74, 0x6f, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, + 0x4b, 0x75, 0x62, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x64, 0x4e, 0x61, + 0x6d, 0x65, 0x52, 0x0d, 0x6b, 0x75, 0x62, 0x65, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, + 0x73, 0x22, 0xe5, 0x04, 0x0a, 0x06, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x12, 0x0a, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x12, 0x1c, 0x0a, 0x09, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x18, 0x02, 0x20, + 0x03, 0x28, 0x0c, 0x52, 0x09, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x12, 0x1e, + 0x0a, 0x0a, 0x69, 0x6e, 0x69, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x0a, 0x69, 0x6e, 0x69, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x22, + 0x0a, 0x0c, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0c, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x43, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x12, 0x1e, 0x0a, 0x0a, 0x6c, 0x6f, 0x67, 0x73, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x6c, 0x6f, 0x67, 0x73, 0x43, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x12, 0x24, 0x0a, 0x0d, 0x61, 0x64, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, + 0x65, 0x72, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0d, 0x61, 0x64, 0x49, 0x64, 0x65, + 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x73, 0x12, 0x61, 0x0a, 0x15, 0x61, 0x64, 0x76, 0x61, + 0x6e, 0x63, 0x65, 0x64, 0x41, 0x64, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, + 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x64, 0x6f, + 0x67, 0x2e, 0x61, 0x75, 0x74, 0x6f, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, + 0x41, 0x64, 0x76, 0x61, 0x6e, 0x63, 0x65, 0x64, 0x41, 0x44, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, + 0x66, 0x69, 0x65, 0x72, 0x52, 0x15, 0x61, 0x64, 0x76, 0x61, 0x6e, 0x63, 0x65, 0x64, 0x41, 0x64, + 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x70, + 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, + 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x49, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x49, 0x64, 0x12, 0x22, 0x0a, 0x0c, 0x74, 0x61, 0x67, 0x67, 0x65, 0x72, 0x45, + 0x6e, 0x74, 0x69, 0x74, 0x79, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x74, 0x61, 0x67, + 0x67, 0x65, 0x72, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x12, 0x22, 0x0a, 0x0c, 0x63, 0x6c, 0x75, + 0x73, 0x74, 0x65, 0x72, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x0c, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x12, 0x1a, 0x0a, + 0x08, 0x6e, 0x6f, 0x64, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x08, 0x6e, 0x6f, 0x64, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x12, 0x38, 0x0a, 0x17, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x41, 0x75, 0x74, 0x6f, 0x64, + 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x54, 0x61, 0x67, 0x73, 0x18, 0x0e, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x17, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x41, 0x75, 0x74, 0x6f, 0x64, 0x69, + 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x54, 0x61, 0x67, 0x73, 0x12, 0x28, 0x0a, 0x0f, 0x6d, + 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x45, 0x78, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x64, 0x18, 0x0f, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x45, 0x78, 0x63, + 0x6c, 0x75, 0x64, 0x65, 0x64, 0x12, 0x22, 0x0a, 0x0c, 0x6c, 0x6f, 0x67, 0x73, 0x45, 0x78, 0x63, + 0x6c, 0x75, 0x64, 0x65, 0x64, 0x18, 0x10, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x6c, 0x6f, 0x67, + 0x73, 0x45, 0x78, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x64, 0x22, 0x56, 0x0a, 0x1b, 0x41, 0x75, 0x74, + 0x6f, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x37, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x64, 0x61, 0x74, 0x61, + 0x64, 0x6f, 0x67, 0x2e, 0x61, 0x75, 0x74, 0x6f, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, + 0x79, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, + 0x73, 0x42, 0x15, 0x5a, 0x13, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, + 0x62, 0x67, 0x6f, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_datadog_autodiscovery_autodiscovery_proto_rawDescOnce sync.Once + file_datadog_autodiscovery_autodiscovery_proto_rawDescData = file_datadog_autodiscovery_autodiscovery_proto_rawDesc +) + +func file_datadog_autodiscovery_autodiscovery_proto_rawDescGZIP() []byte { + file_datadog_autodiscovery_autodiscovery_proto_rawDescOnce.Do(func() { + file_datadog_autodiscovery_autodiscovery_proto_rawDescData = protoimpl.X.CompressGZIP(file_datadog_autodiscovery_autodiscovery_proto_rawDescData) + }) + return file_datadog_autodiscovery_autodiscovery_proto_rawDescData +} + +var file_datadog_autodiscovery_autodiscovery_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_datadog_autodiscovery_autodiscovery_proto_goTypes = []interface{}{ + (*KubeNamespacedName)(nil), // 0: datadog.autodiscovery.KubeNamespacedName + (*AdvancedADIdentifier)(nil), // 1: datadog.autodiscovery.AdvancedADIdentifier + (*Config)(nil), // 2: datadog.autodiscovery.Config + (*AutodiscoveryStreamResponse)(nil), // 3: datadog.autodiscovery.AutodiscoveryStreamResponse +} +var file_datadog_autodiscovery_autodiscovery_proto_depIdxs = []int32{ + 0, // 0: datadog.autodiscovery.AdvancedADIdentifier.kubeService:type_name -> datadog.autodiscovery.KubeNamespacedName + 0, // 1: datadog.autodiscovery.AdvancedADIdentifier.kubeEndpoints:type_name -> datadog.autodiscovery.KubeNamespacedName + 1, // 2: datadog.autodiscovery.Config.advancedAdIdentifiers:type_name -> datadog.autodiscovery.AdvancedADIdentifier + 2, // 3: datadog.autodiscovery.AutodiscoveryStreamResponse.configs:type_name -> datadog.autodiscovery.Config + 4, // [4:4] is the sub-list for method output_type + 4, // [4:4] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name +} + +func init() { file_datadog_autodiscovery_autodiscovery_proto_init() } +func file_datadog_autodiscovery_autodiscovery_proto_init() { + if File_datadog_autodiscovery_autodiscovery_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_datadog_autodiscovery_autodiscovery_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*KubeNamespacedName); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_datadog_autodiscovery_autodiscovery_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AdvancedADIdentifier); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_datadog_autodiscovery_autodiscovery_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Config); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_datadog_autodiscovery_autodiscovery_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AutodiscoveryStreamResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_datadog_autodiscovery_autodiscovery_proto_rawDesc, + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_datadog_autodiscovery_autodiscovery_proto_goTypes, + DependencyIndexes: file_datadog_autodiscovery_autodiscovery_proto_depIdxs, + MessageInfos: file_datadog_autodiscovery_autodiscovery_proto_msgTypes, + }.Build() + File_datadog_autodiscovery_autodiscovery_proto = out.File + file_datadog_autodiscovery_autodiscovery_proto_rawDesc = nil + file_datadog_autodiscovery_autodiscovery_proto_goTypes = nil + file_datadog_autodiscovery_autodiscovery_proto_depIdxs = nil +} diff --git a/pkg/proto/pbgo/mocks/core/api_mockgen.pb.go b/pkg/proto/pbgo/mocks/core/api_mockgen.pb.go index f63731fc7bb98..7d7798b724aaa 100644 --- a/pkg/proto/pbgo/mocks/core/api_mockgen.pb.go +++ b/pkg/proto/pbgo/mocks/core/api_mockgen.pb.go @@ -119,6 +119,26 @@ func (m *MockAgentSecureClient) EXPECT() *MockAgentSecureClientMockRecorder { return m.recorder } +// AutodiscoveryStreamConfig mocks base method. +func (m *MockAgentSecureClient) AutodiscoveryStreamConfig(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (core.AgentSecure_AutodiscoveryStreamConfigClient, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, in} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "AutodiscoveryStreamConfig", varargs...) + ret0, _ := ret[0].(core.AgentSecure_AutodiscoveryStreamConfigClient) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// AutodiscoveryStreamConfig indicates an expected call of AutodiscoveryStreamConfig. +func (mr *MockAgentSecureClientMockRecorder) AutodiscoveryStreamConfig(ctx, in interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, in}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AutodiscoveryStreamConfig", reflect.TypeOf((*MockAgentSecureClient)(nil).AutodiscoveryStreamConfig), varargs...) +} + // ClientGetConfigs mocks base method. func (m *MockAgentSecureClient) ClientGetConfigs(ctx context.Context, in *core.ClientGetConfigsRequest, opts ...grpc.CallOption) (*core.ClientGetConfigsResponse, error) { m.ctrl.T.Helper() @@ -565,6 +585,129 @@ func (mr *MockAgentSecure_WorkloadmetaStreamEntitiesClientMockRecorder) Trailer( return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Trailer", reflect.TypeOf((*MockAgentSecure_WorkloadmetaStreamEntitiesClient)(nil).Trailer)) } +// MockAgentSecure_AutodiscoveryStreamConfigClient is a mock of AgentSecure_AutodiscoveryStreamConfigClient interface. +type MockAgentSecure_AutodiscoveryStreamConfigClient struct { + ctrl *gomock.Controller + recorder *MockAgentSecure_AutodiscoveryStreamConfigClientMockRecorder +} + +// MockAgentSecure_AutodiscoveryStreamConfigClientMockRecorder is the mock recorder for MockAgentSecure_AutodiscoveryStreamConfigClient. +type MockAgentSecure_AutodiscoveryStreamConfigClientMockRecorder struct { + mock *MockAgentSecure_AutodiscoveryStreamConfigClient +} + +// NewMockAgentSecure_AutodiscoveryStreamConfigClient creates a new mock instance. +func NewMockAgentSecure_AutodiscoveryStreamConfigClient(ctrl *gomock.Controller) *MockAgentSecure_AutodiscoveryStreamConfigClient { + mock := &MockAgentSecure_AutodiscoveryStreamConfigClient{ctrl: ctrl} + mock.recorder = &MockAgentSecure_AutodiscoveryStreamConfigClientMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockAgentSecure_AutodiscoveryStreamConfigClient) EXPECT() *MockAgentSecure_AutodiscoveryStreamConfigClientMockRecorder { + return m.recorder +} + +// CloseSend mocks base method. +func (m *MockAgentSecure_AutodiscoveryStreamConfigClient) CloseSend() error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CloseSend") + ret0, _ := ret[0].(error) + return ret0 +} + +// CloseSend indicates an expected call of CloseSend. +func (mr *MockAgentSecure_AutodiscoveryStreamConfigClientMockRecorder) CloseSend() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CloseSend", reflect.TypeOf((*MockAgentSecure_AutodiscoveryStreamConfigClient)(nil).CloseSend)) +} + +// Context mocks base method. +func (m *MockAgentSecure_AutodiscoveryStreamConfigClient) Context() context.Context { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Context") + ret0, _ := ret[0].(context.Context) + return ret0 +} + +// Context indicates an expected call of Context. +func (mr *MockAgentSecure_AutodiscoveryStreamConfigClientMockRecorder) Context() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Context", reflect.TypeOf((*MockAgentSecure_AutodiscoveryStreamConfigClient)(nil).Context)) +} + +// Header mocks base method. +func (m *MockAgentSecure_AutodiscoveryStreamConfigClient) Header() (metadata.MD, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Header") + ret0, _ := ret[0].(metadata.MD) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Header indicates an expected call of Header. +func (mr *MockAgentSecure_AutodiscoveryStreamConfigClientMockRecorder) Header() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Header", reflect.TypeOf((*MockAgentSecure_AutodiscoveryStreamConfigClient)(nil).Header)) +} + +// Recv mocks base method. +func (m *MockAgentSecure_AutodiscoveryStreamConfigClient) Recv() (*core.AutodiscoveryStreamResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Recv") + ret0, _ := ret[0].(*core.AutodiscoveryStreamResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Recv indicates an expected call of Recv. +func (mr *MockAgentSecure_AutodiscoveryStreamConfigClientMockRecorder) Recv() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Recv", reflect.TypeOf((*MockAgentSecure_AutodiscoveryStreamConfigClient)(nil).Recv)) +} + +// RecvMsg mocks base method. +func (m_2 *MockAgentSecure_AutodiscoveryStreamConfigClient) RecvMsg(m any) error { + m_2.ctrl.T.Helper() + ret := m_2.ctrl.Call(m_2, "RecvMsg", m) + ret0, _ := ret[0].(error) + return ret0 +} + +// RecvMsg indicates an expected call of RecvMsg. +func (mr *MockAgentSecure_AutodiscoveryStreamConfigClientMockRecorder) RecvMsg(m interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RecvMsg", reflect.TypeOf((*MockAgentSecure_AutodiscoveryStreamConfigClient)(nil).RecvMsg), m) +} + +// SendMsg mocks base method. +func (m_2 *MockAgentSecure_AutodiscoveryStreamConfigClient) SendMsg(m any) error { + m_2.ctrl.T.Helper() + ret := m_2.ctrl.Call(m_2, "SendMsg", m) + ret0, _ := ret[0].(error) + return ret0 +} + +// SendMsg indicates an expected call of SendMsg. +func (mr *MockAgentSecure_AutodiscoveryStreamConfigClientMockRecorder) SendMsg(m interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendMsg", reflect.TypeOf((*MockAgentSecure_AutodiscoveryStreamConfigClient)(nil).SendMsg), m) +} + +// Trailer mocks base method. +func (m *MockAgentSecure_AutodiscoveryStreamConfigClient) Trailer() metadata.MD { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Trailer") + ret0, _ := ret[0].(metadata.MD) + return ret0 +} + +// Trailer indicates an expected call of Trailer. +func (mr *MockAgentSecure_AutodiscoveryStreamConfigClientMockRecorder) Trailer() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Trailer", reflect.TypeOf((*MockAgentSecure_AutodiscoveryStreamConfigClient)(nil).Trailer)) +} + // MockAgentSecureServer is a mock of AgentSecureServer interface. type MockAgentSecureServer struct { ctrl *gomock.Controller @@ -588,6 +731,20 @@ func (m *MockAgentSecureServer) EXPECT() *MockAgentSecureServerMockRecorder { return m.recorder } +// AutodiscoveryStreamConfig mocks base method. +func (m *MockAgentSecureServer) AutodiscoveryStreamConfig(arg0 *empty.Empty, arg1 core.AgentSecure_AutodiscoveryStreamConfigServer) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "AutodiscoveryStreamConfig", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// AutodiscoveryStreamConfig indicates an expected call of AutodiscoveryStreamConfig. +func (mr *MockAgentSecureServerMockRecorder) AutodiscoveryStreamConfig(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AutodiscoveryStreamConfig", reflect.TypeOf((*MockAgentSecureServer)(nil).AutodiscoveryStreamConfig), arg0, arg1) +} + // ClientGetConfigs mocks base method. func (m *MockAgentSecureServer) ClientGetConfigs(arg0 context.Context, arg1 *core.ClientGetConfigsRequest) (*core.ClientGetConfigsResponse, error) { m.ctrl.T.Helper() @@ -974,6 +1131,125 @@ func (mr *MockAgentSecure_WorkloadmetaStreamEntitiesServerMockRecorder) SetTrail return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetTrailer", reflect.TypeOf((*MockAgentSecure_WorkloadmetaStreamEntitiesServer)(nil).SetTrailer), arg0) } +// MockAgentSecure_AutodiscoveryStreamConfigServer is a mock of AgentSecure_AutodiscoveryStreamConfigServer interface. +type MockAgentSecure_AutodiscoveryStreamConfigServer struct { + ctrl *gomock.Controller + recorder *MockAgentSecure_AutodiscoveryStreamConfigServerMockRecorder +} + +// MockAgentSecure_AutodiscoveryStreamConfigServerMockRecorder is the mock recorder for MockAgentSecure_AutodiscoveryStreamConfigServer. +type MockAgentSecure_AutodiscoveryStreamConfigServerMockRecorder struct { + mock *MockAgentSecure_AutodiscoveryStreamConfigServer +} + +// NewMockAgentSecure_AutodiscoveryStreamConfigServer creates a new mock instance. +func NewMockAgentSecure_AutodiscoveryStreamConfigServer(ctrl *gomock.Controller) *MockAgentSecure_AutodiscoveryStreamConfigServer { + mock := &MockAgentSecure_AutodiscoveryStreamConfigServer{ctrl: ctrl} + mock.recorder = &MockAgentSecure_AutodiscoveryStreamConfigServerMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockAgentSecure_AutodiscoveryStreamConfigServer) EXPECT() *MockAgentSecure_AutodiscoveryStreamConfigServerMockRecorder { + return m.recorder +} + +// Context mocks base method. +func (m *MockAgentSecure_AutodiscoveryStreamConfigServer) Context() context.Context { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Context") + ret0, _ := ret[0].(context.Context) + return ret0 +} + +// Context indicates an expected call of Context. +func (mr *MockAgentSecure_AutodiscoveryStreamConfigServerMockRecorder) Context() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Context", reflect.TypeOf((*MockAgentSecure_AutodiscoveryStreamConfigServer)(nil).Context)) +} + +// RecvMsg mocks base method. +func (m_2 *MockAgentSecure_AutodiscoveryStreamConfigServer) RecvMsg(m any) error { + m_2.ctrl.T.Helper() + ret := m_2.ctrl.Call(m_2, "RecvMsg", m) + ret0, _ := ret[0].(error) + return ret0 +} + +// RecvMsg indicates an expected call of RecvMsg. +func (mr *MockAgentSecure_AutodiscoveryStreamConfigServerMockRecorder) RecvMsg(m interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RecvMsg", reflect.TypeOf((*MockAgentSecure_AutodiscoveryStreamConfigServer)(nil).RecvMsg), m) +} + +// Send mocks base method. +func (m *MockAgentSecure_AutodiscoveryStreamConfigServer) Send(arg0 *core.AutodiscoveryStreamResponse) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Send", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// Send indicates an expected call of Send. +func (mr *MockAgentSecure_AutodiscoveryStreamConfigServerMockRecorder) Send(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Send", reflect.TypeOf((*MockAgentSecure_AutodiscoveryStreamConfigServer)(nil).Send), arg0) +} + +// SendHeader mocks base method. +func (m *MockAgentSecure_AutodiscoveryStreamConfigServer) SendHeader(arg0 metadata.MD) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SendHeader", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// SendHeader indicates an expected call of SendHeader. +func (mr *MockAgentSecure_AutodiscoveryStreamConfigServerMockRecorder) SendHeader(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendHeader", reflect.TypeOf((*MockAgentSecure_AutodiscoveryStreamConfigServer)(nil).SendHeader), arg0) +} + +// SendMsg mocks base method. +func (m_2 *MockAgentSecure_AutodiscoveryStreamConfigServer) SendMsg(m any) error { + m_2.ctrl.T.Helper() + ret := m_2.ctrl.Call(m_2, "SendMsg", m) + ret0, _ := ret[0].(error) + return ret0 +} + +// SendMsg indicates an expected call of SendMsg. +func (mr *MockAgentSecure_AutodiscoveryStreamConfigServerMockRecorder) SendMsg(m interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendMsg", reflect.TypeOf((*MockAgentSecure_AutodiscoveryStreamConfigServer)(nil).SendMsg), m) +} + +// SetHeader mocks base method. +func (m *MockAgentSecure_AutodiscoveryStreamConfigServer) SetHeader(arg0 metadata.MD) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SetHeader", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// SetHeader indicates an expected call of SetHeader. +func (mr *MockAgentSecure_AutodiscoveryStreamConfigServerMockRecorder) SetHeader(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetHeader", reflect.TypeOf((*MockAgentSecure_AutodiscoveryStreamConfigServer)(nil).SetHeader), arg0) +} + +// SetTrailer mocks base method. +func (m *MockAgentSecure_AutodiscoveryStreamConfigServer) SetTrailer(arg0 metadata.MD) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "SetTrailer", arg0) +} + +// SetTrailer indicates an expected call of SetTrailer. +func (mr *MockAgentSecure_AutodiscoveryStreamConfigServerMockRecorder) SetTrailer(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetTrailer", reflect.TypeOf((*MockAgentSecure_AutodiscoveryStreamConfigServer)(nil).SetTrailer), arg0) +} + // MockRemoteAgentClient is a mock of RemoteAgentClient interface. type MockRemoteAgentClient struct { ctrl *gomock.Controller diff --git a/tasks/go.py b/tasks/go.py index 0aefe9624115c..341e054dcd189 100644 --- a/tasks/go.py +++ b/tasks/go.py @@ -215,6 +215,7 @@ def generate_protobuf(ctx): 'workloadmeta': (False, False), 'languagedetection': (False, False), 'remoteagent': (False, False), + 'autodiscovery': (False, False), } # maybe put this in a separate function From f7c6fdc6a839be81b43eb354809e3d165947ae56 Mon Sep 17 00:00:00 2001 From: Pierre Gimalac Date: Thu, 21 Nov 2024 11:57:03 +0100 Subject: [PATCH 02/10] feat: add autodiscovery rpc server --- comp/api/api/apiimpl/grpc.go | 17 ++- comp/api/api/apiimpl/server_cmd.go | 1 + .../autodiscoveryimpl/autoconfig.go | 4 + comp/core/autodiscovery/component.go | 1 + .../core/autodiscovery/noopimpl/autoconfig.go | 4 + comp/core/autodiscovery/proto/proto.go | 93 +++++++++++++++ .../autodiscovery/scheduler/controller.go | 33 +++++- comp/core/autodiscovery/stream/stream.go | 66 +++++++++++ .../datadog/autodiscovery/autodiscovery.proto | 5 + pkg/proto/pbgo/core/autodiscovery.pb.go | 112 ++++++++++++++---- 10 files changed, 303 insertions(+), 33 deletions(-) create mode 100644 comp/core/autodiscovery/proto/proto.go create mode 100644 comp/core/autodiscovery/stream/stream.go diff --git a/comp/api/api/apiimpl/grpc.go b/comp/api/api/apiimpl/grpc.go index 0386f022c6927..5f88cdb722163 100644 --- a/comp/api/api/apiimpl/grpc.go +++ b/comp/api/api/apiimpl/grpc.go @@ -10,30 +10,30 @@ import ( "fmt" "time" - "github.com/DataDog/datadog-agent/comp/remote-config/rcservice" - "github.com/DataDog/datadog-agent/comp/remote-config/rcservicemrf" - "github.com/DataDog/datadog-agent/pkg/util/optional" - "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" "google.golang.org/grpc/status" "google.golang.org/protobuf/types/known/emptypb" + "github.com/DataDog/datadog-agent/comp/core/autodiscovery" + autodiscoverystream "github.com/DataDog/datadog-agent/comp/core/autodiscovery/stream" remoteagentregistry "github.com/DataDog/datadog-agent/comp/core/remoteagentregistry/def" rarproto "github.com/DataDog/datadog-agent/comp/core/remoteagentregistry/proto" - workloadmetaServer "github.com/DataDog/datadog-agent/comp/core/workloadmeta/server" - tagger "github.com/DataDog/datadog-agent/comp/core/tagger/def" taggerProto "github.com/DataDog/datadog-agent/comp/core/tagger/proto" taggerserver "github.com/DataDog/datadog-agent/comp/core/tagger/server" taggerTypes "github.com/DataDog/datadog-agent/comp/core/tagger/types" + workloadmetaServer "github.com/DataDog/datadog-agent/comp/core/workloadmeta/server" "github.com/DataDog/datadog-agent/comp/dogstatsd/pidmap" dsdReplay "github.com/DataDog/datadog-agent/comp/dogstatsd/replay/def" dogstatsdServer "github.com/DataDog/datadog-agent/comp/dogstatsd/server" + "github.com/DataDog/datadog-agent/comp/remote-config/rcservice" + "github.com/DataDog/datadog-agent/comp/remote-config/rcservicemrf" pb "github.com/DataDog/datadog-agent/pkg/proto/pbgo/core" "github.com/DataDog/datadog-agent/pkg/util/grpc" "github.com/DataDog/datadog-agent/pkg/util/hostname" "github.com/DataDog/datadog-agent/pkg/util/log" + "github.com/DataDog/datadog-agent/pkg/util/optional" ) type grpcServer struct { @@ -51,6 +51,7 @@ type serverSecure struct { capture dsdReplay.Component pidMap pidmap.Component remoteAgentRegistry remoteagentregistry.Component + autodiscovery autodiscovery.Component } func (s *grpcServer) GetHostname(ctx context.Context, _ *pb.HostnameRequest) (*pb.HostnameReply, error) { @@ -202,6 +203,10 @@ func (s *serverSecure) RegisterRemoteAgent(_ context.Context, in *pb.RegisterRem }, nil } +func (s *serverSecure) AutodiscoveryStreamConfig(_ *emptypb.Empty, out pb.AgentSecure_AutodiscoveryStreamConfigServer) error { + return autodiscoverystream.Config(s.autodiscovery, out) +} + func init() { grpclog.SetLoggerV2(grpc.NewLogger()) } diff --git a/comp/api/api/apiimpl/server_cmd.go b/comp/api/api/apiimpl/server_cmd.go index daf855a161d41..2b806aa8726e3 100644 --- a/comp/api/api/apiimpl/server_cmd.go +++ b/comp/api/api/apiimpl/server_cmd.go @@ -76,6 +76,7 @@ func (server *apiServer) startCMDServer( capture: server.capture, pidMap: server.pidMap, remoteAgentRegistry: server.remoteAgentRegistry, + autodiscovery: server.autoConfig, }) dcreds := credentials.NewTLS(&tls.Config{ diff --git a/comp/core/autodiscovery/autodiscoveryimpl/autoconfig.go b/comp/core/autodiscovery/autodiscoveryimpl/autoconfig.go index f8df2b1618eba..d11222efac81f 100644 --- a/comp/core/autodiscovery/autodiscoveryimpl/autoconfig.go +++ b/comp/core/autodiscovery/autodiscoveryimpl/autoconfig.go @@ -380,6 +380,10 @@ func (ac *AutoConfig) Stop() { } } +func (ac *AutoConfig) GetServerChannels() (chan *integration.Config, chan *integration.Config) { + return ac.schedulerController.GetServerChannels() +} + // AddConfigProvider adds a new configuration provider to AutoConfig. // Callers must pass a flag to indicate whether the configuration provider // expects to be polled and at which interval or it's fine for it to be invoked only once in the diff --git a/comp/core/autodiscovery/component.go b/comp/core/autodiscovery/component.go index 28d74363ffedc..7d50335a00ab2 100644 --- a/comp/core/autodiscovery/component.go +++ b/comp/core/autodiscovery/component.go @@ -28,6 +28,7 @@ type Component interface { GetAllConfigs() []integration.Config AddListeners(listenerConfigs []pkgconfigsetup.Listeners) AddScheduler(name string, s scheduler.Scheduler, replayConfigs bool) + GetServerChannels() (chan *integration.Config, chan *integration.Config) RemoveScheduler(name string) MapOverLoadedConfigs(f func(map[string]integration.Config)) LoadedConfigs() []integration.Config diff --git a/comp/core/autodiscovery/noopimpl/autoconfig.go b/comp/core/autodiscovery/noopimpl/autoconfig.go index 9893a70e4dcf2..50c964aa31f8d 100644 --- a/comp/core/autodiscovery/noopimpl/autoconfig.go +++ b/comp/core/autodiscovery/noopimpl/autoconfig.go @@ -87,6 +87,10 @@ func (n *noopAutoConfig) GetConfigCheck() integration.ConfigCheckResponse { return integration.ConfigCheckResponse{} } +func (n *noopAutoConfig) GetServerChannels() (chan *integration.Config, chan *integration.Config) { + return nil, nil +} + func (n *noopAutoConfig) IsStarted() bool { return false } diff --git a/comp/core/autodiscovery/proto/proto.go b/comp/core/autodiscovery/proto/proto.go new file mode 100644 index 0000000000000..f03c1f2ad66d1 --- /dev/null +++ b/comp/core/autodiscovery/proto/proto.go @@ -0,0 +1,93 @@ +// Unless explicitly stated otherwise all files in this repository are licensed +// under the Apache License Version 2.0. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2016-present Datadog, Inc. + +package proto + +import ( + "github.com/DataDog/datadog-agent/comp/core/autodiscovery/integration" + "github.com/DataDog/datadog-agent/pkg/proto/pbgo/core" +) + +func ProtobufConfigFromAutodiscoveryConfig(config *integration.Config) *core.Config { + instances := [][]byte{} + + for _, instance := range config.Instances { + instances = append(instances, []byte(instance)) + } + + advancedAdIdentifiers := make([]*core.AdvancedADIdentifier, 0, len(config.AdvancedADIdentifiers)) + for _, advancedAdIdentifier := range config.AdvancedADIdentifiers { + advancedAdIdentifiers = append(advancedAdIdentifiers, &core.AdvancedADIdentifier{ + KubeService: &core.KubeNamespacedName{ + Name: advancedAdIdentifier.KubeService.Name, + Namespace: advancedAdIdentifier.KubeService.Namespace, + }, + KubeEndpoints: &core.KubeNamespacedName{ + Name: advancedAdIdentifier.KubeEndpoints.Name, + Namespace: advancedAdIdentifier.KubeEndpoints.Namespace, + }, + }) + } + + return &core.Config{ + Name: config.Name, + Instances: instances, + InitConfig: config.InitConfig, + MetricConfig: config.MetricConfig, + LogsConfig: config.LogsConfig, + AdIdentifiers: config.ADIdentifiers, + AdvancedAdIdentifiers: advancedAdIdentifiers, + Provider: config.Provider, + ServiceId: config.ServiceID, + TaggerEntity: config.TaggerEntity, + ClusterCheck: config.ClusterCheck, + NodeName: config.NodeName, + Source: config.Source, + IgnoreAutodiscoveryTags: config.IgnoreAutodiscoveryTags, + MetricsExcluded: config.MetricsExcluded, + LogsExcluded: config.LogsExcluded, + } +} + +func AutodiscoveryConfigFromprotobufConfig(config *core.Config) integration.Config { + instances := []integration.Data{} + + for _, instance := range config.Instances { + instances = append(instances, integration.Data(instance)) + } + + advancedAdIdentifiers := make([]integration.AdvancedADIdentifier, 0, len(config.AdvancedAdIdentifiers)) + for _, advancedAdIdentifier := range config.AdvancedAdIdentifiers { + advancedAdIdentifiers = append(advancedAdIdentifiers, integration.AdvancedADIdentifier{ + KubeService: integration.KubeNamespacedName{ + Name: advancedAdIdentifier.KubeService.Name, + Namespace: advancedAdIdentifier.KubeService.Namespace, + }, + KubeEndpoints: integration.KubeNamespacedName{ + Name: advancedAdIdentifier.KubeEndpoints.Name, + Namespace: advancedAdIdentifier.KubeEndpoints.Namespace, + }, + }) + } + + return integration.Config{ + Name: config.Name, + Instances: instances, + InitConfig: config.InitConfig, + MetricConfig: config.MetricConfig, + LogsConfig: config.LogsConfig, + ADIdentifiers: config.AdIdentifiers, + AdvancedADIdentifiers: advancedAdIdentifiers, + Provider: config.Provider, + ServiceID: config.ServiceId, + TaggerEntity: config.TaggerEntity, + ClusterCheck: config.ClusterCheck, + NodeName: config.NodeName, + Source: config.Source, + IgnoreAutodiscoveryTags: config.IgnoreAutodiscoveryTags, + MetricsExcluded: config.MetricsExcluded, + LogsExcluded: config.LogsExcluded, + } +} diff --git a/comp/core/autodiscovery/scheduler/controller.go b/comp/core/autodiscovery/scheduler/controller.go index f47c02f663607..a3c6e811d6efa 100644 --- a/comp/core/autodiscovery/scheduler/controller.go +++ b/comp/core/autodiscovery/scheduler/controller.go @@ -9,11 +9,12 @@ import ( "sync" "time" + "k8s.io/apimachinery/pkg/util/wait" + "k8s.io/client-go/util/workqueue" + "github.com/DataDog/datadog-agent/comp/core/autodiscovery/common/types" "github.com/DataDog/datadog-agent/comp/core/autodiscovery/integration" "github.com/DataDog/datadog-agent/pkg/util/log" - "k8s.io/apimachinery/pkg/util/wait" - "k8s.io/client-go/util/workqueue" ) const ( @@ -39,6 +40,12 @@ type Controller struct { // a workqueue to process the config events queue workqueue.TypedDelayingInterface[Digest] + // serverScheduleChannel is the channel we use to schedule configuration changes over gRPC + serverScheduleChannel chan *integration.Config + + // serverUnscheduleChannel is the channel we use to unschedule configuration changes over gRPC + serverUnscheduleChannel chan *integration.Config + started bool stopChannel chan struct{} } @@ -53,8 +60,10 @@ func NewController() *Controller { queue: workqueue.NewTypedDelayingQueueWithConfig(workqueue.TypedDelayingQueueConfig[Digest]{ Name: "ADSchedulerController", }), - stopChannel: make(chan struct{}), - configStateStore: NewConfigStateStore(), + stopChannel: make(chan struct{}), + configStateStore: NewConfigStateStore(), + serverScheduleChannel: make(chan *integration.Config), + serverUnscheduleChannel: make(chan *integration.Config), } schedulerController.start() return &schedulerController @@ -130,6 +139,11 @@ func (ms *Controller) ApplyChanges(changes integration.ConfigChanges) { } } +// GetServerChannels returns the channels used to schedule and unschedule configuration changes +func (ms *Controller) GetServerChannels() (chan *integration.Config, chan *integration.Config) { + return ms.serverScheduleChannel, ms.serverUnscheduleChannel +} + func (ms *Controller) worker() { for ms.processNextWorkItem() { } @@ -167,6 +181,15 @@ func (ms *Controller) processNextWorkItem() bool { } log.Tracef("Controller starts processing config %s: currentState: %d, desiredState: %d", configName, currentState, desiredState) ms.m.Lock() //lock on activeSchedulers + + if desiredState == Scheduled { + //to be scheduled + ms.serverScheduleChannel <- desiredConfigState.config + } else { + //to be unscheduled + ms.serverUnscheduleChannel <- desiredConfigState.config + } + for _, scheduler := range ms.activeSchedulers { if desiredState == Scheduled { //to be scheduled @@ -196,6 +219,8 @@ func (ms *Controller) Stop() { scheduler.Stop() } close(ms.stopChannel) + close(ms.serverScheduleChannel) + close(ms.serverUnscheduleChannel) ms.queue.ShutDown() ms.started = false ms.scheduledConfigs = make(map[Digest]*integration.Config) diff --git a/comp/core/autodiscovery/stream/stream.go b/comp/core/autodiscovery/stream/stream.go new file mode 100644 index 0000000000000..a1b67ad2147b6 --- /dev/null +++ b/comp/core/autodiscovery/stream/stream.go @@ -0,0 +1,66 @@ +// Unless explicitly stated otherwise all files in this repository are licensed +// under the Apache License Version 2.0. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2016-present Datadog, Inc. + +// Package server provides the autodiscovery stream config +package stream + +import ( + "time" + + "github.com/DataDog/datadog-agent/comp/core/autodiscovery" + "github.com/DataDog/datadog-agent/comp/core/autodiscovery/proto" + pb "github.com/DataDog/datadog-agent/pkg/proto/pbgo/core" + "github.com/DataDog/datadog-agent/pkg/util/grpc" + "github.com/DataDog/datadog-agent/pkg/util/log" +) + +// StreamConfig streams configs +func Config(ac autodiscovery.Component, out pb.AgentSecure_AutodiscoveryStreamConfigServer) error { + scheduleChannel, unscheduleChannel := ac.GetServerChannels() + + for { + select { + case config, ok := <-scheduleChannel: + if !ok { + return nil + } + + protobufConfig := proto.ProtobufConfigFromAutodiscoveryConfig(config) + protobufConfig.EventType = pb.ConfigEventType_SCHEDULE + + err := grpc.DoWithTimeout(func() error { + return out.Send(&pb.AutodiscoveryStreamResponse{ + Configs: []*pb.Config{protobufConfig}, + }) + }, 1*time.Minute) + + if err != nil { + log.Warnf("error sending schedule autodiscovbery event: %s", err) + return err + } + case config, ok := <-unscheduleChannel: + if !ok { + return nil + } + + protobufConfig := proto.ProtobufConfigFromAutodiscoveryConfig(config) + protobufConfig.EventType = pb.ConfigEventType_UNSCHEDULE + + err := grpc.DoWithTimeout(func() error { + return out.Send(&pb.AutodiscoveryStreamResponse{ + Configs: []*pb.Config{protobufConfig}, + }) + }, 1*time.Minute) + + if err != nil { + log.Warnf("error sending unschedule autodiscovbery event: %s", err) + return err + } + + case <-out.Context().Done(): + return nil + } + } +} diff --git a/pkg/proto/datadog/autodiscovery/autodiscovery.proto b/pkg/proto/datadog/autodiscovery/autodiscovery.proto index 5835110f6eaf3..2419747504513 100644 --- a/pkg/proto/datadog/autodiscovery/autodiscovery.proto +++ b/pkg/proto/datadog/autodiscovery/autodiscovery.proto @@ -4,6 +4,10 @@ package datadog.autodiscovery; option go_package = "pkg/proto/pbgo/core"; // golang\ +enum ConfigEventType { + SCHEDULE = 0; + UNSCHEDULE = 1; +} message KubeNamespacedName { string name = 1; @@ -32,6 +36,7 @@ message Config { bool ignoreAutodiscoveryTags = 14; bool metricsExcluded = 15; bool logsExcluded = 16; + ConfigEventType eventType = 17; } message AutodiscoveryStreamResponse { diff --git a/pkg/proto/pbgo/core/autodiscovery.pb.go b/pkg/proto/pbgo/core/autodiscovery.pb.go index 2064fbf351031..20f2c5c010231 100644 --- a/pkg/proto/pbgo/core/autodiscovery.pb.go +++ b/pkg/proto/pbgo/core/autodiscovery.pb.go @@ -20,6 +20,52 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +type ConfigEventType int32 + +const ( + ConfigEventType_SCHEDULE ConfigEventType = 0 + ConfigEventType_UNSCHEDULE ConfigEventType = 1 +) + +// Enum value maps for ConfigEventType. +var ( + ConfigEventType_name = map[int32]string{ + 0: "SCHEDULE", + 1: "UNSCHEDULE", + } + ConfigEventType_value = map[string]int32{ + "SCHEDULE": 0, + "UNSCHEDULE": 1, + } +) + +func (x ConfigEventType) Enum() *ConfigEventType { + p := new(ConfigEventType) + *p = x + return p +} + +func (x ConfigEventType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ConfigEventType) Descriptor() protoreflect.EnumDescriptor { + return file_datadog_autodiscovery_autodiscovery_proto_enumTypes[0].Descriptor() +} + +func (ConfigEventType) Type() protoreflect.EnumType { + return &file_datadog_autodiscovery_autodiscovery_proto_enumTypes[0] +} + +func (x ConfigEventType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ConfigEventType.Descriptor instead. +func (ConfigEventType) EnumDescriptor() ([]byte, []int) { + return file_datadog_autodiscovery_autodiscovery_proto_rawDescGZIP(), []int{0} +} + type KubeNamespacedName struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -151,6 +197,7 @@ type Config struct { IgnoreAutodiscoveryTags bool `protobuf:"varint,14,opt,name=ignoreAutodiscoveryTags,proto3" json:"ignoreAutodiscoveryTags,omitempty"` MetricsExcluded bool `protobuf:"varint,15,opt,name=metricsExcluded,proto3" json:"metricsExcluded,omitempty"` LogsExcluded bool `protobuf:"varint,16,opt,name=logsExcluded,proto3" json:"logsExcluded,omitempty"` + EventType ConfigEventType `protobuf:"varint,17,opt,name=eventType,proto3,enum=datadog.autodiscovery.ConfigEventType" json:"eventType,omitempty"` } func (x *Config) Reset() { @@ -297,6 +344,13 @@ func (x *Config) GetLogsExcluded() bool { return false } +func (x *Config) GetEventType() ConfigEventType { + if x != nil { + return x.EventType + } + return ConfigEventType_SCHEDULE +} + type AutodiscoveryStreamResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -367,7 +421,7 @@ var file_datadog_autodiscovery_autodiscovery_proto_rawDesc = []byte{ 0x67, 0x2e, 0x61, 0x75, 0x74, 0x6f, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x4b, 0x75, 0x62, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x0d, 0x6b, 0x75, 0x62, 0x65, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, - 0x73, 0x22, 0xe5, 0x04, 0x0a, 0x06, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x12, 0x0a, 0x04, + 0x73, 0x22, 0xab, 0x05, 0x0a, 0x06, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x09, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x12, 0x1e, @@ -405,14 +459,22 @@ var file_datadog_autodiscovery_autodiscovery_proto_rawDesc = []byte{ 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x45, 0x78, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x64, 0x12, 0x22, 0x0a, 0x0c, 0x6c, 0x6f, 0x67, 0x73, 0x45, 0x78, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x64, 0x18, 0x10, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x6c, 0x6f, 0x67, - 0x73, 0x45, 0x78, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x64, 0x22, 0x56, 0x0a, 0x1b, 0x41, 0x75, 0x74, - 0x6f, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x37, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x64, 0x61, 0x74, 0x61, - 0x64, 0x6f, 0x67, 0x2e, 0x61, 0x75, 0x74, 0x6f, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, - 0x79, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x73, 0x42, 0x15, 0x5a, 0x13, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, - 0x62, 0x67, 0x6f, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x73, 0x45, 0x78, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x64, 0x12, 0x44, 0x0a, 0x09, 0x65, 0x76, 0x65, + 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x18, 0x11, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x26, 0x2e, 0x64, + 0x61, 0x74, 0x61, 0x64, 0x6f, 0x67, 0x2e, 0x61, 0x75, 0x74, 0x6f, 0x64, 0x69, 0x73, 0x63, 0x6f, + 0x76, 0x65, 0x72, 0x79, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x45, 0x76, 0x65, 0x6e, 0x74, + 0x54, 0x79, 0x70, 0x65, 0x52, 0x09, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x22, + 0x56, 0x0a, 0x1b, 0x41, 0x75, 0x74, 0x6f, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, + 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x37, + 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x1d, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x64, 0x6f, 0x67, 0x2e, 0x61, 0x75, 0x74, 0x6f, 0x64, 0x69, + 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x07, + 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x2a, 0x2f, 0x0a, 0x0f, 0x43, 0x6f, 0x6e, 0x66, 0x69, + 0x67, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0c, 0x0a, 0x08, 0x53, 0x43, + 0x48, 0x45, 0x44, 0x55, 0x4c, 0x45, 0x10, 0x00, 0x12, 0x0e, 0x0a, 0x0a, 0x55, 0x4e, 0x53, 0x43, + 0x48, 0x45, 0x44, 0x55, 0x4c, 0x45, 0x10, 0x01, 0x42, 0x15, 0x5a, 0x13, 0x70, 0x6b, 0x67, 0x2f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x62, 0x67, 0x6f, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -427,23 +489,26 @@ func file_datadog_autodiscovery_autodiscovery_proto_rawDescGZIP() []byte { return file_datadog_autodiscovery_autodiscovery_proto_rawDescData } +var file_datadog_autodiscovery_autodiscovery_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_datadog_autodiscovery_autodiscovery_proto_msgTypes = make([]protoimpl.MessageInfo, 4) var file_datadog_autodiscovery_autodiscovery_proto_goTypes = []interface{}{ - (*KubeNamespacedName)(nil), // 0: datadog.autodiscovery.KubeNamespacedName - (*AdvancedADIdentifier)(nil), // 1: datadog.autodiscovery.AdvancedADIdentifier - (*Config)(nil), // 2: datadog.autodiscovery.Config - (*AutodiscoveryStreamResponse)(nil), // 3: datadog.autodiscovery.AutodiscoveryStreamResponse + (ConfigEventType)(0), // 0: datadog.autodiscovery.ConfigEventType + (*KubeNamespacedName)(nil), // 1: datadog.autodiscovery.KubeNamespacedName + (*AdvancedADIdentifier)(nil), // 2: datadog.autodiscovery.AdvancedADIdentifier + (*Config)(nil), // 3: datadog.autodiscovery.Config + (*AutodiscoveryStreamResponse)(nil), // 4: datadog.autodiscovery.AutodiscoveryStreamResponse } var file_datadog_autodiscovery_autodiscovery_proto_depIdxs = []int32{ - 0, // 0: datadog.autodiscovery.AdvancedADIdentifier.kubeService:type_name -> datadog.autodiscovery.KubeNamespacedName - 0, // 1: datadog.autodiscovery.AdvancedADIdentifier.kubeEndpoints:type_name -> datadog.autodiscovery.KubeNamespacedName - 1, // 2: datadog.autodiscovery.Config.advancedAdIdentifiers:type_name -> datadog.autodiscovery.AdvancedADIdentifier - 2, // 3: datadog.autodiscovery.AutodiscoveryStreamResponse.configs:type_name -> datadog.autodiscovery.Config - 4, // [4:4] is the sub-list for method output_type - 4, // [4:4] is the sub-list for method input_type - 4, // [4:4] is the sub-list for extension type_name - 4, // [4:4] is the sub-list for extension extendee - 0, // [0:4] is the sub-list for field type_name + 1, // 0: datadog.autodiscovery.AdvancedADIdentifier.kubeService:type_name -> datadog.autodiscovery.KubeNamespacedName + 1, // 1: datadog.autodiscovery.AdvancedADIdentifier.kubeEndpoints:type_name -> datadog.autodiscovery.KubeNamespacedName + 2, // 2: datadog.autodiscovery.Config.advancedAdIdentifiers:type_name -> datadog.autodiscovery.AdvancedADIdentifier + 0, // 3: datadog.autodiscovery.Config.eventType:type_name -> datadog.autodiscovery.ConfigEventType + 3, // 4: datadog.autodiscovery.AutodiscoveryStreamResponse.configs:type_name -> datadog.autodiscovery.Config + 5, // [5:5] is the sub-list for method output_type + 5, // [5:5] is the sub-list for method input_type + 5, // [5:5] is the sub-list for extension type_name + 5, // [5:5] is the sub-list for extension extendee + 0, // [0:5] is the sub-list for field type_name } func init() { file_datadog_autodiscovery_autodiscovery_proto_init() } @@ -506,13 +571,14 @@ func file_datadog_autodiscovery_autodiscovery_proto_init() { File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_datadog_autodiscovery_autodiscovery_proto_rawDesc, - NumEnums: 0, + NumEnums: 1, NumMessages: 4, NumExtensions: 0, NumServices: 0, }, GoTypes: file_datadog_autodiscovery_autodiscovery_proto_goTypes, DependencyIndexes: file_datadog_autodiscovery_autodiscovery_proto_depIdxs, + EnumInfos: file_datadog_autodiscovery_autodiscovery_proto_enumTypes, MessageInfos: file_datadog_autodiscovery_autodiscovery_proto_msgTypes, }.Build() File_datadog_autodiscovery_autodiscovery_proto = out.File From 0ba561b22497610bb5fd9f33d2345b44f2e0191d Mon Sep 17 00:00:00 2001 From: Pierre Gimalac Date: Thu, 21 Nov 2024 16:01:42 +0100 Subject: [PATCH 03/10] refactor: use sheduler to get autodiscovery configs in rpc server --- .../autodiscoveryimpl/autoconfig.go | 4 - comp/core/autodiscovery/component.go | 1 - .../core/autodiscovery/noopimpl/autoconfig.go | 4 - .../autodiscovery/scheduler/controller.go | 33 +------- comp/core/autodiscovery/stream/stream.go | 81 ++++++++++--------- 5 files changed, 49 insertions(+), 74 deletions(-) diff --git a/comp/core/autodiscovery/autodiscoveryimpl/autoconfig.go b/comp/core/autodiscovery/autodiscoveryimpl/autoconfig.go index d11222efac81f..f8df2b1618eba 100644 --- a/comp/core/autodiscovery/autodiscoveryimpl/autoconfig.go +++ b/comp/core/autodiscovery/autodiscoveryimpl/autoconfig.go @@ -380,10 +380,6 @@ func (ac *AutoConfig) Stop() { } } -func (ac *AutoConfig) GetServerChannels() (chan *integration.Config, chan *integration.Config) { - return ac.schedulerController.GetServerChannels() -} - // AddConfigProvider adds a new configuration provider to AutoConfig. // Callers must pass a flag to indicate whether the configuration provider // expects to be polled and at which interval or it's fine for it to be invoked only once in the diff --git a/comp/core/autodiscovery/component.go b/comp/core/autodiscovery/component.go index 7d50335a00ab2..28d74363ffedc 100644 --- a/comp/core/autodiscovery/component.go +++ b/comp/core/autodiscovery/component.go @@ -28,7 +28,6 @@ type Component interface { GetAllConfigs() []integration.Config AddListeners(listenerConfigs []pkgconfigsetup.Listeners) AddScheduler(name string, s scheduler.Scheduler, replayConfigs bool) - GetServerChannels() (chan *integration.Config, chan *integration.Config) RemoveScheduler(name string) MapOverLoadedConfigs(f func(map[string]integration.Config)) LoadedConfigs() []integration.Config diff --git a/comp/core/autodiscovery/noopimpl/autoconfig.go b/comp/core/autodiscovery/noopimpl/autoconfig.go index 50c964aa31f8d..9893a70e4dcf2 100644 --- a/comp/core/autodiscovery/noopimpl/autoconfig.go +++ b/comp/core/autodiscovery/noopimpl/autoconfig.go @@ -87,10 +87,6 @@ func (n *noopAutoConfig) GetConfigCheck() integration.ConfigCheckResponse { return integration.ConfigCheckResponse{} } -func (n *noopAutoConfig) GetServerChannels() (chan *integration.Config, chan *integration.Config) { - return nil, nil -} - func (n *noopAutoConfig) IsStarted() bool { return false } diff --git a/comp/core/autodiscovery/scheduler/controller.go b/comp/core/autodiscovery/scheduler/controller.go index a3c6e811d6efa..f47c02f663607 100644 --- a/comp/core/autodiscovery/scheduler/controller.go +++ b/comp/core/autodiscovery/scheduler/controller.go @@ -9,12 +9,11 @@ import ( "sync" "time" - "k8s.io/apimachinery/pkg/util/wait" - "k8s.io/client-go/util/workqueue" - "github.com/DataDog/datadog-agent/comp/core/autodiscovery/common/types" "github.com/DataDog/datadog-agent/comp/core/autodiscovery/integration" "github.com/DataDog/datadog-agent/pkg/util/log" + "k8s.io/apimachinery/pkg/util/wait" + "k8s.io/client-go/util/workqueue" ) const ( @@ -40,12 +39,6 @@ type Controller struct { // a workqueue to process the config events queue workqueue.TypedDelayingInterface[Digest] - // serverScheduleChannel is the channel we use to schedule configuration changes over gRPC - serverScheduleChannel chan *integration.Config - - // serverUnscheduleChannel is the channel we use to unschedule configuration changes over gRPC - serverUnscheduleChannel chan *integration.Config - started bool stopChannel chan struct{} } @@ -60,10 +53,8 @@ func NewController() *Controller { queue: workqueue.NewTypedDelayingQueueWithConfig(workqueue.TypedDelayingQueueConfig[Digest]{ Name: "ADSchedulerController", }), - stopChannel: make(chan struct{}), - configStateStore: NewConfigStateStore(), - serverScheduleChannel: make(chan *integration.Config), - serverUnscheduleChannel: make(chan *integration.Config), + stopChannel: make(chan struct{}), + configStateStore: NewConfigStateStore(), } schedulerController.start() return &schedulerController @@ -139,11 +130,6 @@ func (ms *Controller) ApplyChanges(changes integration.ConfigChanges) { } } -// GetServerChannels returns the channels used to schedule and unschedule configuration changes -func (ms *Controller) GetServerChannels() (chan *integration.Config, chan *integration.Config) { - return ms.serverScheduleChannel, ms.serverUnscheduleChannel -} - func (ms *Controller) worker() { for ms.processNextWorkItem() { } @@ -181,15 +167,6 @@ func (ms *Controller) processNextWorkItem() bool { } log.Tracef("Controller starts processing config %s: currentState: %d, desiredState: %d", configName, currentState, desiredState) ms.m.Lock() //lock on activeSchedulers - - if desiredState == Scheduled { - //to be scheduled - ms.serverScheduleChannel <- desiredConfigState.config - } else { - //to be unscheduled - ms.serverUnscheduleChannel <- desiredConfigState.config - } - for _, scheduler := range ms.activeSchedulers { if desiredState == Scheduled { //to be scheduled @@ -219,8 +196,6 @@ func (ms *Controller) Stop() { scheduler.Stop() } close(ms.stopChannel) - close(ms.serverScheduleChannel) - close(ms.serverUnscheduleChannel) ms.queue.ShutDown() ms.started = false ms.scheduledConfigs = make(map[Digest]*integration.Config) diff --git a/comp/core/autodiscovery/stream/stream.go b/comp/core/autodiscovery/stream/stream.go index a1b67ad2147b6..faae2728852e5 100644 --- a/comp/core/autodiscovery/stream/stream.go +++ b/comp/core/autodiscovery/stream/stream.go @@ -10,6 +10,7 @@ import ( "time" "github.com/DataDog/datadog-agent/comp/core/autodiscovery" + "github.com/DataDog/datadog-agent/comp/core/autodiscovery/integration" "github.com/DataDog/datadog-agent/comp/core/autodiscovery/proto" pb "github.com/DataDog/datadog-agent/pkg/proto/pbgo/core" "github.com/DataDog/datadog-agent/pkg/util/grpc" @@ -18,49 +19,57 @@ import ( // StreamConfig streams configs func Config(ac autodiscovery.Component, out pb.AgentSecure_AutodiscoveryStreamConfigServer) error { - scheduleChannel, unscheduleChannel := ac.GetServerChannels() + s := &scheduler{ + out: out, + done: make(chan error, 1), + } + + // TODO: add a uuid to avoid name collision when there are concurrent rpc calls ? + schedulerName := "remote" + ac.AddScheduler(schedulerName, s, true) + defer ac.RemoveScheduler(schedulerName) - for { - select { - case config, ok := <-scheduleChannel: - if !ok { - return nil - } + return <-s.done +} + +type scheduler struct { + out pb.AgentSecure_AutodiscoveryStreamConfigServer + done chan error +} - protobufConfig := proto.ProtobufConfigFromAutodiscoveryConfig(config) - protobufConfig.EventType = pb.ConfigEventType_SCHEDULE +func (s *scheduler) Schedule(config []integration.Config) { + s.handleEvent(config, pb.ConfigEventType_SCHEDULE) +} - err := grpc.DoWithTimeout(func() error { - return out.Send(&pb.AutodiscoveryStreamResponse{ - Configs: []*pb.Config{protobufConfig}, - }) - }, 1*time.Minute) +func (s *scheduler) Unschedule(configs []integration.Config) { + s.handleEvent(configs, pb.ConfigEventType_UNSCHEDULE) +} - if err != nil { - log.Warnf("error sending schedule autodiscovbery event: %s", err) - return err - } - case config, ok := <-unscheduleChannel: - if !ok { - return nil - } +func (s *scheduler) Stop() { + close(s.done) +} - protobufConfig := proto.ProtobufConfigFromAutodiscoveryConfig(config) - protobufConfig.EventType = pb.ConfigEventType_UNSCHEDULE +func (s *scheduler) handleEvent(configs []integration.Config, eventType pb.ConfigEventType) { + protobufConfigs := protobufConfigFromAutodiscoveryConfigs(configs, eventType) - err := grpc.DoWithTimeout(func() error { - return out.Send(&pb.AutodiscoveryStreamResponse{ - Configs: []*pb.Config{protobufConfig}, - }) - }, 1*time.Minute) + err := grpc.DoWithTimeout(func() error { + return s.out.Send(&pb.AutodiscoveryStreamResponse{ + Configs: protobufConfigs, + }) + }, 1*time.Minute) - if err != nil { - log.Warnf("error sending unschedule autodiscovbery event: %s", err) - return err - } + if err != nil { + log.Warnf("error sending %s autodiscovery event: %s", eventType.String(), err) + s.done <- err + } +} - case <-out.Context().Done(): - return nil - } +func protobufConfigFromAutodiscoveryConfigs(config []integration.Config, eventType pb.ConfigEventType) []*pb.Config { + res := make([]*pb.Config, 0, len(config)) + for _, c := range config { + protobufConfig := proto.ProtobufConfigFromAutodiscoveryConfig(&c) + protobufConfig.EventType = eventType + res = append(res, protobufConfig) } + return res } From 222ce45ad91c0858d8690eb4228905da7ebb2cdf Mon Sep 17 00:00:00 2001 From: Pierre Gimalac Date: Thu, 21 Nov 2024 16:09:57 +0100 Subject: [PATCH 04/10] fix: typo --- comp/core/autodiscovery/proto/proto.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comp/core/autodiscovery/proto/proto.go b/comp/core/autodiscovery/proto/proto.go index f03c1f2ad66d1..8cbbda7b0c3b3 100644 --- a/comp/core/autodiscovery/proto/proto.go +++ b/comp/core/autodiscovery/proto/proto.go @@ -51,7 +51,7 @@ func ProtobufConfigFromAutodiscoveryConfig(config *integration.Config) *core.Con } } -func AutodiscoveryConfigFromprotobufConfig(config *core.Config) integration.Config { +func AutodiscoveryConfigFromProtobufConfig(config *core.Config) integration.Config { instances := []integration.Data{} for _, instance := range config.Instances { From 4937db591cc2e6de62ea4eba36400582949369b3 Mon Sep 17 00:00:00 2001 From: Pierre Gimalac Date: Thu, 21 Nov 2024 16:32:16 +0100 Subject: [PATCH 05/10] docs: add function comments --- comp/core/autodiscovery/proto/proto.go | 3 +++ comp/core/autodiscovery/stream/stream.go | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/comp/core/autodiscovery/proto/proto.go b/comp/core/autodiscovery/proto/proto.go index 8cbbda7b0c3b3..da176947767d8 100644 --- a/comp/core/autodiscovery/proto/proto.go +++ b/comp/core/autodiscovery/proto/proto.go @@ -3,6 +3,7 @@ // This product includes software developed at Datadog (https://www.datadoghq.com/). // Copyright 2016-present Datadog, Inc. +// Package proto provides autodiscovery proto util functions package proto import ( @@ -10,6 +11,7 @@ import ( "github.com/DataDog/datadog-agent/pkg/proto/pbgo/core" ) +// ProtobufConfigFromAutodiscoveryConfig converts an autodiscovery config to a protobuf config func ProtobufConfigFromAutodiscoveryConfig(config *integration.Config) *core.Config { instances := [][]byte{} @@ -51,6 +53,7 @@ func ProtobufConfigFromAutodiscoveryConfig(config *integration.Config) *core.Con } } +// AutodiscoveryConfigFromProtobufConfig converts a protobuf config to an autodiscovery config func AutodiscoveryConfigFromProtobufConfig(config *core.Config) integration.Config { instances := []integration.Data{} diff --git a/comp/core/autodiscovery/stream/stream.go b/comp/core/autodiscovery/stream/stream.go index faae2728852e5..5801a4104aa55 100644 --- a/comp/core/autodiscovery/stream/stream.go +++ b/comp/core/autodiscovery/stream/stream.go @@ -3,7 +3,7 @@ // This product includes software developed at Datadog (https://www.datadoghq.com/). // Copyright 2016-present Datadog, Inc. -// Package server provides the autodiscovery stream config +// Package stream provides the autodiscovery stream config package stream import ( @@ -17,7 +17,7 @@ import ( "github.com/DataDog/datadog-agent/pkg/util/log" ) -// StreamConfig streams configs +// Config streams autodiscovery configs func Config(ac autodiscovery.Component, out pb.AgentSecure_AutodiscoveryStreamConfigServer) error { s := &scheduler{ out: out, From 384a1b3faeb0fdd30b15218e07b717bfe6928118 Mon Sep 17 00:00:00 2001 From: Pierre Gimalac Date: Thu, 21 Nov 2024 18:14:18 +0100 Subject: [PATCH 06/10] fix: stop scheduler when rpc call ends --- comp/core/autodiscovery/stream/stream.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/comp/core/autodiscovery/stream/stream.go b/comp/core/autodiscovery/stream/stream.go index 5801a4104aa55..17208043b571c 100644 --- a/comp/core/autodiscovery/stream/stream.go +++ b/comp/core/autodiscovery/stream/stream.go @@ -3,7 +3,7 @@ // This product includes software developed at Datadog (https://www.datadoghq.com/). // Copyright 2016-present Datadog, Inc. -// Package stream provides the autodiscovery stream config +// Package stream provides the autodiscovery config streaming logic package stream import ( @@ -29,7 +29,12 @@ func Config(ac autodiscovery.Component, out pb.AgentSecure_AutodiscoveryStreamCo ac.AddScheduler(schedulerName, s, true) defer ac.RemoveScheduler(schedulerName) - return <-s.done + select { + case err := <-s.done: + return err + case <-out.Context().Done(): + return nil + } } type scheduler struct { From 8af60868535411b472b8c95cf6a027b5dc9023a8 Mon Sep 17 00:00:00 2001 From: Pierre Gimalac Date: Mon, 25 Nov 2024 15:25:06 +0100 Subject: [PATCH 07/10] chore: add uuid to avoid name conflicts --- comp/core/autodiscovery/stream/stream.go | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/comp/core/autodiscovery/stream/stream.go b/comp/core/autodiscovery/stream/stream.go index 17208043b571c..7fbbe04633090 100644 --- a/comp/core/autodiscovery/stream/stream.go +++ b/comp/core/autodiscovery/stream/stream.go @@ -9,6 +9,8 @@ package stream import ( "time" + "github.com/google/uuid" + "github.com/DataDog/datadog-agent/comp/core/autodiscovery" "github.com/DataDog/datadog-agent/comp/core/autodiscovery/integration" "github.com/DataDog/datadog-agent/comp/core/autodiscovery/proto" @@ -24,8 +26,11 @@ func Config(ac autodiscovery.Component, out pb.AgentSecure_AutodiscoveryStreamCo done: make(chan error, 1), } - // TODO: add a uuid to avoid name collision when there are concurrent rpc calls ? - schedulerName := "remote" + // Generate a unique scheduler name + id := uuid.New().String() + schedulerName := "remote-" + id + + // replay the existing configs ac.AddScheduler(schedulerName, s, true) defer ac.RemoveScheduler(schedulerName) @@ -65,7 +70,11 @@ func (s *scheduler) handleEvent(configs []integration.Config, eventType pb.Confi if err != nil { log.Warnf("error sending %s autodiscovery event: %s", eventType.String(), err) - s.done <- err + // do not block if an error was already sent + select { + case s.done <- err: + default: + } } } From 9b5586cf519ec669c6f37974a76943b71a15c653 Mon Sep 17 00:00:00 2001 From: Pierre Gimalac Date: Wed, 27 Nov 2024 10:52:37 +0100 Subject: [PATCH 08/10] test: autodiscovery config streaming --- comp/core/autodiscovery/stream/stream_test.go | 168 ++++++++++++++++++ 1 file changed, 168 insertions(+) create mode 100644 comp/core/autodiscovery/stream/stream_test.go diff --git a/comp/core/autodiscovery/stream/stream_test.go b/comp/core/autodiscovery/stream/stream_test.go new file mode 100644 index 0000000000000..914c8d3a3654c --- /dev/null +++ b/comp/core/autodiscovery/stream/stream_test.go @@ -0,0 +1,168 @@ +// Unless explicitly stated otherwise all files in this repository are licensed +// under the Apache License Version 2.0. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2016-present Datadog, Inc. + +package stream + +import ( + "context" + "errors" + "testing" + + "google.golang.org/grpc/metadata" + + "github.com/stretchr/testify/require" + + "github.com/DataDog/datadog-agent/comp/core/autodiscovery" + "github.com/DataDog/datadog-agent/comp/core/autodiscovery/integration" + noopautoconfig "github.com/DataDog/datadog-agent/comp/core/autodiscovery/noopimpl" + autodiscoveryscheduler "github.com/DataDog/datadog-agent/comp/core/autodiscovery/scheduler" + pb "github.com/DataDog/datadog-agent/pkg/proto/pbgo/core" + "github.com/DataDog/datadog-agent/pkg/util/fxutil" +) + +func getAutodiscoveryNoop(t *testing.T) autodiscovery.Component { + return fxutil.Test[autodiscovery.Component]( + t, + noopautoconfig.Module(), + ) +} + +type acMock struct { + autodiscovery.Component + + addScheduler func(string, autodiscoveryscheduler.Scheduler, bool) +} + +func (ac *acMock) AddScheduler(name string, scheduler autodiscoveryscheduler.Scheduler, replay bool) { + ac.addScheduler(name, scheduler, replay) +} + +type outMock struct { + send func(*pb.AutodiscoveryStreamResponse) error + ctx context.Context +} + +func (out *outMock) Send(resp *pb.AutodiscoveryStreamResponse) error { + return out.send(resp) +} + +func (out *outMock) SetHeader(metadata.MD) error { + panic("not implemented") +} + +func (out *outMock) SendHeader(metadata.MD) error { + panic("not implemented") +} + +func (out *outMock) SetTrailer(metadata.MD) { + panic("not implemented") +} + +func (out *outMock) Context() context.Context { + return out.ctx +} + +func (out *outMock) SendMsg(any) error { + panic("not implemented") +} + +func (out *outMock) RecvMsg(any) error { + panic("not implemented") +} + +func setupTestConfig(t *testing.T, sendErr error) (chan error, chan autodiscoveryscheduler.Scheduler, chan *pb.AutodiscoveryStreamResponse, context.CancelFunc) { + schedulerChan := make(chan autodiscoveryscheduler.Scheduler, 1) + sendChan := make(chan *pb.AutodiscoveryStreamResponse, 1) + + acNoop := getAutodiscoveryNoop(t) + ac := &acMock{ + acNoop, + func(_ string, scheduler autodiscoveryscheduler.Scheduler, _ bool) { + schedulerChan <- scheduler + }, + } + + ctx, cancel := context.WithCancel(context.Background()) + + out := &outMock{ + send: func(resp *pb.AutodiscoveryStreamResponse) error { + sendChan <- resp + return sendErr + }, + ctx: ctx, + } + + configErrChan := make(chan error) + go func() { + configErrChan <- Config(ac, out) + }() + + return configErrChan, schedulerChan, sendChan, cancel +} + +func TestConfig(t *testing.T) { + configs := []integration.Config{ + { + Name: "test", + }, + } + + t.Run("schedule unschedule", func(t *testing.T) { + configErrChan, schedulerChan, sendChan, cancel := setupTestConfig(t, nil) + + scheduler := <-schedulerChan + require.NotNil(t, scheduler) + + scheduler.Schedule(configs) + sent := <-sendChan + require.NotNil(t, sent) + require.Len(t, sent.Configs, 1) + require.Equal(t, "test", sent.Configs[0].Name) + require.Equal(t, pb.ConfigEventType_SCHEDULE, sent.Configs[0].EventType) + + scheduler.Unschedule(configs) + sent = <-sendChan + require.NotNil(t, sent) + require.Len(t, sent.Configs, 1) + require.Equal(t, "test", sent.Configs[0].Name) + require.Equal(t, pb.ConfigEventType_UNSCHEDULE, sent.Configs[0].EventType) + + cancel() + + require.NoError(t, <-configErrChan) + }) + + t.Run("send error", func(t *testing.T) { + sendError := errors.New("send error") + configErrChan, schedulerChan, sendChan, _ := setupTestConfig(t, sendError) + + scheduler := <-schedulerChan + require.NotNil(t, scheduler) + + scheduler.Schedule(configs) + sent := <-sendChan + require.NotNil(t, sent) + require.Len(t, sent.Configs, 1) + require.Equal(t, "test", sent.Configs[0].Name) + require.Equal(t, pb.ConfigEventType_SCHEDULE, sent.Configs[0].EventType) + + require.ErrorIs(t, <-configErrChan, sendError) + }) + + t.Run("multiple errors", func(t *testing.T) { + sendError := errors.New("send error") + configErrChan, schedulerChan, sendChan, _ := setupTestConfig(t, sendError) + + scheduler := <-schedulerChan + require.NotNil(t, scheduler) + + scheduler.Schedule(configs) + <-sendChan + scheduler.Unschedule(configs) + <-sendChan + + require.ErrorIs(t, <-configErrChan, sendError) + }) +} From a2de12fc6459e970c63cd995c018ecb53834e75e Mon Sep 17 00:00:00 2001 From: Pierre Gimalac Date: Wed, 27 Nov 2024 13:57:13 +0100 Subject: [PATCH 09/10] test: add autodiscovery proto unit tests --- comp/core/autodiscovery/proto/proto_test.go | 281 ++++++++++++++++++++ 1 file changed, 281 insertions(+) create mode 100644 comp/core/autodiscovery/proto/proto_test.go diff --git a/comp/core/autodiscovery/proto/proto_test.go b/comp/core/autodiscovery/proto/proto_test.go new file mode 100644 index 0000000000000..23843f7515d72 --- /dev/null +++ b/comp/core/autodiscovery/proto/proto_test.go @@ -0,0 +1,281 @@ +// Unless explicitly stated otherwise all files in this repository are licensed +// under the Apache License Version 2.0. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2016-present Datadog, Inc. + +package proto + +import ( + "testing" + + "github.com/stretchr/testify/assert" + + "github.com/DataDog/datadog-agent/comp/core/autodiscovery/integration" + "github.com/DataDog/datadog-agent/pkg/proto/pbgo/core" +) + +func TestProtobufConfigFromAutodiscoveryConfig(t *testing.T) { + tests := []struct { + name string + input integration.Config + expected *core.Config + }{ + { + name: "all fields set", + input: integration.Config{ + Name: "test_config", + Instances: []integration.Data{ + []byte("instance1"), + []byte("instance2"), + }, + InitConfig: []byte("init_config"), + MetricConfig: []byte("metric_config"), + LogsConfig: []byte("logs_config"), + ADIdentifiers: []string{"ad_identifier1", "ad_identifier2"}, + AdvancedADIdentifiers: []integration.AdvancedADIdentifier{ + { + KubeService: integration.KubeNamespacedName{ + Name: "service1", + Namespace: "namespace1", + }, + KubeEndpoints: integration.KubeNamespacedName{ + Name: "endpoint1", + Namespace: "namespace1", + }, + }, + }, + Provider: "provider", + ServiceID: "service_id", + TaggerEntity: "tagger_entity", + ClusterCheck: true, + NodeName: "node_name", + Source: "source", + IgnoreAutodiscoveryTags: true, + MetricsExcluded: true, + LogsExcluded: true, + }, + expected: &core.Config{ + Name: "test_config", + Instances: [][]byte{ + []byte("instance1"), + []byte("instance2"), + }, + InitConfig: []byte("init_config"), + MetricConfig: []byte("metric_config"), + LogsConfig: []byte("logs_config"), + AdIdentifiers: []string{"ad_identifier1", "ad_identifier2"}, + AdvancedAdIdentifiers: []*core.AdvancedADIdentifier{ + { + KubeService: &core.KubeNamespacedName{ + Name: "service1", + Namespace: "namespace1", + }, + KubeEndpoints: &core.KubeNamespacedName{ + Name: "endpoint1", + Namespace: "namespace1", + }, + }, + }, + Provider: "provider", + ServiceId: "service_id", + TaggerEntity: "tagger_entity", + ClusterCheck: true, + NodeName: "node_name", + Source: "source", + IgnoreAutodiscoveryTags: true, + MetricsExcluded: true, + LogsExcluded: true, + }, + }, + { + name: "some fields set", + input: integration.Config{ + Name: "test_config", + Instances: []integration.Data{ + []byte("instance1"), + }, + InitConfig: []byte("init_config"), + MetricConfig: []byte("metric_config"), + LogsConfig: []byte("logs_config"), + ADIdentifiers: []string{"ad_identifier1"}, + Provider: "provider", + ServiceID: "service_id", + TaggerEntity: "tagger_entity", + ClusterCheck: true, + NodeName: "node_name", + Source: "source", + IgnoreAutodiscoveryTags: true, + MetricsExcluded: true, + LogsExcluded: true, + }, + expected: &core.Config{ + Name: "test_config", + Instances: [][]byte{ + []byte("instance1"), + }, + InitConfig: []byte("init_config"), + MetricConfig: []byte("metric_config"), + LogsConfig: []byte("logs_config"), + AdIdentifiers: []string{"ad_identifier1"}, + Provider: "provider", + ServiceId: "service_id", + TaggerEntity: "tagger_entity", + ClusterCheck: true, + NodeName: "node_name", + Source: "source", + IgnoreAutodiscoveryTags: true, + MetricsExcluded: true, + LogsExcluded: true, + AdvancedAdIdentifiers: []*core.AdvancedADIdentifier{}, + }, + }, + { + name: "no fields set", + input: integration.Config{}, + expected: &core.Config{ + Instances: [][]byte{}, + AdvancedAdIdentifiers: []*core.AdvancedADIdentifier{}, + }, + }, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + result := ProtobufConfigFromAutodiscoveryConfig(&test.input) + assert.Equal(t, test.expected, result) + }) + } +} + +func TestAutodiscoveryConfigFromProtobufConfig(t *testing.T) { + tests := []struct { + name string + input *core.Config + expected integration.Config + }{ + { + name: "all fields set", + input: &core.Config{ + Name: "test_config", + Instances: [][]byte{ + []byte("instance1"), + []byte("instance2"), + }, + InitConfig: []byte("init_config"), + MetricConfig: []byte("metric_config"), + LogsConfig: []byte("logs_config"), + AdIdentifiers: []string{"ad_identifier1", "ad_identifier2"}, + AdvancedAdIdentifiers: []*core.AdvancedADIdentifier{ + { + KubeService: &core.KubeNamespacedName{ + Name: "service1", + Namespace: "namespace1", + }, + KubeEndpoints: &core.KubeNamespacedName{ + Name: "endpoint1", + Namespace: "namespace1", + }, + }, + }, + Provider: "provider", + ServiceId: "service_id", + TaggerEntity: "tagger_entity", + ClusterCheck: true, + NodeName: "node_name", + Source: "source", + IgnoreAutodiscoveryTags: true, + MetricsExcluded: true, + LogsExcluded: true, + }, + expected: integration.Config{ + Name: "test_config", + Instances: []integration.Data{ + []byte("instance1"), + []byte("instance2"), + }, + InitConfig: []byte("init_config"), + MetricConfig: []byte("metric_config"), + LogsConfig: []byte("logs_config"), + ADIdentifiers: []string{"ad_identifier1", "ad_identifier2"}, + AdvancedADIdentifiers: []integration.AdvancedADIdentifier{ + { + KubeService: integration.KubeNamespacedName{ + Name: "service1", + Namespace: "namespace1", + }, + KubeEndpoints: integration.KubeNamespacedName{ + Name: "endpoint1", + Namespace: "namespace1", + }, + }, + }, + Provider: "provider", + ServiceID: "service_id", + TaggerEntity: "tagger_entity", + ClusterCheck: true, + NodeName: "node_name", + Source: "source", + IgnoreAutodiscoveryTags: true, + MetricsExcluded: true, + LogsExcluded: true, + }, + }, + { + name: "some fields set", + input: &core.Config{ + Name: "test_config", + Instances: [][]byte{ + []byte("instance1"), + }, + InitConfig: []byte("init_config"), + MetricConfig: []byte("metric_config"), + LogsConfig: []byte("logs_config"), + AdIdentifiers: []string{"ad_identifier1"}, + Provider: "provider", + ServiceId: "service_id", + TaggerEntity: "tagger_entity", + ClusterCheck: true, + NodeName: "node_name", + Source: "source", + IgnoreAutodiscoveryTags: true, + MetricsExcluded: true, + LogsExcluded: true, + }, + expected: integration.Config{ + Name: "test_config", + Instances: []integration.Data{ + []byte("instance1"), + }, + InitConfig: []byte("init_config"), + MetricConfig: []byte("metric_config"), + LogsConfig: []byte("logs_config"), + ADIdentifiers: []string{"ad_identifier1"}, + Provider: "provider", + ServiceID: "service_id", + TaggerEntity: "tagger_entity", + ClusterCheck: true, + NodeName: "node_name", + Source: "source", + IgnoreAutodiscoveryTags: true, + MetricsExcluded: true, + LogsExcluded: true, + AdvancedADIdentifiers: []integration.AdvancedADIdentifier{}, + }, + }, + { + name: "no fields set", + input: &core.Config{}, + expected: integration.Config{ + AdvancedADIdentifiers: []integration.AdvancedADIdentifier{}, + Instances: []integration.Data{}, + }, + }, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + result := AutodiscoveryConfigFromProtobufConfig(test.input) + assert.Equal(t, test.expected, result) + }) + } +} From a4d7836ee417bf54acab53351610f6fce66cd6dd Mon Sep 17 00:00:00 2001 From: Pierre Gimalac Date: Fri, 6 Dec 2024 11:18:34 +0100 Subject: [PATCH 10/10] fix: handle nil case --- comp/core/autodiscovery/proto/proto.go | 8 ++++++++ comp/core/autodiscovery/proto/proto_test.go | 20 +++++++++++++++----- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/comp/core/autodiscovery/proto/proto.go b/comp/core/autodiscovery/proto/proto.go index da176947767d8..0ba534caebed3 100644 --- a/comp/core/autodiscovery/proto/proto.go +++ b/comp/core/autodiscovery/proto/proto.go @@ -13,6 +13,10 @@ import ( // ProtobufConfigFromAutodiscoveryConfig converts an autodiscovery config to a protobuf config func ProtobufConfigFromAutodiscoveryConfig(config *integration.Config) *core.Config { + if config == nil { + return nil + } + instances := [][]byte{} for _, instance := range config.Instances { @@ -55,6 +59,10 @@ func ProtobufConfigFromAutodiscoveryConfig(config *integration.Config) *core.Con // AutodiscoveryConfigFromProtobufConfig converts a protobuf config to an autodiscovery config func AutodiscoveryConfigFromProtobufConfig(config *core.Config) integration.Config { + if config == nil { + return integration.Config{} + } + instances := []integration.Data{} for _, instance := range config.Instances { diff --git a/comp/core/autodiscovery/proto/proto_test.go b/comp/core/autodiscovery/proto/proto_test.go index 23843f7515d72..6ae1620476d74 100644 --- a/comp/core/autodiscovery/proto/proto_test.go +++ b/comp/core/autodiscovery/proto/proto_test.go @@ -17,12 +17,12 @@ import ( func TestProtobufConfigFromAutodiscoveryConfig(t *testing.T) { tests := []struct { name string - input integration.Config + input *integration.Config expected *core.Config }{ { name: "all fields set", - input: integration.Config{ + input: &integration.Config{ Name: "test_config", Instances: []integration.Data{ []byte("instance1"), @@ -89,7 +89,7 @@ func TestProtobufConfigFromAutodiscoveryConfig(t *testing.T) { }, { name: "some fields set", - input: integration.Config{ + input: &integration.Config{ Name: "test_config", Instances: []integration.Data{ []byte("instance1"), @@ -131,17 +131,22 @@ func TestProtobufConfigFromAutodiscoveryConfig(t *testing.T) { }, { name: "no fields set", - input: integration.Config{}, + input: &integration.Config{}, expected: &core.Config{ Instances: [][]byte{}, AdvancedAdIdentifiers: []*core.AdvancedADIdentifier{}, }, }, + { + "nil", + nil, + nil, + }, } for _, test := range tests { t.Run(test.name, func(t *testing.T) { - result := ProtobufConfigFromAutodiscoveryConfig(&test.input) + result := ProtobufConfigFromAutodiscoveryConfig(test.input) assert.Equal(t, test.expected, result) }) } @@ -270,6 +275,11 @@ func TestAutodiscoveryConfigFromProtobufConfig(t *testing.T) { Instances: []integration.Data{}, }, }, + { + "nil", + nil, + integration.Config{}, + }, } for _, test := range tests {