Skip to content

Commit

Permalink
default to dataplane being supported when checking version annotation (
Browse files Browse the repository at this point in the history
  • Loading branch information
ndhanushkodi authored Nov 17, 2022
1 parent b70210e commit a14f597
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ func isConsulDataplaneSupported(pod corev1.Pod) bool {
if anno, ok := pod.Annotations[constants.AnnotationConsulK8sVersion]; ok {
consulK8sVersion, err := version.NewVersion(anno)
if err != nil {
return false
// Only consul-k8s v1.0.0+ (including pre-release versions) have the version annotation. So it would be
// reasonable to default to supporting dataplane even if the version is malformed or invalid.
return true
}
consulDPSupportedVersion, err := version.NewVersion(minSupportedConsulDataplaneVersion)
if err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,19 @@ func TestIsConsulDataplaneSupported(t *testing.T) {
versions := map[string]struct {
expIsConsulDataplaneSupported bool
}{
"": {false},
"v1.0.0": {true},
"1.0.0": {true},
"v0.49.0": {false},
"0.49.0-beta2": {false},
"0.49.2": {false},
"v1.0.0-beta1": {true},
"v1.0.0-beta3": {true},
"v1.1.0-beta1": {true},
"v1.0.0-dev": {true},
"v1.0.0-dev+abcdef": {true},
"invalid": {false},
"": {false},
"v1.0.0": {true},
"1.0.0": {true},
"v0.49.0": {false},
"0.49.0-beta2": {false},
"0.49.2": {false},
"v1.0.0-beta1": {true},
"v1.0.0-beta3": {true},
"v1.1.0-beta1": {true},
"v1.0.0-dev": {true},
"v1.0.0-dev (abcdef)": {true},
"v1.0.0-dev+abcdef": {true},
"invalid": {true},
}

for version, c := range versions {
Expand Down

0 comments on commit a14f597

Please sign in to comment.