-
Notifications
You must be signed in to change notification settings - Fork 84
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
No pruning with NewDirectApplier #201
Comments
A not so pretty solution for kubernetes-sigs#201, more like a temporary workaround. I think it would be nicer to use `ApplyOptions` directly instead of the internal `ApplierOptions` type, but this would break compatibility with ExecApplier.
A not so pretty solution for kubernetes-sigs#201, more like a temporary workaround. I think it would be nicer to use `ApplyOptions` directly instead of the internal `ApplierOptions` type, but this would break compatibility with ExecApplier.
Thanks for figuring this out and for sending the PR - I'm going to look at why it isn't passing...
This feels like a great time to introduce stronger versioning into this library and maybe start cleaning up some of the older code. Once we introduce versioning, we can then drop support for the exec applier at a version boundary (clearly announcing it). (Versioning and clearer announcements there will also probably better let us find out if anyone wants to keep the execApplier!) |
Sounds good, let me know if there's anything I can do to help with introducing stronger versioning. In the mean time, we've used a nicer workaround where we convert |
pruning seems still broken, because some attributes of applyOpts is nil. To make pruning work normally, below attributes must be set before calling applyOpts.Run(). applyOpts.Mapper = opt.RESTMapper
applyOpts.DynamicClient, _ = dynamic.NewForConfig(opt.RESTConfig)
applyOpts.DeleteOptions.CascadingStrategy = "Background"
applyOpts.DeleteOptions.GracePeriod = -1
applyOpts.PostProcessorFn = applyOpts.PrintAndPrunePostProcessor() |
A not so pretty solution for kubernetes-sigs#201, more like a temporary workaround. I think it would be nicer to use `ApplyOptions` directly instead of the internal `ApplierOptions` type, but this would break compatibility with ExecApplier.
Recently, some PRs related with |
To solve this issue, I have 3 ideas:
|
/reopen @justinsb |
@atoato88: Reopened this issue. In response to this:
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. |
Any comment on this issue? |
/close |
@atoato88: Closing this issue. In response to this:
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. |
Do we have tests that will cover the prune? |
We don't have cover tests to prune in DirectApplier. |
What happened:
The
kubectl --prune
flag is set asextraOpts
inreconciler.go
.However, since the
NewDirectApplier
is used (#101), the prune option is not propagated to theapplyOpts.Prune
boolean ofdirect.go
.What you expected to happen:
The prune option to be propagated so that pruning happens as expected.
How to reproduce it (as minimally and precisely as possible):
Putting a breakpoint on
direct.go#L80
clearly shows that thePrune
flag is not set on theapplyOpts
object.Anything else we need to know?:
There currently is also no support for the
--prune-whitelist
flag, which we need for our use case.Happy to create a PR for this, but I think it's better to solve this issue first.
Is there a specific reason for keeping the old ExecApplier around?
If not, I guess the
ApplierOptions
from the library could be directly replaced byApplyOptions
from thek8s.io./kubectl
module.Environment:
kubectl version
):cat /etc/os-release
): macOS Big Sure 11.6.2uname -a
):go version
):go version go1.17.6 darwin/amd64
The text was updated successfully, but these errors were encountered: