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

Checks and updates ownerRef of Hub-db pvc if Hub instance is already created #827

Merged
merged 1 commit into from
Jun 8, 2022

Conversation

PuneetPunamiya
Copy link
Member

  • If Hub instance is already created, then the data in the Hub db should
    be preserved

  • Hence, this patch checks the ownerRef of hub-db pvc and updates it
    to TektonHub so while upgrade the pvc is not deleted and the data
    is preserved

Signed-off-by: Puneet Punamiya ppunamiy@redhat.com

Changes

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

See the contribution guide for more details.

Release Notes

@tekton-robot tekton-robot added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label Jun 7, 2022
@tekton-robot tekton-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jun 7, 2022
@PuneetPunamiya
Copy link
Member Author

/retest

Comment on lines 236 to 243
ownerRef := *metav1.NewControllerRef(th, th.GroupVersionKind())
pvc.SetOwnerReferences([]metav1.OwnerReference{ownerRef})

_, err := r.kubeClientSet.CoreV1().PersistentVolumeClaims(th.Spec.GetTargetNamespace()).Update(ctx, pvc, metav1.UpdateOptions{})
if err != nil {
return err
}
}
Copy link
Member

Choose a reason for hiding this comment

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

why don't we move this also into the checkPVCOwnerRef(pvc, th) function.

Copy link
Member Author

@PuneetPunamiya PuneetPunamiya Jun 7, 2022

Choose a reason for hiding this comment

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

yeah we can move that, but then function name should be changed as well, because if we are changing the ownerRef of pvc then on the cluster we are updating the pvc and I guess checkPVCOwnerRef function is just checking if it has the TektonHub as ownerRef

@nikhil-thomas
Copy link
Member

@PuneetPunamiya do we need this change on main branch. Even if we decide to keep it, let us make sure that we remove it after few releases.

could you create 2 issues:

  1. hub e2e tests in operator (hub is the only component without e2e tests now) refer
  2. an issue to track the removal of changes made by this pr.

@nikhil-thomas
Copy link
Member

/approve
✅ lgtm

@tekton-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: nikhil-thomas

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

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 7, 2022
@PuneetPunamiya
Copy link
Member Author

/test pull-tekton-operator-build-tests

@PuneetPunamiya PuneetPunamiya force-pushed the update-db-pvc branch 2 times, most recently from 1e78948 to c7dd92f Compare June 8, 2022 07:33
…created

If Hub instance is already created, then the data in the Hub db should
be preserved

Hence, this patch checks the ownerRef of hub-db pvc and updates it
to `TektonHub` so while upgrade the pvc is not deleted and the data
is preserved

Signed-off-by: Puneet Punamiya <ppunamiy@redhat.com>
@nikhil-thomas
Copy link
Member

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Jun 8, 2022
@tekton-robot tekton-robot merged commit 1f0a6ef into tektoncd:main Jun 8, 2022
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. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants