diff --git a/CHANGELOG.md b/CHANGELOG.md index da53777d4..e6d707a89 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Current snapshot tag (v0.7) +Breaking backward compatibility from `v0.6` + +* Default blue/green deployment mode changed from `pod` to `deploy`. Use `ingress.kubernetes.io/blue-green-mode` annotation to change to the v0.6 behavior. See also the blue/green deployment [doc](/README.md#blue-green). + Fixes and improvements since `v0.6` * Add SSL config on TCP services [#192](https://github.com/jcmoraisjr/haproxy-ingress/pull/192) - [doc](/README.md#tcp-services-configmap) @@ -36,6 +40,10 @@ Fixes and improvements since `v0.6` * Configmap options: * `http-port` * `https-port` +* Add blue/green balance mode [#201](https://github.com/jcmoraisjr/haproxy-ingress/pull/201) - [doc](/README.md#blue-green) + * Annotations: + * `ingress.kubernetes.io/blue-green-balance` + * `ingress.kubernetes.io/blue-green-mode` ## v0.6-beta.2 diff --git a/README.md b/README.md index 576b65c13..7532bd797 100644 --- a/README.md +++ b/README.md @@ -144,7 +144,7 @@ selector and another that matches the blue/green selector. * `ingress.kubernetes.io/blue-green-balance`: comma separated list of labels and weights * `ingress.kubernetes.io/blue-green-deploy`: deprecated on v0.7, this is an alias to `ingress.kubernetes.io/blue-green-balance`. -* `ingress.kubernetes.io/blue-green-mode`: how to apply the weights, might be `pod` or `deploy` +* `ingress.kubernetes.io/blue-green-mode`: defaults to `deploy` on v0.7, defines how to apply the weights, might be `pod` or `deploy` The following configuration `group=blue=1,group=green=4` will redirect 20% of the load to the `group=blue` group and 80% of the load to `group=green` group. diff --git a/examples/blue-green/README.md b/examples/blue-green/README.md index 9849ffaac..0773e15a5 100644 --- a/examples/blue-green/README.md +++ b/examples/blue-green/README.md @@ -144,7 +144,7 @@ Running 100 requests... --- -Changing to deploy mode. This mode targets the balance config to the whole deployment +Changing to *deploy* mode. This mode targets the balance config to the whole deployment instead of single pods. **Note:** BG mode was added on v0.7. On v0.6, the only supported mode is `pod`. diff --git a/pkg/common/ingress/annotations/bluegreen/main.go b/pkg/common/ingress/annotations/bluegreen/main.go index 65c4ad93a..01b4a0b37 100644 --- a/pkg/common/ingress/annotations/bluegreen/main.go +++ b/pkg/common/ingress/annotations/bluegreen/main.go @@ -99,9 +99,9 @@ func (bg bgdeploy) Parse(ing *extensions.Ingress) (interface{}, error) { mode, _ := parser.GetStringAnnotation(blueGreenModeAnn, ing) if !modeAnnRegex.MatchString(mode) { if mode != "" { - glog.Warningf("unsupported blue/green mode '%v' on '%v/%v', falling back to 'pod'", mode, ing.Namespace, ing.Name) + glog.Warningf("unsupported blue/green mode '%v' on '%v/%v', falling back to 'deploy'", mode, ing.Namespace, ing.Name) } - mode = "pod" + mode = "deploy" } return &Config{ DeployWeight: dw, diff --git a/pkg/common/ingress/controller/bluegreen_test.go b/pkg/common/ingress/controller/bluegreen_test.go index 704d56e21..e11185e71 100644 --- a/pkg/common/ingress/controller/bluegreen_test.go +++ b/pkg/common/ingress/controller/bluegreen_test.go @@ -59,11 +59,13 @@ func TestWeightBalance(t *testing.T) { "b06-01": buildBackend("v=1=50,v=2=25", ",pod0102-01", "deploy"), "b07-01": buildBackend("v=1=50,v=non=25", "pod0101-01,pod0102-01", "deploy"), "b07-02": buildBackend("v=1=50,v=non=25", "pod0101-01,pod0102-01", "pod"), - "b07-03": buildBackend("v=1=50,v=2=25", "pod0101-01,pod0102-non", "deploy"), - "b07-04": buildBackend("v=1=50,v=2=25", "pod0101-01,pod0102-non", "pod"), + "b07-03": buildBackend("v=1=50,non=2=25", "pod0101-01,pod0102-01", "deploy"), + "b07-04": buildBackend("v=1=50,v=2=25", "pod0101-01,pod0102-non", "deploy"), + "b07-05": buildBackend("v=1=50,v=2=25", "pod0101-01,pod0102-non", "pod"), "b08-01": buildBackend("v=1=50,v=2=25,v=3=25", "pod0101-01,pod0102-01,pod0102-02,pod0103-01", "deploy"), "b08-02": buildBackend("v=1=50,v=2=0,v=3=25", "pod0101-01,pod0102-01,pod0102-02,pod0103-01", "deploy"), "b09-01": buildBackend("v=1=50,v=2=0,v=3=25", "", "deploy"), + "b10-01": buildBackend("v=1=0,v=2=0", "pod0101-01,pod0102-01", "deploy"), } testExpectedWeight := map[string][]int{ "b01-01": {1, 1}, @@ -83,10 +85,12 @@ func TestWeightBalance(t *testing.T) { "b07-01": {1, 0}, "b07-02": {50, 0}, "b07-03": {1, 0}, - "b07-04": {50, 0}, + "b07-04": {1, 0}, + "b07-05": {50, 0}, "b08-01": {4, 1, 1, 2}, "b08-02": {2, 0, 0, 1}, "b09-01": {}, + "b10-01": {0, 0}, } weightBalance(&testUpstreams, podLister) for name, upstream := range testUpstreams {