This is an automated email from the ASF dual-hosted git repository.
zhongxjian pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo-kubernetes.git
The following commit(s) were added to refs/heads/master by this push:
new d5768c73 Update networking api (#838)
d5768c73 is described below
commit d5768c7379c0b04325700c6b80a09fb467d1569e
Author: mfordjody <[email protected]>
AuthorDate: Sun Jan 4 22:50:30 2026 +0800
Update networking api (#838)
---
api/google/api/field_behavior.proto | 79 ++++
api/networking/v1alpha3/destination_rule.pb.go | 405 +++++++++++++++++++++
api/networking/v1alpha3/destination_rule.proto | 52 ++-
.../v1alpha3/destination_rule_deepcopy.gen.go | 90 +++++
.../v1alpha3/destination_rule_json.gen.go | 56 +++
api/networking/v1alpha3/virtual_service.pb.go | 327 +++++++++++++++++
api/networking/v1alpha3/virtual_service.proto | 41 ++-
.../v1alpha3/virtual_service_deepcopy.gen.go | 90 +++++
.../v1alpha3/virtual_service_json.gen.go | 56 +++
dubbod/planet/pkg/bootstrap/config_controller.go | 2 +-
dubbod/planet/pkg/bootstrap/server.go | 10 +-
dubbod/planet/pkg/config/kube/crdclient/client.go | 4 +-
dubbod/planet/pkg/config/kube/crdclient/types.go | 60 +--
dubbod/planet/pkg/model/destinationrule.go | 2 +-
dubbod/planet/pkg/model/push_context.go | 118 +++---
.../model/{serviceroute.go => virtualservice.go} | 14 +-
dubbod/planet/pkg/networking/grpcgen/cds.go | 2 +-
dubbod/planet/pkg/networking/grpcgen/rds.go | 18 +-
dubbod/planet/pkg/xds/eds.go | 2 +-
manifests/charts/base/files/crd-all.yaml | 12 +-
pkg/config/schema/collections/collections.agent.go | 34 +-
pkg/config/schema/collections/collections.go | 34 +-
pkg/config/schema/gvk/resources.go | 10 +-
pkg/config/schema/gvr/resources.go | 4 +-
pkg/config/schema/kind/resources.go | 6 +-
pkg/config/schema/kubeclient/resources.go | 8 +-
pkg/config/schema/kubetypes/resources.go | 2 +-
pkg/xds/server.go | 2 +-
samples/grpc-app/README.md | 2 +-
29 files changed, 1367 insertions(+), 175 deletions(-)
diff --git a/api/google/api/field_behavior.proto
b/api/google/api/field_behavior.proto
new file mode 100644
index 00000000..eb7f78ef
--- /dev/null
+++ b/api/google/api/field_behavior.proto
@@ -0,0 +1,79 @@
+// Copyright 2019 Google LLC.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+syntax = "proto3";
+
+package google.api;
+
+import "google/protobuf/descriptor.proto";
+
+option go_package =
"google.golang.org/genproto/googleapis/api/annotations;annotations";
+option java_multiple_files = true;
+option java_outer_classname = "FieldBehaviorProto";
+option java_package = "com.google.api";
+option objc_class_prefix = "GAPI";
+
+extend google.protobuf.FieldOptions {
+ // A designation of a specific field behavior (required, output only, etc.)
+ // in protobuf messages.
+ //
+ // Examples:
+ //
+ // string name = 1 [(google.api.field_behavior) = REQUIRED];
+ // State state = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
+ // google.protobuf.Duration ttl = 1
+ // [(google.api.field_behavior) = INPUT_ONLY];
+ // google.protobuf.Timestamp expire_time = 1
+ // [(google.api.field_behavior) = OUTPUT_ONLY,
+ // (google.api.field_behavior) = IMMUTABLE];
+ repeated google.api.FieldBehavior field_behavior = 1052;
+}
+
+// An indicator of the behavior of a given field (for example, that a field
+// is required in requests, or given as output but ignored as input).
+// This **does not** change the behavior in protocol buffers itself; it only
+// denotes the behavior and may affect how API tooling handles the field.
+//
+// Note: This enum **may** receive new values in the future.
+enum FieldBehavior {
+ // Conventional default for enums. Do not use this.
+ FIELD_BEHAVIOR_UNSPECIFIED = 0;
+
+ // Specifically denotes a field as optional.
+ // While all fields in protocol buffers are optional, this may be specified
+ // for emphasis if appropriate.
+ OPTIONAL = 1;
+
+ // Denotes a field as required.
+ // This indicates that the field **must** be provided as part of the request,
+ // and failure to do so will cause an error (usually `INVALID_ARGUMENT`).
+ REQUIRED = 2;
+
+ // Denotes a field as output only.
+ // This indicates that the field is provided in responses, but including the
+ // field in a request does nothing (the server *must* ignore it and
+ // *must not* throw an error as a result of the field's presence).
+ OUTPUT_ONLY = 3;
+
+ // Denotes a field as input only.
+ // This indicates that the field is provided in requests, and the
+ // corresponding field is not included in output.
+ INPUT_ONLY = 4;
+
+ // Denotes a field as immutable.
+ // This indicates that the field may be set once in a request to create a
+ // resource, but may not be changed thereafter.
+ IMMUTABLE = 5;
+}
diff --git a/api/networking/v1alpha3/destination_rule.pb.go
b/api/networking/v1alpha3/destination_rule.pb.go
new file mode 100644
index 00000000..587bbd24
--- /dev/null
+++ b/api/networking/v1alpha3/destination_rule.pb.go
@@ -0,0 +1,405 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// Code generated by protoc-gen-go. DO NOT EDIT.
+// versions:
+// protoc-gen-go v1.36.10
+// protoc v6.33.0
+// source: networking/v1alpha3/destination_rule.proto
+
+// $schema: dubbo.networking.v1alpha3.DestinationRule
+// $title: Destination Rule
+
+package v1alpha3
+
+import (
+ _ "google.golang.org/genproto/googleapis/api/annotations"
+ protoreflect "google.golang.org/protobuf/reflect/protoreflect"
+ protoimpl "google.golang.org/protobuf/runtime/protoimpl"
+ _ "google.golang.org/protobuf/types/known/durationpb"
+ _ "google.golang.org/protobuf/types/known/wrapperspb"
+ reflect "reflect"
+ sync "sync"
+ unsafe "unsafe"
+)
+
+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 ClientTLSSettings_TLSmode int32
+
+const (
+ ClientTLSSettings_DISABLE ClientTLSSettings_TLSmode = 0
+ // TODO Not yet implemented
+ ClientTLSSettings_MUTUAL ClientTLSSettings_TLSmode = 1
+ ClientTLSSettings_DUBBO_MUTUAL ClientTLSSettings_TLSmode = 2
+)
+
+// Enum value maps for ClientTLSSettings_TLSmode.
+var (
+ ClientTLSSettings_TLSmode_name = map[int32]string{
+ 0: "DISABLE",
+ 1: "MUTUAL",
+ 2: "DUBBO_MUTUAL",
+ }
+ ClientTLSSettings_TLSmode_value = map[string]int32{
+ "DISABLE": 0,
+ "MUTUAL": 1,
+ "DUBBO_MUTUAL": 2,
+ }
+)
+
+func (x ClientTLSSettings_TLSmode) Enum() *ClientTLSSettings_TLSmode {
+ p := new(ClientTLSSettings_TLSmode)
+ *p = x
+ return p
+}
+
+func (x ClientTLSSettings_TLSmode) String() string {
+ return protoimpl.X.EnumStringOf(x.Descriptor(),
protoreflect.EnumNumber(x))
+}
+
+func (ClientTLSSettings_TLSmode) Descriptor() protoreflect.EnumDescriptor {
+ return
file_networking_v1alpha3_destination_rule_proto_enumTypes[0].Descriptor()
+}
+
+func (ClientTLSSettings_TLSmode) Type() protoreflect.EnumType {
+ return &file_networking_v1alpha3_destination_rule_proto_enumTypes[0]
+}
+
+func (x ClientTLSSettings_TLSmode) Number() protoreflect.EnumNumber {
+ return protoreflect.EnumNumber(x)
+}
+
+// Deprecated: Use ClientTLSSettings_TLSmode.Descriptor instead.
+func (ClientTLSSettings_TLSmode) EnumDescriptor() ([]byte, []int) {
+ return file_networking_v1alpha3_destination_rule_proto_rawDescGZIP(),
[]int{3, 0}
+}
+
+// <!-- go code generation tags
+// +kubetype-gen
+// +kubetype-gen:groupVersion=networking.dubbo.apache.org/v1alpha3
+// +genclient
+// +k8s:deepcopy-gen=true
+// -->
+type DestinationRule struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ Host string
`protobuf:"bytes,1,opt,name=host,proto3" json:"host,omitempty"`
+ TrafficPolicy *TrafficPolicy
`protobuf:"bytes,2,opt,name=traffic_policy,json=trafficPolicy,proto3"
json:"traffic_policy,omitempty"`
+ Subsets []*Subset
`protobuf:"bytes,3,rep,name=subsets,proto3" json:"subsets,omitempty"`
+ ExportTo []string
`protobuf:"bytes,4,rep,name=export_to,json=exportTo,proto3"
json:"export_to,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *DestinationRule) Reset() {
+ *x = DestinationRule{}
+ mi := &file_networking_v1alpha3_destination_rule_proto_msgTypes[0]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *DestinationRule) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*DestinationRule) ProtoMessage() {}
+
+func (x *DestinationRule) ProtoReflect() protoreflect.Message {
+ mi := &file_networking_v1alpha3_destination_rule_proto_msgTypes[0]
+ if x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use DestinationRule.ProtoReflect.Descriptor instead.
+func (*DestinationRule) Descriptor() ([]byte, []int) {
+ return file_networking_v1alpha3_destination_rule_proto_rawDescGZIP(),
[]int{0}
+}
+
+func (x *DestinationRule) GetHost() string {
+ if x != nil {
+ return x.Host
+ }
+ return ""
+}
+
+func (x *DestinationRule) GetTrafficPolicy() *TrafficPolicy {
+ if x != nil {
+ return x.TrafficPolicy
+ }
+ return nil
+}
+
+func (x *DestinationRule) GetSubsets() []*Subset {
+ if x != nil {
+ return x.Subsets
+ }
+ return nil
+}
+
+func (x *DestinationRule) GetExportTo() []string {
+ if x != nil {
+ return x.ExportTo
+ }
+ return nil
+}
+
+type TrafficPolicy struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ Tls *ClientTLSSettings
`protobuf:"bytes,4,opt,name=tls,proto3" json:"tls,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *TrafficPolicy) Reset() {
+ *x = TrafficPolicy{}
+ mi := &file_networking_v1alpha3_destination_rule_proto_msgTypes[1]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *TrafficPolicy) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*TrafficPolicy) ProtoMessage() {}
+
+func (x *TrafficPolicy) ProtoReflect() protoreflect.Message {
+ mi := &file_networking_v1alpha3_destination_rule_proto_msgTypes[1]
+ if x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use TrafficPolicy.ProtoReflect.Descriptor instead.
+func (*TrafficPolicy) Descriptor() ([]byte, []int) {
+ return file_networking_v1alpha3_destination_rule_proto_rawDescGZIP(),
[]int{1}
+}
+
+func (x *TrafficPolicy) GetTls() *ClientTLSSettings {
+ if x != nil {
+ return x.Tls
+ }
+ return nil
+}
+
+type Subset struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ Name string
`protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+ Labels map[string]string
`protobuf:"bytes,2,rep,name=labels,proto3" json:"labels,omitempty"
protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
+ TrafficPolicy *TrafficPolicy
`protobuf:"bytes,3,opt,name=traffic_policy,json=trafficPolicy,proto3"
json:"traffic_policy,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *Subset) Reset() {
+ *x = Subset{}
+ mi := &file_networking_v1alpha3_destination_rule_proto_msgTypes[2]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *Subset) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Subset) ProtoMessage() {}
+
+func (x *Subset) ProtoReflect() protoreflect.Message {
+ mi := &file_networking_v1alpha3_destination_rule_proto_msgTypes[2]
+ if x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Subset.ProtoReflect.Descriptor instead.
+func (*Subset) Descriptor() ([]byte, []int) {
+ return file_networking_v1alpha3_destination_rule_proto_rawDescGZIP(),
[]int{2}
+}
+
+func (x *Subset) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *Subset) GetLabels() map[string]string {
+ if x != nil {
+ return x.Labels
+ }
+ return nil
+}
+
+func (x *Subset) GetTrafficPolicy() *TrafficPolicy {
+ if x != nil {
+ return x.TrafficPolicy
+ }
+ return nil
+}
+
+type ClientTLSSettings struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ Mode ClientTLSSettings_TLSmode
`protobuf:"varint,1,opt,name=mode,proto3,enum=dubbo.networking.v1alpha3.ClientTLSSettings_TLSmode"
json:"mode,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *ClientTLSSettings) Reset() {
+ *x = ClientTLSSettings{}
+ mi := &file_networking_v1alpha3_destination_rule_proto_msgTypes[3]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *ClientTLSSettings) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ClientTLSSettings) ProtoMessage() {}
+
+func (x *ClientTLSSettings) ProtoReflect() protoreflect.Message {
+ mi := &file_networking_v1alpha3_destination_rule_proto_msgTypes[3]
+ if x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use ClientTLSSettings.ProtoReflect.Descriptor instead.
+func (*ClientTLSSettings) Descriptor() ([]byte, []int) {
+ return file_networking_v1alpha3_destination_rule_proto_rawDescGZIP(),
[]int{3}
+}
+
+func (x *ClientTLSSettings) GetMode() ClientTLSSettings_TLSmode {
+ if x != nil {
+ return x.Mode
+ }
+ return ClientTLSSettings_DISABLE
+}
+
+var File_networking_v1alpha3_destination_rule_proto protoreflect.FileDescriptor
+
+const file_networking_v1alpha3_destination_rule_proto_rawDesc = "" +
+ "\n" +
+
"*networking/v1alpha3/destination_rule.proto\x12\x19dubbo.networking.v1alpha3\x1a\x1fgoogle/api/field_behavior.proto\x1a\x1egoogle/protobuf/duration.proto\x1a\x1egoogle/protobuf/wrappers.proto\x1a)networking/v1alpha3/virtual_service.proto\"\xd6\x01\n"
+
+ "\x0fDestinationRule\x12\x18\n" +
+ "\x04host\x18\x01 \x01(\tB\x04\xe2A\x01\x02R\x04host\x12O\n" +
+ "\x0etraffic_policy\x18\x02
\x01(\v2(.dubbo.networking.v1alpha3.TrafficPolicyR\rtrafficPolicy\x12;\n" +
+ "\asubsets\x18\x03
\x03(\v2!.dubbo.networking.v1alpha3.SubsetR\asubsets\x12\x1b\n" +
+ "\texport_to\x18\x04 \x03(\tR\bexportTo\"O\n" +
+ "\rTrafficPolicy\x12>\n" +
+ "\x03tls\x18\x04
\x01(\v2,.dubbo.networking.v1alpha3.ClientTLSSettingsR\x03tls\"\xf5\x01\n" +
+ "\x06Subset\x12\x18\n" +
+ "\x04name\x18\x01 \x01(\tB\x04\xe2A\x01\x02R\x04name\x12E\n" +
+ "\x06labels\x18\x02
\x03(\v2-.dubbo.networking.v1alpha3.Subset.LabelsEntryR\x06labels\x12O\n" +
+ "\x0etraffic_policy\x18\x03
\x01(\v2(.dubbo.networking.v1alpha3.TrafficPolicyR\rtrafficPolicy\x1a9\n" +
+ "\vLabelsEntry\x12\x10\n" +
+ "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" +
+ "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"\x93\x01\n" +
+ "\x11ClientTLSSettings\x12H\n" +
+ "\x04mode\x18\x01
\x01(\x0e24.dubbo.networking.v1alpha3.ClientTLSSettings.TLSmodeR\x04mode\"4\n" +
+ "\aTLSmode\x12\v\n" +
+ "\aDISABLE\x10\x00\x12\n" +
+ "\n" +
+ "\x06MUTUAL\x10\x01\x12\x10\n" +
+ "\fDUBBO_MUTUAL\x10\x02B\x1aZ\x18/api/networking/v1alpha3b\x06proto3"
+
+var (
+ file_networking_v1alpha3_destination_rule_proto_rawDescOnce sync.Once
+ file_networking_v1alpha3_destination_rule_proto_rawDescData []byte
+)
+
+func file_networking_v1alpha3_destination_rule_proto_rawDescGZIP() []byte {
+ file_networking_v1alpha3_destination_rule_proto_rawDescOnce.Do(func() {
+ file_networking_v1alpha3_destination_rule_proto_rawDescData =
protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_networking_v1alpha3_destination_rule_proto_rawDesc),
len(file_networking_v1alpha3_destination_rule_proto_rawDesc)))
+ })
+ return file_networking_v1alpha3_destination_rule_proto_rawDescData
+}
+
+var file_networking_v1alpha3_destination_rule_proto_enumTypes =
make([]protoimpl.EnumInfo, 1)
+var file_networking_v1alpha3_destination_rule_proto_msgTypes =
make([]protoimpl.MessageInfo, 5)
+var file_networking_v1alpha3_destination_rule_proto_goTypes = []any{
+ (ClientTLSSettings_TLSmode)(0), // 0:
dubbo.networking.v1alpha3.ClientTLSSettings.TLSmode
+ (*DestinationRule)(nil), // 1:
dubbo.networking.v1alpha3.DestinationRule
+ (*TrafficPolicy)(nil), // 2:
dubbo.networking.v1alpha3.TrafficPolicy
+ (*Subset)(nil), // 3: dubbo.networking.v1alpha3.Subset
+ (*ClientTLSSettings)(nil), // 4:
dubbo.networking.v1alpha3.ClientTLSSettings
+ nil, // 5:
dubbo.networking.v1alpha3.Subset.LabelsEntry
+}
+var file_networking_v1alpha3_destination_rule_proto_depIdxs = []int32{
+ 2, // 0:
dubbo.networking.v1alpha3.DestinationRule.traffic_policy:type_name ->
dubbo.networking.v1alpha3.TrafficPolicy
+ 3, // 1: dubbo.networking.v1alpha3.DestinationRule.subsets:type_name ->
dubbo.networking.v1alpha3.Subset
+ 4, // 2: dubbo.networking.v1alpha3.TrafficPolicy.tls:type_name ->
dubbo.networking.v1alpha3.ClientTLSSettings
+ 5, // 3: dubbo.networking.v1alpha3.Subset.labels:type_name ->
dubbo.networking.v1alpha3.Subset.LabelsEntry
+ 2, // 4: dubbo.networking.v1alpha3.Subset.traffic_policy:type_name ->
dubbo.networking.v1alpha3.TrafficPolicy
+ 0, // 5: dubbo.networking.v1alpha3.ClientTLSSettings.mode:type_name ->
dubbo.networking.v1alpha3.ClientTLSSettings.TLSmode
+ 6, // [6:6] is the sub-list for method output_type
+ 6, // [6:6] is the sub-list for method input_type
+ 6, // [6:6] is the sub-list for extension type_name
+ 6, // [6:6] is the sub-list for extension extendee
+ 0, // [0:6] is the sub-list for field type_name
+}
+
+func init() { file_networking_v1alpha3_destination_rule_proto_init() }
+func file_networking_v1alpha3_destination_rule_proto_init() {
+ if File_networking_v1alpha3_destination_rule_proto != nil {
+ return
+ }
+ file_networking_v1alpha3_virtual_service_proto_init()
+ type x struct{}
+ out := protoimpl.TypeBuilder{
+ File: protoimpl.DescBuilder{
+ GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
+ RawDescriptor:
unsafe.Slice(unsafe.StringData(file_networking_v1alpha3_destination_rule_proto_rawDesc),
len(file_networking_v1alpha3_destination_rule_proto_rawDesc)),
+ NumEnums: 1,
+ NumMessages: 5,
+ NumExtensions: 0,
+ NumServices: 0,
+ },
+ GoTypes:
file_networking_v1alpha3_destination_rule_proto_goTypes,
+ DependencyIndexes:
file_networking_v1alpha3_destination_rule_proto_depIdxs,
+ EnumInfos:
file_networking_v1alpha3_destination_rule_proto_enumTypes,
+ MessageInfos:
file_networking_v1alpha3_destination_rule_proto_msgTypes,
+ }.Build()
+ File_networking_v1alpha3_destination_rule_proto = out.File
+ file_networking_v1alpha3_destination_rule_proto_goTypes = nil
+ file_networking_v1alpha3_destination_rule_proto_depIdxs = nil
+}
diff --git a/api/networking/v1alpha3/destination_rule.proto
b/api/networking/v1alpha3/destination_rule.proto
index a6f66394..154044c3 100644
--- a/api/networking/v1alpha3/destination_rule.proto
+++ b/api/networking/v1alpha3/destination_rule.proto
@@ -12,4 +12,54 @@
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
-// limitations under the License.
\ No newline at end of file
+// limitations under the License.
+
+syntax = "proto3";
+
+// $schema: dubbo.networking.v1alpha3.DestinationRule
+// $title: Destination Rule
+
+package dubbo.networking.v1alpha3;
+
+import "google/api/field_behavior.proto";
+import "google/protobuf/duration.proto";
+import "google/protobuf/wrappers.proto";
+import "networking/v1alpha3/virtual_service.proto";
+
+option go_package = "/api/networking/v1alpha3";
+
+//
+// <!-- go code generation tags
+// +kubetype-gen
+// +kubetype-gen:groupVersion=networking.dubbo.apache.org/v1alpha3
+// +genclient
+// +k8s:deepcopy-gen=true
+// -->
+message DestinationRule {
+ string host = 1 [(google.api.field_behavior) = REQUIRED];
+ TrafficPolicy traffic_policy = 2;
+ repeated Subset subsets = 3;
+ repeated string export_to = 4;
+}
+
+message TrafficPolicy {
+ ClientTLSSettings tls = 4;
+}
+
+message Subset {
+ string name = 1 [(google.api.field_behavior) = REQUIRED];
+ map<string, string> labels = 2;
+ TrafficPolicy traffic_policy = 3;
+}
+
+message ClientTLSSettings {
+ enum TLSmode {
+ DISABLE = 0;
+ // TODO Not yet implemented
+ MUTUAL = 1;
+ DUBBO_MUTUAL = 2;
+ }
+ TLSmode mode = 1;
+}
+
+
diff --git a/api/networking/v1alpha3/destination_rule_deepcopy.gen.go
b/api/networking/v1alpha3/destination_rule_deepcopy.gen.go
new file mode 100644
index 00000000..28559d2b
--- /dev/null
+++ b/api/networking/v1alpha3/destination_rule_deepcopy.gen.go
@@ -0,0 +1,90 @@
+// Code generated by protoc-gen-deepcopy. DO NOT EDIT.
+package v1alpha3
+
+import (
+ proto "google.golang.org/protobuf/proto"
+)
+
+// DeepCopyInto supports using DestinationRule within kubernetes types, where
deepcopy-gen is used.
+func (in *DestinationRule) DeepCopyInto(out *DestinationRule) {
+ p := proto.Clone(in).(*DestinationRule)
+ *out = *p
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver,
creating a new DestinationRule. Required by controller-gen.
+func (in *DestinationRule) DeepCopy() *DestinationRule {
+ if in == nil {
+ return nil
+ }
+ out := new(DestinationRule)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyInterface is an autogenerated deepcopy function, copying the
receiver, creating a new DestinationRule. Required by controller-gen.
+func (in *DestinationRule) DeepCopyInterface() interface{} {
+ return in.DeepCopy()
+}
+
+// DeepCopyInto supports using TrafficPolicy within kubernetes types, where
deepcopy-gen is used.
+func (in *TrafficPolicy) DeepCopyInto(out *TrafficPolicy) {
+ p := proto.Clone(in).(*TrafficPolicy)
+ *out = *p
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver,
creating a new TrafficPolicy. Required by controller-gen.
+func (in *TrafficPolicy) DeepCopy() *TrafficPolicy {
+ if in == nil {
+ return nil
+ }
+ out := new(TrafficPolicy)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyInterface is an autogenerated deepcopy function, copying the
receiver, creating a new TrafficPolicy. Required by controller-gen.
+func (in *TrafficPolicy) DeepCopyInterface() interface{} {
+ return in.DeepCopy()
+}
+
+// DeepCopyInto supports using Subset within kubernetes types, where
deepcopy-gen is used.
+func (in *Subset) DeepCopyInto(out *Subset) {
+ p := proto.Clone(in).(*Subset)
+ *out = *p
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver,
creating a new Subset. Required by controller-gen.
+func (in *Subset) DeepCopy() *Subset {
+ if in == nil {
+ return nil
+ }
+ out := new(Subset)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyInterface is an autogenerated deepcopy function, copying the
receiver, creating a new Subset. Required by controller-gen.
+func (in *Subset) DeepCopyInterface() interface{} {
+ return in.DeepCopy()
+}
+
+// DeepCopyInto supports using ClientTLSSettings within kubernetes types,
where deepcopy-gen is used.
+func (in *ClientTLSSettings) DeepCopyInto(out *ClientTLSSettings) {
+ p := proto.Clone(in).(*ClientTLSSettings)
+ *out = *p
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver,
creating a new ClientTLSSettings. Required by controller-gen.
+func (in *ClientTLSSettings) DeepCopy() *ClientTLSSettings {
+ if in == nil {
+ return nil
+ }
+ out := new(ClientTLSSettings)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyInterface is an autogenerated deepcopy function, copying the
receiver, creating a new ClientTLSSettings. Required by controller-gen.
+func (in *ClientTLSSettings) DeepCopyInterface() interface{} {
+ return in.DeepCopy()
+}
diff --git a/api/networking/v1alpha3/destination_rule_json.gen.go
b/api/networking/v1alpha3/destination_rule_json.gen.go
new file mode 100644
index 00000000..22a30376
--- /dev/null
+++ b/api/networking/v1alpha3/destination_rule_json.gen.go
@@ -0,0 +1,56 @@
+// Code generated by protoc-gen-jsonshim. DO NOT EDIT.
+package v1alpha3
+
+import (
+ bytes "bytes"
+ jsonpb "github.com/golang/protobuf/jsonpb"
+)
+
+// MarshalJSON is a custom marshaler for DestinationRule
+func (this *DestinationRule) MarshalJSON() ([]byte, error) {
+ str, err := DestinationRuleMarshaler.MarshalToString(this)
+ return []byte(str), err
+}
+
+// UnmarshalJSON is a custom unmarshaler for DestinationRule
+func (this *DestinationRule) UnmarshalJSON(b []byte) error {
+ return DestinationRuleUnmarshaler.Unmarshal(bytes.NewReader(b), this)
+}
+
+// MarshalJSON is a custom marshaler for TrafficPolicy
+func (this *TrafficPolicy) MarshalJSON() ([]byte, error) {
+ str, err := DestinationRuleMarshaler.MarshalToString(this)
+ return []byte(str), err
+}
+
+// UnmarshalJSON is a custom unmarshaler for TrafficPolicy
+func (this *TrafficPolicy) UnmarshalJSON(b []byte) error {
+ return DestinationRuleUnmarshaler.Unmarshal(bytes.NewReader(b), this)
+}
+
+// MarshalJSON is a custom marshaler for Subset
+func (this *Subset) MarshalJSON() ([]byte, error) {
+ str, err := DestinationRuleMarshaler.MarshalToString(this)
+ return []byte(str), err
+}
+
+// UnmarshalJSON is a custom unmarshaler for Subset
+func (this *Subset) UnmarshalJSON(b []byte) error {
+ return DestinationRuleUnmarshaler.Unmarshal(bytes.NewReader(b), this)
+}
+
+// MarshalJSON is a custom marshaler for ClientTLSSettings
+func (this *ClientTLSSettings) MarshalJSON() ([]byte, error) {
+ str, err := DestinationRuleMarshaler.MarshalToString(this)
+ return []byte(str), err
+}
+
+// UnmarshalJSON is a custom unmarshaler for ClientTLSSettings
+func (this *ClientTLSSettings) UnmarshalJSON(b []byte) error {
+ return DestinationRuleUnmarshaler.Unmarshal(bytes.NewReader(b), this)
+}
+
+var (
+ DestinationRuleMarshaler = &jsonpb.Marshaler{}
+ DestinationRuleUnmarshaler = &jsonpb.Unmarshaler{AllowUnknownFields:
true}
+)
diff --git a/api/networking/v1alpha3/virtual_service.pb.go
b/api/networking/v1alpha3/virtual_service.pb.go
new file mode 100644
index 00000000..5f92d8a1
--- /dev/null
+++ b/api/networking/v1alpha3/virtual_service.pb.go
@@ -0,0 +1,327 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// Code generated by protoc-gen-go. DO NOT EDIT.
+// versions:
+// protoc-gen-go v1.36.10
+// protoc v6.33.0
+// source: networking/v1alpha3/virtual_service.proto
+
+package v1alpha3
+
+import (
+ _ "google.golang.org/genproto/googleapis/api/annotations"
+ protoreflect "google.golang.org/protobuf/reflect/protoreflect"
+ protoimpl "google.golang.org/protobuf/runtime/protoimpl"
+ _ "google.golang.org/protobuf/types/known/durationpb"
+ _ "google.golang.org/protobuf/types/known/wrapperspb"
+ reflect "reflect"
+ sync "sync"
+ unsafe "unsafe"
+)
+
+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)
+)
+
+// <!-- go code generation tags
+// +kubetype-gen
+// +kubetype-gen:groupVersion=networking.dubbo.apache.org/v1alpha3
+// +genclient
+// +k8s:deepcopy-gen=true
+// -->
+type VirtualService struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ Hosts []string
`protobuf:"bytes,1,rep,name=hosts,proto3" json:"hosts,omitempty"`
+ Http []*HTTPRoute
`protobuf:"bytes,2,rep,name=http,proto3" json:"http,omitempty"`
+ ExportTo []string
`protobuf:"bytes,3,rep,name=export_to,json=exportTo,proto3"
json:"export_to,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *VirtualService) Reset() {
+ *x = VirtualService{}
+ mi := &file_networking_v1alpha3_virtual_service_proto_msgTypes[0]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *VirtualService) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*VirtualService) ProtoMessage() {}
+
+func (x *VirtualService) ProtoReflect() protoreflect.Message {
+ mi := &file_networking_v1alpha3_virtual_service_proto_msgTypes[0]
+ if x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use VirtualService.ProtoReflect.Descriptor instead.
+func (*VirtualService) Descriptor() ([]byte, []int) {
+ return file_networking_v1alpha3_virtual_service_proto_rawDescGZIP(),
[]int{0}
+}
+
+func (x *VirtualService) GetHosts() []string {
+ if x != nil {
+ return x.Hosts
+ }
+ return nil
+}
+
+func (x *VirtualService) GetHttp() []*HTTPRoute {
+ if x != nil {
+ return x.Http
+ }
+ return nil
+}
+
+func (x *VirtualService) GetExportTo() []string {
+ if x != nil {
+ return x.ExportTo
+ }
+ return nil
+}
+
+type Destination struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ Host string
`protobuf:"bytes,1,opt,name=host,proto3" json:"host,omitempty"`
+ Subset string
`protobuf:"bytes,2,opt,name=subset,proto3" json:"subset,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *Destination) Reset() {
+ *x = Destination{}
+ mi := &file_networking_v1alpha3_virtual_service_proto_msgTypes[1]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *Destination) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Destination) ProtoMessage() {}
+
+func (x *Destination) ProtoReflect() protoreflect.Message {
+ mi := &file_networking_v1alpha3_virtual_service_proto_msgTypes[1]
+ if x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Destination.ProtoReflect.Descriptor instead.
+func (*Destination) Descriptor() ([]byte, []int) {
+ return file_networking_v1alpha3_virtual_service_proto_rawDescGZIP(),
[]int{1}
+}
+
+func (x *Destination) GetHost() string {
+ if x != nil {
+ return x.Host
+ }
+ return ""
+}
+
+func (x *Destination) GetSubset() string {
+ if x != nil {
+ return x.Subset
+ }
+ return ""
+}
+
+type HTTPRoute struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ Route []*HTTPRouteDestination
`protobuf:"bytes,1,rep,name=route,proto3" json:"route,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *HTTPRoute) Reset() {
+ *x = HTTPRoute{}
+ mi := &file_networking_v1alpha3_virtual_service_proto_msgTypes[2]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *HTTPRoute) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*HTTPRoute) ProtoMessage() {}
+
+func (x *HTTPRoute) ProtoReflect() protoreflect.Message {
+ mi := &file_networking_v1alpha3_virtual_service_proto_msgTypes[2]
+ if x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use HTTPRoute.ProtoReflect.Descriptor instead.
+func (*HTTPRoute) Descriptor() ([]byte, []int) {
+ return file_networking_v1alpha3_virtual_service_proto_rawDescGZIP(),
[]int{2}
+}
+
+func (x *HTTPRoute) GetRoute() []*HTTPRouteDestination {
+ if x != nil {
+ return x.Route
+ }
+ return nil
+}
+
+type HTTPRouteDestination struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ Destination *Destination
`protobuf:"bytes,1,opt,name=destination,proto3" json:"destination,omitempty"`
+ Weight int32
`protobuf:"varint,2,opt,name=weight,proto3" json:"weight,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *HTTPRouteDestination) Reset() {
+ *x = HTTPRouteDestination{}
+ mi := &file_networking_v1alpha3_virtual_service_proto_msgTypes[3]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *HTTPRouteDestination) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*HTTPRouteDestination) ProtoMessage() {}
+
+func (x *HTTPRouteDestination) ProtoReflect() protoreflect.Message {
+ mi := &file_networking_v1alpha3_virtual_service_proto_msgTypes[3]
+ if x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use HTTPRouteDestination.ProtoReflect.Descriptor instead.
+func (*HTTPRouteDestination) Descriptor() ([]byte, []int) {
+ return file_networking_v1alpha3_virtual_service_proto_rawDescGZIP(),
[]int{3}
+}
+
+func (x *HTTPRouteDestination) GetDestination() *Destination {
+ if x != nil {
+ return x.Destination
+ }
+ return nil
+}
+
+func (x *HTTPRouteDestination) GetWeight() int32 {
+ if x != nil {
+ return x.Weight
+ }
+ return 0
+}
+
+var File_networking_v1alpha3_virtual_service_proto protoreflect.FileDescriptor
+
+const file_networking_v1alpha3_virtual_service_proto_rawDesc = "" +
+ "\n" +
+
")networking/v1alpha3/virtual_service.proto\x12\x19dubbo.networking.v1alpha3\x1a\x1fgoogle/api/field_behavior.proto\x1a\x1egoogle/protobuf/duration.proto\x1a\x1egoogle/protobuf/wrappers.proto\"}\n"
+
+ "\x0eVirtualService\x12\x14\n" +
+ "\x05hosts\x18\x01 \x03(\tR\x05hosts\x128\n" +
+ "\x04http\x18\x02
\x03(\v2$.dubbo.networking.v1alpha3.HTTPRouteR\x04http\x12\x1b\n" +
+ "\texport_to\x18\x03 \x03(\tR\bexportTo\"?\n" +
+ "\vDestination\x12\x18\n" +
+ "\x04host\x18\x01 \x01(\tB\x04\xe2A\x01\x02R\x04host\x12\x16\n" +
+ "\x06subset\x18\x02 \x01(\tR\x06subset\"R\n" +
+ "\tHTTPRoute\x12E\n" +
+ "\x05route\x18\x01
\x03(\v2/.dubbo.networking.v1alpha3.HTTPRouteDestinationR\x05route\"~\n" +
+ "\x14HTTPRouteDestination\x12N\n" +
+ "\vdestination\x18\x01
\x01(\v2&.dubbo.networking.v1alpha3.DestinationB\x04\xe2A\x01\x02R\vdestination\x12\x16\n"
+
+ "\x06weight\x18\x02
\x01(\x05R\x06weightB\x1aZ\x18/api/networking/v1alpha3b\x06proto3"
+
+var (
+ file_networking_v1alpha3_virtual_service_proto_rawDescOnce sync.Once
+ file_networking_v1alpha3_virtual_service_proto_rawDescData []byte
+)
+
+func file_networking_v1alpha3_virtual_service_proto_rawDescGZIP() []byte {
+ file_networking_v1alpha3_virtual_service_proto_rawDescOnce.Do(func() {
+ file_networking_v1alpha3_virtual_service_proto_rawDescData =
protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_networking_v1alpha3_virtual_service_proto_rawDesc),
len(file_networking_v1alpha3_virtual_service_proto_rawDesc)))
+ })
+ return file_networking_v1alpha3_virtual_service_proto_rawDescData
+}
+
+var file_networking_v1alpha3_virtual_service_proto_msgTypes =
make([]protoimpl.MessageInfo, 4)
+var file_networking_v1alpha3_virtual_service_proto_goTypes = []any{
+ (*VirtualService)(nil), // 0:
dubbo.networking.v1alpha3.VirtualService
+ (*Destination)(nil), // 1:
dubbo.networking.v1alpha3.Destination
+ (*HTTPRoute)(nil), // 2: dubbo.networking.v1alpha3.HTTPRoute
+ (*HTTPRouteDestination)(nil), // 3:
dubbo.networking.v1alpha3.HTTPRouteDestination
+}
+var file_networking_v1alpha3_virtual_service_proto_depIdxs = []int32{
+ 2, // 0: dubbo.networking.v1alpha3.VirtualService.http:type_name ->
dubbo.networking.v1alpha3.HTTPRoute
+ 3, // 1: dubbo.networking.v1alpha3.HTTPRoute.route:type_name ->
dubbo.networking.v1alpha3.HTTPRouteDestination
+ 1, // 2:
dubbo.networking.v1alpha3.HTTPRouteDestination.destination:type_name ->
dubbo.networking.v1alpha3.Destination
+ 3, // [3:3] is the sub-list for method output_type
+ 3, // [3:3] is the sub-list for method input_type
+ 3, // [3:3] is the sub-list for extension type_name
+ 3, // [3:3] is the sub-list for extension extendee
+ 0, // [0:3] is the sub-list for field type_name
+}
+
+func init() { file_networking_v1alpha3_virtual_service_proto_init() }
+func file_networking_v1alpha3_virtual_service_proto_init() {
+ if File_networking_v1alpha3_virtual_service_proto != nil {
+ return
+ }
+ type x struct{}
+ out := protoimpl.TypeBuilder{
+ File: protoimpl.DescBuilder{
+ GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
+ RawDescriptor:
unsafe.Slice(unsafe.StringData(file_networking_v1alpha3_virtual_service_proto_rawDesc),
len(file_networking_v1alpha3_virtual_service_proto_rawDesc)),
+ NumEnums: 0,
+ NumMessages: 4,
+ NumExtensions: 0,
+ NumServices: 0,
+ },
+ GoTypes:
file_networking_v1alpha3_virtual_service_proto_goTypes,
+ DependencyIndexes:
file_networking_v1alpha3_virtual_service_proto_depIdxs,
+ MessageInfos:
file_networking_v1alpha3_virtual_service_proto_msgTypes,
+ }.Build()
+ File_networking_v1alpha3_virtual_service_proto = out.File
+ file_networking_v1alpha3_virtual_service_proto_goTypes = nil
+ file_networking_v1alpha3_virtual_service_proto_depIdxs = nil
+}
diff --git a/api/networking/v1alpha3/virtual_service.proto
b/api/networking/v1alpha3/virtual_service.proto
index a6f66394..a9c01ecd 100644
--- a/api/networking/v1alpha3/virtual_service.proto
+++ b/api/networking/v1alpha3/virtual_service.proto
@@ -12,4 +12,43 @@
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
-// limitations under the License.
\ No newline at end of file
+// limitations under the License.
+
+syntax = "proto3";
+
+package dubbo.networking.v1alpha3;
+
+import "google/api/field_behavior.proto";
+import "google/protobuf/duration.proto";
+import "google/protobuf/wrappers.proto";
+
+option go_package = "/api/networking/v1alpha3";
+
+//
+// <!-- go code generation tags
+// +kubetype-gen
+// +kubetype-gen:groupVersion=networking.dubbo.apache.org/v1alpha3
+// +genclient
+// +k8s:deepcopy-gen=true
+// -->
+message VirtualService {
+ repeated string hosts = 1;
+ repeated HTTPRoute http = 2;
+ repeated string export_to = 3;
+}
+
+message Destination {
+ string host = 1 [(google.api.field_behavior) = REQUIRED];
+ string subset = 2;
+}
+
+message HTTPRoute {
+ repeated HTTPRouteDestination route = 1;
+}
+
+message HTTPRouteDestination {
+ Destination destination = 1 [(google.api.field_behavior) = REQUIRED];
+ int32 weight = 2;
+}
+
+
diff --git a/api/networking/v1alpha3/virtual_service_deepcopy.gen.go
b/api/networking/v1alpha3/virtual_service_deepcopy.gen.go
new file mode 100644
index 00000000..242c333f
--- /dev/null
+++ b/api/networking/v1alpha3/virtual_service_deepcopy.gen.go
@@ -0,0 +1,90 @@
+// Code generated by protoc-gen-deepcopy. DO NOT EDIT.
+package v1alpha3
+
+import (
+ proto "google.golang.org/protobuf/proto"
+)
+
+// DeepCopyInto supports using VirtualService within kubernetes types, where
deepcopy-gen is used.
+func (in *VirtualService) DeepCopyInto(out *VirtualService) {
+ p := proto.Clone(in).(*VirtualService)
+ *out = *p
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver,
creating a new VirtualService. Required by controller-gen.
+func (in *VirtualService) DeepCopy() *VirtualService {
+ if in == nil {
+ return nil
+ }
+ out := new(VirtualService)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyInterface is an autogenerated deepcopy function, copying the
receiver, creating a new VirtualService. Required by controller-gen.
+func (in *VirtualService) DeepCopyInterface() interface{} {
+ return in.DeepCopy()
+}
+
+// DeepCopyInto supports using Destination within kubernetes types, where
deepcopy-gen is used.
+func (in *Destination) DeepCopyInto(out *Destination) {
+ p := proto.Clone(in).(*Destination)
+ *out = *p
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver,
creating a new Destination. Required by controller-gen.
+func (in *Destination) DeepCopy() *Destination {
+ if in == nil {
+ return nil
+ }
+ out := new(Destination)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyInterface is an autogenerated deepcopy function, copying the
receiver, creating a new Destination. Required by controller-gen.
+func (in *Destination) DeepCopyInterface() interface{} {
+ return in.DeepCopy()
+}
+
+// DeepCopyInto supports using HTTPRoute within kubernetes types, where
deepcopy-gen is used.
+func (in *HTTPRoute) DeepCopyInto(out *HTTPRoute) {
+ p := proto.Clone(in).(*HTTPRoute)
+ *out = *p
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver,
creating a new HTTPRoute. Required by controller-gen.
+func (in *HTTPRoute) DeepCopy() *HTTPRoute {
+ if in == nil {
+ return nil
+ }
+ out := new(HTTPRoute)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyInterface is an autogenerated deepcopy function, copying the
receiver, creating a new HTTPRoute. Required by controller-gen.
+func (in *HTTPRoute) DeepCopyInterface() interface{} {
+ return in.DeepCopy()
+}
+
+// DeepCopyInto supports using HTTPRouteDestination within kubernetes types,
where deepcopy-gen is used.
+func (in *HTTPRouteDestination) DeepCopyInto(out *HTTPRouteDestination) {
+ p := proto.Clone(in).(*HTTPRouteDestination)
+ *out = *p
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver,
creating a new HTTPRouteDestination. Required by controller-gen.
+func (in *HTTPRouteDestination) DeepCopy() *HTTPRouteDestination {
+ if in == nil {
+ return nil
+ }
+ out := new(HTTPRouteDestination)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyInterface is an autogenerated deepcopy function, copying the
receiver, creating a new HTTPRouteDestination. Required by controller-gen.
+func (in *HTTPRouteDestination) DeepCopyInterface() interface{} {
+ return in.DeepCopy()
+}
diff --git a/api/networking/v1alpha3/virtual_service_json.gen.go
b/api/networking/v1alpha3/virtual_service_json.gen.go
new file mode 100644
index 00000000..2a1138eb
--- /dev/null
+++ b/api/networking/v1alpha3/virtual_service_json.gen.go
@@ -0,0 +1,56 @@
+// Code generated by protoc-gen-jsonshim. DO NOT EDIT.
+package v1alpha3
+
+import (
+ bytes "bytes"
+ jsonpb "github.com/golang/protobuf/jsonpb"
+)
+
+// MarshalJSON is a custom marshaler for VirtualService
+func (this *VirtualService) MarshalJSON() ([]byte, error) {
+ str, err := VirtualServiceMarshaler.MarshalToString(this)
+ return []byte(str), err
+}
+
+// UnmarshalJSON is a custom unmarshaler for VirtualService
+func (this *VirtualService) UnmarshalJSON(b []byte) error {
+ return VirtualServiceUnmarshaler.Unmarshal(bytes.NewReader(b), this)
+}
+
+// MarshalJSON is a custom marshaler for Destination
+func (this *Destination) MarshalJSON() ([]byte, error) {
+ str, err := VirtualServiceMarshaler.MarshalToString(this)
+ return []byte(str), err
+}
+
+// UnmarshalJSON is a custom unmarshaler for Destination
+func (this *Destination) UnmarshalJSON(b []byte) error {
+ return VirtualServiceUnmarshaler.Unmarshal(bytes.NewReader(b), this)
+}
+
+// MarshalJSON is a custom marshaler for HTTPRoute
+func (this *HTTPRoute) MarshalJSON() ([]byte, error) {
+ str, err := VirtualServiceMarshaler.MarshalToString(this)
+ return []byte(str), err
+}
+
+// UnmarshalJSON is a custom unmarshaler for HTTPRoute
+func (this *HTTPRoute) UnmarshalJSON(b []byte) error {
+ return VirtualServiceUnmarshaler.Unmarshal(bytes.NewReader(b), this)
+}
+
+// MarshalJSON is a custom marshaler for HTTPRouteDestination
+func (this *HTTPRouteDestination) MarshalJSON() ([]byte, error) {
+ str, err := VirtualServiceMarshaler.MarshalToString(this)
+ return []byte(str), err
+}
+
+// UnmarshalJSON is a custom unmarshaler for HTTPRouteDestination
+func (this *HTTPRouteDestination) UnmarshalJSON(b []byte) error {
+ return VirtualServiceUnmarshaler.Unmarshal(bytes.NewReader(b), this)
+}
+
+var (
+ VirtualServiceMarshaler = &jsonpb.Marshaler{}
+ VirtualServiceUnmarshaler = &jsonpb.Unmarshaler{AllowUnknownFields:
true}
+)
diff --git a/dubbod/planet/pkg/bootstrap/config_controller.go
b/dubbod/planet/pkg/bootstrap/config_controller.go
index 2777e567..2f0ab8fa 100644
--- a/dubbod/planet/pkg/bootstrap/config_controller.go
+++ b/dubbod/planet/pkg/bootstrap/config_controller.go
@@ -33,6 +33,7 @@ import (
"net/url"
"strings"
+ "github.com/apache/dubbo-kubernetes/api/networking/v1alpha3"
"github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/config/kube/crdclient"
"github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/config/kube/file"
"github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/config/memory"
@@ -45,7 +46,6 @@ import (
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/credentials/insecure"
- "istio.io/api/networking/v1alpha3"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
diff --git a/dubbod/planet/pkg/bootstrap/server.go
b/dubbod/planet/pkg/bootstrap/server.go
index 556d2d5b..a8b8406e 100644
--- a/dubbod/planet/pkg/bootstrap/server.go
+++ b/dubbod/planet/pkg/bootstrap/server.go
@@ -493,8 +493,8 @@ func (s *Server) initRegistryEventHandlers() {
switch schemaID {
case "DestinationRule":
configKind = kind.DestinationRule
- case "serviceRoute", "ServiceRoute":
- configKind = kind.ServiceRoute
+ case "virtualService", "VirtualService":
+ configKind = kind.VirtualService
case "PeerAuthentication":
configKind = kind.PeerAuthentication
case "GatewayClass":
@@ -517,18 +517,18 @@ func (s *Server) initRegistryEventHandlers() {
// Log the config change
log.Infof("configHandler: %s event for %s/%s/%s", event,
configKey.Kind, configKey.Namespace, configKey.Name)
- // Some configs
(DestinationRule/ServiceRoute/PeerAuthentication/HTTPRoute) require Full push
to ensure
+ // Some configs
(DestinationRule/VirtualService/PeerAuthentication/HTTPRoute) require Full push
to ensure
// PushContext is re-initialized and configuration is reloaded.
// PeerAuthentication must rebuild AuthenticationPolicies to
enable STRICT mTLS on LDS; without
// a full push the cached PushContext would continue serving
plaintext listeners.
// HTTPRoute must rebuild HTTPRoute index to enable Gateway API
routing.
- needsFullPush := configKind == kind.DestinationRule ||
configKind == kind.ServiceRoute || configKind == kind.PeerAuthentication ||
configKind == kind.HTTPRoute
+ needsFullPush := configKind == kind.DestinationRule ||
configKind == kind.VirtualService || configKind == kind.PeerAuthentication ||
configKind == kind.HTTPRoute
// Trigger ConfigUpdate to push changes to all connected proxies
s.XDSServer.ConfigUpdate(&model.PushRequest{
ConfigsUpdated: sets.New(configKey),
Reason:
model.NewReasonStats(model.DependentResource),
- Full: needsFullPush, // Full push for
DestinationRule/ServiceRoute to reload PushContext
+ Full: needsFullPush, // Full push for
DestinationRule/VirtualService to reload PushContext
})
}
schemas := collections.Planet.All()
diff --git a/dubbod/planet/pkg/config/kube/crdclient/client.go
b/dubbod/planet/pkg/config/kube/crdclient/client.go
index d5a361f7..a6b87aa6 100644
--- a/dubbod/planet/pkg/config/kube/crdclient/client.go
+++ b/dubbod/planet/pkg/config/kube/crdclient/client.go
@@ -206,10 +206,10 @@ func (cl *Client) addCRD(name string, opts
krt.OptionsBuilder) {
if s.IsBuiltin() {
kc = kclient.NewUntypedInformer(cl.client, gvr, filter)
} else {
- // For DestinationRule and ServiceRoute, we use Dynamic client
which returns unstructured objects
+ // For DestinationRule and VirtualService, we use Dynamic
client which returns unstructured objects
// So we need to use DynamicInformer type to ensure the
informer expects unstructured objects
informerType := kubetypes.StandardInformer
- if resourceGVK == gvk.DestinationRule || resourceGVK ==
gvk.ServiceRoute || resourceGVK == gvk.PeerAuthentication {
+ if resourceGVK == gvk.DestinationRule || resourceGVK ==
gvk.VirtualService || resourceGVK == gvk.PeerAuthentication {
informerType = kubetypes.DynamicInformer
cl.logger.Debugf("addCRD: using DynamicInformer for %v
(uses Dynamic client)", resourceGVK)
}
diff --git a/dubbod/planet/pkg/config/kube/crdclient/types.go
b/dubbod/planet/pkg/config/kube/crdclient/types.go
index 59895f25..dca35f46 100644
--- a/dubbod/planet/pkg/config/kube/crdclient/types.go
+++ b/dubbod/planet/pkg/config/kube/crdclient/types.go
@@ -22,11 +22,11 @@ import (
"fmt"
dubboapimetav1alpha1
"github.com/apache/dubbo-kubernetes/api/meta/v1alpha1"
+ orgapachedubboapinetworkingv1alpha3
"github.com/apache/dubbo-kubernetes/api/networking/v1alpha3"
"github.com/apache/dubbo-kubernetes/pkg/config"
"github.com/apache/dubbo-kubernetes/pkg/config/schema/gvk"
"github.com/apache/dubbo-kubernetes/pkg/kube"
"github.com/apache/dubbo-kubernetes/pkg/util/protomarshal"
- istioioapinetworkingv1alpha3 "istio.io/api/networking/v1alpha3"
istioioapisecurityv1beta1 "istio.io/api/security/v1beta1"
apiistioioapinetworkingv1 "istio.io/client-go/pkg/apis/networking/v1"
apiistioioapisecurityv1 "istio.io/client-go/pkg/apis/security/v1"
@@ -57,7 +57,7 @@ func create(c kube.Client, cfg config.Config, objMeta
metav1.ObjectMeta) (metav1
case gvk.DestinationRule:
// DestinationRule uses networking.dubbo.apache.org API group,
not networking.istio.io
// Use Dynamic client to access it, but reuse Istio's
DestinationRule spec structure
- spec := cfg.Spec.(*istioioapinetworkingv1alpha3.DestinationRule)
+ spec :=
cfg.Spec.(*orgapachedubboapinetworkingv1alpha3.DestinationRule)
clonedSpec := protomarshal.Clone(spec)
obj := &apiistioioapinetworkingv1.DestinationRule{
ObjectMeta: objMeta,
@@ -101,10 +101,10 @@ func create(c kube.Client, cfg config.Config, objMeta
metav1.ObjectMeta) (metav1
Version: "v1",
Resource: "peerauthentications",
}).Namespace(cfg.Namespace).Create(context.TODO(), u,
metav1.CreateOptions{})
- case gvk.ServiceRoute:
- // ServiceRoute uses networking.dubbo.apache.org API group, not
networking.istio.io
+ case gvk.VirtualService:
+ // VirtualService uses networking.dubbo.apache.org API group,
not networking.istio.io
// Use Dynamic client to access it, but reuse Istio's
VirtualService spec structure
- spec := cfg.Spec.(*istioioapinetworkingv1alpha3.VirtualService)
+ spec :=
cfg.Spec.(*orgapachedubboapinetworkingv1alpha3.VirtualService)
clonedSpec := protomarshal.Clone(spec)
obj := &apiistioioapinetworkingv1.VirtualService{
ObjectMeta: objMeta,
@@ -119,12 +119,12 @@ func create(c kube.Client, cfg config.Config, objMeta
metav1.ObjectMeta) (metav1
u.SetGroupVersionKind(schema.GroupVersionKind{
Group: "networking.dubbo.apache.org",
Version: "v1",
- Kind: "ServiceRoute",
+ Kind: "VirtualService",
})
return c.Dynamic().Resource(schema.GroupVersionResource{
Group: "networking.dubbo.apache.org",
Version: "v1",
- Resource: "serviceroutes",
+ Resource: "virtualservices",
}).Namespace(cfg.Namespace).Create(context.TODO(), u,
metav1.CreateOptions{})
case gvk.Gateway:
return
c.GatewayAPI().GatewayV1().Gateways(cfg.Namespace).Create(context.TODO(),
&sigsk8siogatewayapiapisv1.Gateway{
@@ -150,7 +150,7 @@ func update(c kube.Client, cfg config.Config, objMeta
metav1.ObjectMeta) (metav1
switch cfg.GroupVersionKind {
case gvk.DestinationRule:
// DestinationRule uses networking.dubbo.apache.org API group,
use Dynamic client
- spec := cfg.Spec.(*istioioapinetworkingv1alpha3.DestinationRule)
+ spec :=
cfg.Spec.(*orgapachedubboapinetworkingv1alpha3.DestinationRule)
clonedSpec := protomarshal.Clone(spec)
obj := &apiistioioapinetworkingv1.DestinationRule{
ObjectMeta: objMeta,
@@ -193,9 +193,9 @@ func update(c kube.Client, cfg config.Config, objMeta
metav1.ObjectMeta) (metav1
Version: "v1",
Resource: "peerauthentications",
}).Namespace(cfg.Namespace).Update(context.TODO(), u,
metav1.UpdateOptions{})
- case gvk.ServiceRoute:
- // ServiceRoute uses networking.dubbo.apache.org API group, use
Dynamic client
- spec := cfg.Spec.(*istioioapinetworkingv1alpha3.VirtualService)
+ case gvk.VirtualService:
+ // VirtualService uses networking.dubbo.apache.org API group,
use Dynamic client
+ spec :=
cfg.Spec.(*orgapachedubboapinetworkingv1alpha3.VirtualService)
clonedSpec := protomarshal.Clone(spec)
obj := &apiistioioapinetworkingv1.VirtualService{
ObjectMeta: objMeta,
@@ -209,12 +209,12 @@ func update(c kube.Client, cfg config.Config, objMeta
metav1.ObjectMeta) (metav1
u.SetGroupVersionKind(schema.GroupVersionKind{
Group: "networking.dubbo.apache.org",
Version: "v1",
- Kind: "ServiceRoute",
+ Kind: "VirtualService",
})
return c.Dynamic().Resource(schema.GroupVersionResource{
Group: "networking.dubbo.apache.org",
Version: "v1",
- Resource: "serviceroutes",
+ Resource: "virtualservices",
}).Namespace(cfg.Namespace).Update(context.TODO(), u,
metav1.UpdateOptions{})
case gvk.GatewayClass:
return
c.GatewayAPI().GatewayV1().GatewayClasses().Update(context.TODO(),
&sigsk8siogatewayapiapisv1.GatewayClass{
@@ -283,8 +283,8 @@ func updateStatus(c kube.Client, cfg config.Config, objMeta
metav1.ObjectMeta) (
Version: "v1",
Resource: "peerauthentications",
}).Namespace(cfg.Namespace).UpdateStatus(context.TODO(), u,
metav1.UpdateOptions{})
- case gvk.ServiceRoute:
- // ServiceRoute uses networking.dubbo.apache.org API group, use
Dynamic client
+ case gvk.VirtualService:
+ // VirtualService uses networking.dubbo.apache.org API group,
use Dynamic client
status := cfg.Status.(*dubboapimetav1alpha1.DubboStatus)
clonedStatus := protomarshal.Clone(status)
obj := &apiistioioapinetworkingv1.VirtualService{
@@ -299,12 +299,12 @@ func updateStatus(c kube.Client, cfg config.Config,
objMeta metav1.ObjectMeta) (
u.SetGroupVersionKind(schema.GroupVersionKind{
Group: "networking.dubbo.apache.org",
Version: "v1",
- Kind: "ServiceRoute",
+ Kind: "VirtualService",
})
return c.Dynamic().Resource(schema.GroupVersionResource{
Group: "networking.dubbo.apache.org",
Version: "v1",
- Resource: "serviceroutes",
+ Resource: "virtualservices",
}).Namespace(cfg.Namespace).UpdateStatus(context.TODO(), u,
metav1.UpdateOptions{})
case gvk.Gateway:
return
c.GatewayAPI().GatewayV1().Gateways(cfg.Namespace).UpdateStatus(context.TODO(),
&sigsk8siogatewayapiapisv1.Gateway{
@@ -333,8 +333,8 @@ func patch(c kube.Client, orig config.Config, origMeta
metav1.ObjectMeta, mod co
switch orig.GroupVersionKind {
case gvk.DestinationRule:
// DestinationRule uses networking.dubbo.apache.org API group,
use Dynamic client
- origSpec :=
orig.Spec.(*istioioapinetworkingv1alpha3.DestinationRule)
- modSpec :=
mod.Spec.(*istioioapinetworkingv1alpha3.DestinationRule)
+ origSpec :=
orig.Spec.(*orgapachedubboapinetworkingv1alpha3.DestinationRule)
+ modSpec :=
mod.Spec.(*orgapachedubboapinetworkingv1alpha3.DestinationRule)
clonedOrigSpec := protomarshal.Clone(origSpec)
clonedModSpec := protomarshal.Clone(modSpec)
oldRes := &apiistioioapinetworkingv1.DestinationRule{
@@ -376,10 +376,10 @@ func patch(c kube.Client, orig config.Config, origMeta
metav1.ObjectMeta, mod co
Version: "v1",
Resource: "peerauthentications",
}).Namespace(orig.Namespace).Patch(context.TODO(), orig.Name,
typ, patchBytes, metav1.PatchOptions{FieldManager: "planet-discovery"})
- case gvk.ServiceRoute:
- // ServiceRoute uses networking.dubbo.apache.org API group, use
Dynamic client
- origSpec :=
orig.Spec.(*istioioapinetworkingv1alpha3.VirtualService)
- modSpec :=
mod.Spec.(*istioioapinetworkingv1alpha3.VirtualService)
+ case gvk.VirtualService:
+ // VirtualService uses networking.dubbo.apache.org API group,
use Dynamic client
+ origSpec :=
orig.Spec.(*orgapachedubboapinetworkingv1alpha3.VirtualService)
+ modSpec :=
mod.Spec.(*orgapachedubboapinetworkingv1alpha3.VirtualService)
clonedOrigSpec := protomarshal.Clone(origSpec)
clonedModSpec := protomarshal.Clone(modSpec)
oldRes := &apiistioioapinetworkingv1.VirtualService{
@@ -397,7 +397,7 @@ func patch(c kube.Client, orig config.Config, origMeta
metav1.ObjectMeta, mod co
return c.Dynamic().Resource(schema.GroupVersionResource{
Group: "networking.dubbo.apache.org",
Version: "v1",
- Resource: "serviceroutes",
+ Resource: "virtualservices",
}).Namespace(orig.Namespace).Patch(context.TODO(), orig.Name,
typ, patchBytes, metav1.PatchOptions{FieldManager: "planet-discovery"})
case gvk.GatewayClass:
oldRes := &sigsk8siogatewayapiapisv1.GatewayClass{
@@ -468,12 +468,12 @@ func delete(c kube.Client, typ config.GroupVersionKind,
name, namespace string,
Version: "v1",
Resource: "peerauthentications",
}).Namespace(namespace).Delete(context.TODO(), name,
deleteOptions)
- case gvk.ServiceRoute:
- // ServiceRoute uses networking.dubbo.apache.org API group, use
Dynamic client
+ case gvk.VirtualService:
+ // VirtualService uses networking.dubbo.apache.org API group,
use Dynamic client
return c.Dynamic().Resource(schema.GroupVersionResource{
Group: "networking.dubbo.apache.org",
Version: "v1",
- Resource: "serviceroutes",
+ Resource: "virtualservices",
}).Namespace(namespace).Delete(context.TODO(), name,
deleteOptions)
case gvk.GatewayClass:
return
c.GatewayAPI().GatewayV1().GatewayClasses().Delete(context.TODO(), name,
deleteOptions)
@@ -769,7 +769,7 @@ var translationMap = map[config.GroupVersionKind]func(r
runtime.Object) config.C
Spec: obj,
}
},
- gvk.ServiceRoute: func(r runtime.Object) config.Config {
+ gvk.VirtualService: func(r runtime.Object) config.Config {
var obj *apiistioioapinetworkingv1.VirtualService
// Handle unstructured objects from Dynamic client
// First try to convert from unstructured, as Dynamic client
returns unstructured objects
@@ -793,12 +793,12 @@ var translationMap = map[config.GroupVersionKind]func(r
runtime.Object) config.C
panic(fmt.Sprintf("failed to convert
object %T to VirtualService: %v", r, err))
}
} else {
- panic(fmt.Sprintf("unexpected object type for
ServiceRoute: %T, expected *unstructured.Unstructured or
*apiistioioapinetworkingv1.VirtualService, conversion error: %v", r, err))
+ panic(fmt.Sprintf("unexpected object type for
VirtualService: %T, expected *unstructured.Unstructured or
*apiistioioapinetworkingv1.VirtualService, conversion error: %v", r, err))
}
}
return config.Config{
Meta: config.Meta{
- GroupVersionKind: gvk.ServiceRoute,
+ GroupVersionKind: gvk.VirtualService,
Name: obj.Name,
Namespace: obj.Namespace,
Labels: obj.Labels,
diff --git a/dubbod/planet/pkg/model/destinationrule.go
b/dubbod/planet/pkg/model/destinationrule.go
index cb409d40..8d71f78e 100644
--- a/dubbod/planet/pkg/model/destinationrule.go
+++ b/dubbod/planet/pkg/model/destinationrule.go
@@ -17,13 +17,13 @@
package model
import (
+ networking "github.com/apache/dubbo-kubernetes/api/networking/v1alpha3"
"github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/features"
"github.com/apache/dubbo-kubernetes/pkg/config"
"github.com/apache/dubbo-kubernetes/pkg/config/host"
"github.com/apache/dubbo-kubernetes/pkg/config/labels"
"github.com/apache/dubbo-kubernetes/pkg/config/visibility"
"github.com/apache/dubbo-kubernetes/pkg/util/sets"
- networking "istio.io/api/networking/v1alpha3"
"k8s.io/apimachinery/pkg/types"
)
diff --git a/dubbod/planet/pkg/model/push_context.go
b/dubbod/planet/pkg/model/push_context.go
index 22336fcc..5a2c701d 100644
--- a/dubbod/planet/pkg/model/push_context.go
+++ b/dubbod/planet/pkg/model/push_context.go
@@ -23,9 +23,9 @@ import (
"sync"
"time"
+ networking "github.com/apache/dubbo-kubernetes/api/networking/v1alpha3"
"github.com/apache/dubbo-kubernetes/pkg/config/labels"
"github.com/apache/dubbo-kubernetes/pkg/config/schema/gvk"
- networking "istio.io/api/networking/v1alpha3"
sigsk8siogatewayapiapisv1 "sigs.k8s.io/gateway-api/apis/v1"
meshv1alpha1 "github.com/apache/dubbo-kubernetes/api/mesh/v1alpha1"
@@ -75,9 +75,9 @@ type PushContext struct {
clusterLocalHosts ClusterLocalHosts
exportToDefaults exportToDefaults
ServiceIndex serviceIndex
- serviceRouteIndex serviceRouteIndex
+ virtualServiceIndex virtualServiceIndex
httpRouteIndex httpRouteIndex
- destinationRuleIndex destinationRuleIndex
+ destinationRuleIndex destinationRuleIndex
serviceAccounts map[serviceAccountKey][]string
AuthenticationPolicies *AuthenticationPolicies
PushVersion string
@@ -139,12 +139,12 @@ type ConsolidatedSubRule struct {
}
type exportToDefaults struct {
- service sets.Set[visibility.Instance]
- serviceRoute sets.Set[visibility.Instance]
- destinationRule sets.Set[visibility.Instance]
+ service sets.Set[visibility.Instance]
+ virtualService sets.Set[visibility.Instance]
+ destinationRule sets.Set[visibility.Instance]
}
-type serviceRouteIndex struct {
+type virtualServiceIndex struct {
// root vs namespace/name ->delegate vs virtualservice
gvk/namespace/name
delegates map[ConfigKey][]ConfigKey
@@ -173,10 +173,10 @@ type consolidatedSubRules struct {
func NewPushContext() *PushContext {
return &PushContext{
- ServiceIndex: newServiceIndex(),
- serviceRouteIndex: newServiceRouteIndex(),
- destinationRuleIndex: newDestinationRuleIndex(),
- serviceAccounts: map[serviceAccountKey][]string{},
+ ServiceIndex: newServiceIndex(),
+ virtualServiceIndex: newVirtualServiceIndex(),
+ destinationRuleIndex: newDestinationRuleIndex(),
+ serviceAccounts: map[serviceAccountKey][]string{},
}
}
@@ -190,8 +190,8 @@ func newServiceIndex() serviceIndex {
}
}
-func newServiceRouteIndex() serviceRouteIndex {
- out := serviceRouteIndex{
+func newVirtualServiceIndex() virtualServiceIndex {
+ out := virtualServiceIndex{
delegates: map[ConfigKey][]ConfigKey{},
referencedDestinations: map[string]sets.String{},
hostToRoutes: map[host.Name][]config.Config{},
@@ -334,13 +334,13 @@ func (ps *PushContext) initDefaultExportMaps() {
ps.exportToDefaults.service.Insert(visibility.Public)
}
- ps.exportToDefaults.serviceRoute = sets.New[visibility.Instance]()
+ ps.exportToDefaults.virtualService = sets.New[visibility.Instance]()
if ps.Mesh.DefaultVirtualServiceExportTo != nil {
for _, e := range ps.Mesh.DefaultVirtualServiceExportTo {
-
ps.exportToDefaults.serviceRoute.Insert(visibility.Instance(e))
+
ps.exportToDefaults.virtualService.Insert(visibility.Instance(e))
}
} else {
- ps.exportToDefaults.serviceRoute.Insert(visibility.Public)
+ ps.exportToDefaults.virtualService.Insert(visibility.Public)
}
}
@@ -530,7 +530,7 @@ func (ps *PushContext) createNewContext(env *Environment) {
// This mirrors Istio's behavior, where Gateway API is translated into
// internal Gateway and VirtualService resources during push context
creation.
ps.initKubernetesGateways(env)
- ps.initServiceRoutes(env)
+ ps.initVirtualServices(env)
ps.initHTTPRoutes(env)
ps.initDestinationRules(env)
ps.initAuthenticationPolicies(env)
@@ -544,28 +544,28 @@ func (ps *PushContext) updateContext(env *Environment,
oldPushContext *PushConte
servicesChanged := pushReq != nil &&
(HasConfigsOfKind(pushReq.ConfigsUpdated, kind.ServiceEntry) ||
len(pushReq.AddressesUpdated) > 0)
- // Check if serviceRoutes have changed base on:
- // 1. ServiceRoute updates in ConfigsUpdated
+ // Check if virtualServices have changed base on:
+ // 1. VirtualService updates in ConfigsUpdated
// 2. Full push (Full: true) - always re-initialize on full push
- serviceRoutesChanged := pushReq != nil && (pushReq.Full ||
HasConfigsOfKind(pushReq.ConfigsUpdated, kind.ServiceRoute) ||
+ virtualServicesChanged := pushReq != nil && (pushReq.Full ||
HasConfigsOfKind(pushReq.ConfigsUpdated, kind.VirtualService) ||
len(pushReq.AddressesUpdated) > 0)
if pushReq != nil {
- serviceRouteCount := 0
+ virtualServiceCount := 0
for cfg := range pushReq.ConfigsUpdated {
- if cfg.Kind == kind.ServiceRoute {
- serviceRouteCount++
+ if cfg.Kind == kind.VirtualService {
+ virtualServiceCount++
}
}
- if serviceRouteCount > 0 {
- log.Debugf("updateContext: detected %d ServiceRoute
config changes", serviceRouteCount)
+ if virtualServiceCount > 0 {
+ log.Debugf("updateContext: detected %d VirtualService
config changes", virtualServiceCount)
}
}
// Check if destinationrules have changed base on:
// 1. DestinationRule updates in ConfigsUpdated
// 2. Full push (Full: true) - always re-initialize on full push
- destinationRuleChanged := pushReq != nil && (pushReq.Full ||
HasConfigsOfKind(pushReq.ConfigsUpdated, kind.DestinationRule) ||
+ destinationRuleChanged := pushReq != nil && (pushReq.Full ||
HasConfigsOfKind(pushReq.ConfigsUpdated, kind.DestinationRule) ||
len(pushReq.AddressesUpdated) > 0)
if pushReq != nil {
@@ -579,10 +579,10 @@ func (ps *PushContext) updateContext(env *Environment,
oldPushContext *PushConte
log.Debugf("updateContext: detected %d DestinationRule
config changes", destinationRuleCount)
}
if pushReq.Full {
- log.Debugf("updateContext: Full push requested, will
re-initialize DestinationRule and ServiceRoute indexes")
+ log.Debugf("updateContext: Full push requested, will
re-initialize DestinationRule and VirtualService indexes")
}
- log.Debugf("updateContext: destinationRuleChanged=%v,
serviceRoutesChanged=%v, pushReq.ConfigsUpdated size=%d, Full=%v",
- destinationRuleChanged, serviceRoutesChanged,
len(pushReq.ConfigsUpdated), pushReq != nil && pushReq.Full)
+ log.Debugf("updateContext: destinationRuleChanged=%v,
virtualServicesChanged=%v, pushReq.ConfigsUpdated size=%d, Full=%v",
+ destinationRuleChanged, virtualServicesChanged,
len(pushReq.ConfigsUpdated), pushReq != nil && pushReq.Full)
}
// Also check if the actual number of services has changed
@@ -620,12 +620,12 @@ func (ps *PushContext) updateContext(env *Environment,
oldPushContext *PushConte
httpRoutesChanged := pushReq != nil &&
HasConfigsOfKind(pushReq.ConfigsUpdated, kind.HTTPRoute)
- if serviceRoutesChanged {
- log.Debugf("updateContext: ServiceRoutes changed,
re-initializing ServiceRoute index")
- ps.initServiceRoutes(env)
+ if virtualServicesChanged {
+ log.Debugf("updateContext: VirtualServices changed,
re-initializing VirtualService index")
+ ps.initVirtualServices(env)
} else {
- log.Debugf("updateContext: ServiceRoutes unchanged, reusing old
ServiceRoute index")
- ps.serviceRouteIndex = oldPushContext.serviceRouteIndex
+ log.Debugf("updateContext: VirtualServices unchanged, reusing
old VirtualService index")
+ ps.virtualServiceIndex = oldPushContext.virtualServiceIndex
}
if httpRoutesChanged {
@@ -739,35 +739,35 @@ func (ps *PushContext) GetAllServices() []*Service {
return ps.servicesExportedToNamespace(NamespaceAll)
}
-func (ps *PushContext) initServiceRoutes(env *Environment) {
- log.Debugf("initServiceRoutes: starting ServiceRoute initialization")
- ps.serviceRouteIndex.referencedDestinations = map[string]sets.String{}
- serviceroutes := env.List(gvk.ServiceRoute, NamespaceAll)
- log.Debugf("initServiceRoutes: found %d ServiceRoute configs",
len(serviceroutes))
- sroutes := make([]config.Config, len(serviceroutes))
+func (ps *PushContext) initVirtualServices(env *Environment) {
+ log.Debugf("initVirtualServices: starting VirtualService
initialization")
+ ps.virtualServiceIndex.referencedDestinations = map[string]sets.String{}
+ virtualservices := env.List(gvk.VirtualService, NamespaceAll)
+ log.Debugf("initVirtualServices: found %d VirtualService configs",
len(virtualservices))
+ vsroutes := make([]config.Config, len(virtualservices))
- for i, r := range serviceroutes {
- sroutes[i] = resolveServiceRouteShortnames(r)
+ for i, r := range virtualservices {
+ vsroutes[i] = resolveVirtualServiceShortnames(r)
if vs, ok := r.Spec.(*networking.VirtualService); ok {
- log.Debugf("initServiceRoutes: ServiceRoute %s/%s with
hosts %v and %d HTTP routes",
+ log.Debugf("initVirtualServices: VirtualService %s/%s
with hosts %v and %d HTTP routes",
r.Namespace, r.Name, vs.Hosts, len(vs.Http))
}
}
- sroutes, ps.serviceRouteIndex.delegates =
mergeServiceRoutesIfNeeded(sroutes, ps.exportToDefaults.serviceRoute)
+ vsroutes, ps.virtualServiceIndex.delegates =
mergeVirtualServicesIfNeeded(vsroutes, ps.exportToDefaults.virtualService)
hostToRoutes := make(map[host.Name][]config.Config)
- for i := range sroutes {
- vs := sroutes[i].Spec.(*networking.VirtualService)
+ for i := range vsroutes {
+ vs := vsroutes[i].Spec.(*networking.VirtualService)
for idx, h := range vs.Hosts {
- resolvedHost := string(ResolveShortnameToFQDN(h,
sroutes[i].Meta))
+ resolvedHost := string(ResolveShortnameToFQDN(h,
vsroutes[i].Meta))
vs.Hosts[idx] = resolvedHost
hostName := host.Name(resolvedHost)
- hostToRoutes[hostName] = append(hostToRoutes[hostName],
sroutes[i])
- log.Debugf("initServiceRoutes: indexed ServiceRoute
%s/%s for hostname %s", sroutes[i].Namespace, sroutes[i].Name, hostName)
+ hostToRoutes[hostName] = append(hostToRoutes[hostName],
vsroutes[i])
+ log.Debugf("initVirtualServices: indexed VirtualService
%s/%s for hostname %s", vsroutes[i].Namespace, vsroutes[i].Name, hostName)
}
}
- ps.serviceRouteIndex.hostToRoutes = hostToRoutes
- log.Debugf("initServiceRoutes: indexed ServiceRoutes for %d hostnames",
len(hostToRoutes))
+ ps.virtualServiceIndex.hostToRoutes = hostToRoutes
+ log.Debugf("initVirtualServices: indexed VirtualServices for %d
hostnames", len(hostToRoutes))
}
func (ps *PushContext) initHTTPRoutes(env *Environment) {
@@ -1032,19 +1032,19 @@ func (ps *PushContext) initServiceAccounts(env
*Environment, services []*Service
}
}
-// ServiceRouteForHost returns the first ServiceRoute (VirtualService) that
matches the given host.
-func (ps *PushContext) ServiceRouteForHost(hostname host.Name)
*networking.VirtualService {
- routes := ps.serviceRouteIndex.hostToRoutes[hostname]
+// VirtualServiceForHost returns the first VirtualService that matches the
given host.
+func (ps *PushContext) VirtualServiceForHost(hostname host.Name)
*networking.VirtualService {
+ routes := ps.virtualServiceIndex.hostToRoutes[hostname]
if len(routes) == 0 {
- log.Debugf("ServiceRouteForHost: no ServiceRoute found for
hostname %s", hostname)
+ log.Debugf("VirtualServiceForHost: no VirtualService found for
hostname %s", hostname)
return nil
}
if vs, ok := routes[0].Spec.(*networking.VirtualService); ok {
- log.Infof("ServiceRouteForHost: found ServiceRoute %s/%s for
hostname %s with %d HTTP routes",
+ log.Infof("VirtualServiceForHost: found VirtualService %s/%s
for hostname %s with %d HTTP routes",
routes[0].Namespace, routes[0].Name, hostname,
len(vs.Http))
return vs
}
- log.Warnf("ServiceRouteForHost: ServiceRoute %s/%s for hostname %s is
not a VirtualService",
+ log.Warnf("VirtualServiceForHost: VirtualService %s/%s for hostname %s
is not a VirtualService",
routes[0].Namespace, routes[0].Name, hostname)
return nil
}
@@ -1178,10 +1178,10 @@ func firstDestinationRule(csr *consolidatedSubRules,
hostname host.Name) *networ
return nil
}
-func (ps *PushContext) DelegateServiceRoutes(vses []config.Config)
[]ConfigHash {
+func (ps *PushContext) DelegateVirtualServices(vses []config.Config)
[]ConfigHash {
var out []ConfigHash
for _, vs := range vses {
- for _, delegate := range
ps.serviceRouteIndex.delegates[ConfigKey{Kind: kind.ServiceRoute, Namespace:
vs.Namespace, Name: vs.Name}] {
+ for _, delegate := range
ps.virtualServiceIndex.delegates[ConfigKey{Kind: kind.VirtualService,
Namespace: vs.Namespace, Name: vs.Name}] {
out = append(out, delegate.HashCode())
}
}
diff --git a/dubbod/planet/pkg/model/serviceroute.go
b/dubbod/planet/pkg/model/virtualservice.go
similarity index 94%
rename from dubbod/planet/pkg/model/serviceroute.go
rename to dubbod/planet/pkg/model/virtualservice.go
index 825369a3..4c721bce 100644
--- a/dubbod/planet/pkg/model/serviceroute.go
+++ b/dubbod/planet/pkg/model/virtualservice.go
@@ -19,16 +19,16 @@ package model
import (
"strings"
+ networking "github.com/apache/dubbo-kubernetes/api/networking/v1alpha3"
"github.com/apache/dubbo-kubernetes/pkg/config"
"github.com/apache/dubbo-kubernetes/pkg/config/schema/kind"
"github.com/apache/dubbo-kubernetes/pkg/config/visibility"
"github.com/apache/dubbo-kubernetes/pkg/util/sets"
"google.golang.org/protobuf/proto"
- networking "istio.io/api/networking/v1alpha3"
"k8s.io/apimachinery/pkg/types"
)
-func resolveServiceRouteShortnames(config config.Config) config.Config {
+func resolveVirtualServiceShortnames(config config.Config) config.Config {
// values returned from ConfigStore.List are immutable.
// Therefore, we make a copy
r := config.DeepCopy()
@@ -52,15 +52,15 @@ func resolveServiceRouteShortnames(config config.Config)
config.Config {
return r
}
-// Return merged service routes and the root->delegate vs map
-func mergeServiceRoutesIfNeeded(sRoutes []config.Config, defaultExportTo
sets.Set[visibility.Instance]) ([]config.Config, map[ConfigKey][]ConfigKey) {
+// Return merged virtual services and the root->delegate vs map
+func mergeVirtualServicesIfNeeded(sRoutes []config.Config, defaultExportTo
sets.Set[visibility.Instance]) ([]config.Config, map[ConfigKey][]ConfigKey) {
out := make([]config.Config, 0, len(sRoutes))
delegatesMap := map[types.NamespacedName]config.Config{}
delegatesExportToMap :=
make(map[types.NamespacedName]sets.Set[visibility.Instance])
// root service routes with delegate
var rootVses []config.Config
- // 1. classify serviceroutes
+ // 1. classify virtualservices
for _, sr := range sRoutes {
rule := sr.Spec.(*networking.VirtualService)
// it is delegate, add it to the indexer cache along with the
exportTo for the delegate
@@ -106,7 +106,7 @@ func mergeServiceRoutesIfNeeded(sRoutes []config.Config,
defaultExportTo sets.Se
// 2. merge delegates and root
for _, root := range rootVses {
- rootConfigKey := ConfigKey{Kind: kind.ServiceRoute, Name:
root.Name, Namespace: root.Namespace}
+ rootConfigKey := ConfigKey{Kind: kind.VirtualService, Name:
root.Name, Namespace: root.Namespace}
rootVs := root.Spec.(*networking.VirtualService)
mergedRoutes := []*networking.HTTPRoute{}
for _, route := range rootVs.Http {
@@ -116,7 +116,7 @@ func mergeServiceRoutesIfNeeded(sRoutes []config.Config,
defaultExportTo sets.Se
if delegateNamespace == "" {
delegateNamespace = root.Namespace
}
- delegateConfigKey := ConfigKey{Kind:
kind.ServiceRoute, Name: delegate.Name, Namespace: delegateNamespace}
+ delegateConfigKey := ConfigKey{Kind:
kind.VirtualService, Name: delegate.Name, Namespace: delegateNamespace}
delegatesByRoot[rootConfigKey] =
append(delegatesByRoot[rootConfigKey], delegateConfigKey)
delegateVS, ok :=
delegatesMap[types.NamespacedName{Namespace: delegateNamespace, Name:
delegate.Name}]
if !ok {
diff --git a/dubbod/planet/pkg/networking/grpcgen/cds.go
b/dubbod/planet/pkg/networking/grpcgen/cds.go
index cf90f252..31c55b38 100644
--- a/dubbod/planet/pkg/networking/grpcgen/cds.go
+++ b/dubbod/planet/pkg/networking/grpcgen/cds.go
@@ -23,6 +23,7 @@ import (
"github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/util/protoconv"
discovery
"github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3"
+ networking "github.com/apache/dubbo-kubernetes/api/networking/v1alpha3"
"github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/model"
"github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/networking/util"
"github.com/apache/dubbo-kubernetes/pkg/config/host"
@@ -30,7 +31,6 @@ import (
cluster "github.com/envoyproxy/go-control-plane/envoy/config/cluster/v3"
core "github.com/envoyproxy/go-control-plane/envoy/config/core/v3"
tlsv3
"github.com/envoyproxy/go-control-plane/envoy/extensions/transport_sockets/tls/v3"
- networking "istio.io/api/networking/v1alpha3"
)
type clusterBuilder struct {
diff --git a/dubbod/planet/pkg/networking/grpcgen/rds.go
b/dubbod/planet/pkg/networking/grpcgen/rds.go
index 5c2d1c9c..d88800ec 100644
--- a/dubbod/planet/pkg/networking/grpcgen/rds.go
+++ b/dubbod/planet/pkg/networking/grpcgen/rds.go
@@ -24,13 +24,13 @@ import (
"github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/util/protoconv"
discovery
"github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3"
+ networking "github.com/apache/dubbo-kubernetes/api/networking/v1alpha3"
"github.com/apache/dubbo-kubernetes/dubbod/planet/pkg/model"
"github.com/apache/dubbo-kubernetes/pkg/config"
"github.com/apache/dubbo-kubernetes/pkg/config/host"
route "github.com/envoyproxy/go-control-plane/envoy/config/route/v3"
matcher "github.com/envoyproxy/go-control-plane/envoy/type/matcher/v3"
"google.golang.org/protobuf/types/known/wrapperspb"
- networking "istio.io/api/networking/v1alpha3"
sigsk8siogatewayapiapisv1 "sigs.k8s.io/gateway-api/apis/v1"
)
@@ -142,17 +142,17 @@ func buildHTTPRoute(node *model.Proxy, push
*model.PushContext, routeName string
} else {
log.Warnf("buildHTTPRoute: HTTPRoute found but
no routes built")
}
- } else if vs := push.ServiceRouteForHost(host.Name(hostStr));
vs != nil {
- // Fallback to ServiceRoute if no HTTPRoute found
- log.Infof("buildHTTPRoute: found ServiceRoute for host
%s with %d HTTP routes", hostStr, len(vs.Http))
- if routes := buildRoutesFromServiceRoute(vs,
host.Name(hostStr), parsedPort); len(routes) > 0 {
- log.Infof("buildHTTPRoute: built %d weighted
routes from ServiceRoute for host %s", len(routes), hostStr)
+ } else if vs := push.VirtualServiceForHost(host.Name(hostStr));
vs != nil {
+ // Fallback to VirtualService if no HTTPRoute found
+ log.Infof("buildHTTPRoute: found VirtualService for
host %s with %d HTTP routes", hostStr, len(vs.Http))
+ if routes := buildRoutesFromVirtualService(vs,
host.Name(hostStr), parsedPort); len(routes) > 0 {
+ log.Infof("buildHTTPRoute: built %d weighted
routes from VirtualService for host %s", len(routes), hostStr)
outboundRoutes = routes
} else {
- log.Warnf("buildHTTPRoute: ServiceRoute found
but no routes built for host %s", hostStr)
+ log.Warnf("buildHTTPRoute: VirtualService found
but no routes built for host %s", hostStr)
}
} else {
- log.Debugf("buildHTTPRoute: no HTTPRoute or
ServiceRoute found for host %s, using default route", hostStr)
+ log.Debugf("buildHTTPRoute: no HTTPRoute or
VirtualService found for host %s, using default route", hostStr)
}
return &route.RouteConfiguration{
@@ -331,7 +331,7 @@ func defaultSingleClusterRoute(clusterName string)
*route.Route {
}
}
-func buildRoutesFromServiceRoute(vs *networking.VirtualService, hostName
host.Name, defaultPort int) []*route.Route {
+func buildRoutesFromVirtualService(vs *networking.VirtualService, hostName
host.Name, defaultPort int) []*route.Route {
if vs == nil || len(vs.Http) == 0 {
return nil
}
diff --git a/dubbod/planet/pkg/xds/eds.go b/dubbod/planet/pkg/xds/eds.go
index 093535a9..25d122db 100644
--- a/dubbod/planet/pkg/xds/eds.go
+++ b/dubbod/planet/pkg/xds/eds.go
@@ -36,7 +36,7 @@ type EdsGenerator struct {
var _ model.XdsDeltaResourceGenerator = &EdsGenerator{}
var skippedEdsConfigs = sets.New(
- kind.ServiceRoute,
+ kind.VirtualService,
kind.PeerAuthentication,
kind.Secret,
)
diff --git a/manifests/charts/base/files/crd-all.yaml
b/manifests/charts/base/files/crd-all.yaml
index 91b32e55..2162ae2a 100644
--- a/manifests/charts/base/files/crd-all.yaml
+++ b/manifests/charts/base/files/crd-all.yaml
@@ -142,19 +142,19 @@ metadata:
chart: dubbo
heritage: Tiller
release: dubbo
- name: serviceroutes.networking.dubbo.apache.org
+ name: virtualservices.networking.dubbo.apache.org
spec:
group: networking.dubbo.apache.org
names:
categories:
- dubbo
- networking
- kind: ServiceRoute
- listKind: ServiceRouteList
- plural: serviceroutes
+ kind: VirtualService
+ listKind: VirtualServiceList
+ plural: virtualservices
shortNames:
- - sr
- singular: serviceroute
+ - vs
+ singular: virtualservice
scope: Namespaced
versions:
- additionalPrinterColumns:
diff --git a/pkg/config/schema/collections/collections.agent.go
b/pkg/config/schema/collections/collections.agent.go
index b2959b44..eaff5c68 100644
--- a/pkg/config/schema/collections/collections.agent.go
+++ b/pkg/config/schema/collections/collections.agent.go
@@ -26,8 +26,8 @@ import (
sigsk8siogatewayapiapisv1beta1 "sigs.k8s.io/gateway-api/apis/v1beta1"
dubboapimetav1alpha1
"github.com/apache/dubbo-kubernetes/api/meta/v1alpha1"
+ orgapachedubboapinetworkingv1alpha3
"github.com/apache/dubbo-kubernetes/api/networking/v1alpha3"
"github.com/apache/dubbo-kubernetes/pkg/config/schema/collection"
- istioioapinetworkingv1alpha3 "istio.io/api/networking/v1alpha3"
istioioapisecurityv1beta1 "istio.io/api/security/v1beta1"
k8sioapiadmissionregistrationv1 "k8s.io/api/admissionregistration/v1"
)
@@ -54,23 +54,23 @@ var (
Plural: "destinationrules",
Version: "v1alpha3",
VersionAliases: []string{},
- Proto: "istio.networking.v1alpha3.DestinationRule",
StatusProto: "istio.meta.v1alpha1.DubboStatus",
- ReflectType:
reflect.TypeOf(&istioioapinetworkingv1alpha3.DestinationRule{}).Elem(),
StatusType: reflect.TypeOf(&dubboapimetav1alpha1.DubboStatus{}).Elem(),
- ProtoPackage: "istio.io/api/networking/v1alpha3",
StatusPackage: "github.com/apache/dubbo-kubernetes/api/meta/v1alpha1",
+ Proto: "dubbo.networking.v1alpha3.DestinationRule",
StatusProto: "dubbo.meta.v1alpha1.DubboStatus",
+ ReflectType:
reflect.TypeOf(&orgapachedubboapinetworkingv1alpha3.DestinationRule{}).Elem(),
StatusType: reflect.TypeOf(&dubboapimetav1alpha1.DubboStatus{}).Elem(),
+ ProtoPackage:
"github.com/apache/dubbo-kubernetes/api/networking/v1alpha3", StatusPackage:
"github.com/apache/dubbo-kubernetes/api/meta/v1alpha1",
ClusterScoped: false,
Synthetic: false,
Builtin: false,
}.MustBuild()
- ServiceRoute = collection.Builder{
- Identifier: "ServiceRoute",
+ VirtualService = collection.Builder{
+ Identifier: "VirtualService",
Group: "networking.dubbo.apache.org",
- Kind: "ServiceRoute",
- Plural: "serviceroutes",
+ Kind: "VirtualService",
+ Plural: "virtualservices",
Version: "v1",
VersionAliases: []string{},
- Proto: "istio.networking.v1alpha3.VirtualService",
StatusProto: "istio.meta.v1alpha1.DubboStatus",
- ReflectType:
reflect.TypeOf(&istioioapinetworkingv1alpha3.VirtualService{}).Elem(),
StatusType: reflect.TypeOf(&dubboapimetav1alpha1.DubboStatus{}).Elem(),
- ProtoPackage: "istio.io/api/networking/v1alpha3",
StatusPackage: "github.com/apache/dubbo-kubernetes/api/meta/v1alpha1",
+ Proto: "dubbo.networking.v1alpha3.VirtualService",
StatusProto: "dubbo.meta.v1alpha1.DubboStatus",
+ ReflectType:
reflect.TypeOf(&orgapachedubboapinetworkingv1alpha3.VirtualService{}).Elem(),
StatusType: reflect.TypeOf(&dubboapimetav1alpha1.DubboStatus{}).Elem(),
+ ProtoPackage:
"github.com/apache/dubbo-kubernetes/api/networking/v1alpha3", StatusPackage:
"github.com/apache/dubbo-kubernetes/api/meta/v1alpha1",
ClusterScoped: false,
Synthetic: false,
Builtin: false,
@@ -147,19 +147,19 @@ var (
Planet = collection.NewSchemasBuilder().
MustAdd(PeerAuthentication).
MustAdd(DestinationRule).
- MustAdd(ServiceRoute).
+ MustAdd(VirtualService).
Build()
planetGatewayAPI = collection.NewSchemasBuilder().
- MustAdd(GatewayClass).
- MustAdd(Gateway).
- MustAdd(HTTPRoute).
- Build()
+ MustAdd(GatewayClass).
+ MustAdd(Gateway).
+ MustAdd(HTTPRoute).
+ Build()
All = collection.NewSchemasBuilder().
MustAdd(PeerAuthentication).
MustAdd(DestinationRule).
- MustAdd(ServiceRoute).
+ MustAdd(VirtualService).
MustAdd(MutatingWebhookConfiguration).
MustAdd(ValidatingWebhookConfiguration).
MustAdd(GatewayClass).
diff --git a/pkg/config/schema/collections/collections.go
b/pkg/config/schema/collections/collections.go
index 5526ab90..1275c184 100644
--- a/pkg/config/schema/collections/collections.go
+++ b/pkg/config/schema/collections/collections.go
@@ -26,8 +26,8 @@ import (
sigsk8siogatewayapiapisv1beta1 "sigs.k8s.io/gateway-api/apis/v1beta1"
dubboapimetav1alpha1
"github.com/apache/dubbo-kubernetes/api/meta/v1alpha1"
+ orgapachedubboapinetworkingv1alpha3
"github.com/apache/dubbo-kubernetes/api/networking/v1alpha3"
"github.com/apache/dubbo-kubernetes/pkg/config/schema/collection"
- istioioapinetworkingv1alpha3 "istio.io/api/networking/v1alpha3"
istioioapisecurityv1beta1 "istio.io/api/security/v1beta1"
k8sioapiadmissionregistrationv1 "k8s.io/api/admissionregistration/v1"
)
@@ -54,23 +54,23 @@ var (
Plural: "destinationrules",
Version: "v1alpha3",
VersionAliases: []string{},
- Proto: "istio.networking.v1alpha3.DestinationRule",
StatusProto: "dubbo.meta.v1alpha1.DubboStatus",
- ReflectType:
reflect.TypeOf(&istioioapinetworkingv1alpha3.DestinationRule{}).Elem(),
StatusType: reflect.TypeOf(&dubboapimetav1alpha1.DubboStatus{}).Elem(),
- ProtoPackage: "istio.io/api/networking/v1alpha3",
StatusPackage: "github.com/apache/dubbo-kubernetes/api/meta/v1alpha1",
+ Proto: "dubbo.networking.v1alpha3.DestinationRule",
StatusProto: "dubbo.meta.v1alpha1.DubboStatus",
+ ReflectType:
reflect.TypeOf(&orgapachedubboapinetworkingv1alpha3.DestinationRule{}).Elem(),
StatusType: reflect.TypeOf(&dubboapimetav1alpha1.DubboStatus{}).Elem(),
+ ProtoPackage:
"github.com/apache/dubbo-kubernetes/api/networking/v1alpha3", StatusPackage:
"github.com/apache/dubbo-kubernetes/api/meta/v1alpha1",
ClusterScoped: false,
Synthetic: false,
Builtin: false,
}.MustBuild()
- ServiceRoute = collection.Builder{
- Identifier: "ServiceRoute",
+ VirtualService = collection.Builder{
+ Identifier: "VirtualService",
Group: "networking.dubbo.apache.org",
- Kind: "ServiceRoute",
- Plural: "serviceroutes",
+ Kind: "VirtualService",
+ Plural: "virtualservices",
Version: "v1",
VersionAliases: []string{},
- Proto: "istio.networking.v1alpha3.VirtualService",
StatusProto: "dubbo.meta.v1alpha1.DubboStatus",
- ReflectType:
reflect.TypeOf(&istioioapinetworkingv1alpha3.VirtualService{}).Elem(),
StatusType: reflect.TypeOf(&dubboapimetav1alpha1.DubboStatus{}).Elem(),
- ProtoPackage: "istio.io/api/networking/v1alpha3",
StatusPackage: "github.com/apache/dubbo-kubernetes/api/meta/v1alpha1",
+ Proto: "dubbo.networking.v1alpha3.VirtualService",
StatusProto: "dubbo.meta.v1alpha1.DubboStatus",
+ ReflectType:
reflect.TypeOf(&orgapachedubboapinetworkingv1alpha3.VirtualService{}).Elem(),
StatusType: reflect.TypeOf(&dubboapimetav1alpha1.DubboStatus{}).Elem(),
+ ProtoPackage:
"github.com/apache/dubbo-kubernetes/api/networking/v1alpha3", StatusPackage:
"github.com/apache/dubbo-kubernetes/api/meta/v1alpha1",
ClusterScoped: false,
Synthetic: false,
Builtin: false,
@@ -147,19 +147,19 @@ var (
Planet = collection.NewSchemasBuilder().
MustAdd(PeerAuthentication).
MustAdd(DestinationRule).
- MustAdd(ServiceRoute).
+ MustAdd(VirtualService).
Build()
planetGatewayAPI = collection.NewSchemasBuilder().
- MustAdd(GatewayClass).
- MustAdd(Gateway).
- MustAdd(HTTPRoute).
- Build()
+ MustAdd(GatewayClass).
+ MustAdd(Gateway).
+ MustAdd(HTTPRoute).
+ Build()
All = collection.NewSchemasBuilder().
MustAdd(PeerAuthentication).
MustAdd(DestinationRule).
- MustAdd(ServiceRoute).
+ MustAdd(VirtualService).
MustAdd(MutatingWebhookConfiguration).
MustAdd(ValidatingWebhookConfiguration).
MustAdd(GatewayClass).
diff --git a/pkg/config/schema/gvk/resources.go
b/pkg/config/schema/gvk/resources.go
index bcd12201..e0cbf9d9 100644
--- a/pkg/config/schema/gvk/resources.go
+++ b/pkg/config/schema/gvk/resources.go
@@ -39,7 +39,7 @@ var (
MeshGlobalConfig = config.GroupVersionKind{Group: "",
Version: "v1alpha1", Kind: "MeshGlobalConfig"}
PeerAuthentication = config.GroupVersionKind{Group:
"security.dubbo.apache.org", Version: "v1", Kind: "PeerAuthentication"}
DestinationRule = config.GroupVersionKind{Group:
"networking.dubbo.apache.org", Version: "v1alpha3", Kind: "DestinationRule"}
- ServiceRoute = config.GroupVersionKind{Group:
"networking.dubbo.apache.org", Version: "v1", Kind: "ServiceRoute"}
+ VirtualService = config.GroupVersionKind{Group:
"networking.dubbo.apache.org", Version: "v1", Kind: "VirtualService"}
EndpointSlice = config.GroupVersionKind{Group:
"discovery.k8s.io", Version: "v1", Kind: "EndpointSlice"}
Endpoints = config.GroupVersionKind{Group: "",
Version: "v1", Kind: "Endpoints"}
GatewayClass = config.GroupVersionKind{Group:
"gateway.networking.k8s.io", Version: "v1", Kind: "GatewayClass"}
@@ -81,8 +81,8 @@ func ToGVR(g config.GroupVersionKind)
(schema.GroupVersionResource, bool) {
return gvr.PeerAuthentication, true
case DestinationRule:
return gvr.DestinationRule, true
- case ServiceRoute:
- return gvr.ServiceRoute, true
+ case VirtualService:
+ return gvr.VirtualService, true
case EndpointSlice:
return gvr.EndpointSlice, true
case Endpoints:
@@ -117,8 +117,8 @@ func FromGVR(g schema.GroupVersionResource)
(config.GroupVersionKind, bool) {
return Job, true
case gvr.PeerAuthentication:
return PeerAuthentication, true
- case gvr.ServiceRoute:
- return ServiceRoute, true
+ case gvr.VirtualService:
+ return VirtualService, true
case gvr.DestinationRule:
return DestinationRule, true
case gvr.EndpointSlice:
diff --git a/pkg/config/schema/gvr/resources.go
b/pkg/config/schema/gvr/resources.go
index 08d627b6..7a02eb63 100644
--- a/pkg/config/schema/gvr/resources.go
+++ b/pkg/config/schema/gvr/resources.go
@@ -36,7 +36,7 @@ var (
MeshGlobalConfig = schema.GroupVersionResource{Group: "",
Version: "v1alpha1", Resource: "meshglobalconfigs"}
PeerAuthentication = schema.GroupVersionResource{Group:
"security.dubbo.apache.org", Version: "v1", Resource: "peerauthentications"}
DestinationRule =
schema.GroupVersionResource{Group: "networking.dubbo.apache.org", Version:
"v1alpha3", Resource: "destinationrules"}
- ServiceRoute = schema.GroupVersionResource{Group:
"networking.dubbo.apache.org", Version: "v1", Resource: "serviceroutes"}
+ VirtualService = schema.GroupVersionResource{Group:
"networking.dubbo.apache.org", Version: "v1", Resource: "virtualservices"}
EndpointSlice = schema.GroupVersionResource{Group:
"discovery.k8s.io", Version: "v1", Resource: "endpointslices"}
Endpoints = schema.GroupVersionResource{Group: "",
Version: "v1", Resource: "endpoints"}
Pod = schema.GroupVersionResource{Group: "",
Version: "v1", Resource: "pods"}
@@ -67,7 +67,7 @@ func IsClusterScoped(g schema.GroupVersionResource) bool {
return false
case DestinationRule:
return false
- case ServiceRoute:
+ case VirtualService:
return false
case MutatingWebhookConfiguration:
return true
diff --git a/pkg/config/schema/kind/resources.go
b/pkg/config/schema/kind/resources.go
index 02b94b07..11cbc716 100644
--- a/pkg/config/schema/kind/resources.go
+++ b/pkg/config/schema/kind/resources.go
@@ -31,7 +31,7 @@ const (
ValidatingWebhookConfiguration
MutatingWebhookConfiguration
PeerAuthentication
- ServiceRoute
+ VirtualService
DestinationRule
Gateway
GatewayClass
@@ -66,8 +66,8 @@ func (k Kind) String() string {
return "MutatingWebhookConfiguration"
case PeerAuthentication:
return "PeerAuthentication"
- case ServiceRoute:
- return "ServiceRoute"
+ case VirtualService:
+ return "VirtualService"
case DestinationRule:
return "DestinationRule"
case GatewayClass:
diff --git a/pkg/config/schema/kubeclient/resources.go
b/pkg/config/schema/kubeclient/resources.go
index 5849a396..8f7beedb 100644
--- a/pkg/config/schema/kubeclient/resources.go
+++ b/pkg/config/schema/kubeclient/resources.go
@@ -118,7 +118,7 @@ func gvrToObject(g schema.GroupVersionResource)
runtime.Object {
return
&k8sioapiadmissionregistrationv1.ValidatingWebhookConfiguration{}
case gvr.PeerAuthentication:
return &apiistioioapisecurityv1.PeerAuthentication{}
- case gvr.ServiceRoute:
+ case gvr.VirtualService:
return &apiistioioapinetworkingv1.VirtualService{}
case gvr.DestinationRule:
return &apiistioioapinetworkingv1.DestinationRule{}
@@ -229,13 +229,13 @@ func getInformerFiltered(c ClientGetter, opts
ktypes.InformerOptions, g schema.G
w = func(options metav1.ListOptions) (watch.Interface, error) {
return
c.Kube().AdmissionregistrationV1().ValidatingWebhookConfigurations().Watch(context.Background(),
options)
}
- case gvr.ServiceRoute:
- // ServiceRoute uses networking.dubbo.apache.org API group, not
networking.istio.io
+ case gvr.VirtualService:
+ // VirtualService uses networking.dubbo.apache.org API group,
not networking.istio.io
// Use Dynamic client to access it
gvr := schema.GroupVersionResource{
Group: "networking.dubbo.apache.org",
Version: "v1",
- Resource: "serviceroutes",
+ Resource: "virtualservices",
}
l = func(options metav1.ListOptions) (runtime.Object, error) {
return
c.Dynamic().Resource(gvr).Namespace(opts.Namespace).List(context.Background(),
options)
diff --git a/pkg/config/schema/kubetypes/resources.go
b/pkg/config/schema/kubetypes/resources.go
index c5721a57..b13d79c5 100644
--- a/pkg/config/schema/kubetypes/resources.go
+++ b/pkg/config/schema/kubetypes/resources.go
@@ -43,7 +43,7 @@ func getGvk(obj any) (config.GroupVersionKind, bool) {
case *apiistioioapinetworkingv1.DestinationRule:
return gvk.DestinationRule, true
case *apiistioioapinetworkingv1.VirtualService:
- return gvk.ServiceRoute, true
+ return gvk.VirtualService, true
case *k8sioapicorev1.ConfigMap:
return gvk.ConfigMap, true
case *k8sioapicorev1.Endpoints:
diff --git a/pkg/xds/server.go b/pkg/xds/server.go
index 0f0f7b97..a1e5ec9c 100644
--- a/pkg/xds/server.go
+++ b/pkg/xds/server.go
@@ -324,7 +324,7 @@ func ShouldRespond(w Watcher, id string, request
*discovery.DiscoveryRequest) (b
if request.ResponseNonce != previousInfo.NonceSent {
newResources := sets.New(request.ResourceNames...)
// Special-case proxyless gRPC: xDS clients may send a "stale"
nonce when they change
- // subscriptions (e.g., after ServiceRoute introduces subset
clusters). Treat this
+ // subscriptions (e.g., after VirtualService introduces subset
clusters). Treat this
// as a resource change rather than an ACK so the new clusters
get a response.
previousResourcesCopy := previousInfo.ResourceNames.Copy()
if !newResources.Equals(previousResourcesCopy) &&
len(newResources) > 0 {
diff --git a/samples/grpc-app/README.md b/samples/grpc-app/README.md
index fe7c8f25..0d902375 100644
--- a/samples/grpc-app/README.md
+++ b/samples/grpc-app/README.md
@@ -85,7 +85,7 @@ Using the subsets defined above, you can send weighted
traffic to different vers
```bash
cat <<EOF | kubectl apply -f -
apiVersion: networking.dubbo.apache.org/v1alpha3
-kind: ServiceRoute
+kind: VirtualService
metadata:
name: provider-weights
namespace: grpc-app