public static final class VirtualServiceOuterClass.Destination.Builder extends com.google.protobuf.GeneratedMessageV3.Builder<VirtualServiceOuterClass.Destination.Builder> 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| 限定符和类型 | 方法和说明 |
|---|---|
VirtualServiceOuterClass.Destination.Builder |
addRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field,
Object value) |
VirtualServiceOuterClass.Destination |
build() |
VirtualServiceOuterClass.Destination |
buildPartial() |
VirtualServiceOuterClass.Destination.Builder |
clear() |
VirtualServiceOuterClass.Destination.Builder |
clearField(com.google.protobuf.Descriptors.FieldDescriptor field) |
VirtualServiceOuterClass.Destination.Builder |
clearHost()
The name of a service from the service registry.
|
VirtualServiceOuterClass.Destination.Builder |
clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) |
VirtualServiceOuterClass.Destination.Builder |
clearPort()
Specifies the port on the host that is being addressed.
|
VirtualServiceOuterClass.Destination.Builder |
clearSubset()
The name of a subset within the service.
|
VirtualServiceOuterClass.Destination.Builder |
clone() |
VirtualServiceOuterClass.Destination |
getDefaultInstanceForType() |
static com.google.protobuf.Descriptors.Descriptor |
getDescriptor() |
com.google.protobuf.Descriptors.Descriptor |
getDescriptorForType() |
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.
|
VirtualServiceOuterClass.PortSelector |
getPort()
Specifies the port on the host that is being addressed.
|
VirtualServiceOuterClass.PortSelector.Builder |
getPortBuilder()
Specifies the port on the host that is being addressed.
|
VirtualServiceOuterClass.PortSelectorOrBuilder |
getPortOrBuilder()
Specifies the port on the host that is being addressed.
|
String |
getSubset()
The name of a subset within the service.
|
com.google.protobuf.ByteString |
getSubsetBytes()
The name of a subset within the service.
|
boolean |
hasPort()
Specifies the port on the host that is being addressed.
|
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable |
internalGetFieldAccessorTable() |
boolean |
isInitialized() |
VirtualServiceOuterClass.Destination.Builder |
mergeFrom(com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
VirtualServiceOuterClass.Destination.Builder |
mergeFrom(com.google.protobuf.Message other) |
VirtualServiceOuterClass.Destination.Builder |
mergeFrom(VirtualServiceOuterClass.Destination other) |
VirtualServiceOuterClass.Destination.Builder |
mergePort(VirtualServiceOuterClass.PortSelector value)
Specifies the port on the host that is being addressed.
|
VirtualServiceOuterClass.Destination.Builder |
mergeUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields) |
VirtualServiceOuterClass.Destination.Builder |
setField(com.google.protobuf.Descriptors.FieldDescriptor field,
Object value) |
VirtualServiceOuterClass.Destination.Builder |
setHost(String value)
The name of a service from the service registry.
|
VirtualServiceOuterClass.Destination.Builder |
setHostBytes(com.google.protobuf.ByteString value)
The name of a service from the service registry.
|
VirtualServiceOuterClass.Destination.Builder |
setPort(VirtualServiceOuterClass.PortSelector.Builder builderForValue)
Specifies the port on the host that is being addressed.
|
VirtualServiceOuterClass.Destination.Builder |
setPort(VirtualServiceOuterClass.PortSelector value)
Specifies the port on the host that is being addressed.
|
VirtualServiceOuterClass.Destination.Builder |
setRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field,
int index,
Object value) |
VirtualServiceOuterClass.Destination.Builder |
setSubset(String value)
The name of a subset within the service.
|
VirtualServiceOuterClass.Destination.Builder |
setSubsetBytes(com.google.protobuf.ByteString value)
The name of a subset within the service.
|
VirtualServiceOuterClass.Destination.Builder |
setUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields) |
getAllFields, getField, getFieldBuilder, getOneofFieldDescriptor, getParentForChildren, getRepeatedField, getRepeatedFieldBuilder, getRepeatedFieldCount, getUnknownFields, getUnknownFieldSetBuilder, hasField, hasOneof, internalGetMapField, internalGetMutableMapField, isClean, markClean, mergeUnknownLengthDelimitedField, mergeUnknownVarintField, newBuilderForField, onBuilt, onChanged, parseUnknownField, setUnknownFieldSetBuilder, setUnknownFieldsProto3findInitializationErrors, getInitializationErrorString, internalMergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, newUninitializedMessageException, toStringaddAll, addAll, mergeDelimitedFrom, mergeDelimitedFrom, mergeFrom, newUninitializedMessageExceptionpublic static final com.google.protobuf.Descriptors.Descriptor getDescriptor()
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
internalGetFieldAccessorTable 在类中 com.google.protobuf.GeneratedMessageV3.Builder<VirtualServiceOuterClass.Destination.Builder>public VirtualServiceOuterClass.Destination.Builder clear()
clear 在接口中 com.google.protobuf.Message.Builderclear 在接口中 com.google.protobuf.MessageLite.Builderclear 在类中 com.google.protobuf.GeneratedMessageV3.Builder<VirtualServiceOuterClass.Destination.Builder>public com.google.protobuf.Descriptors.Descriptor getDescriptorForType()
getDescriptorForType 在接口中 com.google.protobuf.Message.BuildergetDescriptorForType 在接口中 com.google.protobuf.MessageOrBuildergetDescriptorForType 在类中 com.google.protobuf.GeneratedMessageV3.Builder<VirtualServiceOuterClass.Destination.Builder>public VirtualServiceOuterClass.Destination getDefaultInstanceForType()
getDefaultInstanceForType 在接口中 com.google.protobuf.MessageLiteOrBuildergetDefaultInstanceForType 在接口中 com.google.protobuf.MessageOrBuilderpublic VirtualServiceOuterClass.Destination build()
build 在接口中 com.google.protobuf.Message.Builderbuild 在接口中 com.google.protobuf.MessageLite.Builderpublic VirtualServiceOuterClass.Destination buildPartial()
buildPartial 在接口中 com.google.protobuf.Message.BuilderbuildPartial 在接口中 com.google.protobuf.MessageLite.Builderpublic VirtualServiceOuterClass.Destination.Builder clone()
clone 在接口中 com.google.protobuf.Message.Builderclone 在接口中 com.google.protobuf.MessageLite.Builderclone 在类中 com.google.protobuf.GeneratedMessageV3.Builder<VirtualServiceOuterClass.Destination.Builder>public VirtualServiceOuterClass.Destination.Builder setField(com.google.protobuf.Descriptors.FieldDescriptor field, Object value)
setField 在接口中 com.google.protobuf.Message.BuildersetField 在类中 com.google.protobuf.GeneratedMessageV3.Builder<VirtualServiceOuterClass.Destination.Builder>public VirtualServiceOuterClass.Destination.Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field)
clearField 在接口中 com.google.protobuf.Message.BuilderclearField 在类中 com.google.protobuf.GeneratedMessageV3.Builder<VirtualServiceOuterClass.Destination.Builder>public VirtualServiceOuterClass.Destination.Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof)
clearOneof 在接口中 com.google.protobuf.Message.BuilderclearOneof 在类中 com.google.protobuf.GeneratedMessageV3.Builder<VirtualServiceOuterClass.Destination.Builder>public VirtualServiceOuterClass.Destination.Builder setRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, int index, Object value)
setRepeatedField 在接口中 com.google.protobuf.Message.BuildersetRepeatedField 在类中 com.google.protobuf.GeneratedMessageV3.Builder<VirtualServiceOuterClass.Destination.Builder>public VirtualServiceOuterClass.Destination.Builder addRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, Object value)
addRepeatedField 在接口中 com.google.protobuf.Message.BuilderaddRepeatedField 在类中 com.google.protobuf.GeneratedMessageV3.Builder<VirtualServiceOuterClass.Destination.Builder>public VirtualServiceOuterClass.Destination.Builder mergeFrom(com.google.protobuf.Message other)
mergeFrom 在接口中 com.google.protobuf.Message.BuildermergeFrom 在类中 com.google.protobuf.AbstractMessage.Builder<VirtualServiceOuterClass.Destination.Builder>public VirtualServiceOuterClass.Destination.Builder mergeFrom(VirtualServiceOuterClass.Destination other)
public final boolean isInitialized()
isInitialized 在接口中 com.google.protobuf.MessageLiteOrBuilderisInitialized 在类中 com.google.protobuf.GeneratedMessageV3.Builder<VirtualServiceOuterClass.Destination.Builder>public VirtualServiceOuterClass.Destination.Builder mergeFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException
mergeFrom 在接口中 com.google.protobuf.Message.BuildermergeFrom 在接口中 com.google.protobuf.MessageLite.BuildermergeFrom 在类中 com.google.protobuf.AbstractMessage.Builder<VirtualServiceOuterClass.Destination.Builder>IOExceptionpublic 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 VirtualServiceOuterClass.Destination.Builder setHost(String value)
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];value - The host to set.public VirtualServiceOuterClass.Destination.Builder clearHost()
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];public VirtualServiceOuterClass.Destination.Builder setHostBytes(com.google.protobuf.ByteString value)
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];value - The bytes for host to set.public 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 VirtualServiceOuterClass.Destination.Builder setSubset(String value)
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;value - The subset to set.public VirtualServiceOuterClass.Destination.Builder clearSubset()
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;public VirtualServiceOuterClass.Destination.Builder setSubsetBytes(com.google.protobuf.ByteString value)
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;value - The bytes for subset to set.public 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.Destination.Builder setPort(VirtualServiceOuterClass.PortSelector value)
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 VirtualServiceOuterClass.Destination.Builder setPort(VirtualServiceOuterClass.PortSelector.Builder builderForValue)
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 VirtualServiceOuterClass.Destination.Builder mergePort(VirtualServiceOuterClass.PortSelector value)
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 VirtualServiceOuterClass.Destination.Builder clearPort()
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 VirtualServiceOuterClass.PortSelector.Builder getPortBuilder()
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 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 VirtualServiceOuterClass.Destination.Builder setUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields)
setUnknownFields 在接口中 com.google.protobuf.Message.BuildersetUnknownFields 在类中 com.google.protobuf.GeneratedMessageV3.Builder<VirtualServiceOuterClass.Destination.Builder>public final VirtualServiceOuterClass.Destination.Builder mergeUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields)
mergeUnknownFields 在接口中 com.google.protobuf.Message.BuildermergeUnknownFields 在类中 com.google.protobuf.GeneratedMessageV3.Builder<VirtualServiceOuterClass.Destination.Builder>Copyright © 2018–2023 Alibaba Group. All rights reserved.