|
| 1 | +//// |
| 2 | +This module included in the following assemblies: |
| 3 | +* service_mesh/v2x/ossm-federation.adoc |
| 4 | +//// |
| 5 | + |
| 6 | +[id="ossm-federation-config-export_{context}"] |
| 7 | += Exporting a service from a federated mesh |
| 8 | + |
| 9 | +Exporting services allows a mesh to share one or more of its services with another member of the federated mesh. |
| 10 | + |
| 11 | +//Insert ExportedServiceSet diagram here |
| 12 | + |
| 13 | +You use an `ExportedServiceSet` resource to declare the services from one mesh that you are making available to another peer in the federated mesh. You must explicitly declare each service to be shared with a peer. |
| 14 | + |
| 15 | +* You can select services by namespace or name. |
| 16 | +* You can use wildcards to select services; for example, to export all the services in a namespace. |
| 17 | +* You can export services using an alias. For example, you can export the `foo/bar` service as `custom-ns/bar`. |
| 18 | +// Need non foo/bar example above |
| 19 | +* You can only export services that are visible to the mesh’s system namespace. For example, a service in another namespace with a `networking.istio.io/exportTo` label set to ‘.’ would not be a candidate for export. |
| 20 | +* For exported services, their target services will only see traffic from the ingress gateway, not the original requestor (that is, they won’t see the client ID of either the other mesh’s egress gateway or the workload originating the request) |
| 21 | + |
| 22 | +The following example is for services that `red-mesh` is exporting to `green-mesh`. |
| 23 | + |
| 24 | +.Example ExportServiceSet resource |
| 25 | +[source,yaml] |
| 26 | +---- |
| 27 | +kind: ExportedServiceSet |
| 28 | +apiVersion: federation.maistra.io/v1 |
| 29 | +metadata: |
| 30 | + name: green-mesh |
| 31 | + namespace: red-mesh-system |
| 32 | +spec: |
| 33 | + exportRules: |
| 34 | + # export ratings.mesh-x-bookinfo as ratings.bookinfo |
| 35 | + - type: NameSelector |
| 36 | + nameSelector: |
| 37 | + namespace: red-mesh-bookinfo |
| 38 | + name: red-ratings |
| 39 | + alias: |
| 40 | + namespace: bookinfo |
| 41 | + name: ratings |
| 42 | +# export any service in red-mesh-bookinfo namespace with label export-service=true |
| 43 | + - type: LabelSelector |
| 44 | + labelSelector: |
| 45 | + namespace: red-mesh-bookinfo |
| 46 | + Selector: |
| 47 | + matchLabels: |
| 48 | + export-service: “true” |
| 49 | + alias: # exported as if they were in the bookinfo namespace |
| 50 | + namespace: bookinfo |
| 51 | +---- |
| 52 | + |
| 53 | +.ExportServiceSet parameters |
| 54 | +[options="header"] |
| 55 | +[cols="l, a, a"] |
| 56 | +|=== |
| 57 | +|Parameter |Description |Values |
| 58 | +|metadata: |
| 59 | + name: |
| 60 | +|Name of the ServiceMeshPeer you are exposing this service to. |
| 61 | +|Must match the `name` value for the mesh in the `ServiceMeshPeer` resource. |
| 62 | + |
| 63 | +|metadata: |
| 64 | + namespace: |
| 65 | +|Name of the project/namespace containing this resource (should be the system namespace for the mesh) . |
| 66 | +| |
| 67 | + |
| 68 | +|spec: |
| 69 | + exportRules: |
| 70 | + -type: |
| 71 | +|Type of rule that will govern the export for this service. The first matching rule found for the service will be used for the export. |
| 72 | +|`NameSelector`, `LabelSelector` |
| 73 | + |
| 74 | +|spec: |
| 75 | + exportRules: |
| 76 | + -type: nameSelector |
| 77 | + NameSelector: |
| 78 | + namespace: |
| 79 | + name: |
| 80 | +|To create a `NameSelector` rule, specify the `namespace` of the service and the `name` of the service as defined in the `Deployment` resource. |
| 81 | +| |
| 82 | + |
| 83 | +|spec: |
| 84 | + exportRules: |
| 85 | + -type: NameSelector |
| 86 | + NameSelector: |
| 87 | + alias: |
| 88 | + namespace: |
| 89 | + name: |
| 90 | +|To create a `NameSelector` rule that uses an alias for the service, after specifying the `namespace` and `name` for the service, then specify the alias for the `namespace` and the alias to be used for `name` of the service. |
| 91 | +| |
| 92 | + |
| 93 | +|spec: |
| 94 | + exportRules: |
| 95 | + -type: LabelSelector |
| 96 | + LabelSelector: |
| 97 | + namespace: <exportingMesh> |
| 98 | + Selector: |
| 99 | + matchLabels: |
| 100 | + <label>: "true" |
| 101 | +|To create a `LabelSelector` rule, specify the `namespace` of the service and specify the `label` defined in the `Deployment` resource. In the example above, the label is `export-service`. |
| 102 | +| |
| 103 | + |
| 104 | +|spec: |
| 105 | + exportRules: |
| 106 | + -type: LabelSelector |
| 107 | + LabelSelector: |
| 108 | + namespace: <exportingMesh> |
| 109 | + Selector: |
| 110 | + matchLabels: |
| 111 | + <label>: "true" |
| 112 | + alias: |
| 113 | + namespace: |
| 114 | + name: |
| 115 | +|To create a `LabelSelector` rule that uses an alias for the service, after specifying the `namespace` and `label`, then specify the alias to be used for `name` or `namespace` of the service. In the example above, the alias is `bookinfo`. |
| 116 | +| |
| 117 | +|=== |
| 118 | + |
| 119 | +//PLEASE CHECK THESE EXAMPLES |
| 120 | + |
| 121 | +.Export services with the name "ratings" from all namespaces in the red-mesh to blue-mesh. |
| 122 | +[source,yaml] |
| 123 | +---- |
| 124 | +kind: ExportedServiceSet |
| 125 | +apiVersion: federation.maistra.io/v1 |
| 126 | +metadata: |
| 127 | + name: blue-mesh |
| 128 | + namespace: red-mesh-system |
| 129 | +spec: |
| 130 | + exportRules: |
| 131 | + - type: NameSelector |
| 132 | + nameSelector: |
| 133 | + namespace: * |
| 134 | + name: ratings |
| 135 | +---- |
| 136 | + |
| 137 | +.Export all services from the west-data-center namespace to green-mesh |
| 138 | +[source,yaml] |
| 139 | +---- |
| 140 | +kind: ExportedServiceSet |
| 141 | +apiVersion: federation.maistra.io/v1 |
| 142 | +metadata: |
| 143 | + name: green-mesh |
| 144 | + namespace: red-mesh-system |
| 145 | +spec: |
| 146 | + exportRules: |
| 147 | + - type: NameSelector |
| 148 | + nameSelector: |
| 149 | + namespace: west-data-center |
| 150 | + name: * |
| 151 | +---- |
0 commit comments