<p>I am working on the K8s implementation using kubernetes java client. I am looking for the solution to delete <strong>Contour HTTPProxy</strong> which are in invalid state. However I am not able to figure out how to do it with help of Java Client.</p>
<p>I am aware that we can delete the ingress using below code</p>
<p><code>k8sClient.extensions().ingresses().withName(&quot;my-ingress&quot;).delete();</code></p>
<p>Any help on how to delete Contour HTTPProxy object from K8s namespace using java client will be appreciated?</p>

Mahesh
<p>Contour HTTPProxy seems to be a <a href="https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/" rel="nofollow noreferrer">custom resource</a>. You can either use our <a href="https://github.com/fabric8io/kubernetes-client/blob/master/doc/CHEATSHEET.md#customresource-typed-api" rel="nofollow noreferrer">typed(required CustomResource POJOs)</a> or <a href="https://github.com/fabric8io/kubernetes-client/blob/master/doc/CHEATSHEET.md#customresource-typeless-api" rel="nofollow noreferrer">typeless API(CustomResource manipulation using raw maps)</a> for deleting HTTPProxy.</p>
<p>Here is an example of doing it using the typeless API(based on KubernetesClient v5.4.1):</p>
<pre class="lang-java prettyprint-override"><code>try (KubernetesClient client = new DefaultKubernetesClient()) {
    CustomResourceDefinitionContext context = new CustomResourceDefinitionContext.Builder()
            .withKind(&quot;HTTPProxy&quot;)
            .withPlural(&quot;httpproxies&quot;)
            .withGroup(&quot;projectcontour.io&quot;)
            .withVersion(&quot;v1&quot;)
            .withScope(&quot;Namespaced&quot;)
            .build();

    boolean isDeleted = client.customResource(context).inNamespace(&quot;default&quot;).withName(&quot;root&quot;).delete();
    if (!isDeleted) {
        logger.warn(&quot;Unable to Delete HTTPProxy {} in {} namespace&quot;, &quot;root&quot;, &quot;default&quot;);
    }
    logger.info(&quot;HTTPProxy {} successfully deleted.&quot;, &quot;root&quot;);
} catch (KubernetesClientException exception) {
    logger.error(&quot;Exception in interacting with Kubernetes API&quot;, exception);
}
</code></pre>
