Skip to content

Commit 553a40c

Browse files
authored
Merge pull request #247 from MStokluska/THREESCALE-11013
THREESCALE-11013 include full 3scale version in apicast cr
2 parents 8167c0d + 21f8517 commit 553a40c

File tree

4 files changed

+29
-7
lines changed

4 files changed

+29
-7
lines changed

Diff for: apis/apps/v1alpha1/apicast_types.go

+9-3
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,10 @@ import (
3232
)
3333

3434
const (
35-
APIcastOperatorVersionAnnotation = "apicast.apps.3scale.net/operator-version"
36-
ReadyConditionType string = "Ready"
37-
WarningConditionType string = "Warning"
35+
APIcastOperatorVersionAnnotation = "apicast.apps.3scale.net/operator-version"
36+
APIcastThreescaleVersionAnnotation = "apicast.apps.3scale.net/apicast-threescale-version"
37+
ReadyConditionType string = "Ready"
38+
WarningConditionType string = "Warning"
3839
)
3940

4041
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
@@ -386,6 +387,11 @@ func (a *APIcast) UpdateOperatorVersion() bool {
386387
changed = true
387388
}
388389

390+
if v, ok := a.Annotations[APIcastThreescaleVersionAnnotation]; !ok || v != version.ThreescaleVersionMajorMinorPatch() {
391+
a.Annotations[APIcastThreescaleVersionAnnotation] = version.ThreescaleVersionMajorMinorPatch()
392+
changed = true
393+
}
394+
389395
return changed
390396
}
391397

Diff for: pkg/helper/labels.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ func MeteringLabels(componentType ComponentType) map[string]string {
1818
// It should be updated on release branch
1919
"rht.prod_ver": "master",
2020
"rht.comp": "3scale_apicast",
21-
"rht.comp_ver": version.ThreescaleRelease,
21+
"rht.comp_ver": version.ThreescaleVersionMajorMinor(),
2222
"rht.subcomp": "apicast",
2323
"rht.subcomp_t": string(componentType),
2424
}

Diff for: test/manifests-version/deployment_version_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func TestDeploymentVersions(t *testing.T) {
5555
t.Errorf("Parsed object is not a Deployment object")
5656
}
5757

58-
if deployment.Spec.Template.Labels["rht.comp_ver"] != version.ThreescaleRelease {
59-
t.Errorf("rht.comp_ver differ: expected: %s; found: %s", version.ThreescaleRelease, deployment.Spec.Template.Labels["rht.comp_ver"])
58+
if deployment.Spec.Template.Labels["rht.comp_ver"] != version.ThreescaleVersionMajorMinor() {
59+
t.Errorf("rht.comp_ver differ: expected: %s; found: %s", version.ThreescaleVersionMajorMinor(), deployment.Spec.Template.Labels["rht.comp_ver"])
6060
}
6161
}

Diff for: version/version.go

+17-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,22 @@
11
package version
22

3+
import (
4+
"strings"
5+
)
6+
37
var (
48
Version = "0.13.0"
5-
ThreescaleRelease = "2.16"
9+
threescaleRelease = "2.16.0"
610
)
11+
12+
func ThreescaleVersionMajorMinor() string {
13+
parts := strings.Split(threescaleRelease, ".")
14+
if len(parts) >= 2 {
15+
return parts[0] + "." + parts[1]
16+
}
17+
return ""
18+
}
19+
20+
func ThreescaleVersionMajorMinorPatch() string {
21+
return threescaleRelease
22+
}

0 commit comments

Comments
 (0)