kubernetes-sigs / kubebuilder-declarative-pattern

A toolkit for building declarative operators with kubebuilder
Apache License 2.0
254 stars 84 forks source link

add option to configure cascading strategy #283

Closed stephanhorsthemke closed 1 year ago

stephanhorsthemke commented 1 year ago

What this PR does / why we need it: This PR makes the CascadingStrategy added in https://github.com/kubernetes-sigs/kubebuilder-declarative-pattern/pull/274 configurable, adding a new option withCascadingStrategy and making sure that Foreground is the default if not set.

Which issue(s) this PR fixes: We need it to configure different CascadingStrategies for main and test

Fixes #

Special notes for your reviewer: I have not seen proper tests I could test this with. Are there some? I ran this with the controller I am working on.

Additional documentation:

k8s-ci-robot commented 1 year ago

Hi @stephanhorsthemke. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.
justinsb commented 1 year ago

Sorry for the delay here! Was trying to get some test coverage but we have a bit of an LGTM backlog on those PRs :-)

I dug into what this does, this sets the argument propagationPolicy on delete requests. So we should be able to pick that up in our tests if we trigger a delete, but we'll just be testing that it is passed through.

One nit is I'm wondering if we should call it withDeletionPropagationPolicy... "deletion" to make it clearer that it is only on delete, "propagationPolicy" to mirror the actual flag. But it's actually easy enough to change later (with an alias for compatibility), and I'm thinking kubectl does call it cascading and not propagationPolicy, and that might be more familiar to users.

So...

/approve /lgtm

k8s-ci-robot commented 1 year ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: justinsb, stephanhorsthemke

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](https://github.com/kubernetes-sigs/kubebuilder-declarative-pattern/blob/master/OWNERS)~~ [justinsb] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment
keithmcneill commented 1 year ago

/retest

k8s-ci-robot commented 1 year ago

@keithmcneill: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to [this](https://github.com/kubernetes-sigs/kubebuilder-declarative-pattern/pull/283#issuecomment-1377667418): >/retest Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.
keithmcneill commented 1 year ago

/test pull-declarative-test

k8s-ci-robot commented 1 year ago

@keithmcneill: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to [this](https://github.com/kubernetes-sigs/kubebuilder-declarative-pattern/pull/283#issuecomment-1377680431): >/test pull-declarative-test Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.
justinsb commented 1 year ago

I think we've got tests passing again!

/ok-to-test

I'll also figure out what permissions you need to be able to trigger tests yourselves / have them run automatically!