@@ -149,12 +149,20 @@ func checkMaxOpenShiftVersion(checks CommunityOperatorChecks, v1beta1MsgForResou
149
149
150
150
semVerVersionMaxOcp , err := semver .ParseTolerant (olmMaxOpenShiftVersionValue )
151
151
if err != nil {
152
- checks .errs = append (checks .errs , fmt .Errorf ("csv.Annotations.%s has an invalid value." +
152
+ checks .errs = append (checks .errs , fmt .Errorf ("csv.Annotations.%s has an invalid value. " +
153
153
"Unable to parse (%s) using semver : %s" ,
154
154
olmproperties , olmMaxOpenShiftVersionValue , err ))
155
155
return checks
156
156
}
157
157
158
+ truncatedMaxOcp := semver.Version {Major : semVerVersionMaxOcp .Major , Minor : semVerVersionMaxOcp .Minor }
159
+ if ! semVerVersionMaxOcp .EQ (truncatedMaxOcp ) {
160
+ checks .warns = append (checks .warns , fmt .Errorf ("csv.Annotations.%s has an invalid value. " +
161
+ "%s must specify only major.minor versions, %s will be truncated to %s" ,
162
+ olmproperties , olmmaxOpenShiftVersion , semVerVersionMaxOcp , truncatedMaxOcp ))
163
+ return checks
164
+ }
165
+
158
166
if semVerVersionMaxOcp .GE (semVerOCPV1beta1Unsupported ) {
159
167
checks .errs = append (checks .errs , fmt .Errorf ("csv.Annotations.%s with the " +
160
168
"key and value for %s has the OCP version value %s which is >= of %s. This bundle is using APIs which were deprecated and removed in v1.22. More info: https://kubernetes.io/docs/reference/using-api/deprecation-guide/#v1-22. " +
@@ -248,12 +256,12 @@ func validateImageFile(checks CommunityOperatorChecks, deprecatedAPImsg string)
248
256
}
249
257
250
258
if verParsed .GE (semVerOCPV1beta1Unsupported ) {
251
- checks .errs = append (checks .errs , fmt .Errorf ("this bundle is using APIs which were " +
252
- "deprecated and removed in v1.22. " +
253
- "More info: https://kubernetes.io/docs/reference/using-api/deprecation-guide/#v1-22. " +
259
+ checks .errs = append (checks .errs , fmt .Errorf ("this bundle is using APIs which were " +
260
+ "deprecated and removed in v1.22. " +
261
+ "More info: https://kubernetes.io/docs/reference/using-api/deprecation-guide/#v1-22. " +
254
262
"Migrate the API(s) for " +
255
- "%s or provide compatible version(s) by using the %s annotation in " +
256
- "`metadata/annotations.yaml` to ensure that the index image will be geneared " +
263
+ "%s or provide compatible version(s) by using the %s annotation in " +
264
+ "`metadata/annotations.yaml` to ensure that the index image will be geneared " +
257
265
"with its label. (e.g. LABEL %s='4.6-4.8')" ,
258
266
deprecatedAPImsg ,
259
267
ocpLabelindex ,
@@ -263,12 +271,12 @@ func validateImageFile(checks CommunityOperatorChecks, deprecatedAPImsg string)
263
271
} else {
264
272
// if not has not the = then the value needs contains - value less < 4.9
265
273
if ! strings .Contains (indexRange , "-" ) {
266
- checks .errs = append (checks .errs , fmt .Errorf ("this bundle is using APIs which were " +
267
- "deprecated and removed in v1.22. " +
274
+ checks .errs = append (checks .errs , fmt .Errorf ("this bundle is using APIs which were " +
275
+ "deprecated and removed in v1.22. " +
268
276
"More info: https://kubernetes.io/docs/reference/using-api/deprecation-guide/#v1-22 " +
269
277
"The %s allows to distribute it on >= %s. Migrate the API(s) for " +
270
- "%s or provide compatible version(s) by using the %s annotation in " +
271
- "`metadata/annotations.yaml` to ensure that the index image will be generated " +
278
+ "%s or provide compatible version(s) by using the %s annotation in " +
279
+ "`metadata/annotations.yaml` to ensure that the index image will be generated " +
272
280
"with its label. (e.g. LABEL %s='4.6-4.8')" ,
273
281
indexRange ,
274
282
ocpVerV1beta1Unsupported ,
@@ -287,12 +295,12 @@ func validateImageFile(checks CommunityOperatorChecks, deprecatedAPImsg string)
287
295
}
288
296
289
297
if verParsed .GE (semVerOCPV1beta1Unsupported ) {
290
- checks .errs = append (checks .errs , fmt .Errorf ("this bundle is using APIs which were " +
291
- "deprecated and removed in v1.22. " +
292
- "More info: https://kubernetes.io/docs/reference/using-api/deprecation-guide/#v1-22. " +
298
+ checks .errs = append (checks .errs , fmt .Errorf ("this bundle is using APIs which were " +
299
+ "deprecated and removed in v1.22. " +
300
+ "More info: https://kubernetes.io/docs/reference/using-api/deprecation-guide/#v1-22. " +
293
301
"Upgrade the APIs from " +
294
- "for %s or provide compatible distribution version(s) by using the %s " +
295
- "annotation in `metadata/annotations.yaml` to ensure that the index image will " +
302
+ "for %s or provide compatible distribution version(s) by using the %s " +
303
+ "annotation in `metadata/annotations.yaml` to ensure that the index image will " +
296
304
"be generated with its label. (e.g. LABEL %s='4.6-4.8')" ,
297
305
deprecatedAPImsg ,
298
306
ocpLabelindex ,
@@ -310,8 +318,8 @@ func validateImageFile(checks CommunityOperatorChecks, deprecatedAPImsg string)
310
318
}
311
319
}
312
320
} else {
313
- checks .errs = append (checks .errs , fmt .Errorf ("this bundle is using APIs which were deprecated and " +
314
- "removed in v1.22. More info: https://kubernetes.io/docs/reference/using-api/deprecation-guide/#v1-22. " +
321
+ checks .errs = append (checks .errs , fmt .Errorf ("this bundle is using APIs which were deprecated and " +
322
+ "removed in v1.22. More info: https://kubernetes.io/docs/reference/using-api/deprecation-guide/#v1-22. " +
315
323
"Migrate the APIs " +
316
324
"for %s or provide compatible version(s) via the labels. (e.g. LABEL %s='4.6-4.8')" ,
317
325
deprecatedAPImsg ,
0 commit comments