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

ceph: compare ceph commit ID for upgrade check #8060

Merged
merged 1 commit into from Jun 10, 2021
Merged

ceph: compare ceph commit ID for upgrade check #8060

merged 1 commit into from Jun 10, 2021

Conversation

sp98
Copy link
Contributor

@sp98 sp98 commented Jun 7, 2021

.Compare Image ID while checking for upgrades. This will be useful in the case where ceph version is same but image ID is different and also when build number has not changed for a hotfix build.

For example:
existing ceph version -
ceph version 14.2.11-139.el8cp (b8e1f91c99491fb2e5ede748a1c0738ed158d0f5) nautilus (stable)

new ceph version with hotfix -
ceph version 14.2.11-139.0.hotfix.bz1959254.el8cp (5c0dc966af809fd1d429ec7bac48962a746af243) nautilus (stable)

Signed-off-by: Santosh Pillai sapillai@redhat.com

Description of your changes:

Which issue is resolved by this Pull Request:
Resolves #7964

Commit ID Regex test: https://play.golang.org/p/S5wBQrueC_m
Checklist:

  • Commit Message Formatting: Commit titles and messages follow guidelines in the developer guide.
  • Skip Tests for Docs: Add the flag for skipping the build if this is only a documentation change. See here for the flag.
  • Skip Unrelated Tests: Add a flag to run tests for a specific storage provider. See test options.
  • Reviewed the developer guide on Submitting a Pull Request
  • Documentation has been updated, if necessary.
  • Unit tests have been added, if necessary.
  • Integration tests have been added, if necessary.
  • Pending release notes updated with breaking and/or notable changes, if necessary.
  • Upgrade from previous release is tested and upgrade user guide is updated, if necessary.
  • Code generation (make codegen) has been run to update object specifications, if necessary.

@mergify mergify bot added the ceph main ceph tag label Jun 7, 2021
Copy link
Member

@travisn travisn left a comment

Choose a reason for hiding this comment

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

I see this fixes the version check issue, but I think there is a bigger issue as well... If the cephVersion.image field changes for any reason, we should make sure all the ceph daemons get the new image, even if the ceph version is unchanged. Otherwise, we could have daemons running different images until the operator is restarted or there is some other update to the cluster CR that causes a full reconcile. This is a corner case and could be a separate PR, but I'd still propose we address it.

pkg/operator/ceph/version/version.go Outdated Show resolved Hide resolved
@@ -128,7 +132,13 @@ func ExtractCephVersion(src string) (*CephVersion, error) {
}
}

return &CephVersion{major, minor, extra, build}, nil
// get build suffix if running on a build release
mmm := buildSuffixPattern.FindStringSubmatch(src)
Copy link
Member

Choose a reason for hiding this comment

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

nit: how about a more descriptive name than mmm? It's interesting to follow the pattern of the rest of the method, but I'd vote for descriptive names instead of a pattern like that. :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated. Using <>Match as variable names

@sp98
Copy link
Contributor Author

sp98 commented Jun 8, 2021

I see this fixes the version check issue, but I think there is a bigger issue as well... If the cephVersion.image field changes for any reason, we should make sure all the ceph daemons get the new image, even if the ceph version is unchanged. Otherwise, we could have daemons running different images until the operator is restarted or there is some other update to the cluster CR that causes a full reconcile. This is a corner case and could be a separate PR, but I'd still propose we address it.

Added another commit that compares image ID. Now we check for both Build Suffix and Image ID. I think we can remove Build suffix check and only keep image ID check as that would suffice for our use case.

@sp98 sp98 changed the title ceph: compare complete ceph build number ceph: compare complete ceph build number and image ID on upgrade Jun 8, 2021
@sp98 sp98 marked this pull request as ready for review June 8, 2021 06:27
pkg/operator/ceph/version/version.go Outdated Show resolved Hide resolved
fakeRunningVersions = []byte(`
{
"overall": {
"ceph version 14.2.11-139.0.hotfix.bz1959254.el8cp (5c0dc966af809fd1d429ec7bac48962a746af243) nautilus (stable)": 2
Copy link
Member

Choose a reason for hiding this comment

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

So this 139.0.hotfix.bz1959254 is the Build? and el8cp the BuildSuffix?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

139 is the build and anything after that is the build suffix 0.hotfix.bz1959254.el8cp in this case. The implementation in master branch only checks till 14.2.11-139 . Reference

buildSuffix = buildSuffixMatch[5]
}

imageMatch := imagePattern.FindStringSubmatch(src)
Copy link
Member

Choose a reason for hiding this comment

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

Why is this needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

trying to fetch the commit ID of the image here. I believe this should address the commit

pkg/operator/ceph/version/version.go Outdated Show resolved Hide resolved
return true
}
}
if a.Image != b.Image {
Copy link
Member

Choose a reason for hiding this comment

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

If the image changed we don't know if it's superior, right? We only know it's different. For superiority I think we don't need to know at a depth past a.Build so we could revert the changes to this method.

@sp98 sp98 changed the title ceph: compare complete ceph build number and image ID on upgrade ceph: compare ceph commit ID for upgrade check Jun 9, 2021
@sp98 sp98 requested review from leseb and travisn June 9, 2021 07:37
Copy link
Member

@leseb leseb left a comment

Choose a reason for hiding this comment

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

small nit

pkg/operator/ceph/version/version.go Outdated Show resolved Hide resolved
Currently we only check the Major, Minor, Extra and Build number in the ceph version to determine if all daemons should be upgraded or not. This PR also checks the commit hash for upgrading all the daemons.
This will be useful in cases where build number has not changed due to hotfix. For example:
existing ceph version - ceph version 14.2.11-139.el8cp (b8e1f91c99491fb2e5ede748a1c0738ed158d0f5) nautilus (stable)
new ceph version with hotfix - ceph version 14.2.11-139.0.hotfix.bz1959254.el8cp (5c0dc966af809fd1d429ec7bac48962a746af243) nautilus (stable)

Signed-off-by: Santosh Pillai <sapillai@redhat.com>
@sp98 sp98 requested a review from leseb June 10, 2021 06:53
@leseb
Copy link
Member

leseb commented Jun 10, 2021

@sp98 please open an issue to follow with what we discussed yesterday, thanks.

@sp98
Copy link
Contributor Author

sp98 commented Jun 10, 2021

@sp98 please open an issue to follow with what we discussed yesterday, thanks.

opened #8100

@leseb leseb merged commit 250aecd into rook:master Jun 10, 2021
mergify bot added a commit that referenced this pull request Jun 10, 2021
ceph: compare ceph commit ID for upgrade check (backport #8060)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ceph main ceph tag
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Child controllers should reconcile if the ceph image changed
3 participants