@@ -20,7 +20,6 @@ import (
2020 "context"
2121 "fmt"
2222 "path/filepath"
23- "strconv"
2423 "strings"
2524
2625 "github.com/go-logr/logr"
@@ -662,42 +661,16 @@ func (n *ClusterPolicyController) getGPUNodeOSInfo() (string, string, error) {
662661 if ! ok {
663662 return "" , "" , fmt .Errorf ("unable to retrieve OS version from label %s" , nfdOSVersionIDLabelKey )
664663 }
665- osMajorVersion := strings .Split (osVersion , "." )[0 ]
666-
667- // If the OS is RockyLinux or RHEL 10 & above, we will omit the minor version when constructing the os image tag
664+ // If the OS is RockyLinux or RHEL, we will omit the minor version when constructing the os image tag
668665 switch osName {
669- case "rocky" :
670- osVersion = osMajorVersion
671- case "rhel" :
672- osMajorNumber , err := parseOSMajorVersion (osVersion )
673- if err != nil {
674- return "" , "" , err
675- }
676- if osMajorNumber >= 10 {
677- osVersion = osMajorVersion
678- }
666+ case "rocky" , "rhel" :
667+ osVersion = strings .Split (osVersion , "." )[0 ]
679668 }
680669 osTag := fmt .Sprintf ("%s%s" , osName , osVersion )
681670
682671 return osName , osTag , nil
683672}
684673
685- func parseOSMajorVersion (osVersion string ) (int , error ) {
686- osMajorVersion := strings .Split (osVersion , "." )[0 ]
687- osMajorVersion = strings .TrimSpace (osMajorVersion )
688- osMajorVersion = strings .TrimPrefix (strings .TrimPrefix (osMajorVersion , "v" ), "V" )
689- if osMajorVersion == "" {
690- return 0 , fmt .Errorf ("empty OS major version" )
691- }
692-
693- osMajorNumber , err := strconv .Atoi (osMajorVersion )
694- if err != nil {
695- return 0 , fmt .Errorf ("error processing OS major version %s: %w" , osMajorVersion , err )
696- }
697-
698- return osMajorNumber , nil
699- }
700-
701674func (n * ClusterPolicyController ) setPodSecurityLabelsForNamespace () error {
702675 ctx := n .ctx
703676 namespaceName := clusterPolicyCtrl .operatorNamespace
0 commit comments