Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #808 #809

Merged
merged 3 commits into from
Jan 24, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/v1alpha1/istiocontrolplane.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion api/v1alpha1/istiocontrolplane.pb.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ <h2 id="IstioControlPlaneSpec">IstioControlPlaneSpec</h2>
<td><code>string</code></td>
<td>
<p>Contains the intended version for the Istio control plane.
+kubebuilder:validation:Pattern=^1.</p>
+kubebuilder:validation:Pattern=^1\.</p>

</td>
<td>
Expand Down
2 changes: 1 addition & 1 deletion api/v1alpha1/istiocontrolplane.proto
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ option go_package = "github.com/banzaicloud/istio-operator/v2/api/v1alpha1";
// -->
message IstioControlPlaneSpec {
// Contains the intended version for the Istio control plane.
// +kubebuilder:validation:Pattern=^1.
// +kubebuilder:validation:Pattern=^1\.
string version = 1 [(google.api.field_behavior) = REQUIRED];
// Configure the mode for this control plane.
// Currently, two options are supported: "ACTIVE" and "PASSIVE".
Expand Down
4 changes: 2 additions & 2 deletions config/crd/bases/istio-operator-crds.gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6379,7 +6379,7 @@ spec:
type: boolean
type: object
version:
pattern: ^1.
pattern: ^1\.
type: string
watchOneNamespace:
nullable: true
Expand Down Expand Up @@ -13704,7 +13704,7 @@ spec:
type: boolean
type: object
version:
pattern: ^1.
pattern: ^1\.
type: string
watchOneNamespace:
nullable: true
Expand Down
2 changes: 1 addition & 1 deletion controllers/istiocontrolplane_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func (r *IstioControlPlaneReconciler) Reconcile(ctx context.Context, req ctrl.Re
}, nil
}

if !isIstioVersionSupported(icp.Spec.Version) {
if !IsIstioVersionSupported(icp.Spec.Version) {
err = errors.New("intended Istio version is unsupported by this version of the operator")
logger.Error(err, "", "version", icp.Spec.Version)

Expand Down
2 changes: 1 addition & 1 deletion controllers/meshgateway_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func (r *IstioMeshGatewayReconciler) Reconcile(ctx context.Context, req ctrl.Req
return ctrl.Result{}, err
}

if !isIstioVersionSupported(icp.Spec.Version) {
if !IsIstioVersionSupported(icp.Spec.Version) {
return ctrl.Result{}, nil
}

Expand Down
4 changes: 2 additions & 2 deletions controllers/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ package controllers
import "regexp"

const (
supportedIstioMinorVersionRegex = "^1.11"
supportedIstioMinorVersionRegex = "^1\\.11"
Laci21 marked this conversation as resolved.
Show resolved Hide resolved
)

func isIstioVersionSupported(version string) bool {
func IsIstioVersionSupported(version string) bool {
re, _ := regexp.Compile(supportedIstioMinorVersionRegex)

return re.Match([]byte(version))
Expand Down
22 changes: 22 additions & 0 deletions controllers/version_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package controllers_test

import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"

"github.com/banzaicloud/istio-operator/v2/controllers"
)

var _ = Describe("IsIstioVersionSupported()", func() {
It("should deny unsupported versions", func() {
Expect(controllers.IsIstioVersionSupported("2.1")).To(BeFalse())
Expect(controllers.IsIstioVersionSupported("1.13")).To(BeFalse())
Expect(controllers.IsIstioVersionSupported("1.13.1")).To(BeFalse())
})
It("should accept minor versions", func() {
Expect(controllers.IsIstioVersionSupported("1.11")).To(BeTrue())
})
It("should accept micro versions", func() {
Expect(controllers.IsIstioVersionSupported("1.11.1")).To(BeTrue())
})
})
2 changes: 1 addition & 1 deletion deploy/charts/istio-operator/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ icon: https://istio.io/latest/img/istio-whitelogo-bluebackground-framed.svg
# Based on support status of Istio releases: https://istio.io/latest/docs/releases/supported-releases/#support-status-of-istio-releases
kubeVersion: ">= 1.19.0-0 < 1.23.0-0"

version: 2.0.5
version: 2.0.6
appVersion: "v2.11.5"
Original file line number Diff line number Diff line change
Expand Up @@ -6379,7 +6379,7 @@ spec:
type: boolean
type: object
version:
pattern: ^1.
pattern: ^1\.
type: string
watchOneNamespace:
nullable: true
Expand Down Expand Up @@ -13704,7 +13704,7 @@ spec:
type: boolean
type: object
version:
pattern: ^1.
pattern: ^1\.
type: string
watchOneNamespace:
nullable: true
Expand Down