public static final class VirtualServiceOuterClass.Destination extends com.google.protobuf.GeneratedMessageV3 implements VirtualServiceOuterClass.DestinationOrBuilder
Destination indicates the network addressable service to which the
request/connection will be sent after processing a routing rule. The
destination.host should unambiguously refer to a service in the service
registry. Istio's service registry is composed of all the services found
in the platform's service registry (e.g., Kubernetes services, Consul
services), as well as services declared through the
[ServiceEntry](https://istio.io/docs/reference/config/networking/service-entry/#ServiceEntry) resource.
*Note for Kubernetes users*: When short names are used (e.g. "reviews"
instead of "reviews.default.svc.cluster.local"), Istio will interpret
the short name based on the namespace of the rule, not the service. A
rule in the "default" namespace containing a host "reviews will be
interpreted as "reviews.default.svc.cluster.local", irrespective of the
actual namespace associated with the reviews service. _To avoid potential
misconfigurations, it is recommended to always use fully qualified
domain names over short names._
The following Kubernetes example routes all traffic by default to pods
of the reviews service with label "version: v1" (i.e., subset v1), and
some to subset v2, in a Kubernetes environment.
{{<tabset category-name="example">}}
{{<tab name="v1alpha3" category-value="v1alpha3">}}
```yaml
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: reviews-route
namespace: foo
spec:
hosts:
- reviews # interpreted as reviews.foo.svc.cluster.local
http:
- match:
- uri:
prefix: "/wpcatalog"
- uri:
prefix: "/consumercatalog"
rewrite:
uri: "/newcatalog"
route:
- destination:
host: reviews # interpreted as reviews.foo.svc.cluster.local
subset: v2
- route:
- destination:
host: reviews # interpreted as reviews.foo.svc.cluster.local
subset: v1
```
{{</tab>}}
{{<tab name="v1beta1" category-value="v1beta1">}}
```yaml
apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
name: reviews-route
namespace: foo
spec:
hosts:
- reviews # interpreted as reviews.foo.svc.cluster.local
http:
- match:
- uri:
prefix: "/wpcatalog"
- uri:
prefix: "/consumercatalog"
rewrite:
uri: "/newcatalog"
route:
- destination:
host: reviews # interpreted as reviews.foo.svc.cluster.local
subset: v2
- route:
- destination:
host: reviews # interpreted as reviews.foo.svc.cluster.local
subset: v1
```
{{</tab>}}
{{</tabset>}}
And the associated DestinationRule
{{<tabset category-name="example">}}
{{<tab name="v1alpha3" category-value="v1alpha3">}}
```yaml
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
name: reviews-destination
namespace: foo
spec:
host: reviews # interpreted as reviews.foo.svc.cluster.local
subsets:
- name: v1
labels:
version: v1
- name: v2
labels:
version: v2
```
{{</tab>}}
{{<tab name="v1beta1" category-value="v1beta1">}}
```yaml
apiVersion: networking.istio.io/v1beta1
kind: DestinationRule
metadata:
name: reviews-destination
namespace: foo
spec:
host: reviews # interpreted as reviews.foo.svc.cluster.local
subsets:
- name: v1
labels:
version: v1
- name: v2
labels:
version: v2
```
{{</tab>}}
{{</tabset>}}
The following VirtualService sets a timeout of 5s for all calls to
productpage.prod.svc.cluster.local service in Kubernetes. Notice that
there are no subsets defined in this rule. Istio will fetch all
instances of productpage.prod.svc.cluster.local service from the service
registry and populate the sidecar's load balancing pool. Also, notice
that this rule is set in the istio-system namespace but uses the fully
qualified domain name of the productpage service,
productpage.prod.svc.cluster.local. Therefore the rule's namespace does
not have an impact in resolving the name of the productpage service.
{{<tabset category-name="example">}}
{{<tab name="v1alpha3" category-value="v1alpha3">}}
```yaml
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: my-productpage-rule
namespace: istio-system
spec:
hosts:
- productpage.prod.svc.cluster.local # ignores rule namespace
http:
- timeout: 5s
route:
- destination:
host: productpage.prod.svc.cluster.local
```
{{</tab>}}
{{<tab name="v1beta1" category-value="v1beta1">}}
```yaml
apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
name: my-productpage-rule
namespace: istio-system
spec:
hosts:
- productpage.prod.svc.cluster.local # ignores rule namespace
http:
- timeout: 5s
route:
- destination:
host: productpage.prod.svc.cluster.local
```
{{</tab>}}
{{</tabset>}}
To control routing for traffic bound to services outside the mesh, external
services must first be added to Istio's internal service registry using the
ServiceEntry resource. VirtualServices can then be defined to control traffic
bound to these external services. For example, the following rules define a
Service for wikipedia.org and set a timeout of 5s for HTTP requests.
{{<tabset category-name="example">}}
{{<tab name="v1alpha3" category-value="v1alpha3">}}
```yaml
apiVersion: networking.istio.io/v1alpha3
kind: ServiceEntry
metadata:
name: external-svc-wikipedia
spec:
hosts:
- wikipedia.org
location: MESH_EXTERNAL
ports:
- number: 80
name: example-http
protocol: HTTP
resolution: DNS
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: my-wiki-rule
spec:
hosts:
- wikipedia.org
http:
- timeout: 5s
route:
- destination:
host: wikipedia.org
```
{{</tab>}}
{{<tab name="v1beta1" category-value="v1beta1">}}
```yaml
apiVersion: networking.istio.io/v1beta1
kind: ServiceEntry
metadata:
name: external-svc-wikipedia
spec:
hosts:
- wikipedia.org
location: MESH_EXTERNAL
ports:
- number: 80
name: example-http
protocol: HTTP
resolution: DNS
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: my-wiki-rule
spec:
hosts:
- wikipedia.org
http:
- timeout: 5s
route:
- destination:
host: wikipedia.org
```
{{</tab>}}
{{</tabset>}}
Protobuf type istio.networking.v1alpha3.Destination| 限定符和类型 | 类和说明 |
|---|---|
static class |
VirtualServiceOuterClass.Destination.Builder
Destination indicates the network addressable service to which the
request/connection will be sent after processing a routing rule.
|
com.google.protobuf.GeneratedMessageV3.BuilderParent, com.google.protobuf.GeneratedMessageV3.ExtendableBuilder<MessageType extends com.google.protobuf.GeneratedMessageV3.ExtendableMessage,BuilderType extends com.google.protobuf.GeneratedMessageV3.ExtendableBuilder<MessageType,BuilderType>>, com.google.protobuf.GeneratedMessageV3.ExtendableMessage<MessageType extends com.google.protobuf.GeneratedMessageV3.ExtendableMessage>, com.google.protobuf.GeneratedMessageV3.ExtendableMessageOrBuilder<MessageType extends com.google.protobuf.GeneratedMessageV3.ExtendableMessage>, com.google.protobuf.GeneratedMessageV3.FieldAccessorTable, com.google.protobuf.GeneratedMessageV3.UnusedPrivateParameter| 限定符和类型 | 字段和说明 |
|---|---|
static int |
HOST_FIELD_NUMBER |
static int |
PORT_FIELD_NUMBER |
static int |
SUBSET_FIELD_NUMBER |
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
equals(Object obj) |
static VirtualServiceOuterClass.Destination |
getDefaultInstance() |
VirtualServiceOuterClass.Destination |
getDefaultInstanceForType() |
static com.google.protobuf.Descriptors.Descriptor |
getDescriptor() |
String |
getHost()
The name of a service from the service registry.
|
com.google.protobuf.ByteString |
getHostBytes()
The name of a service from the service registry.
|
com.google.protobuf.Parser<VirtualServiceOuterClass.Destination> |
getParserForType() |
VirtualServiceOuterClass.PortSelector |
getPort()
Specifies the port on the host that is being addressed.
|
VirtualServiceOuterClass.PortSelectorOrBuilder |
getPortOrBuilder()
Specifies the port on the host that is being addressed.
|
int |
getSerializedSize() |
String |
getSubset()
The name of a subset within the service.
|
com.google.protobuf.ByteString |
getSubsetBytes()
The name of a subset within the service.
|
com.google.protobuf.UnknownFieldSet |
getUnknownFields() |
int |
hashCode() |
boolean |
hasPort()
Specifies the port on the host that is being addressed.
|
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable |
internalGetFieldAccessorTable() |
boolean |
isInitialized() |
static VirtualServiceOuterClass.Destination.Builder |
newBuilder() |
static VirtualServiceOuterClass.Destination.Builder |
newBuilder(VirtualServiceOuterClass.Destination prototype) |
VirtualServiceOuterClass.Destination.Builder |
newBuilderForType() |
protected VirtualServiceOuterClass.Destination.Builder |
newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) |
protected Object |
newInstance(com.google.protobuf.GeneratedMessageV3.UnusedPrivateParameter unused) |
static VirtualServiceOuterClass.Destination |
parseDelimitedFrom(InputStream input) |
static VirtualServiceOuterClass.Destination |
parseDelimitedFrom(InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
static VirtualServiceOuterClass.Destination |
parseFrom(byte[] data) |
static VirtualServiceOuterClass.Destination |
parseFrom(byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
static VirtualServiceOuterClass.Destination |
parseFrom(ByteBuffer data) |
static VirtualServiceOuterClass.Destination |
parseFrom(ByteBuffer data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
static VirtualServiceOuterClass.Destination |
parseFrom(com.google.protobuf.ByteString data) |
static VirtualServiceOuterClass.Destination |
parseFrom(com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
static VirtualServiceOuterClass.Destination |
parseFrom(com.google.protobuf.CodedInputStream input) |
static VirtualServiceOuterClass.Destination |
parseFrom(com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
static VirtualServiceOuterClass.Destination |
parseFrom(InputStream input) |
static VirtualServiceOuterClass.Destination |
parseFrom(InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
static com.google.protobuf.Parser<VirtualServiceOuterClass.Destination> |
parser() |
VirtualServiceOuterClass.Destination.Builder |
toBuilder() |
void |
writeTo(com.google.protobuf.CodedOutputStream output) |
canUseUnsafe, computeStringSize, computeStringSizeNoTag, emptyBooleanList, emptyDoubleList, emptyFloatList, emptyIntList, emptyLongList, getAllFields, getDescriptorForType, getField, getOneofFieldDescriptor, getRepeatedField, getRepeatedFieldCount, hasField, hasOneof, internalGetMapField, isStringEmpty, makeExtensionsImmutable, mergeFromAndMakeImmutableInternal, mutableCopy, mutableCopy, mutableCopy, mutableCopy, mutableCopy, newBooleanList, newBuilderForType, newDoubleList, newFloatList, newIntList, newLongList, parseDelimitedWithIOException, parseDelimitedWithIOException, parseUnknownField, parseUnknownFieldProto3, parseWithIOException, parseWithIOException, parseWithIOException, parseWithIOException, serializeBooleanMapTo, serializeIntegerMapTo, serializeLongMapTo, serializeStringMapTo, writeReplace, writeString, writeStringNoTagfindInitializationErrors, getInitializationErrorString, hashBoolean, hashEnum, hashEnumList, hashFields, hashLong, toStringaddAll, addAll, checkByteStringIsUtf8, toByteArray, toByteString, writeDelimitedTo, writeTopublic static final int HOST_FIELD_NUMBER
public static final int SUBSET_FIELD_NUMBER
public static final int PORT_FIELD_NUMBER
protected Object newInstance(com.google.protobuf.GeneratedMessageV3.UnusedPrivateParameter unused)
newInstance 在类中 com.google.protobuf.GeneratedMessageV3public final com.google.protobuf.UnknownFieldSet getUnknownFields()
getUnknownFields 在接口中 com.google.protobuf.MessageOrBuildergetUnknownFields 在类中 com.google.protobuf.GeneratedMessageV3public static final com.google.protobuf.Descriptors.Descriptor getDescriptor()
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
internalGetFieldAccessorTable 在类中 com.google.protobuf.GeneratedMessageV3public String getHost()
The name of a service from the service registry. Service names are looked up from the platform's service registry (e.g., Kubernetes services, Consul services, etc.) and from the hosts declared by [ServiceEntry](https://istio.io/docs/reference/config/networking/service-entry/#ServiceEntry). Traffic forwarded to destinations that are not found in either of the two, will be dropped. *Note for Kubernetes users*: When short names are used (e.g. "reviews" instead of "reviews.default.svc.cluster.local"), Istio will interpret the short name based on the namespace of the rule, not the service. A rule in the "default" namespace containing a host "reviews will be interpreted as "reviews.default.svc.cluster.local", irrespective of the actual namespace associated with the reviews service. To avoid potential misconfiguration, it is recommended to always use fully qualified domain names over short names.
string host = 1 [(.google.api.field_behavior) = REQUIRED];getHost 在接口中 VirtualServiceOuterClass.DestinationOrBuilderpublic com.google.protobuf.ByteString getHostBytes()
The name of a service from the service registry. Service names are looked up from the platform's service registry (e.g., Kubernetes services, Consul services, etc.) and from the hosts declared by [ServiceEntry](https://istio.io/docs/reference/config/networking/service-entry/#ServiceEntry). Traffic forwarded to destinations that are not found in either of the two, will be dropped. *Note for Kubernetes users*: When short names are used (e.g. "reviews" instead of "reviews.default.svc.cluster.local"), Istio will interpret the short name based on the namespace of the rule, not the service. A rule in the "default" namespace containing a host "reviews will be interpreted as "reviews.default.svc.cluster.local", irrespective of the actual namespace associated with the reviews service. To avoid potential misconfiguration, it is recommended to always use fully qualified domain names over short names.
string host = 1 [(.google.api.field_behavior) = REQUIRED];getHostBytes 在接口中 VirtualServiceOuterClass.DestinationOrBuilderpublic String getSubset()
The name of a subset within the service. Applicable only to services within the mesh. The subset must be defined in a corresponding DestinationRule.
string subset = 2;getSubset 在接口中 VirtualServiceOuterClass.DestinationOrBuilderpublic com.google.protobuf.ByteString getSubsetBytes()
The name of a subset within the service. Applicable only to services within the mesh. The subset must be defined in a corresponding DestinationRule.
string subset = 2;getSubsetBytes 在接口中 VirtualServiceOuterClass.DestinationOrBuilderpublic boolean hasPort()
Specifies the port on the host that is being addressed. If a service exposes only a single port it is not required to explicitly select the port.
.istio.networking.v1alpha3.PortSelector port = 3;hasPort 在接口中 VirtualServiceOuterClass.DestinationOrBuilderpublic VirtualServiceOuterClass.PortSelector getPort()
Specifies the port on the host that is being addressed. If a service exposes only a single port it is not required to explicitly select the port.
.istio.networking.v1alpha3.PortSelector port = 3;getPort 在接口中 VirtualServiceOuterClass.DestinationOrBuilderpublic VirtualServiceOuterClass.PortSelectorOrBuilder getPortOrBuilder()
Specifies the port on the host that is being addressed. If a service exposes only a single port it is not required to explicitly select the port.
.istio.networking.v1alpha3.PortSelector port = 3;public final boolean isInitialized()
isInitialized 在接口中 com.google.protobuf.MessageLiteOrBuilderisInitialized 在类中 com.google.protobuf.GeneratedMessageV3public void writeTo(com.google.protobuf.CodedOutputStream output)
throws IOException
writeTo 在接口中 com.google.protobuf.MessageLitewriteTo 在类中 com.google.protobuf.GeneratedMessageV3IOExceptionpublic int getSerializedSize()
getSerializedSize 在接口中 com.google.protobuf.MessageLitegetSerializedSize 在类中 com.google.protobuf.GeneratedMessageV3public boolean equals(Object obj)
equals 在接口中 com.google.protobuf.Messageequals 在类中 com.google.protobuf.AbstractMessagepublic int hashCode()
hashCode 在接口中 com.google.protobuf.MessagehashCode 在类中 com.google.protobuf.AbstractMessagepublic static VirtualServiceOuterClass.Destination parseFrom(ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException
com.google.protobuf.InvalidProtocolBufferExceptionpublic static VirtualServiceOuterClass.Destination parseFrom(ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
com.google.protobuf.InvalidProtocolBufferExceptionpublic static VirtualServiceOuterClass.Destination parseFrom(com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException
com.google.protobuf.InvalidProtocolBufferExceptionpublic static VirtualServiceOuterClass.Destination parseFrom(com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
com.google.protobuf.InvalidProtocolBufferExceptionpublic static VirtualServiceOuterClass.Destination parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException
com.google.protobuf.InvalidProtocolBufferExceptionpublic static VirtualServiceOuterClass.Destination parseFrom(byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
com.google.protobuf.InvalidProtocolBufferExceptionpublic static VirtualServiceOuterClass.Destination parseFrom(InputStream input) throws IOException
IOExceptionpublic static VirtualServiceOuterClass.Destination parseFrom(InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException
IOExceptionpublic static VirtualServiceOuterClass.Destination parseDelimitedFrom(InputStream input) throws IOException
IOExceptionpublic static VirtualServiceOuterClass.Destination parseDelimitedFrom(InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException
IOExceptionpublic static VirtualServiceOuterClass.Destination parseFrom(com.google.protobuf.CodedInputStream input) throws IOException
IOExceptionpublic static VirtualServiceOuterClass.Destination parseFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException
IOExceptionpublic VirtualServiceOuterClass.Destination.Builder newBuilderForType()
newBuilderForType 在接口中 com.google.protobuf.MessagenewBuilderForType 在接口中 com.google.protobuf.MessageLitepublic static VirtualServiceOuterClass.Destination.Builder newBuilder()
public static VirtualServiceOuterClass.Destination.Builder newBuilder(VirtualServiceOuterClass.Destination prototype)
public VirtualServiceOuterClass.Destination.Builder toBuilder()
toBuilder 在接口中 com.google.protobuf.MessagetoBuilder 在接口中 com.google.protobuf.MessageLiteprotected VirtualServiceOuterClass.Destination.Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)
newBuilderForType 在类中 com.google.protobuf.GeneratedMessageV3public static VirtualServiceOuterClass.Destination getDefaultInstance()
public static com.google.protobuf.Parser<VirtualServiceOuterClass.Destination> parser()
public com.google.protobuf.Parser<VirtualServiceOuterClass.Destination> getParserForType()
getParserForType 在接口中 com.google.protobuf.MessagegetParserForType 在接口中 com.google.protobuf.MessageLitegetParserForType 在类中 com.google.protobuf.GeneratedMessageV3public VirtualServiceOuterClass.Destination getDefaultInstanceForType()
getDefaultInstanceForType 在接口中 com.google.protobuf.MessageLiteOrBuildergetDefaultInstanceForType 在接口中 com.google.protobuf.MessageOrBuilderCopyright © 2018–2023 Alibaba Group. All rights reserved.