Skip to content

Commit 49f4ba8

Browse files
ayjrshriram
authored andcommitted
fix mixerclient build with gogoslick_proto_library (#220)
gogoproto options seem to be infectious on dependent protobufs. Make the following changes to enable mixerclient protobufs to be built with gogoslick_proto_library. 1) Mirror attributes.go options into mixerclient protobufs to avoid errors about undefined methods, e.g. `this.Attributes.Equal undefined (type *istio_mixer_v1.Attributes has no field or method Equal)` 2) duplicate proxy.v1.config.IstioService and proxy.v1.config.StringMatch into mixer.v1.config.client to avoid polluting proxy protobufs with gogoproto options. Resulting jsonpb encoding is the same for c++ mixerclient. -
1 parent 3e77698 commit 49f4ba8

File tree

4 files changed

+97
-9
lines changed

4 files changed

+97
-9
lines changed

mixer/v1/config/client/api_spec.proto

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,14 @@ syntax = "proto3";
1616

1717
package istio.mixer.v1.config.client;
1818

19+
import "gogoproto/gogo.proto";
20+
1921
import "mixer/v1/attributes.proto";
20-
import "proxy/v1/config/route_rule.proto";
22+
import "mixer/v1/config/client/service.proto";
23+
24+
option (gogoproto.goproto_getters_all) = false;
25+
option (gogoproto.equal_all) = false;
26+
option (gogoproto.gostring_all) = false;
2127

2228
// HTTPAPISpec defines the canonical configuration for generating
2329
// API-related attributes from HTTP requests based on the method and
@@ -154,7 +160,7 @@ message HTTPAPISpecReference {
154160
//
155161
message HTTPAPISpecBinding {
156162
// REQUIRED. One or more services to map the listed HTTPAPISpec onto.
157-
repeated istio.proxy.v1.config.IstioService services = 1;
163+
repeated IstioService services = 1;
158164

159165
// REQUIRED. One or more HTTPAPISpec references that should be mapped to
160166
// the specified service(s). The aggregate collection of match

mixer/v1/config/client/mixer_filter_config.proto

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,18 @@
1414

1515
syntax = "proto3";
1616

17+
import "gogoproto/gogo.proto";
18+
1719
import "mixer/v1/attributes.proto";
1820
import "mixer/v1/config/client/api_spec.proto";
1921
import "mixer/v1/config/client/quota.proto";
2022

2123
package istio.mixer.v1.config.client;
2224

25+
option (gogoproto.goproto_getters_all) = false;
26+
option (gogoproto.equal_all) = false;
27+
option (gogoproto.gostring_all) = false;
28+
2329
// Defines the per-service mixerclient control configuration.
2430
message MixerControlConfig {
2531
// If true, call Mixer Check.
@@ -62,10 +68,10 @@ message MixerFilterConfig {
6268

6369
// Map of control configuration indexed by destination.service. This
6470
// is used to support per-service configuration for cases where a
65-
// mixerclient serves multiple services.
71+
// mixerclient serves multiple services.
6672
map<string, MixerControlConfig> control_configs = 5;
67-
68-
// Default destination service name if none was specified in the
73+
74+
// Default destination service name if none was specified in the
6975
// client request.
7076
string default_destination_service = 6;
7177

@@ -77,4 +83,7 @@ message MixerFilterConfig {
7783
// Default attributes to forward to upstream. This typically
7884
// includes the "source.ip" and "source.uid" attributes.
7985
Attributes forward_attributes = 8;
86+
87+
// If set to true, disables mixer check calls for TCP connections
88+
bool DisableTCPCheckCalls = 9;
8089
}

mixer/v1/config/client/quota.proto

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,12 @@ syntax = "proto3";
1616

1717
package istio.mixer.v1.config.client;
1818

19-
import "proxy/v1/config/route_rule.proto";
19+
import "gogoproto/gogo.proto";
20+
import "mixer/v1/config/client/service.proto";
21+
22+
option (gogoproto.goproto_getters_all) = false;
23+
option (gogoproto.equal_all) = false;
24+
option (gogoproto.gostring_all) = false;
2025

2126
// Specifies runtime quota rules.
2227
// * Uses Istio attributes to match individual requests
@@ -73,6 +78,19 @@ message QuotaRule {
7378
repeated Quota quotas = 2;
7479
}
7580

81+
// Describes how to match a given string in HTTP headers. Match is
82+
// case-sensitive.
83+
message StringMatch {
84+
oneof match_type {
85+
// exact string match
86+
string exact = 1;
87+
// prefix-based match
88+
string prefix = 2;
89+
// ECMAscript style regex-based match
90+
string regex = 3;
91+
}
92+
}
93+
7694
// Specifies a match clause to match Istio attributes
7795
message AttributeMatch {
7896
// Map of attribute names to StringMatch type.
@@ -85,7 +103,7 @@ message AttributeMatch {
85103
// exact: SOURCE_UID
86104
// request.http_method:
87105
// exact: POST
88-
map<string, istio.proxy.v1.config.StringMatch> clause = 1;
106+
map<string, StringMatch> clause = 1;
89107
}
90108

91109
// Specifies a quota to use with quota name and amount.
@@ -101,7 +119,7 @@ message Quota {
101119
// IstioService.
102120
message QuotaSpecBinding {
103121
// REQUIRED. One or more services to map the listed QuotaSpec onto.
104-
repeated istio.proxy.v1.config.IstioService services = 1;
122+
repeated IstioService services = 1;
105123

106124
message QuotaSpecReference {
107125
// REQUIRED. The short name of the QuotaSpec. This is the resource
@@ -117,4 +135,4 @@ message QuotaSpecBinding {
117135
// the specified service(s). The aggregate collection of match
118136
// conditions defined in the QuotaSpecs should not overlap.
119137
repeated QuotaSpecReference quota_specs = 2;
120-
}
138+
}

mixer/v1/config/client/service.proto

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
// Copyright 2017 Istio 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+
syntax = "proto3";
16+
17+
package istio.mixer.v1.config.client;
18+
19+
import "gogoproto/gogo.proto";
20+
21+
option (gogoproto.goproto_getters_all) = false;
22+
option (gogoproto.equal_all) = false;
23+
option (gogoproto.gostring_all) = false;
24+
25+
// NOTE: this is a duplicate of proxy.v1.config.IstioService from
26+
// proxy/v1/config/route_rules.proto.
27+
//
28+
// Mixer protobufs have gogoproto specific options which are not
29+
// compatiable with the proxy's vanilla protobufs. Ideally, these
30+
// protobuf options be reconciled so fundamental istio concepts and
31+
// types can be shared by components. Until then, make a copy of
32+
// IstioService for mixerclient to use.
33+
34+
// IstioService identifies a service and optionally service version.
35+
// The FQDN of the service is composed from the name, namespace, and implementation-specific domain suffix
36+
// (e.g. on Kubernetes, "reviews" + "default" + "svc.cluster.local" -> "reviews.default.svc.cluster.local").
37+
message IstioService {
38+
// The short name of the service such as "foo".
39+
string name = 1;
40+
41+
// Optional namespace of the service. Defaults to value of metadata namespace field.
42+
string namespace = 2;
43+
44+
// Domain suffix used to construct the service FQDN in implementations that support such specification.
45+
string domain = 3;
46+
47+
// The service FQDN.
48+
string service = 4;
49+
50+
// Optional one or more labels that uniquely identify the service version.
51+
//
52+
// *Note:* When used for a RouteRule destination, labels MUST be empty.
53+
//
54+
map<string, string> labels = 5;
55+
}

0 commit comments

Comments
 (0)