Implement KubectlDelete to delete Kubernetes resources#1696
Implement KubectlDelete to delete Kubernetes resources#1696k8s-ci-robot merged 7 commits intomasterfrom
Conversation
Co-authored-by: brendandburns <5751682+brendandburns@users.noreply.github.com>
Co-authored-by: brendandburns <5751682+brendandburns@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR adds support for deleting Kubernetes resources through the Kubectl package, implementing the equivalent of kubectl delete command. The implementation follows the established patterns in the codebase, using the existing GenericClient infrastructure and providing both async and synchronous APIs.
Key Changes:
- Added
DeleteAsync<T>method in AsyncKubectl for asynchronous delete operations with proper ConfigureAwait(false) pattern - Added synchronous
Delete<T>wrapper method in Kubectl following existing patterns - Added comprehensive unit tests covering both namespaced (Pod, Service, Deployment) and cluster-scoped (Namespace) resources
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| src/KubernetesClient.Kubectl/Beta/AsyncKubectl.Delete.cs | Implements async DeleteAsync method using GenericClient, supporting both namespaced and cluster-scoped resources |
| src/KubernetesClient.Kubectl/Beta/Kubectl.Delete.cs | Provides synchronous Delete wrapper using GetAwaiter().GetResult() pattern |
| tests/Kubectl.Tests/KubectlTests.Delete.cs | Adds four test cases covering Pod, Service, Deployment, and Namespace deletion with verification |
The implementation is well-structured and consistent with existing code. However, the tests could be improved by adding try-finally blocks for proper resource cleanup in case of test failures, which is the established pattern in other tests in this codebase (e.g., KubectlTests.Get.cs).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: brendandburns, Copilot The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Adds
kubectl deleteequivalent functionality to the Kubectl package, enabling deletion of Kubernetes resources by name.Implementation
DeleteAsync<T>method supporting both namespaced and cluster-scoped resources via GenericClientDelete<T>wrapper following existing patternsUsage
The implementation automatically determines resource scope from type metadata and delegates to GenericClient's existing delete operations.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
crl.comodoca.com/home/REDACTED/work/csharp/.codeql-scratch/dbs/csharp/working/.dotnet/dotnet /home/REDACTED/work/csharp/.codeql-scratch/dbs/csharp/working/.dotnet/dotnet restore --no-dependencies /home/REDACTED/work/csharp/csharp/src/KubernetesClient.Classic/KubernetesClient.Classic.csproj --packages /home/REDACTED/work/csharp/.codeql-scratch/dbs/csharp/working/packages /p:DisableImplicitNuGetFallbackFolder=true --verbosity normal /p:TargetFrameworkRootPath=/home/REDACTED/work/csharp/.codeql-scratch/dbs/csharp/working/emptyFakeDotnetRoot /p:NetCoreTargetingPackRoot=/home/REDACTED/work/csharp/.codeql-scratch/dbs/csharp/working/emptyFakeDotnetRoot bash --no�� ct tificateValidationTests.cs grep(dns block)kubernetes.io/home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js(dns block)ocsp.comodoca.com/home/REDACTED/work/csharp/.codeql-scratch/dbs/csharp/working/.dotnet/dotnet /home/REDACTED/work/csharp/.codeql-scratch/dbs/csharp/working/.dotnet/dotnet restore --no-dependencies /home/REDACTED/work/csharp/csharp/src/KubernetesClient.Classic/KubernetesClient.Classic.csproj --packages /home/REDACTED/work/csharp/.codeql-scratch/dbs/csharp/working/packages /p:DisableImplicitNuGetFallbackFolder=true --verbosity normal /p:TargetFrameworkRootPath=/home/REDACTED/work/csharp/.codeql-scratch/dbs/csharp/working/emptyFakeDotnetRoot /p:NetCoreTargetingPackRoot=/home/REDACTED/work/csharp/.codeql-scratch/dbs/csharp/working/emptyFakeDotnetRoot bash --no�� ct tificateValidationTests.cs grep(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.