diff --git a/deploy/chart/values.yaml b/deploy/chart/values.yaml index 68a2b0a8c27..89ee35c03a1 100644 --- a/deploy/chart/values.yaml +++ b/deploy/chart/values.yaml @@ -2,7 +2,7 @@ rbacApiVersion: rbac.authorization.k8s.io namespace: operator-lifecycle-manager catalog_namespace: operator-lifecycle-manager operator_namespace: operators -minKubeVersion: 1.11 +minKubeVersion: 1.11.0 imagestream: false debug: false olm: diff --git a/pkg/controller/operators/olm/operator_test.go b/pkg/controller/operators/olm/operator_test.go index 17b1034bcc8..3f7e3bc3371 100644 --- a/pkg/controller/operators/olm/operator_test.go +++ b/pkg/controller/operators/olm/operator_test.go @@ -2321,6 +2321,14 @@ func TestSyncOperatorGroups(t *testing.T) { operatorCSVFinal.Status.LastUpdateTime = timeNow() operatorCSVFinal.Status.LastTransitionTime = timeNow() operatorCSVFinal.Status.RequirementStatus = []v1alpha1.RequirementStatus{ + { + Group: "operators.coreos.com", + Version: "v1alpha1", + Kind: "ClusterServiceVersion", + Name: "csv1", + Status: v1alpha1.RequirementStatusReasonPresent, + Message: "CSV minKubeVersion (0.0.0) less than server version (v0.0.0-master+$Format:%h$)", + }, { Group: "apiextensions.k8s.io", Version: "v1beta1", diff --git a/pkg/controller/operators/olm/requirements.go b/pkg/controller/operators/olm/requirements.go index 936ce8555ee..1c31d2c891f 100644 --- a/pkg/controller/operators/olm/requirements.go +++ b/pkg/controller/operators/olm/requirements.go @@ -59,9 +59,9 @@ func (a *Operator) minKubeVersionStatus(name string, minKubeVersion string) (met return } - if csvVersionInfo.Compare(*serverVersion) < 0 { + if csvVersionInfo.Compare(*serverVersion) > 0 { status.Status = v1alpha1.RequirementStatusReasonPresentNotSatisfied - status.Message = "CSV version requirement not met" + status.Message = fmt.Sprintf("CSV version requirement not met: minKubeVersion (%s) > server version (%s)", minKubeVersion, serverVersion.String()) met = false statuses = append(statuses, status) return diff --git a/pkg/controller/operators/olm/requirements_test.go b/pkg/controller/operators/olm/requirements_test.go index e397926428f..69866cf39b4 100644 --- a/pkg/controller/operators/olm/requirements_test.go +++ b/pkg/controller/operators/olm/requirements_test.go @@ -38,7 +38,7 @@ func TestRequirementAndPermissionStatus(t *testing.T) { description: "BadInstallStrategy", csv: csv("csv1", namespace, - "0.0", + "0.0.0", "", v1alpha1.NamedInstallStrategy{"deployment", json.RawMessage{}}, nil, @@ -55,7 +55,7 @@ func TestRequirementAndPermissionStatus(t *testing.T) { description: "AllPermissionsMet", csv: csv("csv1", namespace, - "0.0", + "0.0.0", "", installStrategy( "csv1-dep", @@ -179,6 +179,13 @@ func TestRequirementAndPermissionStatus(t *testing.T) { }, }, }, + {"operators.coreos.com", "v1alpha1", "ClusterServiceVersion", "csv1"}: { + Group: "operators.coreos.com", + Version: "v1alpha1", + Kind: "ClusterServiceVersion", + Name: "csv1", + Status: v1alpha1.RequirementStatusReasonPresent, + }, }, expectedError: nil, }, @@ -186,7 +193,7 @@ func TestRequirementAndPermissionStatus(t *testing.T) { description: "OnePermissionNotMet", csv: csv("csv1", namespace, - "0.0", + "0.0.0", "", installStrategy( "csv1-dep", @@ -310,6 +317,13 @@ func TestRequirementAndPermissionStatus(t *testing.T) { }, }, }, + {"operators.coreos.com", "v1alpha1", "ClusterServiceVersion", "csv1"}: { + Group: "operators.coreos.com", + Version: "v1alpha1", + Kind: "ClusterServiceVersion", + Name: "csv1", + Status: v1alpha1.RequirementStatusReasonPresent, + }, }, expectedError: nil, }, @@ -317,7 +331,7 @@ func TestRequirementAndPermissionStatus(t *testing.T) { description: "AllRequirementsMet", csv: csv("csv1", namespace, - "0.0", + "0.0.0", "", installStrategy( "csv1-dep", @@ -428,6 +442,13 @@ func TestRequirementAndPermissionStatus(t *testing.T) { Name: "c2group", Status: v1alpha1.RequirementStatusReasonPresent, }, + {"operators.coreos.com", "v1alpha1", "ClusterServiceVersion", "csv1"}: { + Group: "operators.coreos.com", + Version: "v1alpha1", + Kind: "ClusterServiceVersion", + Name: "csv1", + Status: v1alpha1.RequirementStatusReasonPresent, + }, }, expectedError: nil, }, @@ -435,7 +456,7 @@ func TestRequirementAndPermissionStatus(t *testing.T) { description: "RequirementNotMet/NonServedCRDVersion", csv: csv("csv1", namespace, - "0.0", + "0.0.0", "", installStrategy("csv1-dep", nil, nil), []*v1beta1.CustomResourceDefinition{crd("c1", "v2")}, @@ -455,6 +476,13 @@ func TestRequirementAndPermissionStatus(t *testing.T) { Name: "c1group", Status: v1alpha1.RequirementStatusReasonNotPresent, }, + {"operators.coreos.com", "v1alpha1", "ClusterServiceVersion", "csv1"}: { + Group: "operators.coreos.com", + Version: "v1alpha1", + Kind: "ClusterServiceVersion", + Name: "csv1", + Status: v1alpha1.RequirementStatusReasonPresent, + }, }, expectedError: nil, }, @@ -462,7 +490,7 @@ func TestRequirementAndPermissionStatus(t *testing.T) { description: "RequirementNotMet/NotEstablishedCRDVersion", csv: csv("csv1", namespace, - "0.0", + "0.0.0", "", installStrategy("csv1-dep", nil, nil), []*v1beta1.CustomResourceDefinition{crd("c1", "version-not-found")}, @@ -482,6 +510,13 @@ func TestRequirementAndPermissionStatus(t *testing.T) { Name: "c1group", Status: v1alpha1.RequirementStatusReasonNotAvailable, }, + {"operators.coreos.com", "v1alpha1", "ClusterServiceVersion", "csv1"}: { + Group: "operators.coreos.com", + Version: "v1alpha1", + Kind: "ClusterServiceVersion", + Name: "csv1", + Status: v1alpha1.RequirementStatusReasonPresent, + }, }, expectedError: nil, }, @@ -489,7 +524,7 @@ func TestRequirementAndPermissionStatus(t *testing.T) { description: "RequirementNotMet/NamesConflictedCRD", csv: csv("csv1", namespace, - "0.0", + "0.0.0", "", installStrategy("csv1-dep", nil, nil), []*v1beta1.CustomResourceDefinition{crd("c1", "v2")}, @@ -515,6 +550,13 @@ func TestRequirementAndPermissionStatus(t *testing.T) { Name: "c1group", Status: v1alpha1.RequirementStatusReasonNotAvailable, }, + {"operators.coreos.com", "v1alpha1", "ClusterServiceVersion", "csv1"}: { + Group: "operators.coreos.com", + Version: "v1alpha1", + Kind: "ClusterServiceVersion", + Name: "csv1", + Status: v1alpha1.RequirementStatusReasonPresent, + }, }, expectedError: nil, }, @@ -522,7 +564,7 @@ func TestRequirementAndPermissionStatus(t *testing.T) { description: "RequirementNotMet/CRDResourceInactive", csv: csv("csv1", namespace, - "0.0", + "0.0.0", "", installStrategy("csv1-dep", nil, nil), []*v1beta1.CustomResourceDefinition{crd("c1", "v2")}, @@ -548,6 +590,13 @@ func TestRequirementAndPermissionStatus(t *testing.T) { Name: "c1group", Status: v1alpha1.RequirementStatusReasonNotAvailable, }, + {"operators.coreos.com", "v1alpha1", "ClusterServiceVersion", "csv1"}: { + Group: "operators.coreos.com", + Version: "v1alpha1", + Kind: "ClusterServiceVersion", + Name: "csv1", + Status: v1alpha1.RequirementStatusReasonPresent, + }, }, expectedError: nil, }, diff --git a/test/e2e/csv_e2e_test.go b/test/e2e/csv_e2e_test.go index 4461f0c194a..908192ab99d 100644 --- a/test/e2e/csv_e2e_test.go +++ b/test/e2e/csv_e2e_test.go @@ -271,7 +271,7 @@ func TestCreateCSVWithUnmetRequirementsMinKubeVersion(t *testing.T) { Name: genName("csv"), }, Spec: v1alpha1.ClusterServiceVersionSpec{ - MinKubeVersion: "999.999", + MinKubeVersion: "999.999.999", InstallModes: []v1alpha1.InstallMode{ { Type: v1alpha1.InstallModeTypeOwnNamespace, @@ -334,7 +334,7 @@ func TestCreateCSVWithUnmetRequirementsCRD(t *testing.T) { Name: genName("csv"), }, Spec: v1alpha1.ClusterServiceVersionSpec{ - MinKubeVersion: "0.0", + MinKubeVersion: "0.0.0", InstallModes: []v1alpha1.InstallMode{ { Type: v1alpha1.InstallModeTypeOwnNamespace, @@ -507,7 +507,7 @@ func TestCreateCSVWithUnmetRequirementsAPIService(t *testing.T) { Name: genName("csv"), }, Spec: v1alpha1.ClusterServiceVersionSpec{ - MinKubeVersion: "0.0", + MinKubeVersion: "0.0.0", InstallModes: []v1alpha1.InstallMode{ { Type: v1alpha1.InstallModeTypeOwnNamespace, @@ -596,7 +596,7 @@ func TestCreateCSVWithUnmetPermissionsAPIService(t *testing.T) { Name: genName("csv"), }, Spec: v1alpha1.ClusterServiceVersionSpec{ - MinKubeVersion: "0.0", + MinKubeVersion: "0.0.0", InstallModes: []v1alpha1.InstallMode{ { Type: v1alpha1.InstallModeTypeOwnNamespace, @@ -659,7 +659,7 @@ func TestCreateCSVWithUnmetRequirementsNativeAPI(t *testing.T) { Name: genName("csv"), }, Spec: v1alpha1.ClusterServiceVersionSpec{ - MinKubeVersion: "0.0", + MinKubeVersion: "0.0.0", InstallModes: []v1alpha1.InstallMode{ { Type: v1alpha1.InstallModeTypeOwnNamespace, @@ -750,7 +750,7 @@ func TestCreateCSVRequirementsMetCRD(t *testing.T) { Name: genName("csv"), }, Spec: v1alpha1.ClusterServiceVersionSpec{ - MinKubeVersion: "0.0", + MinKubeVersion: "0.0.0", InstallModes: []v1alpha1.InstallMode{ { Type: v1alpha1.InstallModeTypeOwnNamespace, @@ -1006,7 +1006,7 @@ func TestCreateCSVRequirementsMetAPIService(t *testing.T) { Name: genName("csv"), }, Spec: v1alpha1.ClusterServiceVersionSpec{ - MinKubeVersion: "0.0", + MinKubeVersion: "0.0.0", InstallModes: []v1alpha1.InstallMode{ { Type: v1alpha1.InstallModeTypeOwnNamespace, @@ -1162,7 +1162,7 @@ func TestCreateCSVWithOwnedAPIService(t *testing.T) { csv := v1alpha1.ClusterServiceVersion{ Spec: v1alpha1.ClusterServiceVersionSpec{ - MinKubeVersion: "0.0", + MinKubeVersion: "0.0.0", InstallModes: []v1alpha1.InstallMode{ { Type: v1alpha1.InstallModeTypeOwnNamespace, @@ -1337,7 +1337,7 @@ func TestUpdateCSVSameDeploymentName(t *testing.T) { Name: genName("csv"), }, Spec: v1alpha1.ClusterServiceVersionSpec{ - MinKubeVersion: "0.0", + MinKubeVersion: "0.0.0", InstallModes: []v1alpha1.InstallMode{ { Type: v1alpha1.InstallModeTypeOwnNamespace, @@ -1520,7 +1520,7 @@ func TestUpdateCSVDifferentDeploymentName(t *testing.T) { Name: genName("csv"), }, Spec: v1alpha1.ClusterServiceVersionSpec{ - MinKubeVersion: "0.0", + MinKubeVersion: "0.0.0", InstallModes: []v1alpha1.InstallMode{ { Type: v1alpha1.InstallModeTypeOwnNamespace, @@ -1708,7 +1708,7 @@ func TestUpdateCSVMultipleIntermediates(t *testing.T) { Name: genName("csv"), }, Spec: v1alpha1.ClusterServiceVersionSpec{ - MinKubeVersion: "0.0", + MinKubeVersion: "0.0.0", InstallModes: []v1alpha1.InstallMode{ { Type: v1alpha1.InstallModeTypeOwnNamespace, @@ -1902,7 +1902,7 @@ func TestUpdateCSVMultipleVersionCRD(t *testing.T) { Name: genName("csv"), }, Spec: v1alpha1.ClusterServiceVersionSpec{ - MinKubeVersion: "0.0", + MinKubeVersion: "0.0.0", InstallModes: []v1alpha1.InstallMode{ { Type: v1alpha1.InstallModeTypeOwnNamespace,