Skip to content

Added support for passing delete options when using kubectlDelete.#3463 #3572

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

Merged
merged 4 commits into from
Jul 17, 2024

Conversation

callingmahendra
Copy link
Contributor

closes: #3463

Added an option to pass deleteOptions in kubectlDelete.

@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 Jul 16, 2024
@@ -207,6 +209,9 @@ void kubectlDelete() throws KubectlException, ApiException {
KubectlDelete<V1Job> kubectlDelete = Kubectl.delete(V1Job.class);
kubectlDelete.apiClient(apiClient);
kubectlDelete.namespace("foo").name("bar");
DeleteOptions deleteOptions = new DeleteOptions();
deleteOptions.setPropagationPolicy("Foreground");
kubectlDelete.deleteOptions(deleteOptions);
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add validation that this worked correctly to the URL validation below

Copy link
Contributor Author

@callingmahendra callingmahendra Jul 17, 2024

Choose a reason for hiding this comment

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

Added check below for URL validation and you were correct it was not passing deleteOptions, hence modified GenericKubernetesApi to pass it further

@brendandburns
Copy link
Contributor

Thanks for the PR. I think you need to run mvn spotless:apply to perform formatting for style, and expand the unit test slightly.

@@ -1159,6 +1159,7 @@ private CallBuilder makeNamespacedDeleteCallBuilder(
namespace,
this.resourcePlural,
name)
.body(deleteOptions)
// TODO: fill/convert the option
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should we remove this TODO as this is no more valid?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, please delete this now.

@callingmahendra
Copy link
Contributor Author

Thanks for the PR. I think you need to run mvn spotless:apply to perform formatting for style, and expand the unit test slightly.

Done both the changes, please review

@brendandburns
Copy link
Contributor

Thanks for adding the test, and fixing the code.

I think it still needs formatting, and that TODO removed, but then I think it's good to merge.

@callingmahendra
Copy link
Contributor Author

Thanks for adding the test, and fixing the code.

I think it still needs formatting, and that TODO removed, but then I think it's good to merge.

Removed the TODO, and also rerun mvn spotless:apply to make sure formatting apply.

@brendandburns
Copy link
Contributor

/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 Jul 17, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: brendandburns, callingmahendra

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 Jul 17, 2024
@k8s-ci-robot k8s-ci-robot merged commit e898d14 into kubernetes-client:master Jul 17, 2024
18 checks passed
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.

Kubectl should support cascading deletes for Jobs
3 participants