File tree Expand file tree Collapse file tree 1 file changed +1
-25
lines changed Expand file tree Collapse file tree 1 file changed +1
-25
lines changed Original file line number Diff line number Diff line change 15
15
package v1
16
16
17
17
import (
18
- "strings"
19
-
20
18
"github.com/pkg/errors"
21
19
"k8s.io/apimachinery/pkg/runtime"
22
20
"k8s.io/apimachinery/pkg/util/version"
@@ -88,27 +86,5 @@ func (r *QatDevicePlugin) ValidateDelete() error {
88
86
}
89
87
90
88
func (r * QatDevicePlugin ) validatePlugin () error {
91
- parts := strings .SplitN (r .Spec .Image , ":" , 2 )
92
- if len (parts ) != 2 {
93
- return errors .Errorf ("incorrect image field %q" , r .Spec .Image )
94
- }
95
- namespacedName := parts [0 ]
96
- versionStr := parts [1 ]
97
-
98
- parts = strings .Split (namespacedName , "/" )
99
- name := parts [len (parts )- 1 ]
100
- if name != "intel-qat-plugin" {
101
- return errors .Errorf ("incorrect image name %q. Make sure you use '<vendor>/intel-qat-plugin:<version>'" , name )
102
- }
103
-
104
- ver , err := version .ParseSemantic (versionStr )
105
- if err != nil {
106
- return errors .Wrapf (err , "unable to parse version %q" , versionStr )
107
- }
108
-
109
- if ! ver .AtLeast (qatMinVersion ) {
110
- return errors .Errorf ("version %q is too low. Should be at least %q" , ver , qatMinVersion )
111
- }
112
-
113
- return nil
89
+ return validatePluginImage (r .Spec .Image , "intel-qat-plugin" , qatMinVersion )
114
90
}
You can’t perform that action at this time.
0 commit comments