@@ -408,7 +408,6 @@ private void applyAdditionalManifest(GenericKubernetesResource resource) {
408408 } else {
409409 policy = "CreateOnce" ;
410410 }
411- log .info ("Applying persistent manifest (name: {}, policy: {})" , resource .getMetadata ().getName (), policy );
412411 if (policy .equalsIgnoreCase ("CreateOnce" )) {
413412 if (kubeClient .resource (resource ).fromServer ().get () == null ) {
414413 client .create (resource );
@@ -421,15 +420,13 @@ private void applyAdditionalManifest(GenericKubernetesResource resource) {
421420 }
422421 } else if (policy .equalsIgnoreCase ("Delete" )) {
423422 if (kubeClient .resource (resource ).fromServer ().get () != null ) {
424- client . delete (resource );
423+ kubeClient . resource (resource ). withGracePeriod ( 0 ). delete ( );
425424 }
426425 } else if (policy .equalsIgnoreCase ("Replace" )) {
427426 if (kubeClient .resource (resource ).fromServer ().get () != null ) {
428- client .delete (resource );
429- log .info ("Waiting for deletion to finish" );
430- // wait 60 seconds for deletion
427+ kubeClient .resource (resource ).withGracePeriod (0 ).delete ();
428+ // wait 60 seconds for deletion to complete
431429 Retrying .retry ((idx ) -> kubeClient .resource (resource ).fromServer ().get () == null , 1000 , 60 );
432- log .info ("Done" );
433430 }
434431 client .create (resource );
435432 } else {
@@ -504,13 +501,18 @@ protected void doStopProxy(Proxy proxy) throws Exception {
504501 }
505502
506503 Pod pod = Pod .class .cast (container .getParameters ().get (PARAM_POD ));
507- if (pod != null ) kubeClient .pods ().inNamespace (kubeNamespace ).delete (pod );
504+ if (pod != null ) {
505+ // specify gracePeriod 0, this was the default in previous version of the fabric8 k8s client
506+ kubeClient .resource (pod ).withGracePeriod (0 ).delete ();
507+ }
508508 Service service = Service .class .cast (container .getParameters ().get (PARAM_SERVICE ));
509- if (service != null ) kubeClient .services ().inNamespace (kubeNamespace ).delete (service );
509+ if (service != null ) {
510+ kubeClient .resource (service ).withGracePeriod (0 ).delete ();
511+ }
510512
511513 // delete additional manifests
512514 for (HasMetadata fullObject : getAdditionManifestsAsObjects (proxy , kubeNamespace )) {
513- kubeClient .resource (fullObject ).delete ();
515+ kubeClient .resource (fullObject ).withGracePeriod ( 0 ). delete ();
514516 }
515517 }
516518 }
0 commit comments