English | 简体中文 | Regal by Python
For example, let's say you need to do a staged rollout for a particular version or several, which could be a bunch of server clusters, as shown in the following diagram:
The regal-go provides two policies:
- Combine
Number of machines in each group.
- Schedule
As the first group of A/B, the default is 1. You can change this behavior by using the 'schedule' parameter.
See the example for more details.
- Provide A/B Test or Gray release policies and dynamic intelligent distribution;
- Support multi-version grouping and priority;
- Lightweight and scalable;
See ./example for example usage.
package main
import (
"fmt"
"github.com/boylegu/regal-go"
)
func main() {
var example1 = [][]string{
{"app-test-ver1", "10.1.1.1,10.1.1.2,10.1.1.3,10.1.1.4,10.1.1.5"},
}
c1 := regal.RegalEngine(example1, regal.WithCombine(2))
fmt.Println(c1.Grouping())
}
Output:
[root@gbe-pcx example]# go run main.go
[[app-test-version1.0 [[10.1.1.1] [10.1.1.2 10.1.1.3] [10.1.1.4 10.1.1.5]]]]
Based on policy, you will get a data structure. Let's take a look at it:
var example2 = [][]string{
{"ver1", "10.1.1.1,10.1.1.2,10.1.1.3,10.1.1.4,10.1.1.5,10.1.1.6"},
{"ver2", "10.1.1.1,10.1.1.2,10.1.1.3,10.1.1.4,10.1.1.5"},
{"ver3", "10.1.1.1,10.1.1.2,10.1.1.3,10.1.1.4,10.1.1.5"},
}
c2 := regal.RegalEngine(
example2,
regal.WithCombine(3),
regal.WithSchedule(2),
regal.WithPriorKey("ver2"), // Set priority
)
for _, v := range c2.Grouping() {
fmt.Println(v)
}
Output:
[root@gubaoer-pcx example]# go run main.go
[ver2 [[10.1.1.1, 10.1.1.2] [10.1.1.3 10.1.1.4 10.1.1.5]]]
[ver1 [[10.1.1.1, 10.1.1.2] [10.1.1.3 10.1.1.4 10.1.1.5] [10.1.1.6]]]
[ver3 [[10.1.1.1, 10.1.1.2] [10.1.1.3 10.1.1.4 10.1.1.5]]]
Human creation has never left the inspiration brought to us by nature, and whether it is gray release or A/B testing, nature had excellent solutions thousands of years ago. Therefore, I use 'Darwin's finches' as the prototype to pay tribute to the great nature and Darwin's 《ORIGIN OF SPECIES》.
Author: Boyle Gu. Drawing with DeepAI in 2024.