From 642489b1a5bf62055635b5fc780125a30cf2db3c Mon Sep 17 00:00:00 2001 From: Md Irshad Sheikh Date: Mon, 21 Jul 2025 10:29:04 -0400 Subject: [PATCH] Fix version string parsing error Applying the app-intel-device-plugins application fails with the following error when using a custom image version stx.11.0-v0.32.1: invalid resource: could not parse "stx.11.0-v0.32.1" as version This error occurs because the upstream code expects a plain upstream release version, rather than the custom STX image version, during plugin image validation. This commit introduces a patch that resolves the issue by extracting the actual upstream release version (0.32.1) from the STX image version (stx.11.0-v0.32.1) prior to validating the plugin images. TEST PLAN: PASS: ./build-stx-images.sh <..> --only intel-deviceplugin-operator PASS: Compare the app apply results with 24.09 image and new custom image. Parsing error should not occur. Story: 2011407 Task: 52555 Change-Id: I2ec8f64e9e2dc20a73980fc225a56bb30b92bc9f Signed-off-by: Md Irshad Sheikh --- ...-deviceplugin-operator.stable_docker_image | 2 +- ...002-fix-version-string-parsing-error.patch | 35 +++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 intel-device-plugins-images/files/0002-fix-version-string-parsing-error.patch diff --git a/intel-device-plugins-images/debian/intel-deviceplugin-operator.stable_docker_image b/intel-device-plugins-images/debian/intel-deviceplugin-operator.stable_docker_image index fa6ee4c..363f57a 100644 --- a/intel-device-plugins-images/debian/intel-deviceplugin-operator.stable_docker_image +++ b/intel-device-plugins-images/debian/intel-deviceplugin-operator.stable_docker_image @@ -2,7 +2,7 @@ BUILDER=script LABEL=intel-deviceplugin-operator SOURCE_REPO=https://github.com/intel/intel-device-plugins-for-kubernetes.git SOURCE_REF=v0.32.1 -SOURCE_PATCHES="../files/0001-operator-add-possibility-to-use-a-secret-for-plugin.patch" +SOURCE_PATCHES="../files/0001-operator-add-possibility-to-use-a-secret-for-plugin.patch ../files/0002-fix-version-string-parsing-error.patch" COMMAND=bash SCRIPT=build-intel-device-plugins-image.sh ARGS=intel_operator diff --git a/intel-device-plugins-images/files/0002-fix-version-string-parsing-error.patch b/intel-device-plugins-images/files/0002-fix-version-string-parsing-error.patch new file mode 100644 index 0000000..4b1d6cb --- /dev/null +++ b/intel-device-plugins-images/files/0002-fix-version-string-parsing-error.patch @@ -0,0 +1,35 @@ +From 7d5237093a6f3a8c1bddbc0070ec60712b1ac0df Mon Sep 17 00:00:00 2001 +From: Md Irshad Sheikh +Date: Mon, 21 Jul 2025 09:07:42 -0400 +Subject: [PATCH] Fix version string parsing error + +Parsing error occurs because the upstream code expects a plain upstream +release version, rather than the custom STX image version, during +plugin image validation. +This patch resolves the issue by extracting the actual upstream release +version (0.32.1) from the STX image version (stx.11.0-v0.32.1) prior to +validating the plugin images. +--- + pkg/apis/deviceplugin/v1/webhook_common.go | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/pkg/apis/deviceplugin/v1/webhook_common.go b/pkg/apis/deviceplugin/v1/webhook_common.go +index e175f11e..939af077 100644 +--- a/pkg/apis/deviceplugin/v1/webhook_common.go ++++ b/pkg/apis/deviceplugin/v1/webhook_common.go +@@ -168,6 +168,12 @@ func validatePluginImage(image, expectedImageName string, expectedMinVersion *ve + return fmt.Errorf("%w: incorrect image name %q. Make sure you use '/%s'", errValidation, imageName, expectedImageName) + } + ++ re := regexp.MustCompile(`(\d+\.\d+\.\d+)`) ++ matches := re.FindStringSubmatch(versionStr) ++ if len(matches) >= 2 { ++ versionStr = matches[1] ++ } ++ + ver, err := version.ParseSemantic(versionStr) + if err != nil { + return fmt.Errorf("%w: %w: Make sure it's either valid SHA digest or semver tag", errValidation, err) +-- +2.34.1 +