Updated on 2024-06-17 GMT+08:00

Configuring Unconditional Automatic Traffic Switchover

When the administrator of a cluster performs operations such as cluster upgrade, the cluster may be unavailable due to inappropriate upgrade policy, incorrect upgrade configuration, or incorrect operations performed by the operator. This section describes how to create a Remedy object to unconditionally redirect the traffic of the cluster to be upgraded.

Remedy objects can be created to perform specific actions when certain conditions are met. Before upgrading the target cluster (for example, member1), the cluster administrator can create the following Remedy object to redirect the traffic of member1.

The following is an example YAML file for creating a Remedy object. If the trigger condition is left empty, traffic switchover is triggered unconditionally. The cluster federation controller will immediately redirect the traffic of member1. After the cluster is successfully upgraded, delete the Remedy object. The traffic is automatically routed back to member1. In this way, the upgrade of a cluster will not affect the availability of services. For details about the parameters of the Remedy object, see Table 1.

apiVersion: remedy.karmada.io/v1alpha1
kind: Remedy
metadata:
  name: foo
spec:
  clusterAffinity:
    clusterNames:
      - member1
  actions:
  - TrafficControl
Table 1 Remedy parameters

Parameter

Description

spec.clusterAffinity.clusterNames

List of clusters controlled by the policy. The specified action is performed only for clusters in the list. If this parameter is left blank, no action is performed.

spec.decisionMatches

Trigger condition list. When a cluster in the cluster list meets any trigger condition, the specified action is performed. If this parameter is left blank, the specified action is triggered unconditionally.

conditionType

Type of a trigger condition. Only ServiceDomainNameResolutionReady (domain name resolution of CoreDNS reported by CPD) is supported.

operator

Judgment logic. Only Equal (equal to) and NotEqual (not equal to) are supported.

conditionStatus

Status of a trigger condition.

actions

Action to be performed by the policy. Currently, only TrafficControl (traffic control) is supported.