|
| 1 | +//// |
| 2 | +This module included in the following assemblies: |
| 3 | +* service_mesh/v2x/ossm-federation.adoc |
| 4 | +//// |
| 5 | +:_content-type: PROCEDURE |
| 6 | +[id="ossm-federation-config-importserviceset-failover_{context}"] |
| 7 | += Configuring an ImportServiceSet for failover |
| 8 | + |
| 9 | +Locality-weighted load balancing allows administrators to control the distribution of traffic to endpoints based on the localities of where the traffic originates and where it will terminate. These localities are specified using arbitrary labels that designate a hierarchy of localities in {region}/{zone}/{sub-zone} form. |
| 10 | + |
| 11 | +In the examples in this section, the `green-mesh` is located in the `us-east` region, and the `red-mesh` is located in the `us-west` region. |
| 12 | + |
| 13 | +.Example `ImportServiceSet` resource from red-mesh to green-mesh |
| 14 | +[source,yaml] |
| 15 | +---- |
| 16 | +kind: ImportedServiceSet |
| 17 | +apiVersion: federation.maistra.io/v1 |
| 18 | +metadata: |
| 19 | + name: red-mesh #name of mesh that exported the service |
| 20 | + namespace: green-mesh-system #mesh namespace that service is being imported into |
| 21 | +spec: |
| 22 | + importRules: # first matching rule is used |
| 23 | + # import ratings.bookinfo as ratings.bookinfo |
| 24 | + - type: NameSelector |
| 25 | + importAsLocal: true |
| 26 | + nameSelector: |
| 27 | + namespace: bookinfo |
| 28 | + name: ratings |
| 29 | + alias: |
| 30 | + # service will be imported as ratings.bookinfo.svc.red-mesh-imports.local |
| 31 | + namespace: bookinfo |
| 32 | + name: ratings |
| 33 | + #Locality within which imported services should be associated. |
| 34 | + locality: |
| 35 | + region: us-west |
| 36 | +---- |
| 37 | + |
| 38 | +.`ImportedServiceLocality` fields table |
| 39 | +|=== |
| 40 | +| Name | Description | Type |
| 41 | + |
| 42 | +|region: |
| 43 | +|Region within which imported services are located. |
| 44 | +|string |
| 45 | + |
| 46 | +|subzone: |
| 47 | +|Subzone within which imported services are located. I Subzone is specified, Zone must also be specified. |
| 48 | +|string |
| 49 | + |
| 50 | +|zone: |
| 51 | +|Zone within which imported services are located. If Zone is specified, Region must also be specified. |
| 52 | +|string |
| 53 | +|=== |
| 54 | + |
| 55 | + |
| 56 | +.Procedure |
| 57 | + |
| 58 | +. Log in to the {product-title} CLI as a user with the `cluster-admin` role, enter the following command: |
| 59 | ++ |
| 60 | +[source,terminal] |
| 61 | +---- |
| 62 | +$ oc login --username=<NAMEOFUSER> <API token> https://<HOSTNAME>:6443 |
| 63 | +---- |
| 64 | ++ |
| 65 | +. Change to the project where you installed the control plane, enter the following command: |
| 66 | ++ |
| 67 | +[source,terminal] |
| 68 | +---- |
| 69 | +$ oc project <smcp-system> |
| 70 | +---- |
| 71 | ++ |
| 72 | +For example, `green-mesh-system`. |
| 73 | ++ |
| 74 | +[source,terminal] |
| 75 | +---- |
| 76 | +$ oc project green-mesh-system |
| 77 | +---- |
| 78 | ++ |
| 79 | +. Edit the `ImportServiceSet` file, where `<ImportServiceSet.yaml>` includes a full path to the file you want to edit, enter the following command: |
| 80 | ++ |
| 81 | +[source,terminal] |
| 82 | +---- |
| 83 | +$ oc edit -n <smcp-system> -f <ImportServiceSet.yaml> |
| 84 | +---- |
| 85 | ++ |
| 86 | +For example, if you want to modify the file that imports from the red-mesh-system to the green-mesh-system as shown in the previous `ImportServiceSet` example. |
| 87 | ++ |
| 88 | +[source,terminal] |
| 89 | +---- |
| 90 | +$ oc edit -n green-mesh-system -f import-from-red-mesh.yaml |
| 91 | +---- |
| 92 | +. Modify the file: |
| 93 | +.. Set `spec.importRules.importAsLocal` to `true`. |
| 94 | +.. Set `spec.locality` to a `region`, `zone`, or `subzone`. |
| 95 | +.. Save your changes. |
0 commit comments