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

🌱 Ensure CRS controller always add ownerReference to resources #10756

Conversation

fabriziopandini
Copy link
Member

What this PR does / why we need it:
While testing owner references resilience for CAPV I discovered that the CRS controller do not apply owner references to resources in case there is no connection to the workload cluster.

This PR fixes this issue.

Area example:
/area clusterresourceset

@k8s-ci-robot k8s-ci-robot added the area/clusterresourceset Issues or PRs related to clusterresourcesets label Jun 14, 2024
@fabriziopandini
Copy link
Member Author

/test

@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jun 14, 2024
@k8s-ci-robot
Copy link
Contributor

@fabriziopandini: The /test command needs one or more targets.
The following commands are available to trigger required jobs:

  • /test pull-cluster-api-build-main
  • /test pull-cluster-api-e2e-blocking-main
  • /test pull-cluster-api-e2e-conformance-ci-latest-main
  • /test pull-cluster-api-e2e-conformance-main
  • /test pull-cluster-api-e2e-main
  • /test pull-cluster-api-e2e-mink8s-main
  • /test pull-cluster-api-e2e-upgrade-1-30-1-31-main
  • /test pull-cluster-api-test-main
  • /test pull-cluster-api-test-mink8s-main
  • /test pull-cluster-api-verify-main

The following commands are available to trigger optional jobs:

  • /test pull-cluster-api-apidiff-main

Use /test all to run the following jobs that were automatically triggered:

  • pull-cluster-api-apidiff-main
  • pull-cluster-api-build-main
  • pull-cluster-api-e2e-blocking-main
  • pull-cluster-api-test-main
  • pull-cluster-api-verify-main

In response to this:

/test

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-sigs/prow repository.

@fabriziopandini
Copy link
Member Author

/test pull-cluster-api-e2e-main

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 18, 2024
@fabriziopandini fabriziopandini force-pushed the CRS-always-add-ownerReference-to-resources branch from b145e9d to ef35254 Compare June 24, 2024 11:57
@fabriziopandini fabriziopandini added the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label Jun 24, 2024
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 24, 2024
@sbueringer
Copy link
Member

Thx!

/lgtm
/approve

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

LGTM label has been added.

Git tree hash: 45a422cfce7016b35696b1aeeb4bec857841a858

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 25, 2024
@sbueringer
Copy link
Member

@fabriziopandini Can you please check the unit test? Wondering if we got a flake related to this PR

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 27, 2024
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jun 27, 2024
@fabriziopandini
Copy link
Member Author

@fabriziopandini Can you please check the unit test? Wondering if we got a flake related to this PR

The flake was related to this PR and due to a race condition:

  • When reconciling concurrently two CRS targeting the same cluster
  • CRS1 locks briefly when acquiring a client from the cluster cache tracker
  • CRS2 gets a lock error and gets requeued after a minute, while tests fail after 15s

To fix it I have expanded a little bit the scope of this PR:

  • We are now applying owner references to resources before creating connection to the workload cluster (original scope)
  • We are now applying owner CRSBindings before creating connection to the workload cluster (expanded scope scope)
  • We creating an entry into CRSBindings for each CRS before creating connection to the workload cluster (expanded scope scope)

The last change required to fix an existing test, but this should be ok because what is important is that we do not apply resources if there is not yet a kubernetes service in the target cluster, and this is still true (see #7804)

@chrischdi
Copy link
Member

/lgtm

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

LGTM label has been added.

Git tree hash: 36ca06360ded69979dc6b0b2aaa1e01a2d8b10f4

@chrischdi
Copy link
Member

/hold

for manual merge

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 28, 2024
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 28, 2024
@fabriziopandini fabriziopandini force-pushed the CRS-always-add-ownerReference-to-resources branch from 31b66b7 to cf216fe Compare June 28, 2024 11:58
@sbueringer
Copy link
Member

Thx!

/lgtm
/approve

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

LGTM label has been added.

Git tree hash: 1a2a4620114a1eb5ff9970a9705b4b3bda933b32

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: sbueringer

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

@sbueringer
Copy link
Member

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 28, 2024
@k8s-ci-robot k8s-ci-robot merged commit 18a5a04 into kubernetes-sigs:main Jun 28, 2024
18 of 19 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v1.8 milestone Jun 28, 2024
@fabriziopandini fabriziopandini deleted the CRS-always-add-ownerReference-to-resources branch July 2, 2024 08:36
@jimmidyson
Copy link
Member

/cherrypick release-1.7

@k8s-infra-cherrypick-robot

@jimmidyson: new pull request created: #10895

In response to this:

/cherrypick release-1.7

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-sigs/prow 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. area/clusterresourceset Issues or PRs related to clusterresourcesets 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/L Denotes a PR that changes 100-499 lines, ignoring generated files. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants