Skip to content

Conversation

@Liujingfang1
Copy link
Contributor

@Liujingfang1 Liujingfang1 commented Mar 22, 2021

The existing prune has a bug when handling the following case:

  1. The inventory list contains a CR
  2. The CRD is deleted from the cluster. Consequently the CR is also deleted from the cluster.
  3. Then remove the configuration for the CR from the local directory
  4. Apply the directory, since the CR is in the previously applied set and not in the current apply set. The CR should be pruned.
  5. When getting the CR from the cluster, an error is get since no type is matched since the CRD is deleted.
  6. It emits a PruneEvent with this error.

Since the CR doesn't exist in step 5, we actually don't need to trigger the deletion for it. Emitting the PruneEvent with an error doesn't make sense either. It only needs to remove the GKNN of the CR from the inventory list, which is already done by the current code.

This PR checks if the error from step 5 is a NoMatchError. It it is, continue to the next object.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Mar 22, 2021
@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Mar 22, 2021
@Liujingfang1
Copy link
Contributor Author

/assign @seans3 @mortent

Copy link
Member

@mortent mortent left a comment

Choose a reason for hiding this comment

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

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 22, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Liujingfang1, mortent

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:
  • OWNERS [Liujingfang1,mortent]

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

@k8s-ci-robot k8s-ci-robot merged commit 6e08985 into kubernetes-sigs:master Mar 22, 2021
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants