-
Notifications
You must be signed in to change notification settings - Fork 592
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: Set different feature gates for versions before 3.1.x
Signed-off-by: Jintao Zhang <[email protected]>
- Loading branch information
1 parent
75e69ff
commit dfb6908
Showing
3 changed files
with
29 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,32 @@ | ||
package testenv | ||
|
||
import "github.com/kong/kubernetes-ingress-controller/v3/test/consts" | ||
import ( | ||
"github.com/blang/semver/v4" | ||
|
||
func getFeatureGates() string { | ||
"github.com/kong/kubernetes-ingress-controller/v3/test/consts" | ||
) | ||
|
||
func GetFeatureGates() string { | ||
// Due to the possibility of running tests between different versions, | ||
// it is necessary to adjust feature gates according to different KIC versions. | ||
// | ||
// Versions below 3.1.x cannot recognize the KongServiceFacade feature gate. | ||
// We only need to set `GatewayAlpha=true`. | ||
// | ||
// https://github.com/Kong/kubernetes-ingress-controller/issues/5373 | ||
tag := ControllerTag() | ||
if tag != "" { | ||
// Currently, the latest version is 3.0.x, once 3.1.x is released, | ||
// we can remove this logic. | ||
if tag == "latest" { | ||
return "GatewayAlpha=true" | ||
} | ||
if v, err := semver.Make(tag); err == nil { | ||
minVersion, _ := semver.ParseRange("<3.1.x") | ||
if minVersion(v) { | ||
return "GatewayAlpha=true" | ||
} | ||
} | ||
} | ||
return consts.DefaultFeatureGates | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters