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

[release-4.5] Bug 1881957: updating EO to adopt an existing cluster if cr nodes uuid is nil #495

Merged

Conversation

ewolinetz
Copy link
Contributor

To address https://bugzilla.redhat.com/show_bug.cgi?id=1881957
Manual cherry-pick of #471

This addresses cases where there is or was an existing cluster created (deployments, pods, pvcs, etc) who's cluster name is the same as the CR name, however the new elasticsearch CR is missing UUIDs.

As part of the recovery/adoption process, it will be required that the PVCs to be picked back up have the label logging-cluster: . It will also be validated against the name of the cluster that the PVC name is based on.

Recovery/adoption will be triggered upon the processing of a CR that is missing UUIDs. It will only try to recover UUIDs for nodes that do not already have UUIDs defined.

Further documentation will need to be developed and publish as part of how to recover data that from another PVC. This PR does not seek to resolve that but rather address cases where an elasticsearch CR may have been removed on accident and then recreated (without UUIDs).

Please note: as part of this change EO will be creating PVCs with the required labels now, so to ensure keeping previously used PVCs they should be labeled per above.

@openshift-ci-robot openshift-ci-robot added the bugzilla/severity-medium Referenced Bugzilla bug's severity is medium for the branch this PR is targeting. label Sep 23, 2020
@openshift-ci-robot
Copy link

@ewolinetz: This pull request references Bugzilla bug 1881957, which is valid. The bug has been moved to the POST state. The bug has been updated to refer to the pull request using the external bug tracker.

6 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.5.z) matches configured target release for branch (4.5.z)
  • bug is in the state ASSIGNED, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)
  • dependent bug Bugzilla bug 1868300 is in the state VERIFIED, which is one of the valid states (VERIFIED, RELEASE_PENDING, CLOSED (ERRATA))
  • dependent Bugzilla bug 1868300 targets the "4.6.0" release, which is one of the valid target releases: 4.6.0, 4.6.z
  • bug has dependents

In response to this:

[release-4.5] Bug 1881957: updating EO to adopt an existing cluster if cr nodes uuid is nil

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-ci-robot openshift-ci-robot added the bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. label Sep 23, 2020
@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 23, 2020
based on PVC names if PVCs currently exist or deployment|statefulset
names if PVCs do not exist. if there are no matched UUIDs ones are
auto generated. Attempt to best match UUID to a node based on
how naming would match up based on role and node count. Also
match based on resources, node selectors, and tolerations.
Copy link
Contributor

@periklis periklis left a comment

Choose a reason for hiding this comment

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

Looks good to me in general, however I might be wrong but the merge for persistentvolumeclaims blurred some inconsistencies in.

Comment on lines +72 to +73
if retryErr != nil {
return retryErr
Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest to simplify the return statement here to retrun retryErr to enhance readbility

if !errors.IsAlreadyExists(err) {
return fmt.Errorf("Unable to create PVC: %v", err)
}
claim := createPersistentVolumeClaim(newName, namespace, clusterName, pvc)
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like the method is using the wrong prefix create instead of new. Former indicates normally a POST call to the apiserver while latter only a factory method for the resource we would like to persist later.

return fmt.Errorf("unable to create PVC: %w", err)
}

return updatePersistentVolumeClaim(claim, client)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why updating the same PVC resource after initial creation? Looks like duplicate work here.

Copy link
Contributor Author

@ewolinetz ewolinetz Sep 24, 2020

Choose a reason for hiding this comment

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

to ensure its in its correct state as we leave this function

Comment on lines +62 to +63
if !reflect.DeepEqual(current.ObjectMeta.Labels, claim.ObjectMeta.Labels) {
current.ObjectMeta.Labels = claim.ObjectMeta.Labels
Copy link
Contributor

Choose a reason for hiding this comment

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

Why does this function only update if the labels are not equal?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

if nothing is different (that we can change) there isn't a point to making an update call

@ewolinetz
Copy link
Contributor Author

/retest

@periklis
Copy link
Contributor

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Sep 24, 2020
@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ewolinetz, periklis

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@markmc
Copy link

markmc commented Sep 25, 2020

(patch manager) affecting real-world users

@markmc markmc added the cherry-pick-approved Indicates a cherry-pick PR into a release branch has been approved by the release branch manager. label Sep 25, 2020
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-merge-robot openshift-merge-robot merged commit fb37b53 into openshift:release-4.5 Sep 25, 2020
@openshift-ci-robot
Copy link

@ewolinetz: All pull requests linked via external trackers have merged:

Bugzilla bug 1881957 has been moved to the MODIFIED state.

In response to this:

[release-4.5] Bug 1881957: updating EO to adopt an existing cluster if cr nodes uuid is nil

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@ewolinetz
Copy link
Contributor Author

/cherry-pick release-4.4
this was originally reported on 4.4 and likely to still be an issue for customers who haven't upgraded to 4.5 yet

@openshift-cherrypick-robot

@ewolinetz: #495 failed to apply on top of branch "release-4.4":

Applying: updating EO to adopt an existing cluster if cr nodes uuid is nil based on PVC names if PVCs currently exist or deployment|statefulset names if PVCs do not exist. if there are no matched UUIDs ones are auto generated. Attempt to best match UUID to a node based on how naming would match up based on role and node count. Also match based on resources, node selectors, and tolerations.
Using index info to reconstruct a base tree...
M	pkg/k8shandler/cluster.go
M	pkg/k8shandler/common.go
A	pkg/k8shandler/migrations/kibana5to6.go
A	pkg/k8shandler/podtemplate.go
A	pkg/k8shandler/podtemplate_test.go
M	pkg/k8shandler/util.go
Falling back to patching base and 3-way merge...
Auto-merging pkg/k8shandler/util.go
CONFLICT (content): Merge conflict in pkg/k8shandler/util.go
CONFLICT (modify/delete): pkg/k8shandler/podtemplate_test.go deleted in HEAD and modified in updating EO to adopt an existing cluster if cr nodes uuid is nil based on PVC names if PVCs currently exist or deployment|statefulset names if PVCs do not exist. if there are no matched UUIDs ones are auto generated. Attempt to best match UUID to a node based on how naming would match up based on role and node count. Also match based on resources, node selectors, and tolerations.. Version updating EO to adopt an existing cluster if cr nodes uuid is nil based on PVC names if PVCs currently exist or deployment|statefulset names if PVCs do not exist. if there are no matched UUIDs ones are auto generated. Attempt to best match UUID to a node based on how naming would match up based on role and node count. Also match based on resources, node selectors, and tolerations. of pkg/k8shandler/podtemplate_test.go left in tree.
CONFLICT (modify/delete): pkg/k8shandler/podtemplate.go deleted in HEAD and modified in updating EO to adopt an existing cluster if cr nodes uuid is nil based on PVC names if PVCs currently exist or deployment|statefulset names if PVCs do not exist. if there are no matched UUIDs ones are auto generated. Attempt to best match UUID to a node based on how naming would match up based on role and node count. Also match based on resources, node selectors, and tolerations.. Version updating EO to adopt an existing cluster if cr nodes uuid is nil based on PVC names if PVCs currently exist or deployment|statefulset names if PVCs do not exist. if there are no matched UUIDs ones are auto generated. Attempt to best match UUID to a node based on how naming would match up based on role and node count. Also match based on resources, node selectors, and tolerations. of pkg/k8shandler/podtemplate.go left in tree.
CONFLICT (modify/delete): pkg/k8shandler/migrations/kibana5to6.go deleted in HEAD and modified in updating EO to adopt an existing cluster if cr nodes uuid is nil based on PVC names if PVCs currently exist or deployment|statefulset names if PVCs do not exist. if there are no matched UUIDs ones are auto generated. Attempt to best match UUID to a node based on how naming would match up based on role and node count. Also match based on resources, node selectors, and tolerations.. Version updating EO to adopt an existing cluster if cr nodes uuid is nil based on PVC names if PVCs currently exist or deployment|statefulset names if PVCs do not exist. if there are no matched UUIDs ones are auto generated. Attempt to best match UUID to a node based on how naming would match up based on role and node count. Also match based on resources, node selectors, and tolerations. of pkg/k8shandler/migrations/kibana5to6.go left in tree.
Auto-merging pkg/k8shandler/common.go
Auto-merging pkg/k8shandler/cluster.go
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 updating EO to adopt an existing cluster if cr nodes uuid is nil based on PVC names if PVCs currently exist or deployment|statefulset names if PVCs do not exist. if there are no matched UUIDs ones are auto generated. Attempt to best match UUID to a node based on how naming would match up based on role and node count. Also match based on resources, node selectors, and tolerations.
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

In response to this:

/cherry-pick release-4.4
this was originally reported on 4.4 and likely to still be an issue for customers who haven't upgraded to 4.5 yet

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. bugzilla/severity-medium Referenced Bugzilla bug's severity is medium for the branch this PR is targeting. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. cherry-pick-approved Indicates a cherry-pick PR into a release branch has been approved by the release branch manager. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants