How to delete Ingress rules with java synchronously

Viewed 112

I am using Kubernetes and Ingress via fabric8 kubeclient. I have namespaces with user content and in each namespace i have an ingress rule.

I need to remove the namespaces with user content on request. But deleting a namespace is not a quick operation. I want to first delete the ingress rule - so that there is no access to the content - and then asynchronously delete the namespace itself. Question: is there any way to delete ingress rule synchronously?

All of that code do it async:

client.extensions().ingresses().inNamespace(namespaceName).delete();

//or
//client.extensions().ingresses().inNamespace(namespaceName).withName(ingressName).delete();;

client.namespaces().withName(namespaceName).delete();

My Ingress config file:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  labels:
    my-cluster: dev-cluster
  name: name_1
spec:
  ingressClassName: nginx
  rules:
    - host: {{host}}
      http:
        paths:
          - backend:
              service:
                name: service_1
                port:
                  number: 80
            path: /
            pathType: ImplementationSpecific

How to delete kubernetes namespace or ingress rule in namespace synchronically?

0 Answers
Related