1// Copyright 2021 The gRPC Authors
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15// Local copy of Envoy xDS proto file, used for testing only.
16
17syntax = "proto3";
18
19package envoy.service.status.v3;
20
21import "src/proto/grpc/testing/xds/v3/config_dump.proto";
22import "src/proto/grpc/testing/xds/v3/base.proto";
23
24import "google/protobuf/any.proto";
25import "google/protobuf/timestamp.proto";
26
27
28// CSDS is Client Status Discovery Service. It can be used to get the status of
29// an xDS-compliant client from the management server's point of view. It can
30// also be used to get the current xDS states directly from the client.
31service ClientStatusDiscoveryService {
32  rpc StreamClientStatus(stream ClientStatusRequest) returns (stream ClientStatusResponse) {}
33  rpc FetchClientStatus(ClientStatusRequest) returns (ClientStatusResponse) {}
34}
35
36// Status of a config from a management server view.
37enum ConfigStatus {
38  // Status info is not available/unknown.
39  UNKNOWN = 0;
40
41  // Management server has sent the config to client and received ACK.
42  SYNCED = 1;
43
44  // Config is not sent.
45  NOT_SENT = 2;
46
47  // Management server has sent the config to client but hasn’t received
48  // ACK/NACK.
49  STALE = 3;
50
51  // Management server has sent the config to client but received NACK. The
52  // attached config dump will be the latest config (the rejected one), since
53  // it is the persisted version in the management server.
54  ERROR = 4;
55}
56
57// Request for client status of clients identified by a list of NodeMatchers.
58message ClientStatusRequest {
59  // The node making the csds request.
60  config.core.v3.Node node = 2;
61}
62
63// Detailed config (per xDS) with status.
64// [#next-free-field: 8]
65message PerXdsConfig {
66  // Config status generated by management servers. Will not be present if the
67  // CSDS server is an xDS client.
68  ConfigStatus status = 1;
69
70  oneof per_xds_config {
71    admin.v3.ListenersConfigDump listener_config = 2;
72
73    admin.v3.ClustersConfigDump cluster_config = 3;
74
75    admin.v3.RoutesConfigDump route_config = 4;
76
77    admin.v3.EndpointsConfigDump endpoint_config = 6;
78  }
79}
80
81// All xds configs for a particular client.
82message ClientConfig {
83  // GenericXdsConfig is used to specify the config status and the dump
84  // of any xDS resource identified by their type URL. It is the generalized
85  // version of the now deprecated ListenersConfigDump, ClustersConfigDump etc
86  // [#next-free-field: 10]
87  message GenericXdsConfig {
88    // Type_url represents the fully qualified name of xDS resource type
89    // like envoy.v3.Cluster, envoy.v3.ClusterLoadAssignment etc.
90    string type_url = 1;
91
92    // Name of the xDS resource
93    string name = 2;
94
95    // This is the :ref:`version_info <envoy_v3_api_field_service.discovery.v3.DiscoveryResponse.version_info>`
96    // in the last processed xDS discovery response. If there are only
97    // static bootstrap listeners, this field will be ""
98    string version_info = 3;
99
100    // The xDS resource config. Actual content depends on the type
101    google.protobuf.Any xds_config = 4;
102
103    // Timestamp when the xDS resource was last updated
104    google.protobuf.Timestamp last_updated = 5;
105
106    // Per xDS resource config status. It is generated by management servers.
107    // It will not be present if the CSDS server is an xDS client.
108    ConfigStatus config_status = 6;
109
110    // Per xDS resource status from the view of a xDS client
111    admin.v3.ClientResourceStatus client_status = 7;
112
113    // Set if the last update failed, cleared after the next successful
114    // update. The *error_state* field contains the rejected version of
115    // this particular resource along with the reason and timestamp. For
116    // successfully updated or acknowledged resource, this field should
117    // be empty.
118    admin.v3.UpdateFailureState error_state = 8;
119
120    // Is static resource is true if it is specified in the config supplied
121    // through the file at the startup.
122    bool is_static_resource = 9;
123  }
124
125  // Node for a particular client.
126  config.core.v3.Node node = 1;
127
128  // This field is deprecated in favor of generic_xds_configs which is
129  // much simpler and uniform in structure.
130  repeated PerXdsConfig xds_config = 2 [deprecated = true];
131
132  // Represents generic xDS config and the exact config structure depends on
133  // the type URL (like Cluster if it is CDS)
134  repeated GenericXdsConfig generic_xds_configs = 3;
135}
136
137message ClientStatusResponse {
138  // Client configs for the clients specified in the ClientStatusRequest.
139  repeated ClientConfig config = 1;
140}
141