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

🐛 Fix secret selection logic for ownerRef test #7973

Merged

Conversation

killianmuldoon
Copy link
Contributor

Fixes a failure in the ownerReference e2e test for Kubernetes versions below v1.24. This ensures that the secrets considered for the ownerReference test are only those directly associated with the Cluster.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jan 23, 2023
@killianmuldoon
Copy link
Contributor Author

/test ?

@k8s-ci-robot
Copy link
Contributor

@killianmuldoon: The following commands are available to trigger required jobs:

  • /test pull-cluster-api-build-main
  • /test pull-cluster-api-e2e-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
  • /test pull-cluster-api-e2e-full-main
  • /test pull-cluster-api-e2e-informing-ipv6-main
  • /test pull-cluster-api-e2e-informing-main
  • /test pull-cluster-api-e2e-workload-upgrade-1-26-latest-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-informing-ipv6-main
  • pull-cluster-api-e2e-informing-main
  • pull-cluster-api-e2e-main
  • pull-cluster-api-test-main
  • pull-cluster-api-test-mink8s-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/test-infra repository.

@killianmuldoon
Copy link
Contributor Author

/test pull-cluster-api-e2e-full-main

@killianmuldoon killianmuldoon force-pushed the fix-ownerRef-secrets branch 3 times, most recently from 5541888 to 11435e7 Compare January 23, 2023 13:56
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jan 23, 2023
@killianmuldoon killianmuldoon changed the title 🐛 [WIP] Fix secret selection logic for ownerRef test 🐛 Fix secret selection logic for ownerRef test Jan 23, 2023
@@ -79,3 +96,12 @@ func GetOwnerGraph(namespace, kubeconfigPath string) (OwnerGraph, error) {
}
return owners, nil
}

// isClusterSecret checks whether a Secret is related to a CAPI Cluster by checking if the secret type is ClusterSecretType.
func isClusterSecret(ref corev1.ObjectReference, c client.Client) (bool, error) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've tested this locally with Kubernetes 1.20.15 and it works. I think this approach makes sense for what we're currently testing, but we might want to be careful of expectations if providers pick up this test.

@sbueringer
Copy link
Member

/retest

/lgtm
/approve

Thx for fixing this so quickly!

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

LGTM label has been added.

Git tree hash: 43780247d54c0d5133e1332a19a4271cadf03e36

@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

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

@killianmuldoon As you mentioned it in Slack, WDYT about adding a pull-cluster-api-e2e-full-mink8s-main optional job?

@k8s-ci-robot k8s-ci-robot merged commit ea506ae into kubernetes-sigs:main Jan 23, 2023
@k8s-ci-robot k8s-ci-robot added this to the v1.4 milestone Jan 23, 2023
@fabriziopandini
Copy link
Member

@killianmuldoon sorry for getting late at this, but have you consider to use the concept of "tenant" cluster already embedded inside discovery, so we have this logic implemented in only one place?

@sbueringer
Copy link
Member

@fabriziopandini Sorry I already merged to get CI green again. But let's open a follow-up PR if we want to refactor.

@killianmuldoon
Copy link
Contributor Author

Opened #7976 - thanks @fabriziopandini - it's much cleaner!

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/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.

None yet

4 participants