Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop MOFED support older than 5.7-0.1.2.0 #566

Merged
merged 1 commit into from
Jul 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 6 additions & 20 deletions pkg/state/state_ofed.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,10 @@ const (
stateOFEDName = "state-OFED"
stateOFEDDescription = "OFED driver deployed in the cluster"

// newMofedImageFormatVersion is the first mofed driver container version
// which has a new image name format
// TODO: update with new version
newMofedImageFormatVersion = "5.7-0.1.2.0"
// mofedImageNewFormat is the new mofed driver container image name format
// mofedImageFormat is the mofed driver container image name format
// format: <repo>/<image-name>:<driver-version>-<os-name><os-ver>-<cpu-arch>
// e.x: nvcr.io/nvidia/mellanox/mofed:5.7-0.1.2.0-ubuntu20.04-amd64
mofedImageNewFormat = "%s/%s:%s-%s%s-%s"
// mofedImageOldFormat is the old mofed driver container image name format
// format: <repo>/<image-name>-<driver-version>:<os-name><os-ver>-<cpu-arch>
// e.x: nvcr.io/nvidia/mellanox/mofed-5.6-1.0.3.3:ubuntu20.04-amd64
mofedImageOldFormat = "%s/%s-%s:%s%s-%s"
mofedImageFormat = "%s/%s:%s-%s%s-%s"
)

// Openshift cluster-wide Proxy
Expand Down Expand Up @@ -458,19 +450,13 @@ func (s *stateOFED) getManifestObjects(
// TODO(adrianc): in Network-Operator v1.5.0, we should just use the new naming scheme
func (s *stateOFED) getMofedDriverImageName(cr *mellanoxv1alpha1.NicClusterPolicy,
nodeAttr map[nodeinfo.AttributeType]string, reqLogger logr.Logger) string {
mofedImgFmt := mofedImageNewFormat

curDriverVer, err1 := semver.NewVersion(cr.Spec.OFEDDriver.Version)
newFormatDriverVer, err2 := semver.NewVersion(newMofedImageFormatVersion)
if err1 == nil && err2 == nil {
if curDriverVer.LessThan(newFormatDriverVer) {
mofedImgFmt = mofedImageOldFormat
}
} else {
curDriverVer, err := semver.NewVersion(cr.Spec.OFEDDriver.Version)
if err != nil {
reqLogger.V(consts.LogLevelDebug).Info("failed to parse ofed driver version as semver")
}
reqLogger.V(consts.LogLevelDebug).Info("Generating ofed driver image name for version: %v", "version", curDriverVer)

return fmt.Sprintf(mofedImgFmt,
return fmt.Sprintf(mofedImageFormat,
cr.Spec.OFEDDriver.Repository,
cr.Spec.OFEDDriver.Image,
cr.Spec.OFEDDriver.Version,
Expand Down
5 changes: 0 additions & 5 deletions pkg/state/state_ofed_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,6 @@ var _ = Describe("MOFED state test", func() {
},
}

It("generates old image format", func() {
cr.Spec.OFEDDriver.Version = "5.6-1.0.0.0"
imageName := stateOfed.getMofedDriverImageName(cr, nodeAttr, testLogger)
Expect(imageName).To(Equal("nvcr.io/mellanox/mofed-5.6-1.0.0.0:ubuntu20.04-amd64"))
})
It("generates new image format", func() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: drop the "new"

cr.Spec.OFEDDriver.Version = "5.7-1.0.0.0"
imageName := stateOfed.getMofedDriverImageName(cr, nodeAttr, testLogger)
Expand Down