When you update fields in the spec block of an Istio resource, Alibaba Cloud Service Mesh (ASM) records the resource version before the update. ASM stores up to five latest versions. This topic describes how to roll back a virtual service to an earlier version.

Prerequisites

Background information

ASM provides various Istio resources. Istio resources related to traffic management include virtual services, destination rules, gateways, service entries, Envoy filters, workload groups, workload entries, and sidecar resources. Istio resources related to zero-trust security include request authentication policies, peer authentication policies, and authorization policies. You can create these resources in the ASM console.

Step 1: Enable the rollback feature for Istio resources

You can use one of the following methods to enable the rollback feature for Istio resources:
  • Enable the rollback feature when you create an ASM instance. On the Create Service Mesh page, select Enable Istio custom resource version control to enable the rollback feature.
  • Enable the rollback feature when you modify the configurations of an ASM instance. In the Settings Update panel, select Enable Istio custom resource version control to enable the rollback feature. This method is used in the following example.
  1. Log on to the ASM console.
  2. In the left-side navigation pane, choose Service Mesh > Mesh Management.
  3. On the Mesh Management page, find the ASM instance that you want to configure. Click the name of the ASM instance or click Manage in the Actions column.
  4. On the details page of the ASM instance, choose ASM Instance > Base Information in the left-side navigation pane. On the Basic Information page, click Settings.
  5. In the Settings Update panel, select Enable Istio custom resource version control and click OK.

Step 2: Generate an earlier version of a virtual service

Notice ASM records an earlier version of an Istio resource only when fields in the spec block of the Istio resource are updated. If you update other fields of the Istio resource, ASM does not record earlier versions.
  1. Log on to the ASM console.
  2. In the left-side navigation pane, choose Service Mesh > Mesh Management.
  3. On the Mesh Management page, find the ASM instance that you want to configure. Click the name of the ASM instance or click Manage in the Actions column.
  4. On the details page of the ASM instance, choose Traffic Management > VirtualService in the left-side navigation pane.
  5. On the VirtualService page, find the virtual service that you want to manage and click YAML in the Actions column.
  6. In the Edit panel, modify a field in the spec block. For example, modify the number field from 9080 to 9081. Then, click OK.

Step 3: Roll back the virtual service to an earlier version

In this example, the virtual service is rolled back to v2.

  1. Log on to the ASM console.
  2. In the left-side navigation pane, choose Service Mesh > Mesh Management.
  3. On the Mesh Management page, find the ASM instance that you want to configure. Click the name of the ASM instance or click Manage in the Actions column.
  4. On the details page of the ASM instance, choose Traffic Management > VirtualService in the left-side navigation pane.
  5. On the VirtualService page, find the virtual service that you want to manage and click Version in the Actions column.
  6. In the Version panel, find v2 and click View in the Actions column. Then, click Rollback.
    On the VirtualService page, find the virtual service that you want to manage and click YAML in the Actions column. In the Edit panel, you can find that the version of the virtual service is v2.

FAQ

What can I do if the Version button is not displayed for the Istio resource that I want to roll back?

Before you roll back an Istio resource to an earlier version, make sure that the version of your ASM instance is v1.9.7.92-g1d820703-aliyun or later and the rollback feature is enabled for Istio resources.

Does ASM record an earlier version of an Istio resource if I update the Istio resource by using a method other than the ASM console?

Yes. After the rollback feature is enabled for Istio resources, ASM records the earlier versions of Istio resources regardless of the methods that are used to update Istio resources.

Does ASM store an unlimited number of earlier versions of Istio resources?

No. ASM stores up to five latest versions of an Istio resource. If an Istio resource is modified more than five times, the earliest version is cleared.

Why are the earlier versions recorded by ASM not the same as the actual YAML content?

Redundant fields are omitted from the earlier versions recorded by ASM. This does not affect the use of these earlier versions. For example, in the YAML content of a gateway, the default value of the servers.tls field in the spec block is PASSTHROUGH. If you set the servers.tls field to PASSTHROUGH again, ASM regards the field as a redundant field and does not record the field in an earlier version.